Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f594d1ae49 | ||
|
|
2bc0728a48 | ||
|
|
bf65814b7d | ||
|
|
a407d460f7 | ||
|
|
35ecf2f810 | ||
|
|
ae2524f2ce | ||
|
|
2b3aa4df32 | ||
|
|
d5cbc11c8a | ||
|
|
2ea20b0a99 | ||
|
|
d9004f3761 | ||
|
|
1dcd625ea2 | ||
|
|
f226358b1c | ||
|
|
de6af2de18 | ||
|
|
ff7bb55faa | ||
|
|
495a4b3fa1 | ||
|
|
3d8b3deb74 | ||
|
|
ec378b0b59 | ||
|
|
a0a03a8f8f | ||
|
|
2acbec94c9 | ||
|
|
ec016293cb | ||
|
|
b4b1b0ffca | ||
|
|
0a7f9282cc | ||
|
|
6d6e67bbba | ||
|
|
1a6c6ad9f5 | ||
|
|
1feb1679ff | ||
|
|
441607f0da | ||
|
|
33b2d856bc | ||
|
|
de9d11e2f3 | ||
|
|
b43ed3e807 | ||
|
|
035bae98d9 | ||
|
|
82665bd4e6 | ||
|
|
82d215f58b | ||
|
|
52747158e9 | ||
|
|
1019169100 | ||
|
|
5dbb2be873 | ||
|
|
9f463c80bc | ||
|
|
aa19e5bde1 |
No files matched your search
@@ -16,7 +16,7 @@ body:
|
|||||||
label: steps to reproduce
|
label: steps to reproduce
|
||||||
description: how can we trigger this?
|
description: how can we trigger this?
|
||||||
placeholder: |
|
placeholder: |
|
||||||
1. open mcl
|
1. open rmcl
|
||||||
2. do this
|
2. do this
|
||||||
3. then this
|
3. then this
|
||||||
4. it breaks
|
4. it breaks
|
||||||
@@ -26,9 +26,9 @@ body:
|
|||||||
- type: input
|
- type: input
|
||||||
id: version
|
id: version
|
||||||
attributes:
|
attributes:
|
||||||
label: mcl version
|
label: rmcl version
|
||||||
description: run `mcl --version` or check the bottom of the TUI.
|
description: run `rmcl --version` or check the bottom of the TUI.
|
||||||
placeholder: 0.1.0
|
placeholder: 0.3.0
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
name: crash report
|
name: crash report
|
||||||
description: mcl crashed or panicked
|
description: rmcl crashed or panicked
|
||||||
labels: ["crash"]
|
labels: ["crash"]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
label: what happened
|
label: what happened
|
||||||
description: what were you doing when mcl crashed?
|
description: what were you doing when rmcl crashed?
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -17,10 +17,10 @@ body:
|
|||||||
description: |
|
description: |
|
||||||
paste relevant log output here. you can find logs at:
|
paste relevant log output here. you can find logs at:
|
||||||
|
|
||||||
- **mcl logs**: `~/.cache/mcl/` (daily rolling files like `mcl.log.2026-04-20`)
|
- **rmcl logs**: `~/.cache/rmcl/` (per-session files like `rmcl_2026-04-20_12-34-56.log`)
|
||||||
- **launch logs**: `~/.local/share/mcl/instances/{instance}/.minecraft/logs/launches/`
|
- **launch logs**: `~/.local/share/rmcl/instances/{instance}/.minecraft/logs/launches/`
|
||||||
|
|
||||||
you can also view logs in the TUI via the log overlay or use `mcl log` from the CLI.
|
you can also view logs in the TUI via the log overlay or use `rmcl log` from the CLI.
|
||||||
render: text
|
render: text
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
@@ -28,9 +28,9 @@ body:
|
|||||||
- type: input
|
- type: input
|
||||||
id: version
|
id: version
|
||||||
attributes:
|
attributes:
|
||||||
label: mcl version
|
label: rmcl version
|
||||||
description: run `mcl --version` or check the bottom of the TUI.
|
description: run `rmcl --version` or check the bottom of the TUI.
|
||||||
placeholder: 0.1.0
|
placeholder: 0.3.0
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- name: install JDK
|
||||||
|
uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: "21"
|
||||||
+14
-190
@@ -7,30 +7,11 @@ on:
|
|||||||
branches: [master]
|
branches: [master]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
check:
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
artifact: mcl
|
|
||||||
- os: ubuntu-latest
|
|
||||||
target: aarch64-unknown-linux-gnu
|
|
||||||
artifact: mcl
|
|
||||||
- os: windows-latest
|
|
||||||
target: x86_64-pc-windows-msvc
|
|
||||||
artifact: mcl.exe
|
|
||||||
- os: macos-latest
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
artifact: mcl
|
|
||||||
- os: macos-latest
|
|
||||||
target: aarch64-apple-darwin
|
|
||||||
artifact: mcl
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
@@ -38,175 +19,18 @@ jobs:
|
|||||||
- name: install Rust
|
- name: install Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
components: clippy
|
||||||
|
|
||||||
|
- name: install JDK
|
||||||
|
uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: "21"
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
|
||||||
key: ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: install cross-compilation deps (aarch64-linux)
|
- name: check
|
||||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
run: cargo check --locked
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
||||||
|
|
||||||
- name: build
|
- name: clippy
|
||||||
env:
|
run: cargo clippy --all-targets --locked -- -D warnings
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
||||||
run: cargo build --release --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: package (unix)
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: |
|
|
||||||
cd target/${{ matrix.target }}/release
|
|
||||||
tar czf ../../../mcl-${{ matrix.target }}.tar.gz ${{ matrix.artifact }}
|
|
||||||
|
|
||||||
- name: package (windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
run: |
|
|
||||||
cd target/${{ matrix.target }}/release
|
|
||||||
Compress-Archive -Path ${{ matrix.artifact }} -DestinationPath ../../../mcl-${{ matrix.target }}.zip
|
|
||||||
|
|
||||||
- name: upload artifact
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: mcl-${{ matrix.target }}
|
|
||||||
path: mcl-${{ matrix.target }}.*
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
|
||||||
outputs:
|
|
||||||
released: ${{ steps.check.outputs.exists == 'false' }}
|
|
||||||
version: ${{ steps.version.outputs.version }}
|
|
||||||
tag: ${{ steps.version.outputs.tag }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: get version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
|
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "tag=v$version" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: check if release exists
|
|
||||||
id: check
|
|
||||||
run: |
|
|
||||||
if gh release view "${{ steps.version.outputs.tag }}" > /dev/null 2>&1; then
|
|
||||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: download artifacts
|
|
||||||
if: steps.check.outputs.exists == 'false'
|
|
||||||
uses: actions/download-artifact@v8
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- name: create and push tag
|
|
||||||
if: steps.check.outputs.exists == 'false'
|
|
||||||
run: |
|
|
||||||
git tag "${{ steps.version.outputs.tag }}"
|
|
||||||
git push origin "${{ steps.version.outputs.tag }}"
|
|
||||||
|
|
||||||
- name: generate changelog
|
|
||||||
if: steps.check.outputs.exists == 'false'
|
|
||||||
id: changelog
|
|
||||||
uses: orhun/git-cliff-action@v4
|
|
||||||
with:
|
|
||||||
args: --latest --strip header
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: create release
|
|
||||||
if: steps.check.outputs.exists == 'false'
|
|
||||||
run: |
|
|
||||||
gh release create "${{ steps.version.outputs.tag }}" \
|
|
||||||
--title "${{ steps.version.outputs.tag }}" \
|
|
||||||
--notes "${{ steps.changelog.outputs.content }}" \
|
|
||||||
artifacts/mcl-*/*
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
publish-crates:
|
|
||||||
needs: release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: needs.release.outputs.released == 'true'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: install Rust
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: publish to crates.io
|
|
||||||
run: cargo publish --allow-dirty
|
|
||||||
env:
|
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
publish-aur:
|
|
||||||
needs: release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: needs.release.outputs.released == 'true'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
|
|
||||||
# mcl-launcher (source package)
|
|
||||||
- name: prepare mcl-launcher
|
|
||||||
run: |
|
|
||||||
sed -i "s|^pkgver=.*|pkgver=${{ needs.release.outputs.version }}|" pkg/mcl-launcher/PKGBUILD
|
|
||||||
cp pkg/mcl-launcher/PKGBUILD PKGBUILD
|
|
||||||
|
|
||||||
- name: update checksums for mcl-launcher
|
|
||||||
uses: datakrama/archlinux-package-action@v2
|
|
||||||
with:
|
|
||||||
updpkgsums: true
|
|
||||||
srcinfo: true
|
|
||||||
flags: ""
|
|
||||||
namcap: false
|
|
||||||
|
|
||||||
- name: publish mcl-launcher to AUR
|
|
||||||
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
|
|
||||||
with:
|
|
||||||
pkgname: mcl-launcher
|
|
||||||
pkgbuild: PKGBUILD
|
|
||||||
assets: .SRCINFO
|
|
||||||
commit_username: objz
|
|
||||||
commit_email: me@objz.dev
|
|
||||||
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
||||||
commit_message: "Update to ${{ needs.release.outputs.version }}"
|
|
||||||
|
|
||||||
# mcl-launcher-bin (binary package)
|
|
||||||
- name: prepare mcl-launcher-bin
|
|
||||||
run: |
|
|
||||||
sed -i "s|^pkgver=.*|pkgver=${{ needs.release.outputs.version }}|" pkg/mcl-launcher-bin/PKGBUILD
|
|
||||||
cp pkg/mcl-launcher-bin/PKGBUILD PKGBUILD
|
|
||||||
rm -f .SRCINFO
|
|
||||||
|
|
||||||
- name: update checksums for mcl-launcher-bin
|
|
||||||
uses: datakrama/archlinux-package-action@v2
|
|
||||||
with:
|
|
||||||
updpkgsums: true
|
|
||||||
srcinfo: true
|
|
||||||
flags: ""
|
|
||||||
namcap: false
|
|
||||||
|
|
||||||
- name: publish mcl-launcher-bin to AUR
|
|
||||||
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
|
|
||||||
with:
|
|
||||||
pkgname: mcl-launcher-bin
|
|
||||||
pkgbuild: PKGBUILD
|
|
||||||
assets: .SRCINFO
|
|
||||||
commit_username: objz
|
|
||||||
commit_email: me@objz.dev
|
|
||||||
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
||||||
commit_message: "Update to ${{ needs.release.outputs.version }}"
|
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
name: publish aur
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
plan:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PLAN: ${{ inputs.plan }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ fromJson(inputs.plan).announcement_tag }}
|
||||||
|
|
||||||
|
- name: get version
|
||||||
|
id: version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
version="$(jq --raw-output '.releases[0].app_version' <<< "$PLAN")"
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: prepare rmcl
|
||||||
|
run: |
|
||||||
|
sed -i "s|^pkgver=.*|pkgver=${{ steps.version.outputs.version }}|" pkg/rmcl/PKGBUILD
|
||||||
|
cp pkg/rmcl/PKGBUILD PKGBUILD
|
||||||
|
|
||||||
|
- name: update checksums for rmcl
|
||||||
|
uses: datakrama/archlinux-package-action@v2
|
||||||
|
with:
|
||||||
|
updpkgsums: true
|
||||||
|
srcinfo: true
|
||||||
|
flags: ""
|
||||||
|
namcap: false
|
||||||
|
|
||||||
|
- name: publish rmcl to AUR
|
||||||
|
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
|
||||||
|
with:
|
||||||
|
pkgname: rmcl
|
||||||
|
pkgbuild: PKGBUILD
|
||||||
|
assets: .SRCINFO
|
||||||
|
commit_username: objz
|
||||||
|
commit_email: me@objz.dev
|
||||||
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
|
commit_message: "Update to ${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
|
- name: prepare rmcl-bin
|
||||||
|
run: |
|
||||||
|
sed -i "s|^pkgver=.*|pkgver=${{ steps.version.outputs.version }}|" pkg/rmcl-bin/PKGBUILD
|
||||||
|
sed -i "s|^pkgrel=.*|pkgrel=1|" pkg/rmcl-bin/PKGBUILD
|
||||||
|
cp pkg/rmcl-bin/PKGBUILD PKGBUILD
|
||||||
|
rm -f .SRCINFO
|
||||||
|
|
||||||
|
- name: update checksums for rmcl-bin
|
||||||
|
uses: datakrama/archlinux-package-action@v2
|
||||||
|
with:
|
||||||
|
updpkgsums: true
|
||||||
|
srcinfo: true
|
||||||
|
flags: ""
|
||||||
|
namcap: false
|
||||||
|
|
||||||
|
- name: publish rmcl-bin to AUR
|
||||||
|
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
|
||||||
|
with:
|
||||||
|
pkgname: rmcl-bin
|
||||||
|
pkgbuild: PKGBUILD
|
||||||
|
assets: .SRCINFO
|
||||||
|
commit_username: objz
|
||||||
|
commit_email: me@objz.dev
|
||||||
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
|
commit_message: "Update to ${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
|
- name: prepare rmcl-git
|
||||||
|
run: |
|
||||||
|
cp pkg/rmcl-git/PKGBUILD PKGBUILD
|
||||||
|
rm -f .SRCINFO
|
||||||
|
|
||||||
|
- name: update metadata for rmcl-git
|
||||||
|
uses: datakrama/archlinux-package-action@v2
|
||||||
|
with:
|
||||||
|
updpkgsums: true
|
||||||
|
srcinfo: true
|
||||||
|
flags: ""
|
||||||
|
namcap: false
|
||||||
|
|
||||||
|
- name: publish rmcl-git to AUR
|
||||||
|
uses: KSXGitHub/github-actions-deploy-aur@v4.1.3
|
||||||
|
with:
|
||||||
|
pkgname: rmcl-git
|
||||||
|
pkgbuild: PKGBUILD
|
||||||
|
assets: .SRCINFO
|
||||||
|
commit_username: objz
|
||||||
|
commit_email: me@objz.dev
|
||||||
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
|
commit_message: "Update package metadata"
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
name: publish chocolatey
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
plan:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
PLAN: ${{ inputs.plan }}
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ fromJson(inputs.plan).announcement_tag }}
|
||||||
|
|
||||||
|
- name: verify Chocolatey publishing secret
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ -z "${CHOCOLATEY_API_KEY}" ]; then
|
||||||
|
echo "::error::CHOCOLATEY_API_KEY is required to publish rmcl to Chocolatey."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: prepare Chocolatey package
|
||||||
|
id: package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
tag="$(jq --raw-output '.announcement_tag' <<< "$PLAN")"
|
||||||
|
version="$(jq --raw-output '.releases[0].app_version' <<< "$PLAN")"
|
||||||
|
package_dir="target/chocolatey/rmcl"
|
||||||
|
checksum_file="rmcl-x86_64-pc-windows-msvc.msi.sha256"
|
||||||
|
|
||||||
|
mkdir -p "$package_dir"
|
||||||
|
cp -R pkg/chocolatey/* "$package_dir/"
|
||||||
|
gh release download "$tag" --pattern "$checksum_file" --dir "$package_dir"
|
||||||
|
|
||||||
|
checksum="$(awk '{print $1}' "$package_dir/$checksum_file")"
|
||||||
|
sed -i "s|__TAG__|$tag|g; s|__CHECKSUM64__|$checksum|g" "$package_dir/tools/chocolateyInstall.ps1"
|
||||||
|
sed -i "s|__TAG__|$tag|g; s|__CHECKSUM64__|$checksum|g" "$package_dir/tools/VERIFICATION.txt"
|
||||||
|
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "package_dir=$package_dir" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: pack Chocolatey package
|
||||||
|
uses: crazy-max/ghaction-chocolatey@v4
|
||||||
|
with:
|
||||||
|
args: pack ${{ steps.package.outputs.package_dir }}/rmcl.nuspec --version ${{ steps.package.outputs.version }} --output-directory target/chocolatey/out
|
||||||
|
|
||||||
|
- name: push Chocolatey package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
package="target/chocolatey/out/rmcl.${{ steps.package.outputs.version }}.nupkg"
|
||||||
|
version="${{ steps.package.outputs.version }}"
|
||||||
|
public_package_url="https://community.chocolatey.org/packages/rmcl/$version"
|
||||||
|
saw_server_error=false
|
||||||
|
|
||||||
|
for attempt in 1 2 3; do
|
||||||
|
log_file="$RUNNER_TEMP/chocolatey-push-${attempt}.log"
|
||||||
|
|
||||||
|
if docker run --rm --workdir /wksp --volume "$PWD:/wksp" ghcr.io/crazy-max/chocolatey push "$package" --source "https://push.chocolatey.org/" --api-key "$CHOCOLATEY_API_KEY" --timeout 2700 2>&1 | tee "$log_file"; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "409 (Conflict)" "$log_file"; then
|
||||||
|
echo "::warning::Chocolatey package version already exists; treating this publish as complete."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -qE "50[0-9] \\(" "$log_file"; then
|
||||||
|
saw_server_error=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "403 (Forbidden)" "$log_file"; then
|
||||||
|
if [ "$saw_server_error" = "true" ]; then
|
||||||
|
echo "::warning::Chocolatey returned 403 after an earlier server error. The previous push may have been accepted and put into moderation; treating this publish as complete."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
page_file="$RUNNER_TEMP/chocolatey-package-$version.html"
|
||||||
|
page_status="$(curl --location --silent --show-error --output "$page_file" --write-out "%{http_code}" "$public_package_url")"
|
||||||
|
|
||||||
|
if [ "$page_status" = "200" ] && grep -qE "awaiting moderation|remain unlisted until it has been approved|Version History" "$page_file"; then
|
||||||
|
echo "::warning::Chocolatey returned 403, but the public package page for version $version exists and is awaiting moderation; treating this publish as complete."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::error::Chocolatey rejected the push with 403 before any server-side failure. Check CHOCOLATEY_API_KEY ownership/permissions for rmcl."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$attempt" -eq 3 ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep $((attempt * 30))
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: publish crates
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
plan:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dry_run:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
plan:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
dry_run:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ fromJson(inputs.plan).announcement_tag }}
|
||||||
|
|
||||||
|
- name: install Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: publish to crates.io
|
||||||
|
run: |
|
||||||
|
if [ "${{ inputs.dry_run }}" = "true" ]; then
|
||||||
|
cargo publish --allow-dirty --dry-run
|
||||||
|
else
|
||||||
|
cargo publish --allow-dirty
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
name: publish winget
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
plan:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: prepare WinGet manifest
|
||||||
|
id: manifest
|
||||||
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
PLAN: ${{ inputs.plan }}
|
||||||
|
run: |
|
||||||
|
$plan = $env:PLAN | ConvertFrom-Json
|
||||||
|
$tag = $plan.announcement_tag
|
||||||
|
$version = $plan.releases[0].app_version
|
||||||
|
$identifier = 'Objz.Rmcl'
|
||||||
|
$packagePath = "manifests/o/Objz/Rmcl/$version"
|
||||||
|
$assetPath = "winget-manifest-$version.zip"
|
||||||
|
$installerFile = 'rmcl-x86_64-pc-windows-msvc.msi'
|
||||||
|
$checksumFile = "$installerFile.sha256"
|
||||||
|
$installerUrl = "https://github.com/objz/rmcl/releases/download/$tag/$installerFile"
|
||||||
|
$checksumUrl = "https://github.com/objz/rmcl/releases/download/$tag/$checksumFile"
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Path $packagePath -Force | Out-Null
|
||||||
|
Invoke-WebRequest -Uri $checksumUrl -OutFile "$packagePath/$checksumFile"
|
||||||
|
$checksum = (((Get-Content "$packagePath/$checksumFile" -Raw) -split '\s+')[0]).ToUpperInvariant()
|
||||||
|
|
||||||
|
$versionManifest = @(
|
||||||
|
'# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.9.0.schema.json'
|
||||||
|
"PackageIdentifier: $identifier"
|
||||||
|
"PackageVersion: $version"
|
||||||
|
'DefaultLocale: en-US'
|
||||||
|
'ManifestType: version'
|
||||||
|
'ManifestVersion: 1.9.0'
|
||||||
|
) -join "`n"
|
||||||
|
$versionManifest | Set-Content -Path "$packagePath/$identifier.yaml" -Encoding utf8
|
||||||
|
|
||||||
|
$installerManifest = @(
|
||||||
|
'# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.9.0.schema.json'
|
||||||
|
"PackageIdentifier: $identifier"
|
||||||
|
"PackageVersion: $version"
|
||||||
|
'InstallerType: wix'
|
||||||
|
'Scope: machine'
|
||||||
|
'InstallerSwitches:'
|
||||||
|
' Silent: /quiet /norestart'
|
||||||
|
' SilentWithProgress: /passive /norestart'
|
||||||
|
'UpgradeBehavior: install'
|
||||||
|
'Commands:'
|
||||||
|
'- rmcl'
|
||||||
|
'Installers:'
|
||||||
|
'- Architecture: x64'
|
||||||
|
" InstallerUrl: $installerUrl"
|
||||||
|
" InstallerSha256: $checksum"
|
||||||
|
'ManifestType: installer'
|
||||||
|
'ManifestVersion: 1.9.0'
|
||||||
|
) -join "`n"
|
||||||
|
$installerManifest | Set-Content -Path "$packagePath/$identifier.installer.yaml" -Encoding utf8
|
||||||
|
|
||||||
|
$localeManifest = @(
|
||||||
|
'# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.9.0.schema.json'
|
||||||
|
"PackageIdentifier: $identifier"
|
||||||
|
"PackageVersion: $version"
|
||||||
|
'PackageLocale: en-US'
|
||||||
|
'Publisher: objz'
|
||||||
|
'PublisherUrl: https://github.com/objz'
|
||||||
|
'PublisherSupportUrl: https://github.com/objz/rmcl/issues'
|
||||||
|
'Author: objz'
|
||||||
|
'PackageName: rmcl'
|
||||||
|
'PackageUrl: https://github.com/objz/rmcl'
|
||||||
|
'License: GPL-3.0-only'
|
||||||
|
'LicenseUrl: https://github.com/objz/rmcl/blob/master/LICENSE'
|
||||||
|
'Copyright: Copyright (c) objz'
|
||||||
|
'ShortDescription: Minecraft launcher TUI'
|
||||||
|
'Description: A fully featured Minecraft launcher TUI with Microsoft account authentication, instance management, mod loaders, imports, content management, and launch support.'
|
||||||
|
'Moniker: rmcl'
|
||||||
|
'Tags:'
|
||||||
|
'- minecraft'
|
||||||
|
'- launcher'
|
||||||
|
'- cli'
|
||||||
|
'- tui'
|
||||||
|
'ManifestType: defaultLocale'
|
||||||
|
'ManifestVersion: 1.9.0'
|
||||||
|
) -join "`n"
|
||||||
|
$localeManifest | Set-Content -Path "$packagePath/$identifier.locale.en-US.yaml" -Encoding utf8
|
||||||
|
|
||||||
|
Remove-Item "$packagePath/$checksumFile"
|
||||||
|
Compress-Archive -Path manifests -DestinationPath $assetPath -Force
|
||||||
|
|
||||||
|
"path=$packagePath" >> $env:GITHUB_OUTPUT
|
||||||
|
"asset=$assetPath" >> $env:GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: upload WinGet manifest to GitHub Release
|
||||||
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
PLAN: ${{ inputs.plan }}
|
||||||
|
run: |
|
||||||
|
$plan = $env:PLAN | ConvertFrom-Json
|
||||||
|
gh release upload "$($plan.announcement_tag)" "${{ steps.manifest.outputs.asset }}" --clobber
|
||||||
|
|
||||||
|
- name: submit WinGet manifest
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
Invoke-WebRequest -Uri https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
|
||||||
|
.\wingetcreate.exe submit "${{ steps.manifest.outputs.path }}" --token "${{ secrets.WINGET_TOKEN }}"
|
||||||
@@ -0,0 +1,472 @@
|
|||||||
|
# This file was autogenerated by dist: https://axodotdev.github.io/cargo-dist
|
||||||
|
#
|
||||||
|
# Copyright 2022-2024, axodotdev
|
||||||
|
# SPDX-License-Identifier: MIT or Apache-2.0
|
||||||
|
#
|
||||||
|
# CI that:
|
||||||
|
#
|
||||||
|
# * checks for a Git Tag that looks like a release
|
||||||
|
# * builds artifacts with dist (archives, installers, hashes)
|
||||||
|
# * uploads those artifacts to temporary workflow zip
|
||||||
|
# * on success, uploads the artifacts to a GitHub Release
|
||||||
|
#
|
||||||
|
# Note that the GitHub Release will be created with a generated
|
||||||
|
# title/body based on your changelogs.
|
||||||
|
|
||||||
|
name: release
|
||||||
|
permissions:
|
||||||
|
"contents": "write"
|
||||||
|
|
||||||
|
# This task will run whenever you push a git tag that looks like a version
|
||||||
|
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
|
||||||
|
# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where
|
||||||
|
# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION
|
||||||
|
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
|
||||||
|
#
|
||||||
|
# If PACKAGE_NAME is specified, then the announcement will be for that
|
||||||
|
# package (erroring out if it doesn't have the given version or isn't dist-able).
|
||||||
|
#
|
||||||
|
# If PACKAGE_NAME isn't specified, then the announcement will be for all
|
||||||
|
# (dist-able) packages in the workspace with that version (this mode is
|
||||||
|
# intended for workspaces with only one dist-able package, or with all dist-able
|
||||||
|
# packages versioned/released in lockstep).
|
||||||
|
#
|
||||||
|
# If you push multiple tags at once, separate instances of this workflow will
|
||||||
|
# spin up, creating an independent announcement for each one. However, GitHub
|
||||||
|
# will hard limit this to 3 tags per commit, as it will assume more tags is a
|
||||||
|
# mistake.
|
||||||
|
#
|
||||||
|
# If there's a prerelease-style suffix to the version, then the release(s)
|
||||||
|
# will be marked as a prerelease.
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '**[0-9]+.[0-9]+.[0-9]+*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Run 'dist plan' (or host) to determine what tasks we need to do
|
||||||
|
plan:
|
||||||
|
runs-on: "ubuntu-22.04"
|
||||||
|
outputs:
|
||||||
|
val: ${{ steps.plan.outputs.manifest }}
|
||||||
|
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
|
||||||
|
tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}
|
||||||
|
publishing: ${{ !github.event.pull_request }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
submodules: recursive
|
||||||
|
- name: Install dist
|
||||||
|
# we specify bash to get pipefail; it guards against the `curl` command
|
||||||
|
# failing. otherwise `sh` won't catch that `curl` returned non-0
|
||||||
|
shell: bash
|
||||||
|
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.31.0/cargo-dist-installer.sh | sh"
|
||||||
|
- name: Cache dist
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: cargo-dist-cache
|
||||||
|
path: ~/.cargo/bin/dist
|
||||||
|
# sure would be cool if github gave us proper conditionals...
|
||||||
|
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
|
||||||
|
# functionality based on whether this is a pull_request, and whether it's from a fork.
|
||||||
|
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
|
||||||
|
# but also really annoying to build CI around when it needs secrets to work right.)
|
||||||
|
- id: plan
|
||||||
|
run: |
|
||||||
|
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
|
||||||
|
echo "dist ran successfully"
|
||||||
|
cat plan-dist-manifest.json
|
||||||
|
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: "Upload dist-manifest.json"
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: artifacts-plan-dist-manifest
|
||||||
|
path: plan-dist-manifest.json
|
||||||
|
|
||||||
|
# Build and packages all the platform-specific things
|
||||||
|
build-local-artifacts:
|
||||||
|
name: build-local-artifacts (${{ join(matrix.targets, ', ') }})
|
||||||
|
# Let the initial task tell us to not run (currently very blunt)
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
# Target platforms/runners are computed by dist in create-release.
|
||||||
|
# Each member of the matrix has the following arguments:
|
||||||
|
#
|
||||||
|
# - runner: the github runner
|
||||||
|
# - dist-args: cli flags to pass to dist
|
||||||
|
# - install-dist: expression to run to install dist on the runner
|
||||||
|
#
|
||||||
|
# Typically there will be:
|
||||||
|
# - 1 "global" task that builds universal installers
|
||||||
|
# - N "local" tasks that build each platform's binaries and platform-specific installers
|
||||||
|
matrix: ${{ fromJson(needs.plan.outputs.val || '{"ci":{"github":{"artifacts_matrix":{"include":[]}}}}').ci.github.artifacts_matrix }}
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
container: ${{ matrix.container && matrix.container.image || null }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
|
||||||
|
steps:
|
||||||
|
- name: enable windows longpaths
|
||||||
|
run: |
|
||||||
|
git config --global core.longpaths true
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
submodules: recursive
|
||||||
|
- name: Install Rust non-interactively if not already installed
|
||||||
|
if: ${{ matrix.container }}
|
||||||
|
run: |
|
||||||
|
if ! command -v cargo > /dev/null 2>&1; then
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
fi
|
||||||
|
- name: "install JDK"
|
||||||
|
uses: "actions/setup-java@v5"
|
||||||
|
with:
|
||||||
|
"distribution": "temurin"
|
||||||
|
"java-version": "21"
|
||||||
|
- name: Install dist
|
||||||
|
run: ${{ matrix.install_dist.run }}
|
||||||
|
# Get the dist-manifest
|
||||||
|
- name: Fetch local artifacts
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
pattern: artifacts-*
|
||||||
|
path: target/distrib/
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
${{ matrix.packages_install }}
|
||||||
|
- name: Build artifacts
|
||||||
|
run: |
|
||||||
|
# Actually do builds and make zips and whatnot
|
||||||
|
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
|
||||||
|
echo "dist ran successfully"
|
||||||
|
- id: cargo-dist
|
||||||
|
name: Post-build
|
||||||
|
# We force bash here just because github makes it really hard to get values up
|
||||||
|
# to "real" actions without writing to env-vars, and writing to env-vars has
|
||||||
|
# inconsistent syntax between shell and powershell.
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Parse out what we just built and upload it to scratch storage
|
||||||
|
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
|
||||||
|
- name: "Upload artifacts"
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
|
||||||
|
path: |
|
||||||
|
${{ steps.cargo-dist.outputs.paths }}
|
||||||
|
${{ env.BUILD_MANIFEST_NAME }}
|
||||||
|
|
||||||
|
# Build and package all the platform-agnostic(ish) things
|
||||||
|
build-global-artifacts:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- build-local-artifacts
|
||||||
|
runs-on: "ubuntu-22.04"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
submodules: recursive
|
||||||
|
- name: Install cached dist
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
name: cargo-dist-cache
|
||||||
|
path: ~/.cargo/bin/
|
||||||
|
- run: chmod +x ~/.cargo/bin/dist
|
||||||
|
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
|
||||||
|
- name: Fetch local artifacts
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
pattern: artifacts-*
|
||||||
|
path: target/distrib/
|
||||||
|
merge-multiple: true
|
||||||
|
- id: cargo-dist
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
|
||||||
|
echo "dist ran successfully"
|
||||||
|
|
||||||
|
# Parse out what we just built and upload it to scratch storage
|
||||||
|
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
|
||||||
|
- name: "Upload artifacts"
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: artifacts-build-global
|
||||||
|
path: |
|
||||||
|
${{ steps.cargo-dist.outputs.paths }}
|
||||||
|
${{ env.BUILD_MANIFEST_NAME }}
|
||||||
|
# Determines if we should publish/announce
|
||||||
|
host:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- build-local-artifacts
|
||||||
|
- build-global-artifacts
|
||||||
|
# Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
|
||||||
|
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
runs-on: "ubuntu-22.04"
|
||||||
|
outputs:
|
||||||
|
val: ${{ steps.host.outputs.manifest }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
- name: Install cached dist
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
name: cargo-dist-cache
|
||||||
|
path: ~/.cargo/bin/
|
||||||
|
- run: chmod +x ~/.cargo/bin/dist
|
||||||
|
# Fetch artifacts from scratch-storage
|
||||||
|
- name: Fetch artifacts
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
pattern: artifacts-*
|
||||||
|
path: target/distrib/
|
||||||
|
merge-multiple: true
|
||||||
|
- id: host
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
|
||||||
|
echo "artifacts uploaded and released successfully"
|
||||||
|
cat dist-manifest.json
|
||||||
|
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: "Upload dist-manifest.json"
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
# Overwrite the previous copy
|
||||||
|
name: artifacts-dist-manifest
|
||||||
|
path: dist-manifest.json
|
||||||
|
# Create a GitHub Release while uploading all files to it
|
||||||
|
- name: "Download GitHub Artifacts"
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
pattern: artifacts-*
|
||||||
|
path: artifacts
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Cleanup
|
||||||
|
run: |
|
||||||
|
# Remove internal cargo-dist manifests from the public GitHub Release.
|
||||||
|
rm -f artifacts/*-dist-manifest.json artifacts/dist-manifest.json
|
||||||
|
- name: Generate changelog
|
||||||
|
id: changelog
|
||||||
|
uses: orhun/git-cliff-action@v4
|
||||||
|
with:
|
||||||
|
args: --latest --strip header
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Create GitHub Release
|
||||||
|
env:
|
||||||
|
PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"
|
||||||
|
ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}"
|
||||||
|
RELEASE_COMMIT: "${{ github.sha }}"
|
||||||
|
CHANGELOG: "${{ steps.changelog.outputs.content }}"
|
||||||
|
RELEASE_TAG: "${{ needs.plan.outputs.tag }}"
|
||||||
|
APP_VERSION: "${{ fromJson(steps.host.outputs.manifest).releases[0].app_version }}"
|
||||||
|
run: |
|
||||||
|
echo "$CHANGELOG" > $RUNNER_TEMP/notes.txt
|
||||||
|
cat >> $RUNNER_TEMP/notes.txt <<EOF
|
||||||
|
|
||||||
|
## Downloads
|
||||||
|
|
||||||
|
| File | Platform | Checksum |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| [rmcl-aarch64-apple-darwin.tar.xz](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-aarch64-apple-darwin.tar.xz.sha256) |
|
||||||
|
| [rmcl-x86_64-apple-darwin.tar.xz](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-apple-darwin.tar.xz.sha256) |
|
||||||
|
| [rmcl-x86_64-pc-windows-msvc.zip](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-pc-windows-msvc.zip.sha256) |
|
||||||
|
| [rmcl-x86_64-pc-windows-msvc.msi](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-pc-windows-msvc.msi) | x64 Windows | [checksum](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-pc-windows-msvc.msi.sha256) |
|
||||||
|
| [rmcl-aarch64-unknown-linux-gnu.tar.xz](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-aarch64-unknown-linux-gnu.tar.xz) | ARM64 Linux | [checksum](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-aarch64-unknown-linux-gnu.tar.xz.sha256) |
|
||||||
|
| [rmcl-x86_64-unknown-linux-gnu.tar.xz](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-unknown-linux-gnu.tar.xz) | x64 Linux | [checksum](https://github.com/objz/rmcl/releases/download/${RELEASE_TAG}/rmcl-x86_64-unknown-linux-gnu.tar.xz.sha256) |
|
||||||
|
|
||||||
|
## Cargo
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
cargo install rmcl
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Homebrew
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
brew install objz/tap/rmcl
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## WinGet
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
winget install Objz.Rmcl
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
The generated WinGet manifest is attached as \`winget-manifest-${APP_VERSION}.zip\` for local validation.
|
||||||
|
|
||||||
|
## Chocolatey
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
choco install rmcl
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## AUR
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
paru -S rmcl-bin
|
||||||
|
\`\`\`
|
||||||
|
EOF
|
||||||
|
|
||||||
|
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
|
||||||
|
|
||||||
|
publish-homebrew-formula:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
runs-on: "ubuntu-22.04"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PLAN: ${{ needs.plan.outputs.val }}
|
||||||
|
HOMEBREW_TAP_REPOSITORY: "objz/homebrew-tap"
|
||||||
|
GITHUB_USER: "axo bot"
|
||||||
|
GITHUB_EMAIL: "admin+bot@axo.dev"
|
||||||
|
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: true
|
||||||
|
repository: ${{ env.HOMEBREW_TAP_REPOSITORY }}
|
||||||
|
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||||
|
# So we have access to the formula
|
||||||
|
- name: Fetch homebrew formulae
|
||||||
|
uses: actions/download-artifact@v7
|
||||||
|
with:
|
||||||
|
pattern: artifacts-*
|
||||||
|
path: Formula/
|
||||||
|
merge-multiple: true
|
||||||
|
# This is extra complex because you can make your Formula name not match your app name
|
||||||
|
# so we need to find releases with a *.rb file, and publish with that filename.
|
||||||
|
- name: Commit formula files
|
||||||
|
run: |
|
||||||
|
git config --global user.name "${GITHUB_USER}"
|
||||||
|
git config --global user.email "${GITHUB_EMAIL}"
|
||||||
|
starting_commit="$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
|
||||||
|
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
|
||||||
|
name=$(echo "$filename" | sed "s/\.rb$//")
|
||||||
|
version=$(echo "$release" | jq .app_version --raw-output)
|
||||||
|
|
||||||
|
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
|
||||||
|
brew update
|
||||||
|
# We avoid reformatting user-provided data such as the app description and homepage.
|
||||||
|
brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
|
||||||
|
|
||||||
|
git add "Formula/${filename}"
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "Formula/${filename} is unchanged"
|
||||||
|
else
|
||||||
|
git commit -m "${name} ${version}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$(git rev-parse HEAD)" = "$starting_commit" ]; then
|
||||||
|
echo "No Homebrew formula changes to push"
|
||||||
|
else
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
|
||||||
|
custom-publish-crates:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
|
||||||
|
uses: ./.github/workflows/publish-crates.yml
|
||||||
|
with:
|
||||||
|
plan: ${{ needs.plan.outputs.val }}
|
||||||
|
dry_run: false
|
||||||
|
secrets: inherit
|
||||||
|
# publish jobs get escalated permissions
|
||||||
|
permissions:
|
||||||
|
"contents": "read"
|
||||||
|
|
||||||
|
custom-publish-aur:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
|
||||||
|
uses: ./.github/workflows/publish-aur.yml
|
||||||
|
with:
|
||||||
|
plan: ${{ needs.plan.outputs.val }}
|
||||||
|
secrets: inherit
|
||||||
|
# publish jobs get escalated permissions
|
||||||
|
permissions:
|
||||||
|
"contents": "read"
|
||||||
|
|
||||||
|
custom-publish-winget:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
|
||||||
|
uses: ./.github/workflows/publish-winget.yml
|
||||||
|
with:
|
||||||
|
plan: ${{ needs.plan.outputs.val }}
|
||||||
|
secrets: inherit
|
||||||
|
# publish jobs get escalated permissions
|
||||||
|
permissions:
|
||||||
|
"contents": "write"
|
||||||
|
|
||||||
|
custom-publish-chocolatey:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
|
||||||
|
uses: ./.github/workflows/publish-chocolatey.yml
|
||||||
|
with:
|
||||||
|
plan: ${{ needs.plan.outputs.val }}
|
||||||
|
secrets: inherit
|
||||||
|
# publish jobs get escalated permissions
|
||||||
|
permissions:
|
||||||
|
"contents": "read"
|
||||||
|
|
||||||
|
announce:
|
||||||
|
needs:
|
||||||
|
- plan
|
||||||
|
- host
|
||||||
|
- publish-homebrew-formula
|
||||||
|
- custom-publish-crates
|
||||||
|
- custom-publish-aur
|
||||||
|
- custom-publish-winget
|
||||||
|
- custom-publish-chocolatey
|
||||||
|
# use "always() && ..." to allow us to wait for all publish jobs while
|
||||||
|
# still allowing individual publish jobs to skip themselves (for prereleases).
|
||||||
|
# "host" however must run to completion, no skipping allowed!
|
||||||
|
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.custom-publish-crates.result == 'skipped' || needs.custom-publish-crates.result == 'success') && (needs.custom-publish-aur.result == 'skipped' || needs.custom-publish-aur.result == 'success') && (needs.custom-publish-winget.result == 'skipped' || needs.custom-publish-winget.result == 'success') && (needs.custom-publish-chocolatey.result == 'skipped' || needs.custom-publish-chocolatey.result == 'success') }}
|
||||||
|
runs-on: "ubuntu-22.04"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
submodules: recursive
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
name: tag release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["build"]
|
||||||
|
branches: [master]
|
||||||
|
types: [completed]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: tag-release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tag-release:
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
ref: ${{ github.event.workflow_run.head_sha || 'master' }}
|
||||||
|
|
||||||
|
- name: decide release tag
|
||||||
|
id: release
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
version=$(awk '
|
||||||
|
$0 == "[package]" { in_package = 1; next }
|
||||||
|
/^\[/ && in_package { exit }
|
||||||
|
in_package && $1 == "version" {
|
||||||
|
gsub(/"/, "", $3)
|
||||||
|
print $3
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' Cargo.toml)
|
||||||
|
|
||||||
|
if [[ -z "$version" ]]; then
|
||||||
|
echo "failed to read package version from Cargo.toml" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
latest=$(
|
||||||
|
git tag --list \
|
||||||
|
| sed -nE 's/^v?([0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?)$/\1/p' \
|
||||||
|
| sort -V \
|
||||||
|
| tail -n1
|
||||||
|
)
|
||||||
|
|
||||||
|
should_release=false
|
||||||
|
if [[ -z "$latest" ]]; then
|
||||||
|
should_release=true
|
||||||
|
elif [[ "$version" != "$latest" && "$(printf '%s\n%s\n' "$latest" "$version" | sort -V | tail -n1)" == "$version" ]]; then
|
||||||
|
should_release=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
tag="v${version}"
|
||||||
|
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "latest=${latest}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "should-release=${should_release}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
if [[ "$should_release" == "true" ]]; then
|
||||||
|
echo "Cargo.toml version ${version} is newer than latest tag ${latest:-<none>}; creating ${tag}."
|
||||||
|
else
|
||||||
|
echo "Cargo.toml version ${version} is not newer than latest tag ${latest}; skipping release."
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: create release tag
|
||||||
|
if: ${{ steps.release.outputs.should-release == 'true' }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
TAG_NAME: ${{ steps.release.outputs.tag }}
|
||||||
|
TAG_SHA: ${{ steps.release.outputs.sha }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -z "${GH_TOKEN}" ]]; then
|
||||||
|
echo "RELEASE_TOKEN is required so the created tag can trigger the generated release workflow." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh api "repos/${{ github.repository }}/git/refs" \
|
||||||
|
-f "ref=refs/tags/${TAG_NAME}" \
|
||||||
|
-f "sha=${TAG_SHA}"
|
||||||
Generated
+271
-90
@@ -19,13 +19,13 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aes"
|
name = "aes"
|
||||||
version = "0.8.4"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
|
checksum = "66bd29a732b644c0431c6140f370d097879203d79b80c94a6747ba0872adaef8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
|
||||||
"cipher",
|
"cipher",
|
||||||
"cpufeatures",
|
"cpubits",
|
||||||
|
"cpufeatures 0.3.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -234,6 +234,16 @@ dependencies = [
|
|||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be"
|
||||||
|
dependencies = [
|
||||||
|
"hybrid-array",
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bon"
|
name = "bon"
|
||||||
version = "3.9.1"
|
version = "3.9.1"
|
||||||
@@ -323,9 +333,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.60"
|
version = "1.2.61"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20"
|
checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
@@ -361,11 +371,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cipher"
|
name = "cipher"
|
||||||
version = "0.4.4"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
checksum = "e34d8227fe1ba289043aeb13792056ff80fd6de1a9f49137a5f499de8e8c78ea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crypto-common",
|
"crypto-common 0.2.1",
|
||||||
"inout",
|
"inout",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -396,6 +406,12 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
|
checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cmov"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color-eyre"
|
name = "color-eyre"
|
||||||
version = "0.6.5"
|
version = "0.6.5"
|
||||||
@@ -464,6 +480,12 @@ dependencies = [
|
|||||||
"yaml-rust2",
|
"yaml-rust2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "const-oid"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const-random"
|
name = "const-random"
|
||||||
version = "0.1.18"
|
version = "0.1.18"
|
||||||
@@ -514,6 +536,12 @@ version = "0.8.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpubits"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5ef0c543070d296ea414df2dd7625d1b24866ce206709d8a4a424f28377f5861"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "cpufeatures"
|
||||||
version = "0.2.17"
|
version = "0.2.17"
|
||||||
@@ -523,6 +551,15 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
@@ -627,6 +664,15 @@ dependencies = [
|
|||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crypto-common"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710"
|
||||||
|
dependencies = [
|
||||||
|
"hybrid-array",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "csscolorparser"
|
name = "csscolorparser"
|
||||||
version = "0.6.2"
|
version = "0.6.2"
|
||||||
@@ -637,6 +683,15 @@ dependencies = [
|
|||||||
"phf",
|
"phf",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ctutils"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
|
||||||
|
dependencies = [
|
||||||
|
"cmov",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "darling"
|
name = "darling"
|
||||||
version = "0.21.3"
|
version = "0.21.3"
|
||||||
@@ -778,9 +833,21 @@ version = "0.10.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer",
|
"block-buffer 0.10.4",
|
||||||
"crypto-common",
|
"crypto-common 0.1.7",
|
||||||
"subtle",
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.11.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer 0.12.0",
|
||||||
|
"const-oid",
|
||||||
|
"crypto-common 0.2.1",
|
||||||
|
"ctutils",
|
||||||
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1023,6 +1090,15 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fsevent-sys"
|
||||||
|
version = "4.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "funty"
|
name = "funty"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@@ -1214,11 +1290,11 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hmac"
|
name = "hmac"
|
||||||
version = "0.12.1"
|
version = "0.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"digest",
|
"digest 0.11.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1260,6 +1336,15 @@ version = "1.10.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hybrid-array"
|
||||||
|
version = "0.4.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08d46837a0ed51fe95bd3b05de33cd64a1ee88fc797477ca48446872504507c5"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
@@ -1509,12 +1594,32 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inout"
|
name = "inotify"
|
||||||
version = "0.1.4"
|
version = "0.11.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
checksum = "bd5b3eaf1a28b758ac0faa5a4254e8ab2705605496f1b1f3fbbc3988ad73d199"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"generic-array",
|
"bitflags 2.11.1",
|
||||||
|
"inotify-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inotify-sys"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inout"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7"
|
||||||
|
dependencies = [
|
||||||
|
"hybrid-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1588,9 +1693,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jiff"
|
name = "jiff"
|
||||||
version = "0.2.23"
|
version = "0.2.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359"
|
checksum = "f00b5dbd620d61dfdcb6007c9c1f6054ebd75319f163d886a9055cec1155073d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jiff-static",
|
"jiff-static",
|
||||||
"jiff-tzdb-platform",
|
"jiff-tzdb-platform",
|
||||||
@@ -1603,9 +1708,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jiff-static"
|
name = "jiff-static"
|
||||||
version = "0.2.23"
|
version = "0.2.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4"
|
checksum = "e000de030ff8022ea1da3f466fbb0f3a809f5e51ed31f6dd931c35181ad8e6d7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -1692,6 +1797,26 @@ dependencies = [
|
|||||||
"syn 2.0.117",
|
"syn 2.0.117",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kqueue"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a"
|
||||||
|
dependencies = [
|
||||||
|
"kqueue-sys",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kqueue-sys"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lab"
|
name = "lab"
|
||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
@@ -1718,9 +1843,9 @@ checksum = "b3a6a8c165077efc8f3a971534c50ea6a1a18b329ef4a66e897a7e3a1494565f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.185"
|
version = "0.2.186"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
|
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
@@ -1828,48 +1953,6 @@ dependencies = [
|
|||||||
"regex-automata",
|
"regex-automata",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mcl-launcher"
|
|
||||||
version = "0.2.1"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"chrono",
|
|
||||||
"clap",
|
|
||||||
"color-eyre",
|
|
||||||
"config",
|
|
||||||
"crossterm 0.29.0",
|
|
||||||
"dirs",
|
|
||||||
"dirs-next",
|
|
||||||
"image",
|
|
||||||
"log",
|
|
||||||
"minecraft-msa-auth",
|
|
||||||
"oauth2",
|
|
||||||
"open",
|
|
||||||
"ratatui",
|
|
||||||
"ratatui-image",
|
|
||||||
"ratatui-textarea",
|
|
||||||
"ratatui-themekit",
|
|
||||||
"reqwest",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"tachyonfx",
|
|
||||||
"tempfile",
|
|
||||||
"thiserror 2.0.18",
|
|
||||||
"throbber-widgets-tui",
|
|
||||||
"tokio",
|
|
||||||
"toml",
|
|
||||||
"tracing",
|
|
||||||
"tracing-appender",
|
|
||||||
"tracing-subscriber",
|
|
||||||
"tui-logger",
|
|
||||||
"tui-popup",
|
|
||||||
"tui-prompts",
|
|
||||||
"tui-scrollview",
|
|
||||||
"tui-widget-list",
|
|
||||||
"which",
|
|
||||||
"zip",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.8.0"
|
version = "2.8.0"
|
||||||
@@ -1972,6 +2055,33 @@ dependencies = [
|
|||||||
"minimal-lexical",
|
"minimal-lexical",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify"
|
||||||
|
version = "8.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.1",
|
||||||
|
"fsevent-sys",
|
||||||
|
"inotify",
|
||||||
|
"kqueue",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"mio",
|
||||||
|
"notify-types",
|
||||||
|
"walkdir",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "notify-types"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.11.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.50.3"
|
version = "0.50.3"
|
||||||
@@ -2089,9 +2199,9 @@ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "open"
|
name = "open"
|
||||||
version = "5.3.3"
|
version = "5.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "43bb73a7fa3799b198970490a51174027ba0d4ec504b03cd08caf513d40024bc"
|
checksum = "9f3bab717c29a857abf75fcef718d441ec7cb2725f937343c734740a985d37fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"is-wsl",
|
"is-wsl",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -2199,11 +2309,11 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pbkdf2"
|
name = "pbkdf2"
|
||||||
version = "0.12.2"
|
version = "0.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
|
checksum = "112d82ceb8c5bf524d9af484d4e4970c9fd5a0cc15ba14ad93dccd28873b0629"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"digest",
|
"digest 0.11.2",
|
||||||
"hmac",
|
"hmac",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2890,6 +3000,49 @@ dependencies = [
|
|||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rmcl"
|
||||||
|
version = "0.3.0"
|
||||||
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
|
"chrono",
|
||||||
|
"clap",
|
||||||
|
"color-eyre",
|
||||||
|
"config",
|
||||||
|
"crossterm 0.29.0",
|
||||||
|
"dirs",
|
||||||
|
"dirs-next",
|
||||||
|
"image",
|
||||||
|
"log",
|
||||||
|
"minecraft-msa-auth",
|
||||||
|
"notify",
|
||||||
|
"oauth2",
|
||||||
|
"open",
|
||||||
|
"ratatui",
|
||||||
|
"ratatui-image",
|
||||||
|
"ratatui-textarea",
|
||||||
|
"ratatui-themekit",
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tachyonfx",
|
||||||
|
"tempfile",
|
||||||
|
"thiserror 2.0.18",
|
||||||
|
"throbber-widgets-tui",
|
||||||
|
"tokio",
|
||||||
|
"toml",
|
||||||
|
"tracing",
|
||||||
|
"tracing-appender",
|
||||||
|
"tracing-subscriber",
|
||||||
|
"tui-logger",
|
||||||
|
"tui-popup",
|
||||||
|
"tui-prompts",
|
||||||
|
"tui-scrollview",
|
||||||
|
"tui-widget-list",
|
||||||
|
"which",
|
||||||
|
"zip",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ron"
|
name = "ron"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@@ -2963,9 +3116,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.38"
|
version = "0.23.39"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "69f9466fb2c14ea04357e91413efb882e2a6d4a406e625449bc0a5d360d53a21"
|
checksum = "7c2c118cb077cca2822033836dfb1b975355dfb784b5e8da48f7b6c5db74e60e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"ring",
|
"ring",
|
||||||
@@ -2977,9 +3130,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-pki-types"
|
name = "rustls-pki-types"
|
||||||
version = "1.14.0"
|
version = "1.14.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd"
|
checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"web-time",
|
"web-time",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@@ -2987,9 +3140,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.103.12"
|
version = "0.103.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8279bb85272c9f10811ae6a6c547ff594d6a7f3c6c6b02ee9726d1d0dcfcdd06"
|
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ring",
|
"ring",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
@@ -3017,6 +3170,15 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "same-file"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
@@ -3118,13 +3280,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha1"
|
name = "sha1"
|
||||||
version = "0.10.6"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cpufeatures",
|
"cpufeatures 0.3.0",
|
||||||
"digest",
|
"digest 0.11.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3134,8 +3296,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cpufeatures",
|
"cpufeatures 0.2.17",
|
||||||
"digest",
|
"digest 0.10.7",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3850,9 +4012,9 @@ checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.19.0"
|
version = "1.20.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ucd-trie"
|
name = "ucd-trie"
|
||||||
@@ -3972,6 +4134,16 @@ dependencies = [
|
|||||||
"utf8parse",
|
"utf8parse",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "walkdir"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||||
|
dependencies = [
|
||||||
|
"same-file",
|
||||||
|
"winapi-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "want"
|
name = "want"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@@ -4245,6 +4417,15 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-util"
|
||||||
|
version = "0.1.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@@ -4541,9 +4722,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5"
|
checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
@@ -4773,9 +4954,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "8.5.1"
|
version = "8.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dcab981e19633ebcf0b001ddd37dd802996098bc1864f90b7c5d970ce76c1d59"
|
checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"bzip2",
|
"bzip2",
|
||||||
|
|||||||
+17
-4
@@ -1,17 +1,24 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mcl-launcher"
|
name = "rmcl"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
authors = ["objz"]
|
authors = ["objz"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A fully featured Minecraft launcher TUI"
|
description = "A fully featured Minecraft launcher TUI"
|
||||||
repository = "https://github.com/objz/mcl"
|
repository = "https://github.com/objz/rmcl"
|
||||||
|
homepage = "https://github.com/objz/rmcl"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["minecraft", "launcher", "tui", "ratatui"]
|
keywords = ["minecraft", "launcher", "tui", "ratatui"]
|
||||||
categories = ["command-line-utilities", "games"]
|
categories = ["command-line-utilities", "games"]
|
||||||
|
|
||||||
|
[package.metadata.wix]
|
||||||
|
upgrade-guid = "BEC08BE4-6A8F-4C1D-A1B4-B1AC963000AE"
|
||||||
|
path-guid = "E5863AC2-13FC-45C8-B79D-55338F371A8A"
|
||||||
|
license = false
|
||||||
|
eula = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "mcl"
|
name = "rmcl"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -50,6 +57,7 @@ oauth2 = "5.0.0"
|
|||||||
open = "5"
|
open = "5"
|
||||||
which = "8.0.2"
|
which = "8.0.2"
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
|
notify = "8"
|
||||||
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
@@ -58,5 +66,10 @@ lto = true
|
|||||||
opt-level = "s"
|
opt-level = "s"
|
||||||
strip = true
|
strip = true
|
||||||
|
|
||||||
|
# The profile that 'dist' will build with
|
||||||
|
[profile.dist]
|
||||||
|
inherits = "release"
|
||||||
|
lto = "thin"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
# mcl
|
# rmcl
|
||||||
|
|
||||||
[![Contributors][contributors-shield]][contributors-url]
|
[![Contributors][contributors-shield]][contributors-url]
|
||||||
[![Forks][forks-shield]][forks-url]
|
[![Forks][forks-shield]][forks-url]
|
||||||
@@ -8,11 +8,11 @@
|
|||||||
[![Issues][issues-shield]][issues-url]
|
[![Issues][issues-shield]][issues-url]
|
||||||
[![GPL-3.0 License][license-shield]][license-url]
|
[![GPL-3.0 License][license-shield]][license-url]
|
||||||
|
|
||||||
**M**ine**C**raft **L**auncher. or **M**ine**C**raft c**L**i. pick whichever sounds better to you.
|
**R**ust **M**ine**C**raft **L**auncher. or **R**ust **M**ine**C**raft c**L**i. pick whichever sounds better to you.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[Report Bug](https://github.com/objz/mcl/issues) · [Request Feature](https://github.com/objz/mcl/issues)
|
[Report Bug](https://github.com/objz/rmcl/issues) · [Request Feature](https://github.com/objz/rmcl/issues)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
## about
|
## about
|
||||||
|
|
||||||
we all love TUIs. and we all know the official Minecraft launcher is not exactly a joy to use (performance wise; no hatespeech here). so here's mcl, a fully featured Minecraft launcher that lives in your terminal. written in Rust because if you're replacing something bloated you might as well go all the way.
|
we all love TUIs. and we all know the official Minecraft launcher is not exactly a joy to use (performance wise; no hatespeech here). so here's rmcl, a fully featured Minecraft launcher that lives in your terminal. written in Rust because if you're replacing something bloated you might as well go all the way.
|
||||||
|
|
||||||
it does everything you'd expect from a launcher. multiple instances, mod loaders, modpack imports, Microsoft auth, content management, launching. all from a TUI or from the command line. the TUI is the main thing though, the CLI is there for scripting and automation.
|
it does everything you'd expect from a launcher. multiple instances, mod loaders, modpack imports, Microsoft auth, content management, launching. all from a TUI or from the command line. the TUI is the main thing though, the CLI is there for scripting and automation.
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ it does everything you'd expect from a launcher. multiple instances, mod loaders
|
|||||||
| **modpack import** | import from Modrinth via `.mrpack` file, URL, or slug |
|
| **modpack import** | import from Modrinth via `.mrpack` file, URL, or slug |
|
||||||
| **accounts** | multiple Microsoft accounts and offline players, switch between them |
|
| **accounts** | multiple Microsoft accounts and offline players, switch between them |
|
||||||
| **launching** | launch directly from the TUI or generate a desktop shortcut for any instance |
|
| **launching** | launch directly from the TUI or generate a desktop shortcut for any instance |
|
||||||
| **desktop shortcuts** | click it and Minecraft starts, no need to open mcl or type anything |
|
| **desktop shortcuts** | click it and Minecraft starts, no need to open rmcl or type anything |
|
||||||
| **CLI** | every feature the TUI has is also available as a subcommand |
|
| **CLI** | every feature the TUI has is also available as a subcommand |
|
||||||
| **theming** | 10 built-in themes, custom themes, color overrides |
|
| **theming** | 10 built-in themes, custom themes, color overrides |
|
||||||
|
|
||||||
@@ -42,45 +42,82 @@ it does everything you'd expect from a launcher. multiple instances, mod loaders
|
|||||||
|
|
||||||
## authentication
|
## authentication
|
||||||
|
|
||||||
mcl uses its own Microsoft client ID for Minecraft account authentication.
|
rmcl uses its own Microsoft client ID for Minecraft account authentication.
|
||||||
|
|
||||||
Authentication is performed through Microsoft’s official services.
|
Authentication is performed through Microsoft’s official services.
|
||||||
|
|
||||||
## installation
|
## installation
|
||||||
|
|
||||||
### Arch Linux
|
### macOS / Linux
|
||||||
|
|
||||||
[](https://aur.archlinux.org/packages/mcl-launcher)
|
prebuilt archives are attached to each GitHub release.
|
||||||
[](https://aur.archlinux.org/packages/mcl-launcher-bin)
|
|
||||||
[](https://aur.archlinux.org/packages/mcl-launcher-git)
|
```sh
|
||||||
|
# Homebrew
|
||||||
|
brew install objz/tap/rmcl
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
release builds include a `.zip` archive and an `.msi`. WinGet and Chocolatey
|
||||||
|
packages are submitted from release CI and become available after review.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# WinGet
|
||||||
|
winget install Objz.Rmcl
|
||||||
|
|
||||||
|
# Chocolatey
|
||||||
|
choco install rmcl
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# from source (release tarball)
|
# from source (release tarball)
|
||||||
paru -S mcl-launcher
|
paru -S rmcl
|
||||||
|
|
||||||
# prebuilt binary
|
# prebuilt binary
|
||||||
paru -S mcl-launcher-bin
|
paru -S rmcl-bin
|
||||||
|
|
||||||
# latest git
|
# latest git
|
||||||
paru -S mcl-launcher-git
|
paru -S rmcl-git
|
||||||
```
|
```
|
||||||
|
|
||||||
also available on [crates.io](https://crates.io/crates/mcl-launcher)
|
### Cargo
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install rmcl
|
||||||
|
```
|
||||||
|
|
||||||
|
### package status
|
||||||
|
|
||||||
|
release:
|
||||||
|
|
||||||
|
[](https://github.com/objz/rmcl/releases)
|
||||||
|
[](https://crates.io/crates/rmcl)
|
||||||
|
|
||||||
|
package managers:
|
||||||
|
|
||||||
|
[](https://github.com/objz/homebrew-tap)
|
||||||
|
[](https://winstall.app/apps/Objz.Rmcl)
|
||||||
|
[](https://community.chocolatey.org/packages/rmcl)
|
||||||
|
|
||||||
|
aur:
|
||||||
|
|
||||||
|
[](https://aur.archlinux.org/packages/rmcl)
|
||||||
|
[](https://aur.archlinux.org/packages/rmcl-bin)
|
||||||
|
[](https://aur.archlinux.org/packages/rmcl-git)
|
||||||
|
|
||||||
### from source
|
### from source
|
||||||
|
|
||||||
requires a Rust toolchain.
|
requires a Rust toolchain and a JDK (`javac` and `jar` on `PATH`).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/objz/mcl.git
|
git clone https://github.com/objz/rmcl.git
|
||||||
cd mcl
|
cd rmcl
|
||||||
cargo build --release
|
cargo build --release
|
||||||
```
|
```
|
||||||
|
|
||||||
### other platforms
|
|
||||||
|
|
||||||
mcl can be compiled for Linux, macOS, and Windows. right now it's only packaged for Arch Linux (AUR) but official packages for other platforms and package managers will be added continuously.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## where things live
|
## where things live
|
||||||
@@ -91,19 +128,19 @@ settings, accounts, instances, and cached game metadata.
|
|||||||
|
|
||||||
| what | Linux | macOS | Windows |
|
| what | Linux | macOS | Windows |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| config (`config.toml`, `theme.toml`, `accounts.json`) | `~/.config/mcl/` | `~/Library/Application Support/mcl/` | `%APPDATA%\mcl\` |
|
| config (`config.toml`, `theme.toml`, `accounts.json`) | `~/.config/rmcl/` | `~/Library/Application Support/rmcl/` | `%APPDATA%\rmcl\` |
|
||||||
| instances | `~/.local/share/mcl/instances/` | `~/Library/Application Support/mcl/instances/` | `%LOCALAPPDATA%\mcl\instances\` |
|
| instances | `~/.local/share/rmcl/instances/` | `~/Library/Application Support/rmcl/instances/` | `%LOCALAPPDATA%\rmcl\instances\` |
|
||||||
| metadata (versions, libraries, assets, loader profiles) | `~/.local/share/mcl/meta/` | `~/Library/Application Support/mcl/meta/` | `%LOCALAPPDATA%\mcl\meta\` |
|
| metadata (versions, libraries, assets, loader profiles) | `~/.local/share/rmcl/meta/` | `~/Library/Application Support/rmcl/meta/` | `%LOCALAPPDATA%\rmcl\meta\` |
|
||||||
|
|
||||||
each instance has an `instance.json` for its config and a `.minecraft/` directory with the actual game files. standard layout, nothing weird.
|
each instance has an `instance.json` for its config and a `.minecraft/` directory with the actual game files. standard layout, nothing weird.
|
||||||
|
|
||||||
### logs
|
### logs
|
||||||
|
|
||||||
launcher logs are per-session and contain mcl's own output. instance launch logs capture game stdout/stderr per launch.
|
launcher logs are per-session and contain rmcl's own output. instance launch logs capture game stdout/stderr per launch.
|
||||||
|
|
||||||
| what | Linux | macOS | Windows |
|
| what | Linux | macOS | Windows |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| launcher logs | `~/.cache/mcl/` | `~/Library/Caches/mcl/` | `%LOCALAPPDATA%\mcl\` |
|
| launcher logs | `~/.cache/rmcl/` | `~/Library/Caches/rmcl/` | `%LOCALAPPDATA%\rmcl\` |
|
||||||
| instance launch logs | `<instances>/<name>/.minecraft/logs/launches/` | same | same |
|
| instance launch logs | `<instances>/<name>/.minecraft/logs/launches/` | same | same |
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -116,11 +153,11 @@ everything is configured through TOML files. `config.toml` for paths, default me
|
|||||||
|
|
||||||
## themes
|
## themes
|
||||||
|
|
||||||
mcl ships with 10 built-in themes:
|
rmcl ships with 10 built-in themes:
|
||||||
|
|
||||||
`catppuccin` · `dracula` · `nord` · `gruvbox` · `one-dark` · `solarized` · `tailwind` · `tokyo-night` · `rose-pine` · `terminal`
|
`catppuccin` · `dracula` · `nord` · `gruvbox` · `one-dark` · `solarized` · `tailwind` · `tokyo-night` · `rose-pine` · `terminal`
|
||||||
|
|
||||||
you can create your own by dropping a TOML file in `~/.config/mcl/theme/` and referencing it by name, or point to an absolute path.
|
you can create your own by dropping a TOML file in `~/.config/rmcl/theme/` and referencing it by name, or point to an absolute path.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -136,13 +173,13 @@ GPL-3.0. see [LICENSE](LICENSE).
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[contributors-shield]: https://img.shields.io/github/contributors/objz/mcl.svg?style=for-the-badge
|
[contributors-shield]: https://img.shields.io/github/contributors/objz/rmcl.svg?style=for-the-badge
|
||||||
[contributors-url]: https://github.com/objz/mcl/graphs/contributors
|
[contributors-url]: https://github.com/objz/rmcl/graphs/contributors
|
||||||
[forks-shield]: https://img.shields.io/github/forks/objz/mcl.svg?style=for-the-badge
|
[forks-shield]: https://img.shields.io/github/forks/objz/rmcl.svg?style=for-the-badge
|
||||||
[forks-url]: https://github.com/objz/mcl/network/members
|
[forks-url]: https://github.com/objz/rmcl/network/members
|
||||||
[stars-shield]: https://img.shields.io/github/stars/objz/mcl.svg?style=for-the-badge
|
[stars-shield]: https://img.shields.io/github/stars/objz/rmcl.svg?style=for-the-badge
|
||||||
[stars-url]: https://github.com/objz/mcl/stargazers
|
[stars-url]: https://github.com/objz/rmcl/stargazers
|
||||||
[issues-shield]: https://img.shields.io/github/issues/objz/mcl.svg?style=for-the-badge
|
[issues-shield]: https://img.shields.io/github/issues/objz/rmcl.svg?style=for-the-badge
|
||||||
[issues-url]: https://github.com/objz/mcl/issues
|
[issues-url]: https://github.com/objz/rmcl/issues
|
||||||
[license-shield]: https://img.shields.io/github/license/objz/mcl.svg?style=for-the-badge
|
[license-shield]: https://img.shields.io/github/license/objz/rmcl.svg?style=for-the-badge
|
||||||
[license-url]: https://github.com/objz/mcl/blob/master/LICENSE
|
[license-url]: https://github.com/objz/rmcl/blob/master/LICENSE
|
||||||
@@ -3,12 +3,12 @@ use std::path::Path;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-changed=java/MclShim.java");
|
println!("cargo:rerun-if-changed=java/RmclShim.java");
|
||||||
|
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let out = Path::new(&out_dir);
|
let out = Path::new(&out_dir);
|
||||||
|
|
||||||
// compile MclShim.java into a jar that gets embedded via include_bytes!
|
// compile RmclShim.java into a jar that gets embedded via include_bytes!
|
||||||
let status = Command::new("javac")
|
let status = Command::new("javac")
|
||||||
.arg("-source")
|
.arg("-source")
|
||||||
.arg("8")
|
.arg("8")
|
||||||
@@ -16,23 +16,23 @@ fn main() {
|
|||||||
.arg("8")
|
.arg("8")
|
||||||
.arg("-d")
|
.arg("-d")
|
||||||
.arg(out.to_str().unwrap())
|
.arg(out.to_str().unwrap())
|
||||||
.arg("java/MclShim.java")
|
.arg("java/RmclShim.java")
|
||||||
.status()
|
.status()
|
||||||
.expect("Failed to run javac - is a JDK installed?");
|
.expect("Failed to run javac - is a JDK installed?");
|
||||||
|
|
||||||
assert!(status.success(), "javac failed to compile MclShim.java");
|
assert!(status.success(), "javac failed to compile RmclShim.java");
|
||||||
|
|
||||||
// package into a jar
|
// package into a jar
|
||||||
let jar_path = out.join("mcl-shim.jar");
|
let jar_path = out.join("rmcl-shim.jar");
|
||||||
let status = Command::new("jar")
|
let status = Command::new("jar")
|
||||||
.arg("cfe")
|
.arg("cfe")
|
||||||
.arg(jar_path.to_str().unwrap())
|
.arg(jar_path.to_str().unwrap())
|
||||||
.arg("MclShim")
|
.arg("RmclShim")
|
||||||
.arg("-C")
|
.arg("-C")
|
||||||
.arg(out.to_str().unwrap())
|
.arg(out.to_str().unwrap())
|
||||||
.arg("MclShim.class")
|
.arg("RmclShim.class")
|
||||||
.status()
|
.status()
|
||||||
.expect("Failed to run jar - is a JDK installed?");
|
.expect("Failed to run jar - is a JDK installed?");
|
||||||
|
|
||||||
assert!(status.success(), "jar failed to create mcl-shim.jar");
|
assert!(status.success(), "jar failed to create rmcl-shim.jar");
|
||||||
}
|
}
|
||||||
+4
-4
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
[remote.github]
|
[remote.github]
|
||||||
owner = "objz"
|
owner = "objz"
|
||||||
repo = "mcl"
|
repo = "rmcl"
|
||||||
|
|
||||||
[changelog]
|
[changelog]
|
||||||
# A Tera template to be rendered for each release in the changelog.
|
# A Tera template to be rendered for each release in the changelog.
|
||||||
@@ -21,14 +21,14 @@ body = """
|
|||||||
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
||||||
{% if commit.breaking %}[**breaking**] {% endif %}\
|
{% if commit.breaking %}[**breaking**] {% endif %}\
|
||||||
{{ commit.message | upper_first }}\
|
{{ commit.message | upper_first }}\
|
||||||
{% if commit.github.pr_number %} ([#{{ commit.github.pr_number }}](https://github.com/objz/mcl/pull/{{ commit.github.pr_number }})){% endif %}\
|
{% if commit.github.pr_number %} ([#{{ commit.github.pr_number }}](https://github.com/objz/rmcl/pull/{{ commit.github.pr_number }})){% endif %}\
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
|
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
|
||||||
### New Contributors
|
### New Contributors
|
||||||
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
|
||||||
- @{{ contributor.username }} made their first contribution\
|
- @{{ contributor.username }} made their first contribution\
|
||||||
{% if contributor.pr_number %} in [#{{ contributor.pr_number }}](https://github.com/objz/mcl/pull/{{ contributor.pr_number }}){% endif %}\
|
{% if contributor.pr_number %} in [#{{ contributor.pr_number }}](https://github.com/objz/rmcl/pull/{{ contributor.pr_number }}){% endif %}\
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"""
|
"""
|
||||||
@@ -60,7 +60,7 @@ split_commits = false
|
|||||||
# An array of regex based parsers to modify commit messages prior to further processing.
|
# An array of regex based parsers to modify commit messages prior to further processing.
|
||||||
commit_preprocessors = [
|
commit_preprocessors = [
|
||||||
# Replace issue numbers in commit messages with links.
|
# Replace issue numbers in commit messages with links.
|
||||||
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/objz/mcl/issues/${2}))" },
|
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/objz/rmcl/issues/${2}))" },
|
||||||
]
|
]
|
||||||
# Prevent commits that are breaking from being excluded by commit parsers.
|
# Prevent commits that are breaking from being excluded by commit parsers.
|
||||||
protect_breaking_commits = false
|
protect_breaking_commits = false
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
[workspace]
|
||||||
|
members = ["cargo:."]
|
||||||
|
|
||||||
|
# Config for 'dist'
|
||||||
|
[dist]
|
||||||
|
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
|
||||||
|
cargo-dist-version = "0.31.0"
|
||||||
|
# CI backends to support
|
||||||
|
ci = "github"
|
||||||
|
# The installers to generate for each app
|
||||||
|
installers = ["homebrew", "msi"]
|
||||||
|
# A GitHub repo to push Homebrew formulas to
|
||||||
|
tap = "objz/homebrew-tap"
|
||||||
|
# Target platforms to build apps for (Rust target-triple syntax)
|
||||||
|
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
|
||||||
|
# Path that installers should place binaries in
|
||||||
|
install-path = "CARGO_HOME"
|
||||||
|
# Publish jobs to run in CI
|
||||||
|
publish-jobs = ["homebrew", "./publish-crates", "./publish-aur", "./publish-winget", "./publish-chocolatey"]
|
||||||
|
# Custom permissions for publish jobs
|
||||||
|
github-custom-job-permissions = { publish-crates = { contents = "read" }, publish-aur = { contents = "read" }, publish-winget = { contents = "read" }, publish-chocolatey = { contents = "read" } }
|
||||||
|
# Extra setup steps for release artifact builders
|
||||||
|
github-build-setup = "../dist-build-setup.yml"
|
||||||
|
# Where to host releases
|
||||||
|
hosting = "github"
|
||||||
|
# Whether to install an updater program
|
||||||
|
install-updater = false
|
||||||
|
# Allow custom edits to the generated CI file
|
||||||
|
allow-dirty = ["ci"]
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class MclShim {
|
public class RmclShim {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
System.err.println("Usage: MclShim <mainClass> [args...]");
|
System.err.println("Usage: RmclShim <mainClass> [args...]");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>rmcl</id>
|
||||||
|
<version>0.0.0</version>
|
||||||
|
<packageSourceUrl>https://github.com/objz/rmcl</packageSourceUrl>
|
||||||
|
<owners>objz</owners>
|
||||||
|
<title>rmcl</title>
|
||||||
|
<authors>objz</authors>
|
||||||
|
<projectUrl>https://github.com/objz/rmcl</projectUrl>
|
||||||
|
<licenseUrl>https://github.com/objz/rmcl/blob/master/LICENSE</licenseUrl>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<projectSourceUrl>https://github.com/objz/rmcl</projectSourceUrl>
|
||||||
|
<docsUrl>https://github.com/objz/rmcl#readme</docsUrl>
|
||||||
|
<bugTrackerUrl>https://github.com/objz/rmcl/issues</bugTrackerUrl>
|
||||||
|
<tags>minecraft launcher cli tui rust</tags>
|
||||||
|
<summary>Minecraft launcher TUI</summary>
|
||||||
|
<description>A fully featured Minecraft launcher TUI with Microsoft account authentication, instance management, mod loaders, imports, content management, and launch support.</description>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="tools\**" target="tools" />
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
VERIFICATION
|
||||||
|
|
||||||
|
This package downloads the official MSI from the GitHub release:
|
||||||
|
|
||||||
|
https://github.com/objz/rmcl/releases/download/__TAG__/rmcl-x86_64-pc-windows-msvc.msi
|
||||||
|
|
||||||
|
The SHA256 checksum is generated by cargo-dist and published next to the release asset:
|
||||||
|
|
||||||
|
https://github.com/objz/rmcl/releases/download/__TAG__/rmcl-x86_64-pc-windows-msvc.msi.sha256
|
||||||
|
|
||||||
|
Expected SHA256:
|
||||||
|
__CHECKSUM64__
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
$packageArgs = @{
|
||||||
|
packageName = $env:ChocolateyPackageName
|
||||||
|
fileType = 'msi'
|
||||||
|
url64bit = 'https://github.com/objz/rmcl/releases/download/__TAG__/rmcl-x86_64-pc-windows-msvc.msi'
|
||||||
|
softwareName = 'rmcl*'
|
||||||
|
checksum64 = '__CHECKSUM64__'
|
||||||
|
checksumType64 = 'sha256'
|
||||||
|
silentArgs = '/quiet /norestart'
|
||||||
|
validExitCodes = @(0, 3010, 1641)
|
||||||
|
}
|
||||||
|
|
||||||
|
Install-ChocolateyPackage @packageArgs
|
||||||
@@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# Maintainer: objz <me@objz.dev>
|
|
||||||
pkgname=mcl-launcher-bin
|
|
||||||
pkgver=0.2.0
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="Minecraft launcher TUI"
|
|
||||||
arch=('x86_64' 'aarch64')
|
|
||||||
url="https://github.com/objz/mcl"
|
|
||||||
license=('GPL-3.0-only')
|
|
||||||
depends=()
|
|
||||||
provides=('mcl-launcher')
|
|
||||||
conflicts=('mcl-launcher' 'mcl-launcher-git')
|
|
||||||
source=("LICENSE-${pkgver}::${url}/raw/v${pkgver}/LICENSE" "README-${pkgver}::${url}/raw/v${pkgver}/README.md")
|
|
||||||
source_x86_64=("${url}/releases/download/v${pkgver}/mcl-x86_64-unknown-linux-gnu.tar.gz")
|
|
||||||
source_aarch64=("${url}/releases/download/v${pkgver}/mcl-aarch64-unknown-linux-gnu.tar.gz")
|
|
||||||
sha256sums=('SKIP' 'SKIP')
|
|
||||||
sha256sums_x86_64=('SKIP')
|
|
||||||
sha256sums_aarch64=('SKIP')
|
|
||||||
|
|
||||||
package() {
|
|
||||||
install -Dm755 mcl "$pkgdir/usr/bin/mcl"
|
|
||||||
install -Dm644 "LICENSE-${pkgver}" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
||||||
install -Dm644 "README-${pkgver}" "$pkgdir/usr/share/doc/$pkgname/README.md"
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
<div align="center">
|
|
||||||
|
|
||||||
# mcl
|
|
||||||
|
|
||||||
[![Contributors][contributors-shield]][contributors-url]
|
|
||||||
[![Forks][forks-shield]][forks-url]
|
|
||||||
[![Stargazers][stars-shield]][stars-url]
|
|
||||||
[![Issues][issues-shield]][issues-url]
|
|
||||||
[![GPL-3.0 License][license-shield]][license-url]
|
|
||||||
|
|
||||||
**MineCraft Launcher. or MineCraft cLi. pick whichever sounds better to you.**
|
|
||||||
|
|
||||||
<!--  -->
|
|
||||||
|
|
||||||
[Report Bug](https://github.com/objz/mcl/issues) · [Request Feature](https://github.com/objz/mcl/issues)
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## about
|
|
||||||
|
|
||||||
we all love TUIs. and we all know the official Minecraft launcher is not exactly a joy to use. so here's mcl, a fully featured Minecraft launcher that lives in your terminal. written in Rust because if you're replacing something bloated you might as well go all the way.
|
|
||||||
|
|
||||||
it does everything you'd expect from a launcher. multiple instances, mod loaders, modpack imports, Microsoft auth, content management, launching. all from a TUI or from the command line. the TUI is the main thing though, the CLI is there for scripting and automation.
|
|
||||||
|
|
||||||
## features
|
|
||||||
|
|
||||||
| | |
|
|
||||||
|---|---|
|
|
||||||
| **instances** | create and manage multiple instances, each with their own version, loader, mods, and settings |
|
|
||||||
| **mod loaders** | vanilla, Fabric, Quilt, Forge, NeoForge. more might show up later |
|
|
||||||
| **content** | browse and toggle mods, shaders, resource packs. view worlds, screenshots, and logs |
|
|
||||||
| **modpack import** | import from Modrinth via `.mrpack` file, URL, or slug |
|
|
||||||
| **accounts** | multiple Microsoft accounts and offline players, switch between them |
|
|
||||||
| **launching** | launch directly from the TUI or generate a desktop shortcut for any instance |
|
|
||||||
| **desktop shortcuts** | click it and Minecraft starts, no need to open mcl or type anything |
|
|
||||||
| **CLI** | every feature the TUI has is also available as a subcommand |
|
|
||||||
| **theming** | 10 built-in themes, custom themes, color overrides |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## installation
|
|
||||||
|
|
||||||
### Arch Linux
|
|
||||||
|
|
||||||
[](https://aur.archlinux.org/packages/mcl-launcher)
|
|
||||||
[](https://aur.archlinux.org/packages/mcl-launcher-bin)
|
|
||||||
[](https://aur.archlinux.org/packages/mcl-launcher-git)
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# from source (release tarball)
|
|
||||||
paru -S mcl-launcher
|
|
||||||
|
|
||||||
# prebuilt binary
|
|
||||||
paru -S mcl-launcher-bin
|
|
||||||
|
|
||||||
# latest git
|
|
||||||
paru -S mcl-launcher-git
|
|
||||||
```
|
|
||||||
|
|
||||||
### from source
|
|
||||||
|
|
||||||
requires a Rust toolchain and OpenSSL.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/objz/mcl.git
|
|
||||||
cd mcl
|
|
||||||
cargo build --release
|
|
||||||
```
|
|
||||||
|
|
||||||
### other platforms
|
|
||||||
|
|
||||||
mcl can be compiled for Linux, macOS, and Windows. right now it's only packaged for Arch Linux (AUR) but official packages for other platforms and package managers will be added continuously.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## where things live
|
|
||||||
|
|
||||||
| path | what |
|
|
||||||
|---|---|
|
|
||||||
| `~/.config/mcl/config.toml` | general config (paths, memory defaults, UI settings) |
|
|
||||||
| `~/.config/mcl/theme.toml` | theme, border style, color overrides |
|
|
||||||
| `~/.config/mcl/accounts.json` | accounts |
|
|
||||||
| `~/.local/share/mcl/instances/` | instances, each in its own directory |
|
|
||||||
| `~/.local/share/mcl/meta/` | cached game metadata, libraries, assets, loader profiles |
|
|
||||||
|
|
||||||
each instance has an `instance.json` for its config and a `.minecraft/` directory with the actual game files. standard layout, nothing weird.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## configuration
|
|
||||||
|
|
||||||
everything is configured through TOML files. `config.toml` for paths, default memory allocation, and UI behavior. `theme.toml` for theme selection and border style. you can also override individual colors without making a full custom theme.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## themes
|
|
||||||
|
|
||||||
mcl ships with 10 built-in themes:
|
|
||||||
|
|
||||||
`catppuccin` · `dracula` · `nord` · `gruvbox` · `one-dark` · `solarized` · `tailwind` · `tokyo-night` · `rose-pine` · `terminal`
|
|
||||||
|
|
||||||
you can create your own by dropping a TOML file in `~/.config/mcl/theme/` and referencing it by name, or point to an absolute path.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## contributing
|
|
||||||
|
|
||||||
contributions are welcome. fork it, branch it, PR it. make sure `cargo clippy` and `cargo test` pass before opening a PR.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## license
|
|
||||||
|
|
||||||
GPL-3.0. see [LICENSE](LICENSE).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
[contributors-shield]: https://img.shields.io/github/contributors/objz/mcl.svg?style=for-the-badge
|
|
||||||
[contributors-url]: https://github.com/objz/mcl/graphs/contributors
|
|
||||||
[forks-shield]: https://img.shields.io/github/forks/objz/mcl.svg?style=for-the-badge
|
|
||||||
[forks-url]: https://github.com/objz/mcl/network/members
|
|
||||||
[stars-shield]: https://img.shields.io/github/stars/objz/mcl.svg?style=for-the-badge
|
|
||||||
[stars-url]: https://github.com/objz/mcl/stargazers
|
|
||||||
[issues-shield]: https://img.shields.io/github/issues/objz/mcl.svg?style=for-the-badge
|
|
||||||
[issues-url]: https://github.com/objz/mcl/issues
|
|
||||||
[license-shield]: https://img.shields.io/github/license/objz/mcl.svg?style=for-the-badge
|
|
||||||
[license-url]: https://github.com/objz/mcl/blob/master/LICENSE
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,25 @@
|
|||||||
|
# Maintainer: objz <me@objz.dev>
|
||||||
|
pkgname=rmcl-bin
|
||||||
|
pkgver=0.3.0
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Minecraft launcher TUI"
|
||||||
|
arch=('x86_64' 'aarch64')
|
||||||
|
url="https://github.com/objz/rmcl"
|
||||||
|
license=('GPL-3.0-only')
|
||||||
|
depends=()
|
||||||
|
provides=('rmcl')
|
||||||
|
conflicts=('rmcl' 'rmcl-git' 'mcl-launcher' 'mcl-launcher-bin' 'mcl-launcher-git')
|
||||||
|
replaces=('mcl-launcher' 'mcl-launcher-bin' 'mcl-launcher-git')
|
||||||
|
source=("LICENSE-${pkgver}::${url}/raw/v${pkgver}/LICENSE" "README-${pkgver}::${url}/raw/v${pkgver}/README.md")
|
||||||
|
source_x86_64=("rmcl-${pkgver}-x86_64-unknown-linux-gnu.tar.xz::${url}/releases/download/v${pkgver}/rmcl-x86_64-unknown-linux-gnu.tar.xz")
|
||||||
|
source_aarch64=("rmcl-${pkgver}-aarch64-unknown-linux-gnu.tar.xz::${url}/releases/download/v${pkgver}/rmcl-aarch64-unknown-linux-gnu.tar.xz")
|
||||||
|
sha256sums=('SKIP' 'SKIP')
|
||||||
|
sha256sums_x86_64=('SKIP')
|
||||||
|
sha256sums_aarch64=('SKIP')
|
||||||
|
|
||||||
|
package() {
|
||||||
|
local _dir="rmcl-${CARCH}-unknown-linux-gnu"
|
||||||
|
install -Dm755 "$_dir/rmcl" "$pkgdir/usr/bin/rmcl"
|
||||||
|
install -Dm644 "LICENSE-${pkgver}" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||||
|
install -Dm644 "README-${pkgver}" "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||||
|
}
|
||||||
@@ -1,36 +1,37 @@
|
|||||||
# Maintainer: objz <me@objz.dev>
|
# Maintainer: objz <me@objz.dev>
|
||||||
pkgname=mcl-launcher-git
|
pkgname=rmcl-git
|
||||||
pkgver=r116.ab9d9dd
|
pkgver=r116.ab9d9dd
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Minecraft launcher TUI"
|
pkgdesc="Minecraft launcher TUI"
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url="https://github.com/objz/mcl"
|
url="https://github.com/objz/rmcl"
|
||||||
license=('GPL-3.0-only')
|
license=('GPL-3.0-only')
|
||||||
depends=()
|
depends=()
|
||||||
makedepends=('git' 'rust' 'cargo')
|
makedepends=('git' 'rust' 'cargo' 'jdk-openjdk')
|
||||||
provides=('mcl-launcher')
|
provides=('rmcl')
|
||||||
conflicts=('mcl-launcher' 'mcl-launcher-bin')
|
conflicts=('rmcl' 'rmcl-bin' 'mcl-launcher' 'mcl-launcher-bin' 'mcl-launcher-git')
|
||||||
|
replaces=('mcl-launcher' 'mcl-launcher-bin' 'mcl-launcher-git')
|
||||||
source=("git+$url.git")
|
source=("git+$url.git")
|
||||||
sha256sums=('SKIP')
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
pkgver() {
|
pkgver() {
|
||||||
cd "$srcdir/mcl"
|
cd "$srcdir/rmcl"
|
||||||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir/mcl"
|
cd "$srcdir/rmcl"
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
cd "$srcdir/mcl"
|
cd "$srcdir/rmcl"
|
||||||
cargo test --release --locked
|
cargo test --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/mcl"
|
cd "$srcdir/rmcl"
|
||||||
install -Dm755 "target/release/mcl" "$pkgdir/usr/bin/mcl"
|
install -Dm755 "target/release/rmcl" "$pkgdir/usr/bin/rmcl"
|
||||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,32 @@
|
|||||||
# Maintainer: objz <me@objz.dev>
|
# Maintainer: objz <me@objz.dev>
|
||||||
pkgname=mcl-launcher
|
pkgname=rmcl
|
||||||
pkgver=0.1.0
|
pkgver=0.3.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Minecraft launcher TUI"
|
pkgdesc="Minecraft launcher TUI"
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url="https://github.com/objz/mcl"
|
url="https://github.com/objz/rmcl"
|
||||||
license=('GPL-3.0-only')
|
license=('GPL-3.0-only')
|
||||||
depends=()
|
depends=()
|
||||||
makedepends=('rust' 'cargo')
|
makedepends=('rust' 'cargo' 'jdk-openjdk')
|
||||||
provides=('mcl-launcher')
|
provides=('rmcl')
|
||||||
conflicts=('mcl-launcher-bin' 'mcl-launcher-git')
|
conflicts=('rmcl-bin' 'rmcl-git' 'mcl-launcher' 'mcl-launcher-bin' 'mcl-launcher-git')
|
||||||
|
replaces=('mcl-launcher' 'mcl-launcher-bin' 'mcl-launcher-git')
|
||||||
source=("${url}/archive/v${pkgver}.tar.gz")
|
source=("${url}/archive/v${pkgver}.tar.gz")
|
||||||
sha256sums=('SKIP')
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$srcdir/mcl-${pkgver}"
|
cd "$srcdir/rmcl-${pkgver}"
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
cd "$srcdir/mcl-${pkgver}"
|
cd "$srcdir/rmcl-${pkgver}"
|
||||||
cargo test --release --locked
|
cargo test --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/mcl-${pkgver}"
|
cd "$srcdir/rmcl-${pkgver}"
|
||||||
install -Dm755 "target/release/mcl" "$pkgdir/usr/bin/mcl"
|
install -Dm755 "target/release/rmcl" "$pkgdir/usr/bin/rmcl"
|
||||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||||
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,12 @@ impl AccountStore {
|
|||||||
self.accounts.iter().find(|a| a.active)
|
self.accounts.iter().find(|a| a.active)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn has_microsoft_account(&self) -> bool {
|
||||||
|
self.accounts
|
||||||
|
.iter()
|
||||||
|
.any(|account| account.account_type == AccountType::Microsoft)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_active(&mut self, index: usize) {
|
pub fn set_active(&mut self, index: usize) {
|
||||||
for (i, acc) in self.accounts.iter_mut().enumerate() {
|
for (i, acc) in self.accounts.iter_mut().enumerate() {
|
||||||
acc.active = i == index;
|
acc.active = i == index;
|
||||||
@@ -194,6 +200,18 @@ mod tests {
|
|||||||
create_offline_account(name)
|
create_offline_account(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn microsoft_account(name: &str) -> Account {
|
||||||
|
Account {
|
||||||
|
uuid: format!("00000000-0000-0000-0000-{:012}", name.len()),
|
||||||
|
username: name.to_owned(),
|
||||||
|
account_type: AccountType::Microsoft,
|
||||||
|
active: false,
|
||||||
|
refresh_token: Some("refresh".to_owned()),
|
||||||
|
cached_mc_token: None,
|
||||||
|
cached_mc_token_expires_at: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn store_add_first_becomes_active() {
|
fn store_add_first_becomes_active() {
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
@@ -234,6 +252,17 @@ mod tests {
|
|||||||
assert!(store.active_account().is_none());
|
assert!(store.active_account().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn store_has_microsoft_account_when_one_exists() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let mut store = make_store(tmp.path());
|
||||||
|
store.add(dummy_account("Offline"));
|
||||||
|
assert!(!store.has_microsoft_account());
|
||||||
|
|
||||||
|
store.add(microsoft_account("Owner"));
|
||||||
|
assert!(store.has_microsoft_account());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn store_active_account_returns_active() {
|
fn store_active_account_returns_active() {
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@ mod accounts;
|
|||||||
mod oauth;
|
mod oauth;
|
||||||
|
|
||||||
pub use accounts::{
|
pub use accounts::{
|
||||||
account_store_path, create_offline_account, offline_uuid, Account, AccountStore, AccountType,
|
Account, AccountStore, AccountType, AuthResult, account_store_path, create_offline_account,
|
||||||
AuthResult,
|
offline_uuid,
|
||||||
};
|
};
|
||||||
pub use oauth::{refresh_and_get_token, start_microsoft_auth, DeviceCodeInfo, DEVICE_CODE_DISPLAY};
|
pub use oauth::{DEVICE_CODE_DISPLAY, DeviceCodeInfo, refresh_and_get_token, start_microsoft_auth};
|
||||||
+61
-28
@@ -21,13 +21,13 @@ pub async fn handle_account(matches: &ArgMatches) -> CliResult {
|
|||||||
|
|
||||||
// trait indirection so a mock store can be swapped in for tests
|
// trait indirection so a mock store can be swapped in for tests
|
||||||
trait AccountStoreLike {
|
trait AccountStoreLike {
|
||||||
fn accounts(&self) -> &[Account];
|
fn has_microsoft_account(&self) -> bool;
|
||||||
fn add_account(&mut self, account: Account);
|
fn add_account(&mut self, account: Account);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccountStoreLike for AccountStore {
|
impl AccountStoreLike for AccountStore {
|
||||||
fn accounts(&self) -> &[Account] {
|
fn has_microsoft_account(&self) -> bool {
|
||||||
&self.accounts
|
AccountStore::has_microsoft_account(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_account(&mut self, account: Account) {
|
fn add_account(&mut self, account: Account) {
|
||||||
@@ -81,28 +81,30 @@ async fn add_microsoft_account() -> CliResult {
|
|||||||
// wait for the device code to become available before showing it
|
// wait for the device code to become available before showing it
|
||||||
loop {
|
loop {
|
||||||
if let Ok(slot) = crate::auth::DEVICE_CODE_DISPLAY.lock()
|
if let Ok(slot) = crate::auth::DEVICE_CODE_DISPLAY.lock()
|
||||||
&& let Some(info) = slot.as_ref() {
|
&& let Some(info) = slot.as_ref()
|
||||||
println!("Open: {}", info.verification_uri);
|
{
|
||||||
println!("Code: {}", info.user_code);
|
println!("Open: {}", info.verification_uri);
|
||||||
break;
|
println!("Code: {}", info.user_code);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
tokio::time::sleep(Duration::from_millis(200)).await;
|
tokio::time::sleep(Duration::from_millis(200)).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now wait for the user to complete auth in their browser
|
// now wait for the user to complete auth in their browser
|
||||||
loop {
|
loop {
|
||||||
if let Ok(slot) = result_arc.lock()
|
if let Ok(slot) = result_arc.lock()
|
||||||
&& let Some(result) = slot.as_ref() {
|
&& let Some(result) = slot.as_ref()
|
||||||
return match result {
|
{
|
||||||
AuthResult::Success(account) => {
|
return match result {
|
||||||
let mut store = AccountStore::load();
|
AuthResult::Success(account) => {
|
||||||
store.add(account.clone());
|
let mut store = AccountStore::load();
|
||||||
println!("Added Microsoft account '{}'.", account.username);
|
store.add(account.clone());
|
||||||
Ok(())
|
println!("Added Microsoft account '{}'.", account.username);
|
||||||
}
|
Ok(())
|
||||||
AuthResult::Error(message) => Err(io::Error::other(message.clone()).into()),
|
}
|
||||||
};
|
AuthResult::Error(message) => Err(io::Error::other(message.clone()).into()),
|
||||||
}
|
};
|
||||||
|
}
|
||||||
tokio::time::sleep(Duration::from_millis(500)).await;
|
tokio::time::sleep(Duration::from_millis(500)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,6 +114,12 @@ fn add_offline_account<T: AccountStoreLike>(store: &mut T, username: &str) -> Cl
|
|||||||
if username.is_empty() {
|
if username.is_empty() {
|
||||||
return Err(io::Error::other("offline username cannot be empty").into());
|
return Err(io::Error::other("offline username cannot be empty").into());
|
||||||
}
|
}
|
||||||
|
if !store.has_microsoft_account() {
|
||||||
|
return Err(io::Error::other(
|
||||||
|
"add a Microsoft account that owns Minecraft before adding offline accounts",
|
||||||
|
)
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
|
||||||
store.add_account(crate::auth::create_offline_account(username));
|
store.add_account(crate::auth::create_offline_account(username));
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -120,7 +128,7 @@ fn add_offline_account<T: AccountStoreLike>(store: &mut T, username: &str) -> Cl
|
|||||||
fn delete_account(matches: &ArgMatches) -> CliResult {
|
fn delete_account(matches: &ArgMatches) -> CliResult {
|
||||||
let username = required_arg(matches, "username")?;
|
let username = required_arg(matches, "username")?;
|
||||||
let mut store = AccountStore::load();
|
let mut store = AccountStore::load();
|
||||||
let index = find_account_index(store.accounts(), username)
|
let index = find_account_index(&store.accounts, username)
|
||||||
.ok_or_else(|| io::Error::other(format!("account '{}' not found", username)))?;
|
.ok_or_else(|| io::Error::other(format!("account '{}' not found", username)))?;
|
||||||
|
|
||||||
if !matches.get_flag("yes") && !confirm(&format!("Delete '{}'", username))? {
|
if !matches.get_flag("yes") && !confirm(&format!("Delete '{}'", username))? {
|
||||||
@@ -136,7 +144,7 @@ fn delete_account(matches: &ArgMatches) -> CliResult {
|
|||||||
fn use_account(matches: &ArgMatches) -> CliResult {
|
fn use_account(matches: &ArgMatches) -> CliResult {
|
||||||
let username = required_arg(matches, "username")?;
|
let username = required_arg(matches, "username")?;
|
||||||
let mut store = AccountStore::load();
|
let mut store = AccountStore::load();
|
||||||
let index = find_account_index(store.accounts(), username)
|
let index = find_account_index(&store.accounts, username)
|
||||||
.ok_or_else(|| io::Error::other(format!("account '{}' not found", username)))?;
|
.ok_or_else(|| io::Error::other(format!("account '{}' not found", username)))?;
|
||||||
store.set_active(index);
|
store.set_active(index);
|
||||||
println!("Active account set to '{}'.", username);
|
println!("Active account set to '{}'.", username);
|
||||||
@@ -153,7 +161,7 @@ use super::utils::{confirm, required_arg};
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{add_offline_account, AccountStoreLike};
|
use super::{AccountStoreLike, add_offline_account};
|
||||||
use crate::auth::{Account, AccountType};
|
use crate::auth::{Account, AccountType};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@@ -162,8 +170,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AccountStoreLike for MockStore {
|
impl AccountStoreLike for MockStore {
|
||||||
fn accounts(&self) -> &[Account] {
|
fn has_microsoft_account(&self) -> bool {
|
||||||
&self.accounts
|
self.accounts
|
||||||
|
.iter()
|
||||||
|
.any(|account| account.account_type == AccountType::Microsoft)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_account(&mut self, account: Account) {
|
fn add_account(&mut self, account: Account) {
|
||||||
@@ -171,14 +181,37 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn microsoft_account() -> Account {
|
||||||
|
Account {
|
||||||
|
uuid: "00000000-0000-0000-0000-000000000001".to_owned(),
|
||||||
|
username: "Owner".to_owned(),
|
||||||
|
account_type: AccountType::Microsoft,
|
||||||
|
active: false,
|
||||||
|
refresh_token: Some("refresh".to_owned()),
|
||||||
|
cached_mc_token: None,
|
||||||
|
cached_mc_token_expires_at: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn creates_offline_account_through_store() {
|
fn creates_offline_account_after_microsoft_account_exists() {
|
||||||
let mut store = MockStore::default();
|
let mut store = MockStore::default();
|
||||||
|
store.add_account(microsoft_account());
|
||||||
add_offline_account(&mut store, "Steve").expect("offline account should be added");
|
add_offline_account(&mut store, "Steve").expect("offline account should be added");
|
||||||
|
|
||||||
assert_eq!(store.accounts.len(), 1);
|
assert_eq!(store.accounts.len(), 2);
|
||||||
assert_eq!(store.accounts[0].username, "Steve");
|
assert_eq!(store.accounts[1].username, "Steve");
|
||||||
assert_eq!(store.accounts[0].account_type, AccountType::Offline);
|
assert_eq!(store.accounts[1].account_type, AccountType::Offline);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rejects_offline_account_before_microsoft_account_exists() {
|
||||||
|
let mut store = MockStore::default();
|
||||||
|
let err = add_offline_account(&mut store, "Steve")
|
||||||
|
.expect_err("offline account should require a microsoft account");
|
||||||
|
|
||||||
|
assert!(err.to_string().contains("Microsoft account"));
|
||||||
|
assert!(store.accounts.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+1
-1
@@ -2,8 +2,8 @@
|
|||||||
// resolves the input, downloads if needed, then hands off to the import engine.
|
// resolves the input, downloads if needed, then hands off to the import engine.
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
|
|
||||||
use crate::instance::import::{parse_import_input, ImportInput};
|
|
||||||
use crate::instance::InstanceManager;
|
use crate::instance::InstanceManager;
|
||||||
|
use crate::instance::import::{ImportInput, parse_import_input};
|
||||||
use crate::net::modrinth;
|
use crate::net::modrinth;
|
||||||
|
|
||||||
type CliResult = Result<(), Box<dyn std::error::Error>>;
|
type CliResult = Result<(), Box<dyn std::error::Error>>;
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ fn manager() -> InstanceManager {
|
|||||||
|
|
||||||
fn list_instances() -> CliResult {
|
fn list_instances() -> CliResult {
|
||||||
let mut instances = manager().load_all();
|
let mut instances = manager().load_all();
|
||||||
instances.sort_by(|left, right| left.name.to_lowercase().cmp(&right.name.to_lowercase()));
|
instances.sort_by_key(|instance| instance.name.to_lowercase());
|
||||||
|
|
||||||
let rows = instances
|
let rows = instances
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ mod tests {
|
|||||||
|
|
||||||
fn unique_temp_dir() -> std::path::PathBuf {
|
fn unique_temp_dir() -> std::path::PathBuf {
|
||||||
std::env::temp_dir().join(format!(
|
std::env::temp_dir().join(format!(
|
||||||
"mcl_cli_log_test_{}",
|
"rmcl_cli_log_test_{}",
|
||||||
std::time::SystemTime::now()
|
std::time::SystemTime::now()
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
.duration_since(std::time::UNIX_EPOCH)
|
||||||
.expect("time should work")
|
.expect("time should work")
|
||||||
|
|||||||
+3
-3
@@ -14,7 +14,7 @@ use clap::{Arg, ArgAction, ArgGroup, Command};
|
|||||||
pub async fn init() {
|
pub async fn init() {
|
||||||
let matches = build_command().get_matches();
|
let matches = build_command().get_matches();
|
||||||
|
|
||||||
// no subcommand means the user just ran `mcl` bare, so fall through to TUI mode
|
// no subcommand means the user just ran `rmcl` bare, so fall through to TUI mode
|
||||||
if matches.subcommand().is_none() {
|
if matches.subcommand().is_none() {
|
||||||
// force-init the theme so it's ready before the TUI renders
|
// force-init the theme so it's ready before the TUI renders
|
||||||
let _ = &*crate::config::theme::THEME;
|
let _ = &*crate::config::theme::THEME;
|
||||||
@@ -43,7 +43,7 @@ pub async fn init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn build_command() -> Command {
|
fn build_command() -> Command {
|
||||||
Command::new("mcl")
|
Command::new("rmcl")
|
||||||
.about("Minecraft CLI Launcher")
|
.about("Minecraft CLI Launcher")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.subcommand_required(false)
|
.subcommand_required(false)
|
||||||
@@ -245,7 +245,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn parses_instance_list_subcommand() {
|
fn parses_instance_list_subcommand() {
|
||||||
let matches = build_command()
|
let matches = build_command()
|
||||||
.try_get_matches_from(["mcl", "instance", "list"])
|
.try_get_matches_from(["rmcl", "instance", "list"])
|
||||||
.expect("command should parse");
|
.expect("command should parse");
|
||||||
assert!(matches.subcommand_matches("instance").is_some());
|
assert!(matches.subcommand_matches("instance").is_some());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-5
@@ -34,11 +34,7 @@ pub fn format_datetime(value: &DateTime<Utc>) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn active_marker(active: bool) -> &'static str {
|
pub fn active_marker(active: bool) -> &'static str {
|
||||||
if active {
|
if active { ">" } else { " " }
|
||||||
">"
|
|
||||||
} else {
|
|
||||||
" "
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the widest value in each column to pad everything evenly
|
// find the widest value in each column to pad everything evenly
|
||||||
|
|||||||
+1
-1
@@ -9,8 +9,8 @@ use clap::ArgMatches;
|
|||||||
use crate::cli::instance::parse_loader;
|
use crate::cli::instance::parse_loader;
|
||||||
use crate::cli::output::print_table;
|
use crate::cli::output::print_table;
|
||||||
use crate::instance::ModLoader;
|
use crate::instance::ModLoader;
|
||||||
use crate::net::mojang::{VersionEntry, VersionManifest};
|
|
||||||
use crate::net::HttpClient;
|
use crate::net::HttpClient;
|
||||||
|
use crate::net::mojang::{VersionEntry, VersionManifest};
|
||||||
|
|
||||||
type CliResult = Result<(), Box<dyn std::error::Error>>;
|
type CliResult = Result<(), Box<dyn std::error::Error>>;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ pub use settings::Config;
|
|||||||
pub fn get_config_path() -> PathBuf {
|
pub fn get_config_path() -> PathBuf {
|
||||||
dirs_next::config_dir()
|
dirs_next::config_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join("mcl")
|
.join("rmcl")
|
||||||
}
|
}
|
||||||
|
|
||||||
// seeds the config file from the bundled default on first run
|
// seeds the config file from the bundled default on first run
|
||||||
|
|||||||
+13
-12
@@ -21,7 +21,7 @@ pub struct Paths {
|
|||||||
fn default_instances_dir() -> String {
|
fn default_instances_dir() -> String {
|
||||||
dirs_next::data_dir()
|
dirs_next::data_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join("mcl")
|
.join("rmcl")
|
||||||
.join("instances")
|
.join("instances")
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.into_owned()
|
.into_owned()
|
||||||
@@ -30,7 +30,7 @@ fn default_instances_dir() -> String {
|
|||||||
fn default_meta_dir() -> String {
|
fn default_meta_dir() -> String {
|
||||||
dirs_next::data_dir()
|
dirs_next::data_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("."))
|
.unwrap_or_else(|| PathBuf::from("."))
|
||||||
.join("mcl")
|
.join("rmcl")
|
||||||
.join("meta")
|
.join("meta")
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.into_owned()
|
.into_owned()
|
||||||
@@ -53,9 +53,10 @@ pub fn resolve_path(raw: &str) -> PathBuf {
|
|||||||
return home.join(stripped);
|
return home.join(stripped);
|
||||||
}
|
}
|
||||||
} else if raw == "~"
|
} else if raw == "~"
|
||||||
&& let Some(home) = dirs_next::home_dir() {
|
&& let Some(home) = dirs_next::home_dir()
|
||||||
return home;
|
{
|
||||||
}
|
return home;
|
||||||
|
}
|
||||||
PathBuf::from(raw)
|
PathBuf::from(raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,14 +181,14 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_path_absolute() {
|
fn resolve_path_absolute() {
|
||||||
assert_eq!(resolve_path("/opt/mcl"), PathBuf::from("/opt/mcl"));
|
assert_eq!(resolve_path("/opt/rmcl"), PathBuf::from("/opt/rmcl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_path_tilde_prefix() {
|
fn resolve_path_tilde_prefix() {
|
||||||
let resolved = resolve_path("~/games/mcl");
|
let resolved = resolve_path("~/games/rmcl");
|
||||||
assert!(!resolved.to_string_lossy().starts_with('~'));
|
assert!(!resolved.to_string_lossy().starts_with('~'));
|
||||||
assert!(resolved.to_string_lossy().ends_with("games/mcl"));
|
assert!(resolved.to_string_lossy().ends_with("games/rmcl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -199,22 +200,22 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn resolve_instances_dir_absolute() {
|
fn resolve_instances_dir_absolute() {
|
||||||
let paths = Paths {
|
let paths = Paths {
|
||||||
instances_dir: "/opt/mcl/instances".to_owned(),
|
instances_dir: "/opt/rmcl/instances".to_owned(),
|
||||||
..Paths::default()
|
..Paths::default()
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
paths.resolve_instances_dir(),
|
paths.resolve_instances_dir(),
|
||||||
PathBuf::from("/opt/mcl/instances")
|
PathBuf::from("/opt/rmcl/instances")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn resolve_meta_dir_absolute() {
|
fn resolve_meta_dir_absolute() {
|
||||||
let paths = Paths {
|
let paths = Paths {
|
||||||
meta_dir: "/opt/mcl/meta".to_owned(),
|
meta_dir: "/opt/rmcl/meta".to_owned(),
|
||||||
..Paths::default()
|
..Paths::default()
|
||||||
};
|
};
|
||||||
assert_eq!(paths.resolve_meta_dir(), PathBuf::from("/opt/mcl/meta"));
|
assert_eq!(paths.resolve_meta_dir(), PathBuf::from("/opt/rmcl/meta"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ pub mod shaders;
|
|||||||
pub mod worlds;
|
pub mod worlds;
|
||||||
|
|
||||||
pub use mods::{ContentEntry, scan_mods, toggle_entry};
|
pub use mods::{ContentEntry, scan_mods, toggle_entry};
|
||||||
pub use resource_packs::scan_resource_packs;
|
pub use mods::scan_one_mod;
|
||||||
pub use shaders::scan_shaders;
|
pub use resource_packs::{scan_resource_packs, scan_one_resource_pack};
|
||||||
pub use worlds::scan_worlds;
|
pub use shaders::{scan_shaders, scan_one_shader};
|
||||||
|
pub use worlds::{scan_worlds, scan_one_world};
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
|
||||||
|
|||||||
+371
-43
@@ -1,6 +1,8 @@
|
|||||||
// mod scanning, metadata extraction, and icon rendering for the content list.
|
// mod scanning, metadata extraction, and icon rendering for the content list.
|
||||||
// jar files are just zips, so it cracks them open looking for fabric.mod.json to get
|
// jar files are just zips, so it cracks them open looking for loader-specific
|
||||||
// names, descriptions, and icons. if that fails, just the filename is used. it's fine.
|
// metadata (fabric.mod.json, quilt.mod.json, mods.toml, mcmod.info) to get
|
||||||
|
// names, descriptions, and icons. if none of those work, falls back to common
|
||||||
|
// root-level icon paths (logo.png, icon.png, pack.png) or just the filename.
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
@@ -41,18 +43,75 @@ struct FabricModJson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FabricModJson {
|
impl FabricModJson {
|
||||||
// fabric's icon field can be a string path or a map of resolution -> path.
|
|
||||||
// if it's a map, just grab the first one. good enough.
|
|
||||||
fn icon_path(&self) -> String {
|
fn icon_path(&self) -> String {
|
||||||
match &self.icon {
|
icon_path_from_value(&self.icon)
|
||||||
serde_json::Value::String(s) => s.clone(),
|
}
|
||||||
serde_json::Value::Object(map) => map
|
}
|
||||||
.values()
|
|
||||||
.find_map(|v| v.as_str())
|
// fabric and quilt both support icon as a string path or a map of
|
||||||
.unwrap_or("")
|
// resolution -> path. if it's a map, just grab the first one.
|
||||||
.to_owned(),
|
fn icon_path_from_value(value: &serde_json::Value) -> String {
|
||||||
_ => String::new(),
|
match value {
|
||||||
}
|
serde_json::Value::String(s) => s.clone(),
|
||||||
|
serde_json::Value::Object(map) => map
|
||||||
|
.values()
|
||||||
|
.find_map(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned(),
|
||||||
|
_ => String::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// quilt puts its metadata under a "metadata" sub-object
|
||||||
|
#[derive(Deserialize, Default)]
|
||||||
|
struct QuiltModJson {
|
||||||
|
#[serde(default)]
|
||||||
|
quilt_loader: QuiltLoader,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Default)]
|
||||||
|
struct QuiltLoader {
|
||||||
|
#[serde(default)]
|
||||||
|
metadata: QuiltMetadata,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Default)]
|
||||||
|
struct QuiltMetadata {
|
||||||
|
#[serde(default)]
|
||||||
|
name: String,
|
||||||
|
#[serde(default)]
|
||||||
|
description: String,
|
||||||
|
#[serde(default)]
|
||||||
|
icon: serde_json::Value,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl QuiltMetadata {
|
||||||
|
fn icon_path(&self) -> String {
|
||||||
|
icon_path_from_value(&self.icon)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn scan_one_mod(path: &Path, file_stem: &str, enabled: bool) -> ContentEntry {
|
||||||
|
let (name, description, icon_bytes) = read_mod_metadata(path);
|
||||||
|
let icon_lines = icon_bytes
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|bytes| make_icon_pixels(bytes, 6, 3))
|
||||||
|
.or_else(|| Some(fallback_icon()));
|
||||||
|
|
||||||
|
let display_name = if name.is_empty() {
|
||||||
|
file_stem.to_owned()
|
||||||
|
} else {
|
||||||
|
name
|
||||||
|
};
|
||||||
|
|
||||||
|
ContentEntry {
|
||||||
|
file_stem: file_stem.to_owned(),
|
||||||
|
name: display_name,
|
||||||
|
description,
|
||||||
|
enabled,
|
||||||
|
icon_bytes,
|
||||||
|
path: path.to_path_buf(),
|
||||||
|
icon_lines,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,34 +139,17 @@ pub fn scan_mods(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry>
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let (name, description, icon_bytes) = read_mod_metadata(&path);
|
entries.push(scan_one_mod(&path, &file_stem, enabled));
|
||||||
let icon_lines = icon_bytes
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|bytes| make_icon_pixels(bytes, 6, 3))
|
|
||||||
.or_else(|| Some(fallback_icon()));
|
|
||||||
|
|
||||||
let display_name = if name.is_empty() {
|
|
||||||
file_stem.clone()
|
|
||||||
} else {
|
|
||||||
name
|
|
||||||
};
|
|
||||||
entries.push(ContentEntry {
|
|
||||||
file_stem,
|
|
||||||
name: display_name,
|
|
||||||
description,
|
|
||||||
enabled,
|
|
||||||
icon_bytes,
|
|
||||||
path,
|
|
||||||
icon_lines,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
||||||
entries
|
entries
|
||||||
}
|
}
|
||||||
|
|
||||||
// tries fabric.mod.json first for rich metadata. if that's missing (forge/other mods),
|
// tries each loader's metadata file to extract name, description, and icon.
|
||||||
// still attempts to grab pack.png as a last resort for an icon
|
// checks fabric.mod.json, quilt.mod.json, META-INF/mods.toml (forge),
|
||||||
|
// META-INF/neoforge.mods.toml, and mcmod.info (legacy forge). if none of
|
||||||
|
// those yield an icon, falls back to common root-level paths.
|
||||||
fn read_mod_metadata(jar_path: &Path) -> (String, String, Option<Vec<u8>>) {
|
fn read_mod_metadata(jar_path: &Path) -> (String, String, Option<Vec<u8>>) {
|
||||||
let file = match std::fs::File::open(jar_path) {
|
let file = match std::fs::File::open(jar_path) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
@@ -119,19 +161,43 @@ fn read_mod_metadata(jar_path: &Path) -> (String, String, Option<Vec<u8>>) {
|
|||||||
Err(_) => return (String::new(), String::new(), None),
|
Err(_) => return (String::new(), String::new(), None),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some((name, description, icon_path)) = read_fabric_meta(&mut archive) {
|
// try each loader's metadata in order. if we get metadata but the
|
||||||
let icon_bytes = if icon_path.is_empty() {
|
// declared icon path is missing, fall back to common root-level icons.
|
||||||
None
|
type MetaReader = fn(&mut zip::ZipArchive<std::fs::File>) -> Option<(String, String, String)>;
|
||||||
} else {
|
let readers: [MetaReader; 4] = [
|
||||||
read_zip_bytes(&mut archive, &icon_path)
|
read_fabric_meta,
|
||||||
};
|
read_quilt_meta,
|
||||||
return (name, description, icon_bytes);
|
read_forge_toml_meta,
|
||||||
|
read_mcmod_info,
|
||||||
|
];
|
||||||
|
|
||||||
|
for reader in &readers {
|
||||||
|
if let Some((name, description, icon_path)) = reader(&mut archive) {
|
||||||
|
let icon_path = icon_path.trim_start_matches('/');
|
||||||
|
let icon = if icon_path.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
read_zip_bytes(&mut archive, icon_path)
|
||||||
|
}
|
||||||
|
.or_else(|| try_fallback_icons(&mut archive));
|
||||||
|
return (name, description, icon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let icon_bytes = read_zip_bytes(&mut archive, "pack.png");
|
// no recognized metadata at all, try common icon paths
|
||||||
|
let icon_bytes = try_fallback_icons(&mut archive);
|
||||||
(String::new(), String::new(), icon_bytes)
|
(String::new(), String::new(), icon_bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn try_fallback_icons(archive: &mut zip::ZipArchive<std::fs::File>) -> Option<Vec<u8>> {
|
||||||
|
for path in ["logo.png", "icon.png", "pack.png"] {
|
||||||
|
if let Some(bytes) = read_zip_bytes(archive, path) {
|
||||||
|
return Some(bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn read_fabric_meta(
|
fn read_fabric_meta(
|
||||||
archive: &mut zip::ZipArchive<std::fs::File>,
|
archive: &mut zip::ZipArchive<std::fs::File>,
|
||||||
) -> Option<(String, String, String)> {
|
) -> Option<(String, String, String)> {
|
||||||
@@ -144,6 +210,98 @@ fn read_fabric_meta(
|
|||||||
Some((data.name, data.description, icon))
|
Some((data.name, data.description, icon))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_quilt_meta(
|
||||||
|
archive: &mut zip::ZipArchive<std::fs::File>,
|
||||||
|
) -> Option<(String, String, String)> {
|
||||||
|
let mut entry = archive.by_name("quilt.mod.json").ok()?;
|
||||||
|
let mut raw = String::new();
|
||||||
|
entry.read_to_string(&mut raw).ok()?;
|
||||||
|
let sanitized = sanitize_json_strings(&raw);
|
||||||
|
let data: QuiltModJson = serde_json::from_str(&sanitized).ok()?;
|
||||||
|
let meta = data.quilt_loader.metadata;
|
||||||
|
let icon = meta.icon_path();
|
||||||
|
Some((meta.name, meta.description, icon))
|
||||||
|
}
|
||||||
|
|
||||||
|
// forge (META-INF/mods.toml) and neoforge (META-INF/neoforge.mods.toml)
|
||||||
|
// share the same format. we only need the top-level logoFile and the first
|
||||||
|
// [[mods]] entry for name/description.
|
||||||
|
// some jars (e.g. dependency-only libs) have a mods.toml with logoFile
|
||||||
|
// but no [[mods]] section. we still want the icon in that case.
|
||||||
|
fn read_forge_toml_meta(
|
||||||
|
archive: &mut zip::ZipArchive<std::fs::File>,
|
||||||
|
) -> Option<(String, String, String)> {
|
||||||
|
let raw = read_zip_string(archive, "META-INF/neoforge.mods.toml")
|
||||||
|
.or_else(|| read_zip_string(archive, "META-INF/mods.toml"))?;
|
||||||
|
let table: toml::Table = raw.parse().ok()?;
|
||||||
|
let logo = table
|
||||||
|
.get("logoFile")
|
||||||
|
.and_then(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned();
|
||||||
|
let (name, description) = table
|
||||||
|
.get("mods")
|
||||||
|
.and_then(|v| v.as_array())
|
||||||
|
.and_then(|a| a.first())
|
||||||
|
.and_then(|v| v.as_table())
|
||||||
|
.map(|first| {
|
||||||
|
let n = first
|
||||||
|
.get("displayName")
|
||||||
|
.and_then(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned();
|
||||||
|
let d = first
|
||||||
|
.get("description")
|
||||||
|
.and_then(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.trim()
|
||||||
|
.to_owned();
|
||||||
|
(n, d)
|
||||||
|
})
|
||||||
|
.unwrap_or_default();
|
||||||
|
Some((name, description, logo))
|
||||||
|
}
|
||||||
|
|
||||||
|
// legacy forge mcmod.info is either a bare json array of mod entries
|
||||||
|
// or an object with a "modList" key wrapping the array
|
||||||
|
fn read_mcmod_info(
|
||||||
|
archive: &mut zip::ZipArchive<std::fs::File>,
|
||||||
|
) -> Option<(String, String, String)> {
|
||||||
|
let mut entry = archive.by_name("mcmod.info").ok()?;
|
||||||
|
let mut raw = String::new();
|
||||||
|
entry.read_to_string(&mut raw).ok()?;
|
||||||
|
let sanitized = sanitize_json_strings(&raw);
|
||||||
|
let parsed: serde_json::Value = serde_json::from_str(&sanitized).ok()?;
|
||||||
|
let first = match &parsed {
|
||||||
|
serde_json::Value::Array(arr) => arr.first()?,
|
||||||
|
serde_json::Value::Object(obj) => obj.get("modList")?.as_array()?.first()?,
|
||||||
|
_ => return None,
|
||||||
|
};
|
||||||
|
let name = first
|
||||||
|
.get("name")
|
||||||
|
.and_then(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned();
|
||||||
|
let description = first
|
||||||
|
.get("description")
|
||||||
|
.and_then(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned();
|
||||||
|
let logo = first
|
||||||
|
.get("logoFile")
|
||||||
|
.and_then(|v| v.as_str())
|
||||||
|
.unwrap_or("")
|
||||||
|
.to_owned();
|
||||||
|
Some((name, description, logo))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_zip_string(archive: &mut zip::ZipArchive<std::fs::File>, path: &str) -> Option<String> {
|
||||||
|
let mut entry = archive.by_name(path).ok()?;
|
||||||
|
let mut s = String::new();
|
||||||
|
entry.read_to_string(&mut s).ok()?;
|
||||||
|
Some(s)
|
||||||
|
}
|
||||||
|
|
||||||
// some mod authors put raw newlines/tabs inside json string values which is
|
// some mod authors put raw newlines/tabs inside json string values which is
|
||||||
// technically invalid json. walks through character by character, tracking
|
// technically invalid json. walks through character by character, tracking
|
||||||
// whether it's inside a string, and escapes the offending characters.
|
// whether it's inside a string, and escapes the offending characters.
|
||||||
@@ -407,6 +565,176 @@ mod tests {
|
|||||||
assert!(dir.join("mymod.jar").exists());
|
assert!(dir.join("mymod.jar").exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use std::io::Write as _;
|
||||||
|
|
||||||
|
// helper to create a jar (zip) file with the given entries
|
||||||
|
fn make_jar(dir: &Path, name: &str, entries: &[(&str, &[u8])]) {
|
||||||
|
let path = dir.join(name);
|
||||||
|
let file = std::fs::File::create(&path).unwrap();
|
||||||
|
let mut zip = zip::ZipWriter::new(file);
|
||||||
|
let options: zip::write::FileOptions<()> =
|
||||||
|
zip::write::FileOptions::default().compression_method(zip::CompressionMethod::Stored);
|
||||||
|
for (entry_name, data) in entries {
|
||||||
|
zip.start_file(*entry_name, options).unwrap();
|
||||||
|
zip.write_all(data).unwrap();
|
||||||
|
}
|
||||||
|
zip.finish().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_reads_fabric_metadata() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let meta = r#"{"name":"Fabric Mod","description":"A fabric mod","icon":"icon.png"}"#;
|
||||||
|
make_jar(
|
||||||
|
&dir,
|
||||||
|
"fabric-mod.jar",
|
||||||
|
&[("fabric.mod.json", meta.as_bytes())],
|
||||||
|
);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
assert_eq!(mods[0].name, "Fabric Mod");
|
||||||
|
assert_eq!(mods[0].description, "A fabric mod");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_reads_quilt_metadata() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let meta =
|
||||||
|
r#"{"quilt_loader":{"metadata":{"name":"Quilt Mod","description":"A quilt mod"}}}"#;
|
||||||
|
make_jar(
|
||||||
|
&dir,
|
||||||
|
"quilt-mod.jar",
|
||||||
|
&[("quilt.mod.json", meta.as_bytes())],
|
||||||
|
);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
assert_eq!(mods[0].name, "Quilt Mod");
|
||||||
|
assert_eq!(mods[0].description, "A quilt mod");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_reads_forge_toml_metadata() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let meta = r#"
|
||||||
|
logoFile = "logo.png"
|
||||||
|
|
||||||
|
[[mods]]
|
||||||
|
displayName = "Forge Mod"
|
||||||
|
description = "A forge mod"
|
||||||
|
"#;
|
||||||
|
make_jar(
|
||||||
|
&dir,
|
||||||
|
"forge-mod.jar",
|
||||||
|
&[("META-INF/mods.toml", meta.as_bytes())],
|
||||||
|
);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
assert_eq!(mods[0].name, "Forge Mod");
|
||||||
|
assert_eq!(mods[0].description, "A forge mod");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_reads_neoforge_toml_metadata() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let meta = r#"
|
||||||
|
logoFile = "logo.png"
|
||||||
|
|
||||||
|
[[mods]]
|
||||||
|
displayName = "NeoForge Mod"
|
||||||
|
description = "A neoforge mod"
|
||||||
|
"#;
|
||||||
|
make_jar(
|
||||||
|
&dir,
|
||||||
|
"neoforge-mod.jar",
|
||||||
|
&[("META-INF/neoforge.mods.toml", meta.as_bytes())],
|
||||||
|
);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
assert_eq!(mods[0].name, "NeoForge Mod");
|
||||||
|
assert_eq!(mods[0].description, "A neoforge mod");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_reads_mcmod_info_array() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let meta = r#"[{"name":"Legacy Mod","description":"An old forge mod"}]"#;
|
||||||
|
make_jar(&dir, "legacy-mod.jar", &[("mcmod.info", meta.as_bytes())]);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
assert_eq!(mods[0].name, "Legacy Mod");
|
||||||
|
assert_eq!(mods[0].description, "An old forge mod");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_reads_mcmod_info_modlist() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let meta = r#"{"modList":[{"name":"Wrapped Mod","description":"Has modList wrapper"}]}"#;
|
||||||
|
make_jar(&dir, "wrapped-mod.jar", &[("mcmod.info", meta.as_bytes())]);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
assert_eq!(mods[0].name, "Wrapped Mod");
|
||||||
|
assert_eq!(mods[0].description, "Has modList wrapper");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_prefers_fabric_over_forge() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
let fabric = r#"{"name":"Fabric Name","description":"fabric desc"}"#;
|
||||||
|
let forge = "[[mods]]\ndisplayName = \"Forge Name\"\ndescription = \"forge desc\"\n";
|
||||||
|
make_jar(
|
||||||
|
&dir,
|
||||||
|
"multi.jar",
|
||||||
|
&[
|
||||||
|
("fabric.mod.json", fabric.as_bytes()),
|
||||||
|
("META-INF/mods.toml", forge.as_bytes()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods[0].name, "Fabric Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn scan_mods_fallback_icon_paths() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let dir = setup_mods_dir(tmp.path(), "inst");
|
||||||
|
// jar with no metadata but has logo.png
|
||||||
|
let png_bytes = b"\x89PNG fake";
|
||||||
|
make_jar(&dir, "no-meta.jar", &[("logo.png", png_bytes)]);
|
||||||
|
let mods = scan_mods(tmp.path(), "inst");
|
||||||
|
assert_eq!(mods.len(), 1);
|
||||||
|
// should use filename as name since no metadata
|
||||||
|
assert_eq!(mods[0].name, "no-meta");
|
||||||
|
// icon_bytes should contain the logo.png content
|
||||||
|
assert_eq!(mods[0].icon_bytes.as_deref(), Some(png_bytes.as_slice()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn icon_path_from_value_string() {
|
||||||
|
let val = serde_json::json!("assets/icon.png");
|
||||||
|
assert_eq!(icon_path_from_value(&val), "assets/icon.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn icon_path_from_value_map() {
|
||||||
|
let val = serde_json::json!({"64": "icon_64.png", "128": "icon_128.png"});
|
||||||
|
let result = icon_path_from_value(&val);
|
||||||
|
// should return one of the values
|
||||||
|
assert!(result == "icon_64.png" || result == "icon_128.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn icon_path_from_value_null() {
|
||||||
|
let val = serde_json::Value::Null;
|
||||||
|
assert_eq!(icon_path_from_value(&val), "");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn toggle_entry_disable() {
|
fn toggle_entry_disable() {
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use std::path::Path;
|
|||||||
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use super::mods::{make_icon_pixels, ContentEntry};
|
use super::mods::{ContentEntry, make_icon_pixels};
|
||||||
|
|
||||||
#[derive(Deserialize, Default)]
|
#[derive(Deserialize, Default)]
|
||||||
pub(crate) struct PackMcMeta {
|
pub(crate) struct PackMcMeta {
|
||||||
@@ -43,6 +43,36 @@ pub(crate) fn extract_description(value: &serde_json::Value) -> String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn scan_one_resource_pack(path: &Path, file_stem: &str, enabled: bool) -> ContentEntry {
|
||||||
|
let is_dir = path.is_dir();
|
||||||
|
let (name, description, icon_bytes) = if is_dir {
|
||||||
|
read_pack_metadata_from_dir(path)
|
||||||
|
} else {
|
||||||
|
read_pack_metadata_from_zip(path)
|
||||||
|
};
|
||||||
|
|
||||||
|
let icon_lines = icon_bytes
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|bytes| make_icon_pixels(bytes, 6, 3))
|
||||||
|
.or_else(|| Some(super::mods::fallback_icon()));
|
||||||
|
|
||||||
|
let display_name = if name.is_empty() {
|
||||||
|
file_stem.to_owned()
|
||||||
|
} else {
|
||||||
|
name
|
||||||
|
};
|
||||||
|
|
||||||
|
ContentEntry {
|
||||||
|
file_stem: file_stem.to_owned(),
|
||||||
|
name: display_name,
|
||||||
|
description,
|
||||||
|
enabled,
|
||||||
|
icon_bytes,
|
||||||
|
path: path.to_path_buf(),
|
||||||
|
icon_lines,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn scan_resource_packs(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry> {
|
pub fn scan_resource_packs(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry> {
|
||||||
let packs_dir = instances_dir
|
let packs_dir = instances_dir
|
||||||
.join(instance_name)
|
.join(instance_name)
|
||||||
@@ -63,8 +93,7 @@ pub fn scan_resource_packs(instances_dir: &Path, instance_name: &str) -> Vec<Con
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_dir = path.is_dir();
|
let (enabled, file_stem) = if path.is_dir() {
|
||||||
let (enabled, file_stem) = if is_dir {
|
|
||||||
super::parse_enabled_stem_dir(&file_name)
|
super::parse_enabled_stem_dir(&file_name)
|
||||||
} else if let Some(pair) = super::parse_enabled_stem(&file_name, ".zip") {
|
} else if let Some(pair) = super::parse_enabled_stem(&file_name, ".zip") {
|
||||||
pair
|
pair
|
||||||
@@ -72,27 +101,7 @@ pub fn scan_resource_packs(instances_dir: &Path, instance_name: &str) -> Vec<Con
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let (name, description, icon_bytes) = if is_dir {
|
entries.push(scan_one_resource_pack(&path, &file_stem, enabled));
|
||||||
read_pack_metadata_from_dir(&path)
|
|
||||||
} else {
|
|
||||||
read_pack_metadata_from_zip(&path)
|
|
||||||
};
|
|
||||||
|
|
||||||
let icon_lines = icon_bytes
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|bytes| make_icon_pixels(bytes, 6, 3))
|
|
||||||
.or_else(|| Some(super::mods::fallback_icon()));
|
|
||||||
|
|
||||||
let display_name = if name.is_empty() { file_stem.clone() } else { name };
|
|
||||||
entries.push(ContentEntry {
|
|
||||||
file_stem,
|
|
||||||
name: display_name,
|
|
||||||
description,
|
|
||||||
enabled,
|
|
||||||
icon_bytes,
|
|
||||||
path,
|
|
||||||
icon_lines,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
||||||
@@ -194,10 +203,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_packs_dir(tmp: &std::path::Path, instance: &str) -> std::path::PathBuf {
|
fn setup_packs_dir(tmp: &std::path::Path, instance: &str) -> std::path::PathBuf {
|
||||||
let dir = tmp
|
let dir = tmp.join(instance).join(".minecraft").join("resourcepacks");
|
||||||
.join(instance)
|
|
||||||
.join(".minecraft")
|
|
||||||
.join("resourcepacks");
|
|
||||||
std::fs::create_dir_all(&dir).unwrap();
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
dir
|
dir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,31 @@
|
|||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use super::mods::{make_icon_pixels, ContentEntry};
|
use super::mods::{ContentEntry, make_icon_pixels};
|
||||||
use super::resource_packs::{extract_description, PackMcMeta};
|
use super::resource_packs::{PackMcMeta, extract_description};
|
||||||
|
|
||||||
|
pub fn scan_one_shader(path: &Path, file_stem: &str, enabled: bool) -> ContentEntry {
|
||||||
|
let is_dir = path.is_dir();
|
||||||
|
let (description, icon_bytes) = if is_dir {
|
||||||
|
read_shader_metadata_from_dir(path)
|
||||||
|
} else {
|
||||||
|
read_shader_metadata_from_zip(path)
|
||||||
|
};
|
||||||
|
|
||||||
|
let icon_lines = icon_bytes
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|bytes| make_icon_pixels(bytes, 6, 3));
|
||||||
|
|
||||||
|
ContentEntry {
|
||||||
|
file_stem: file_stem.to_owned(),
|
||||||
|
name: file_stem.to_owned(),
|
||||||
|
description,
|
||||||
|
enabled,
|
||||||
|
icon_bytes,
|
||||||
|
path: path.to_path_buf(),
|
||||||
|
icon_lines,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn scan_shaders(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry> {
|
pub fn scan_shaders(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry> {
|
||||||
let shaders_dir = instances_dir
|
let shaders_dir = instances_dir
|
||||||
@@ -26,8 +49,7 @@ pub fn scan_shaders(instances_dir: &Path, instance_name: &str) -> Vec<ContentEnt
|
|||||||
None => continue,
|
None => continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_dir = path.is_dir();
|
let (enabled, file_stem) = if path.is_dir() {
|
||||||
let (enabled, file_stem) = if is_dir {
|
|
||||||
super::parse_enabled_stem_dir(&file_name)
|
super::parse_enabled_stem_dir(&file_name)
|
||||||
} else if let Some(pair) = super::parse_enabled_stem(&file_name, ".zip") {
|
} else if let Some(pair) = super::parse_enabled_stem(&file_name, ".zip") {
|
||||||
pair
|
pair
|
||||||
@@ -35,25 +57,7 @@ pub fn scan_shaders(instances_dir: &Path, instance_name: &str) -> Vec<ContentEnt
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let (description, icon_bytes) = if is_dir {
|
entries.push(scan_one_shader(&path, &file_stem, enabled));
|
||||||
read_shader_metadata_from_dir(&path)
|
|
||||||
} else {
|
|
||||||
read_shader_metadata_from_zip(&path)
|
|
||||||
};
|
|
||||||
|
|
||||||
let icon_lines = icon_bytes
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|bytes| make_icon_pixels(bytes, 6, 3));
|
|
||||||
|
|
||||||
entries.push(ContentEntry {
|
|
||||||
name: file_stem.clone(),
|
|
||||||
file_stem,
|
|
||||||
description,
|
|
||||||
enabled,
|
|
||||||
icon_bytes,
|
|
||||||
path,
|
|
||||||
icon_lines,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
||||||
|
|||||||
@@ -4,7 +4,27 @@
|
|||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use super::mods::{make_icon_pixels, ContentEntry};
|
use super::mods::{ContentEntry, make_icon_pixels};
|
||||||
|
|
||||||
|
pub fn scan_one_world(path: &Path, file_stem: &str, enabled: bool) -> ContentEntry {
|
||||||
|
let icon_bytes = std::fs::read(path.join("icon.png")).ok();
|
||||||
|
let icon_lines = icon_bytes
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|bytes| make_icon_pixels(bytes, 12, 6))
|
||||||
|
.or_else(|| Some(super::mods::fallback_icon_large()));
|
||||||
|
|
||||||
|
let description = world_description(path);
|
||||||
|
|
||||||
|
ContentEntry {
|
||||||
|
name: file_stem.to_owned(),
|
||||||
|
file_stem: file_stem.to_owned(),
|
||||||
|
description,
|
||||||
|
enabled,
|
||||||
|
icon_bytes,
|
||||||
|
path: path.to_path_buf(),
|
||||||
|
icon_lines,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn scan_worlds(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry> {
|
pub fn scan_worlds(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntry> {
|
||||||
let saves_dir = instances_dir
|
let saves_dir = instances_dir
|
||||||
@@ -31,24 +51,7 @@ pub fn scan_worlds(instances_dir: &Path, instance_name: &str) -> Vec<ContentEntr
|
|||||||
};
|
};
|
||||||
|
|
||||||
let (enabled, file_stem) = super::parse_enabled_stem_dir(&file_name);
|
let (enabled, file_stem) = super::parse_enabled_stem_dir(&file_name);
|
||||||
|
entries.push(scan_one_world(&path, &file_stem, enabled));
|
||||||
let icon_bytes = std::fs::read(path.join("icon.png")).ok();
|
|
||||||
let icon_lines = icon_bytes
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|bytes| make_icon_pixels(bytes, 12, 6))
|
|
||||||
.or_else(|| Some(super::mods::fallback_icon_large()));
|
|
||||||
|
|
||||||
let description = world_description(&path);
|
|
||||||
|
|
||||||
entries.push(ContentEntry {
|
|
||||||
name: file_stem.clone(),
|
|
||||||
file_stem,
|
|
||||||
description,
|
|
||||||
enabled,
|
|
||||||
icon_bytes,
|
|
||||||
path,
|
|
||||||
icon_lines,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
entries.sort_by_cached_key(|e| e.name.to_lowercase());
|
||||||
@@ -77,14 +80,16 @@ fn world_description(world_dir: &Path) -> String {
|
|||||||
let mut lines = Vec::new();
|
let mut lines = Vec::new();
|
||||||
|
|
||||||
if let Some(secs) = created
|
if let Some(secs) = created
|
||||||
&& let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0) {
|
&& let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0)
|
||||||
lines.push(format!("Created: {}", dt.format("%Y-%m-%d %H:%M")));
|
{
|
||||||
}
|
lines.push(format!("Created: {}", dt.format("%Y-%m-%d %H:%M")));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(secs) = modified
|
if let Some(secs) = modified
|
||||||
&& let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0) {
|
&& let Some(dt) = chrono::DateTime::from_timestamp(secs as i64, 0)
|
||||||
lines.push(format!("Played: {}", dt.format("%Y-%m-%d %H:%M")));
|
{
|
||||||
}
|
lines.push(format!("Played: {}", dt.format("%Y-%m-%d %H:%M")));
|
||||||
|
}
|
||||||
|
|
||||||
if dir_size > 0 {
|
if dir_size > 0 {
|
||||||
lines.push(format!("Size: {}", format_size(dir_size)));
|
lines.push(format!("Size: {}", format_size(dir_size)));
|
||||||
@@ -100,9 +105,10 @@ fn dir_size_approx(path: &Path) -> u64 {
|
|||||||
if let Ok(rd) = std::fs::read_dir(path) {
|
if let Ok(rd) = std::fs::read_dir(path) {
|
||||||
for entry in rd.flatten() {
|
for entry in rd.flatten() {
|
||||||
if let Ok(meta) = entry.metadata()
|
if let Ok(meta) = entry.metadata()
|
||||||
&& meta.is_file() {
|
&& meta.is_file()
|
||||||
total += meta.len();
|
{
|
||||||
}
|
total += meta.len();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check region folder too (main chunk data)
|
// Check region folder too (main chunk data)
|
||||||
@@ -181,8 +187,14 @@ mod tests {
|
|||||||
std::fs::create_dir(dir.join("ActiveWorld")).unwrap();
|
std::fs::create_dir(dir.join("ActiveWorld")).unwrap();
|
||||||
std::fs::create_dir(dir.join("HiddenWorld.disabled")).unwrap();
|
std::fs::create_dir(dir.join("HiddenWorld.disabled")).unwrap();
|
||||||
let worlds = scan_worlds(tmp.path(), "inst");
|
let worlds = scan_worlds(tmp.path(), "inst");
|
||||||
let active = worlds.iter().find(|w| w.file_stem == "ActiveWorld").unwrap();
|
let active = worlds
|
||||||
let hidden = worlds.iter().find(|w| w.file_stem == "HiddenWorld").unwrap();
|
.iter()
|
||||||
|
.find(|w| w.file_stem == "ActiveWorld")
|
||||||
|
.unwrap();
|
||||||
|
let hidden = worlds
|
||||||
|
.iter()
|
||||||
|
.find(|w| w.file_stem == "HiddenWorld")
|
||||||
|
.unwrap();
|
||||||
assert!(active.enabled);
|
assert!(active.enabled);
|
||||||
assert!(!hidden.enabled);
|
assert!(!hidden.enabled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub fn desktop_path(name: &str) -> Option<PathBuf> {
|
|||||||
{
|
{
|
||||||
dirs_next::data_dir().map(|d| {
|
dirs_next::data_dir().map(|d| {
|
||||||
d.join("applications")
|
d.join("applications")
|
||||||
.join(format!("mcl-{sanitized}.desktop"))
|
.join(format!("rmcl-{sanitized}.desktop"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ pub fn desktop_path(name: &str) -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn icon_path() -> Option<PathBuf> {
|
pub fn icon_path() -> Option<PathBuf> {
|
||||||
dirs_next::data_dir().map(|d| d.join("mcl").join("icon.svg"))
|
dirs_next::data_dir().map(|d| d.join("rmcl").join("icon.svg"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// lazily writes the bundled svg icon to disk the first time a shortcut needs it
|
// lazily writes the bundled svg icon to disk the first time a shortcut needs it
|
||||||
@@ -145,7 +145,7 @@ fn build_linux_desktop(name: &str, icon: Option<&Path>) -> String {
|
|||||||
out.push_str("Type=Application\n");
|
out.push_str("Type=Application\n");
|
||||||
out.push_str(&format!("Name=Minecraft - {name}\n"));
|
out.push_str(&format!("Name=Minecraft - {name}\n"));
|
||||||
out.push_str(&format!("Comment=Launch {name} Minecraft instance\n"));
|
out.push_str(&format!("Comment=Launch {name} Minecraft instance\n"));
|
||||||
out.push_str(&format!("Exec=mcl instance launch \"{name}\"\n"));
|
out.push_str(&format!("Exec=rmcl instance launch \"{name}\"\n"));
|
||||||
if let Some(icon) = icon {
|
if let Some(icon) = icon {
|
||||||
out.push_str(&format!("Icon={}\n", icon.display()));
|
out.push_str(&format!("Icon={}\n", icon.display()));
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ fn build_windows_shortcut(name: &str) -> String {
|
|||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("@echo off\r\n");
|
out.push_str("@echo off\r\n");
|
||||||
out.push_str(&format!("title Minecraft - {name}\r\n"));
|
out.push_str(&format!("title Minecraft - {name}\r\n"));
|
||||||
out.push_str(&format!("mcl instance launch \"{name}\"\r\n"));
|
out.push_str(&format!("rmcl instance launch \"{name}\"\r\n"));
|
||||||
out.push_str("pause\r\n");
|
out.push_str("pause\r\n");
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ fn build_macos_command(name: &str) -> String {
|
|||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("#!/bin/bash\n");
|
out.push_str("#!/bin/bash\n");
|
||||||
out.push_str(&format!("# Launch Minecraft instance: {name}\n"));
|
out.push_str(&format!("# Launch Minecraft instance: {name}\n"));
|
||||||
out.push_str(&format!("mcl instance launch \"{name}\"\n"));
|
out.push_str(&format!("rmcl instance launch \"{name}\"\n"));
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ mod tests {
|
|||||||
fn build_content_linux() {
|
fn build_content_linux() {
|
||||||
let content = build_content("TestPack", None);
|
let content = build_content("TestPack", None);
|
||||||
assert!(content.contains("Name=Minecraft - TestPack"));
|
assert!(content.contains("Name=Minecraft - TestPack"));
|
||||||
assert!(content.contains("Exec=mcl instance launch \"TestPack\""));
|
assert!(content.contains("Exec=rmcl instance launch \"TestPack\""));
|
||||||
assert!(content.contains("Terminal=true"));
|
assert!(content.contains("Terminal=true"));
|
||||||
assert!(content.contains("Categories=Game;"));
|
assert!(content.contains("Categories=Game;"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,7 @@ pub fn build_summary(path: &Path) -> Result<ImportSummary, String> {
|
|||||||
let (loader_opt, loader_version) = pack.loader();
|
let (loader_opt, loader_version) = pack.loader();
|
||||||
let loader = loader_opt.unwrap_or(ModLoader::Vanilla);
|
let loader = loader_opt.unwrap_or(ModLoader::Vanilla);
|
||||||
|
|
||||||
let name = instance_name_from_cfg(path)
|
let name = instance_name_from_cfg(path).unwrap_or_else(|| "Imported Pack".to_string());
|
||||||
.unwrap_or_else(|| "Imported Pack".to_string());
|
|
||||||
|
|
||||||
let (mod_count, override_count) = count_content_files(path)?;
|
let (mod_count, override_count) = count_content_files(path)?;
|
||||||
|
|
||||||
|
|||||||
@@ -70,17 +70,20 @@ pub struct ImportSummary {
|
|||||||
// peeks inside a zip to figure out what format it is.
|
// peeks inside a zip to figure out what format it is.
|
||||||
// checks for modrinth.index.json first, then mmc-pack.json.
|
// checks for modrinth.index.json first, then mmc-pack.json.
|
||||||
pub fn detect_format(path: &Path) -> Result<PackFormat, String> {
|
pub fn detect_format(path: &Path) -> Result<PackFormat, String> {
|
||||||
let file = std::fs::File::open(path)
|
let file =
|
||||||
.map_err(|e| format!("Cannot open '{}': {e}", path.display()))?;
|
std::fs::File::open(path).map_err(|e| format!("Cannot open '{}': {e}", path.display()))?;
|
||||||
let archive = zip::ZipArchive::new(file)
|
let archive =
|
||||||
.map_err(|e| format!("Invalid ZIP '{}': {e}", path.display()))?;
|
zip::ZipArchive::new(file).map_err(|e| format!("Invalid ZIP '{}': {e}", path.display()))?;
|
||||||
|
|
||||||
if archive.file_names().any(|n| n == "modrinth.index.json") {
|
if archive.file_names().any(|n| n == "modrinth.index.json") {
|
||||||
return Ok(PackFormat::Mrpack);
|
return Ok(PackFormat::Mrpack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mmc-pack.json can be at root or one directory deep
|
// mmc-pack.json can be at root or one directory deep
|
||||||
if archive.file_names().any(|n| n == "mmc-pack.json" || n.ends_with("/mmc-pack.json")) {
|
if archive
|
||||||
|
.file_names()
|
||||||
|
.any(|n| n == "mmc-pack.json" || n.ends_with("/mmc-pack.json"))
|
||||||
|
{
|
||||||
return Ok(PackFormat::Mmc);
|
return Ok(PackFormat::Mmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,12 +103,20 @@ pub fn build_summary(path: &Path) -> Result<ImportSummary, String> {
|
|||||||
|
|
||||||
pub fn unique_instance_name(base: &str, instances_dir: &Path) -> String {
|
pub fn unique_instance_name(base: &str, instances_dir: &Path) -> String {
|
||||||
let candidate = base.to_string();
|
let candidate = base.to_string();
|
||||||
if !instances_dir.join(&candidate).join("instance.json").exists() {
|
if !instances_dir
|
||||||
|
.join(&candidate)
|
||||||
|
.join("instance.json")
|
||||||
|
.exists()
|
||||||
|
{
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
for n in 2..100 {
|
for n in 2..100 {
|
||||||
let candidate = format!("{base} ({n})");
|
let candidate = format!("{base} ({n})");
|
||||||
if !instances_dir.join(&candidate).join("instance.json").exists() {
|
if !instances_dir
|
||||||
|
.join(&candidate)
|
||||||
|
.join("instance.json")
|
||||||
|
.exists()
|
||||||
|
{
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ async fn download_mod_files(
|
|||||||
index: &MrpackIndex,
|
index: &MrpackIndex,
|
||||||
minecraft_dir: &Path,
|
minecraft_dir: &Path,
|
||||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
let client = crate::net::HttpClient::new();
|
let client = crate::net::HttpClient::new();
|
||||||
let total = index.files.len();
|
let total = index.files.len();
|
||||||
|
|||||||
+53
-17
@@ -8,6 +8,7 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
use crate::auth::{Account, AccountType};
|
||||||
use crate::instance::models::{InstanceConfig, ModLoader};
|
use crate::instance::models::{InstanceConfig, ModLoader};
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
@@ -86,6 +87,10 @@ struct GameAuth {
|
|||||||
user_type: String,
|
user_type: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn account_can_launch(has_microsoft_account: bool, account: &Account) -> bool {
|
||||||
|
account.account_type == AccountType::Microsoft || has_microsoft_account
|
||||||
|
}
|
||||||
|
|
||||||
// mojang's library rules are a fun little state machine: each rule can allow
|
// mojang's library rules are a fun little state machine: each rule can allow
|
||||||
// or disallow based on OS. if no rule matches the current OS, the library is
|
// or disallow based on OS. if no rule matches the current OS, the library is
|
||||||
// included only if no rule "dominated" (matched at all). yes, it's weird.
|
// included only if no rule "dominated" (matched at all). yes, it's weird.
|
||||||
@@ -272,23 +277,25 @@ pub async fn launch(
|
|||||||
jvm.extend(config.jvm_args.clone());
|
jvm.extend(config.jvm_args.clone());
|
||||||
|
|
||||||
// resolve auth credentials, refreshing the microsoft token if needed.
|
// resolve auth credentials, refreshing the microsoft token if needed.
|
||||||
// falls back to a generic offline player if no account is configured.
|
|
||||||
let mut account_store = crate::auth::AccountStore::load();
|
let mut account_store = crate::auth::AccountStore::load();
|
||||||
let (mc_username, mc_uuid, mc_token, mc_user_type) = match account_store
|
let (mc_username, mc_uuid, mc_token, mc_user_type) = match account_store
|
||||||
.active_account()
|
.active_account()
|
||||||
.cloned()
|
.cloned()
|
||||||
{
|
{
|
||||||
Some(acc) => {
|
Some(acc) => {
|
||||||
|
if !account_can_launch(account_store.has_microsoft_account(), &acc) {
|
||||||
|
return Err(LaunchError::Auth(
|
||||||
|
"Offline accounts require a Microsoft account that owns Minecraft".to_owned(),
|
||||||
|
));
|
||||||
|
}
|
||||||
let (token, new_refresh, new_expires) = match acc.account_type {
|
let (token, new_refresh, new_expires) = match acc.account_type {
|
||||||
crate::auth::AccountType::Microsoft => {
|
AccountType::Microsoft => match crate::auth::refresh_and_get_token(&acc).await {
|
||||||
match crate::auth::refresh_and_get_token(&acc).await {
|
Ok(triple) => triple,
|
||||||
Ok(triple) => triple,
|
Err(e) => {
|
||||||
Err(e) => {
|
return Err(LaunchError::Auth(format!("Authentication failed: {e}")));
|
||||||
return Err(LaunchError::Auth(format!("Authentication failed: {e}")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
crate::auth::AccountType::Offline => ("0".to_string(), None, None),
|
AccountType::Offline => ("0".to_string(), None, None),
|
||||||
};
|
};
|
||||||
if let Some(stored) = account_store
|
if let Some(stored) = account_store
|
||||||
.accounts
|
.accounts
|
||||||
@@ -310,8 +317,8 @@ pub async fn launch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let user_type = match acc.account_type {
|
let user_type = match acc.account_type {
|
||||||
crate::auth::AccountType::Microsoft => "msa",
|
AccountType::Microsoft => "msa",
|
||||||
crate::auth::AccountType::Offline => "legacy",
|
AccountType::Offline => "legacy",
|
||||||
};
|
};
|
||||||
(
|
(
|
||||||
acc.username.clone(),
|
acc.username.clone(),
|
||||||
@@ -320,12 +327,7 @@ pub async fn launch(
|
|||||||
user_type.to_string(),
|
user_type.to_string(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
None => (
|
None => return Err(LaunchError::Auth("No account selected".to_owned())),
|
||||||
"Player".to_string(),
|
|
||||||
"00000000-0000-0000-0000-000000000000".to_string(),
|
|
||||||
"0".to_string(),
|
|
||||||
"legacy".to_string(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let game_args = build_game_args(
|
let game_args = build_game_args(
|
||||||
@@ -475,6 +477,7 @@ pub async fn launch(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::auth::{Account, AccountType};
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
|
||||||
fn test_config() -> InstanceConfig {
|
fn test_config() -> InstanceConfig {
|
||||||
@@ -493,6 +496,18 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_account(account_type: AccountType) -> Account {
|
||||||
|
Account {
|
||||||
|
uuid: "00000000-0000-0000-0000-000000000001".to_owned(),
|
||||||
|
username: "TestPlayer".to_owned(),
|
||||||
|
account_type,
|
||||||
|
active: true,
|
||||||
|
refresh_token: Some("refresh".to_owned()),
|
||||||
|
cached_mc_token: None,
|
||||||
|
cached_mc_token_expires_at: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_args_include_empty_user_properties() {
|
fn game_args_include_empty_user_properties() {
|
||||||
let args = build_game_args(
|
let args = build_game_args(
|
||||||
@@ -522,4 +537,25 @@ mod tests {
|
|||||||
.any(|pair| pair == ["--tweakClass", "cpw.mods.fml.common.launcher.FMLTweaker"])
|
.any(|pair| pair == ["--tweakClass", "cpw.mods.fml.common.launcher.FMLTweaker"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn offline_account_cannot_launch_without_microsoft_account() {
|
||||||
|
let offline = test_account(AccountType::Offline);
|
||||||
|
|
||||||
|
assert!(!account_can_launch(false, &offline));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn offline_account_can_launch_with_microsoft_account() {
|
||||||
|
let offline = test_account(AccountType::Offline);
|
||||||
|
|
||||||
|
assert!(account_can_launch(true, &offline));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn microsoft_account_can_launch_without_offline_gate() {
|
||||||
|
let microsoft = test_account(AccountType::Microsoft);
|
||||||
|
|
||||||
|
assert!(account_can_launch(false, µsoft));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -83,17 +83,17 @@ pub async fn apply(
|
|||||||
|
|
||||||
Some(LwjglifyPatches {
|
Some(LwjglifyPatches {
|
||||||
jvm_args,
|
jvm_args,
|
||||||
main_class: "MclShim".to_string(),
|
main_class: "RmclShim".to_string(),
|
||||||
extra_args: vec!["com.gtnewhorizons.retrofuturabootstrap.Main".to_string()],
|
extra_args: vec!["com.gtnewhorizons.retrofuturabootstrap.Main".to_string()],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const SHIM_JAR: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/mcl-shim.jar"));
|
const SHIM_JAR: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/rmcl-shim.jar"));
|
||||||
|
|
||||||
fn deploy_shim(minecraft_dir: &Path) -> PathBuf {
|
fn deploy_shim(minecraft_dir: &Path) -> PathBuf {
|
||||||
let dest = minecraft_dir.join(".mcl-shim.jar");
|
let dest = minecraft_dir.join(".rmcl-shim.jar");
|
||||||
if let Err(e) = std::fs::write(&dest, SHIM_JAR) {
|
if let Err(e) = std::fs::write(&dest, SHIM_JAR) {
|
||||||
tracing::warn!("Failed to write mcl-shim.jar: {e}");
|
tracing::warn!("Failed to write rmcl-shim.jar: {e}");
|
||||||
}
|
}
|
||||||
dest
|
dest
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ fn add_lwjgl3(lib_dir: &Path, classpath: &mut Vec<PathBuf>) {
|
|||||||
// recursion on java 24+. the config is written to .minecraft/ and
|
// recursion on java 24+. the config is written to .minecraft/ and
|
||||||
// pointed to via -Dlog4j.configurationFile.
|
// pointed to via -Dlog4j.configurationFile.
|
||||||
fn write_log4j_config(minecraft_dir: &Path, jvm_args: &mut Vec<String>) {
|
fn write_log4j_config(minecraft_dir: &Path, jvm_args: &mut Vec<String>) {
|
||||||
let config_path = minecraft_dir.join(".mcl-log4j2.xml");
|
let config_path = minecraft_dir.join(".rmcl-log4j2.xml");
|
||||||
let config = r#"<?xml version="1.0" encoding="UTF-8"?>
|
let config = r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Configuration status="WARN">
|
<Configuration status="WARN">
|
||||||
<Appenders>
|
<Appenders>
|
||||||
@@ -306,7 +306,9 @@ async fn replace_log4j_fixed(lib_dir: &Path, classpath: &mut [PathBuf]) {
|
|||||||
}
|
}
|
||||||
let client = crate::net::HttpClient::new();
|
let client = crate::net::HttpClient::new();
|
||||||
if let Err(e) = crate::net::download_file(&client, url, &fixed_path, |_, _| {}).await {
|
if let Err(e) = crate::net::download_file(&client, url, &fixed_path, |_, _| {}).await {
|
||||||
tracing::error!("Failed to download patched {old_name}: {e}, continuing with unpatched version");
|
tracing::error!(
|
||||||
|
"Failed to download patched {old_name}: {e}, continuing with unpatched version"
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use async_trait::async_trait;
|
|||||||
|
|
||||||
use super::{GameVersion, ModLoaderInstaller};
|
use super::{GameVersion, ModLoaderInstaller};
|
||||||
use crate::instance::models::ModLoader;
|
use crate::instance::models::ModLoader;
|
||||||
use crate::net::{fabric as fabric_api, HttpClient, NetError};
|
use crate::net::{HttpClient, NetError, fabric as fabric_api};
|
||||||
|
|
||||||
pub struct FabricInstaller;
|
pub struct FabricInstaller;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use async_trait::async_trait;
|
|||||||
|
|
||||||
use super::{GameVersion, ModLoaderInstaller};
|
use super::{GameVersion, ModLoaderInstaller};
|
||||||
use crate::instance::models::ModLoader;
|
use crate::instance::models::ModLoader;
|
||||||
use crate::net::{forge as forge_api, HttpClient, NetError};
|
use crate::net::{HttpClient, NetError, forge as forge_api};
|
||||||
|
|
||||||
pub struct ForgeInstaller;
|
pub struct ForgeInstaller;
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ mod tests {
|
|||||||
async fn test_vanilla_install_noop() {
|
async fn test_vanilla_install_noop() {
|
||||||
let client = HttpClient::new();
|
let client = HttpClient::new();
|
||||||
let installer = VanillaInstaller;
|
let installer = VanillaInstaller;
|
||||||
let tmp = std::env::temp_dir().join("mcl_test_vanilla_install");
|
let tmp = std::env::temp_dir().join("rmcl_test_vanilla_install");
|
||||||
let meta = std::env::temp_dir().join("mcl_test_meta");
|
let meta = std::env::temp_dir().join("rmcl_test_meta");
|
||||||
installer
|
installer
|
||||||
.install(&client, "1.20.1", "vanilla", &tmp, &meta)
|
.install(&client, "1.20.1", "vanilla", &tmp, &meta)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use async_trait::async_trait;
|
|||||||
|
|
||||||
use super::{GameVersion, ModLoaderInstaller};
|
use super::{GameVersion, ModLoaderInstaller};
|
||||||
use crate::instance::models::ModLoader;
|
use crate::instance::models::ModLoader;
|
||||||
use crate::net::{neoforge as neoforge_api, HttpClient, NetError};
|
use crate::net::{HttpClient, NetError, neoforge as neoforge_api};
|
||||||
|
|
||||||
pub struct NeoForgeInstaller;
|
pub struct NeoForgeInstaller;
|
||||||
|
|
||||||
@@ -65,7 +65,11 @@ impl ModLoaderInstaller for NeoForgeInstaller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_neoforge_profile(instance_dir: &Path, meta_dir: &Path, loader_version: &str) -> Result<(), NetError> {
|
fn save_neoforge_profile(
|
||||||
|
instance_dir: &Path,
|
||||||
|
meta_dir: &Path,
|
||||||
|
loader_version: &str,
|
||||||
|
) -> Result<(), NetError> {
|
||||||
let version_dir_name = format!("neoforge-{loader_version}");
|
let version_dir_name = format!("neoforge-{loader_version}");
|
||||||
let profile_filename = format!("neoforge-{loader_version}.json");
|
let profile_filename = format!("neoforge-{loader_version}.json");
|
||||||
super::save_installer_profile(instance_dir, meta_dir, &version_dir_name, &profile_filename)
|
super::save_installer_profile(instance_dir, meta_dir, &version_dir_name, &profile_filename)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use async_trait::async_trait;
|
|||||||
|
|
||||||
use super::{GameVersion, ModLoaderInstaller};
|
use super::{GameVersion, ModLoaderInstaller};
|
||||||
use crate::instance::models::ModLoader;
|
use crate::instance::models::ModLoader;
|
||||||
use crate::net::{quilt as quilt_api, HttpClient, NetError};
|
use crate::net::{HttpClient, NetError, quilt as quilt_api};
|
||||||
|
|
||||||
pub struct QuiltInstaller;
|
pub struct QuiltInstaller;
|
||||||
|
|
||||||
@@ -41,8 +41,7 @@ impl ModLoaderInstaller for QuiltInstaller {
|
|||||||
_instance_dir: &Path,
|
_instance_dir: &Path,
|
||||||
meta_dir: &Path,
|
meta_dir: &Path,
|
||||||
) -> Result<(), NetError> {
|
) -> Result<(), NetError> {
|
||||||
let profile =
|
let profile = quilt_api::fetch_quilt_profile(client, game_version, loader_version).await?;
|
||||||
quilt_api::fetch_quilt_profile(client, game_version, loader_version).await?;
|
|
||||||
quilt_api::download_quilt_libraries(client, &profile, meta_dir).await?;
|
quilt_api::download_quilt_libraries(client, &profile, meta_dir).await?;
|
||||||
|
|
||||||
super::save_profile_json(
|
super::save_profile_json(
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use async_trait::async_trait;
|
|||||||
|
|
||||||
use super::{GameVersion, ModLoaderInstaller};
|
use super::{GameVersion, ModLoaderInstaller};
|
||||||
use crate::instance::models::ModLoader;
|
use crate::instance::models::ModLoader;
|
||||||
use crate::net::{mojang, HttpClient, NetError};
|
use crate::net::{HttpClient, NetError, mojang};
|
||||||
|
|
||||||
pub struct VanillaInstaller;
|
pub struct VanillaInstaller;
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -137,8 +137,7 @@ impl InstanceManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::net::mojang::download_libraries(&self.client, &version_meta, &self.meta_dir)
|
crate::net::mojang::download_libraries(&self.client, &version_meta, &self.meta_dir).await?;
|
||||||
.await?;
|
|
||||||
|
|
||||||
crate::net::mojang::download_assets(&self.client, &version_meta, &self.meta_dir).await?;
|
crate::net::mojang::download_assets(&self.client, &version_meta, &self.meta_dir).await?;
|
||||||
|
|
||||||
@@ -217,15 +216,16 @@ impl InstanceManager {
|
|||||||
|
|
||||||
let config_path = new_dir.join("instance.json");
|
let config_path = new_dir.join("instance.json");
|
||||||
if let Ok(data) = std::fs::read_to_string(&config_path)
|
if let Ok(data) = std::fs::read_to_string(&config_path)
|
||||||
&& let Ok(mut config) = serde_json::from_str::<InstanceConfig>(&data) {
|
&& let Ok(mut config) = serde_json::from_str::<InstanceConfig>(&data)
|
||||||
config.name = new_name.to_string();
|
{
|
||||||
if let Ok(json) = serde_json::to_string_pretty(&config) {
|
config.name = new_name.to_string();
|
||||||
let _ = std::fs::write(&config_path, json);
|
if let Ok(json) = serde_json::to_string_pretty(&config) {
|
||||||
}
|
let _ = std::fs::write(&config_path, json);
|
||||||
if let Err(e) = crate::instance::desktop::rename(old_name, &config) {
|
|
||||||
tracing::warn!("Failed to rename desktop shortcut: {}", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if let Err(e) = crate::instance::desktop::rename(old_name, &config) {
|
||||||
|
tracing::warn!("Failed to rename desktop shortcut: {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -319,8 +319,8 @@ mod tests {
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn test_manager() -> (InstanceManager, PathBuf) {
|
fn test_manager() -> (InstanceManager, PathBuf) {
|
||||||
let tmp = std::env::temp_dir().join(format!("mcl_test_{}", uuid_like()));
|
let tmp = std::env::temp_dir().join(format!("rmcl_test_{}", uuid_like()));
|
||||||
let meta = std::env::temp_dir().join(format!("mcl_meta_test_{}", uuid_like()));
|
let meta = std::env::temp_dir().join(format!("rmcl_meta_test_{}", uuid_like()));
|
||||||
std::fs::create_dir_all(&tmp).ok();
|
std::fs::create_dir_all(&tmp).ok();
|
||||||
std::fs::create_dir_all(&meta).ok();
|
std::fs::create_dir_all(&meta).ok();
|
||||||
(InstanceManager::new(tmp.clone(), meta), tmp)
|
(InstanceManager::new(tmp.clone(), meta), tmp)
|
||||||
|
|||||||
+9
-3
@@ -10,8 +10,14 @@ pub mod manager;
|
|||||||
pub mod models;
|
pub mod models;
|
||||||
pub mod screenshots;
|
pub mod screenshots;
|
||||||
|
|
||||||
pub use content::{scan_mods, toggle_entry, ContentEntry, scan_resource_packs, scan_shaders, scan_worlds};
|
pub use content::{
|
||||||
|
ContentEntry, toggle_entry,
|
||||||
|
scan_mods, scan_one_mod,
|
||||||
|
scan_resource_packs, scan_one_resource_pack,
|
||||||
|
scan_shaders, scan_one_shader,
|
||||||
|
scan_worlds, scan_one_world,
|
||||||
|
};
|
||||||
pub use launch::LaunchError;
|
pub use launch::LaunchError;
|
||||||
pub use loader::{get_installer, GameVersion, ModLoaderInstaller, VanillaInstaller};
|
pub use loader::{GameVersion, ModLoaderInstaller, VanillaInstaller, get_installer};
|
||||||
pub use manager::{InstanceError, InstanceManager};
|
pub use manager::{InstanceError, InstanceManager};
|
||||||
pub use models::{normalize_memory_value, InstanceConfig, ModLoader};
|
pub use models::{InstanceConfig, ModLoader, normalize_memory_value};
|
||||||
@@ -56,9 +56,7 @@ pub fn normalize_memory_value(raw: &str) -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let (digits, suffix) = match trimmed.chars().last() {
|
let (digits, suffix) = match trimmed.chars().last() {
|
||||||
Some(c) if c.is_ascii_alphabetic() => {
|
Some(c) if c.is_ascii_alphabetic() => (&trimmed[..trimmed.len() - c.len_utf8()], Some(c)),
|
||||||
(&trimmed[..trimmed.len() - c.len_utf8()], Some(c))
|
|
||||||
}
|
|
||||||
Some(_) => (trimmed, None),
|
Some(_) => (trimmed, None),
|
||||||
None => return None,
|
None => return None,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,9 +76,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
let lines = get_all(name);
|
let lines = get_all(name);
|
||||||
assert_eq!(lines.len(), MAX_LINES);
|
assert_eq!(lines.len(), MAX_LINES);
|
||||||
assert!(lines
|
assert!(
|
||||||
.last()
|
lines
|
||||||
.unwrap()
|
.last()
|
||||||
.contains(&format!("{}", MAX_LINES + 99)));
|
.unwrap()
|
||||||
|
.contains(&format!("{}", MAX_LINES + 99))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,17 @@ mod cli;
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod instance;
|
pub mod instance;
|
||||||
pub mod instance_logs;
|
pub mod instance_logs;
|
||||||
|
mod migrate;
|
||||||
pub mod net;
|
pub mod net;
|
||||||
pub mod running;
|
pub mod running;
|
||||||
pub mod tui;
|
pub mod tui;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
// Run before logging::init() so the cache rename isn't blocked by a
|
||||||
|
// freshly-created ~/.cache/rmcl/ directory.
|
||||||
|
migrate::run_legacy_rename();
|
||||||
|
|
||||||
// Guard must stay in scope to keep the log file writer alive
|
// Guard must stay in scope to keep the log file writer alive
|
||||||
let _guard = tui::logging::init();
|
let _guard = tui::logging::init();
|
||||||
if let Err(e) = color_eyre::install() {
|
if let Err(e) = color_eyre::install() {
|
||||||
|
|||||||
+313
@@ -0,0 +1,313 @@
|
|||||||
|
//! Legacy mcl→rmcl path migration. Runs once before any other init in main().
|
||||||
|
//! Idempotent: absence of the old dir is the sentinel.
|
||||||
|
|
||||||
|
use std::fs;
|
||||||
|
use std::io;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
const OLD_NAME: &str = "mcl";
|
||||||
|
const NEW_NAME: &str = "rmcl";
|
||||||
|
|
||||||
|
pub fn run_legacy_rename() {
|
||||||
|
if let Some(dir) = dirs_next::config_dir() {
|
||||||
|
rename_top_level(&dir.join(OLD_NAME), &dir.join(NEW_NAME));
|
||||||
|
}
|
||||||
|
if let Some(dir) = dirs_next::data_dir() {
|
||||||
|
let new_data = dir.join(NEW_NAME);
|
||||||
|
rename_top_level(&dir.join(OLD_NAME), &new_data);
|
||||||
|
cleanup_instance_leftovers(&new_data.join("instances"));
|
||||||
|
rewrite_linux_desktop_entries(&dir, &new_data.join("instances"));
|
||||||
|
}
|
||||||
|
if let Some(dir) = dirs_next::cache_dir() {
|
||||||
|
rename_top_level(&dir.join(OLD_NAME), &dir.join(NEW_NAME));
|
||||||
|
}
|
||||||
|
if let (Some(desk), Some(data)) = (dirs::desktop_dir(), dirs_next::data_dir()) {
|
||||||
|
rewrite_native_desktop_shortcuts(&desk, &data.join(NEW_NAME).join("instances"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rename_top_level(old: &Path, new: &Path) {
|
||||||
|
if !old.exists() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if new.exists() {
|
||||||
|
eprintln!(
|
||||||
|
"rmcl migration: both {} and {} exist; leaving as-is, please merge manually",
|
||||||
|
old.display(),
|
||||||
|
new.display()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
match fs::rename(old, new) {
|
||||||
|
Ok(_) => eprintln!("rmcl migration: moved {} -> {}", old.display(), new.display()),
|
||||||
|
Err(e) if e.kind() == io::ErrorKind::CrossesDevices => {
|
||||||
|
if let Err(e2) = copy_dir_recursive(old, new) {
|
||||||
|
eprintln!(
|
||||||
|
"rmcl migration: failed cross-device copy {} -> {}: {}",
|
||||||
|
old.display(),
|
||||||
|
new.display(),
|
||||||
|
e2
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if let Err(e3) = fs::remove_dir_all(old) {
|
||||||
|
eprintln!(
|
||||||
|
"rmcl migration: copied but failed to remove {}: {}",
|
||||||
|
old.display(),
|
||||||
|
e3
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
eprintln!(
|
||||||
|
"rmcl migration: cross-device moved {} -> {}",
|
||||||
|
old.display(),
|
||||||
|
new.display()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Err(e) => eprintln!(
|
||||||
|
"rmcl migration: failed to rename {} -> {}: {}",
|
||||||
|
old.display(),
|
||||||
|
new.display(),
|
||||||
|
e
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn copy_dir_recursive(src: &Path, dst: &Path) -> io::Result<()> {
|
||||||
|
fs::create_dir_all(dst)?;
|
||||||
|
for entry in fs::read_dir(src)? {
|
||||||
|
let entry = entry?;
|
||||||
|
let ty = entry.file_type()?;
|
||||||
|
let dst_path = dst.join(entry.file_name());
|
||||||
|
if ty.is_dir() {
|
||||||
|
copy_dir_recursive(&entry.path(), &dst_path)?;
|
||||||
|
} else {
|
||||||
|
fs::copy(entry.path(), &dst_path)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cleanup_instance_leftovers(instances_dir: &Path) {
|
||||||
|
let Ok(entries) = fs::read_dir(instances_dir) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for entry in entries.flatten() {
|
||||||
|
let mc = entry.path().join(".minecraft");
|
||||||
|
for leftover in [".mcl-shim.jar", ".mcl-log4j2.xml"] {
|
||||||
|
let p = mc.join(leftover);
|
||||||
|
if p.exists() {
|
||||||
|
let _ = fs::remove_file(&p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rewrite_linux_desktop_entries(_data_dir: &Path, _instances_dir: &Path) {
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
{
|
||||||
|
let apps_dir = _data_dir.join("applications");
|
||||||
|
let Ok(entries) = fs::read_dir(_instances_dir) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for entry in entries.flatten() {
|
||||||
|
let name = entry.file_name();
|
||||||
|
let sanitized = sanitize(&name.to_string_lossy());
|
||||||
|
let old = apps_dir.join(format!("mcl-{sanitized}.desktop"));
|
||||||
|
let new = apps_dir.join(format!("rmcl-{sanitized}.desktop"));
|
||||||
|
if old.exists()
|
||||||
|
&& !new.exists()
|
||||||
|
&& let Ok(content) = fs::read_to_string(&old)
|
||||||
|
{
|
||||||
|
let new_content = content.replace("Exec=mcl ", "Exec=rmcl ");
|
||||||
|
if fs::write(&new, new_content).is_ok() {
|
||||||
|
let _ = fs::remove_file(&old);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rewrite_native_desktop_shortcuts(_desktop_dir: &Path, _instances_dir: &Path) {
|
||||||
|
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||||
|
{
|
||||||
|
let ext = if cfg!(target_os = "windows") {
|
||||||
|
"bat"
|
||||||
|
} else {
|
||||||
|
"command"
|
||||||
|
};
|
||||||
|
let Ok(entries) = fs::read_dir(_instances_dir) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for entry in entries.flatten() {
|
||||||
|
let display = entry.file_name().to_string_lossy().into_owned();
|
||||||
|
let path = _desktop_dir.join(format!("Minecraft - {display}.{ext}"));
|
||||||
|
if !path.exists() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if let Ok(content) = fs::read_to_string(&path) {
|
||||||
|
let new_content = content.replace("mcl instance launch", "rmcl instance launch");
|
||||||
|
if new_content != content {
|
||||||
|
let _ = fs::write(&path, new_content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
fn sanitize(name: &str) -> String {
|
||||||
|
name.chars()
|
||||||
|
.map(|c| {
|
||||||
|
if c.is_alphanumeric() || c == '-' || c == '_' {
|
||||||
|
c
|
||||||
|
} else {
|
||||||
|
'_'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
|
|
||||||
|
static COUNTER: AtomicU64 = AtomicU64::new(0);
|
||||||
|
|
||||||
|
fn unique_tmp(label: &str) -> PathBuf {
|
||||||
|
let n = COUNTER.fetch_add(1, Ordering::SeqCst);
|
||||||
|
let nanos = std::time::SystemTime::now()
|
||||||
|
.duration_since(std::time::UNIX_EPOCH)
|
||||||
|
.map(|d| d.as_nanos())
|
||||||
|
.unwrap_or(0);
|
||||||
|
let p = std::env::temp_dir().join(format!("rmcl_migrate_test_{label}_{nanos}_{n}"));
|
||||||
|
std::fs::create_dir_all(&p).unwrap();
|
||||||
|
p
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rename_top_level_moves_when_only_old_exists() {
|
||||||
|
let root = unique_tmp("only_old");
|
||||||
|
let old = root.join("mcl");
|
||||||
|
let new = root.join("rmcl");
|
||||||
|
fs::create_dir_all(old.join("sub")).unwrap();
|
||||||
|
fs::write(old.join("sub").join("f.txt"), b"hi").unwrap();
|
||||||
|
|
||||||
|
rename_top_level(&old, &new);
|
||||||
|
|
||||||
|
assert!(!old.exists());
|
||||||
|
assert!(new.exists());
|
||||||
|
assert_eq!(fs::read(new.join("sub").join("f.txt")).unwrap(), b"hi");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rename_top_level_skips_when_only_new_exists() {
|
||||||
|
let root = unique_tmp("only_new");
|
||||||
|
let old = root.join("mcl");
|
||||||
|
let new = root.join("rmcl");
|
||||||
|
fs::create_dir_all(&new).unwrap();
|
||||||
|
fs::write(new.join("marker.txt"), b"keep").unwrap();
|
||||||
|
|
||||||
|
rename_top_level(&old, &new);
|
||||||
|
|
||||||
|
assert!(!old.exists());
|
||||||
|
assert_eq!(fs::read(new.join("marker.txt")).unwrap(), b"keep");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rename_top_level_skips_when_both_exist() {
|
||||||
|
let root = unique_tmp("both");
|
||||||
|
let old = root.join("mcl");
|
||||||
|
let new = root.join("rmcl");
|
||||||
|
fs::create_dir_all(&old).unwrap();
|
||||||
|
fs::create_dir_all(&new).unwrap();
|
||||||
|
fs::write(old.join("a"), b"old").unwrap();
|
||||||
|
fs::write(new.join("b"), b"new").unwrap();
|
||||||
|
|
||||||
|
rename_top_level(&old, &new);
|
||||||
|
|
||||||
|
assert!(old.exists(), "old should remain when both exist");
|
||||||
|
assert!(new.exists(), "new should remain when both exist");
|
||||||
|
assert_eq!(fs::read(old.join("a")).unwrap(), b"old");
|
||||||
|
assert_eq!(fs::read(new.join("b")).unwrap(), b"new");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rename_top_level_noop_when_neither_exists() {
|
||||||
|
let root = unique_tmp("neither");
|
||||||
|
let old = root.join("mcl");
|
||||||
|
let new = root.join("rmcl");
|
||||||
|
|
||||||
|
rename_top_level(&old, &new);
|
||||||
|
|
||||||
|
assert!(!old.exists());
|
||||||
|
assert!(!new.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cleanup_instance_leftovers_removes_shim_and_log4j() {
|
||||||
|
let instances = unique_tmp("inst").join("instances");
|
||||||
|
let mc = instances.join("Test").join(".minecraft");
|
||||||
|
fs::create_dir_all(&mc).unwrap();
|
||||||
|
fs::write(mc.join(".mcl-shim.jar"), b"jar").unwrap();
|
||||||
|
fs::write(mc.join(".mcl-log4j2.xml"), b"xml").unwrap();
|
||||||
|
fs::write(mc.join("keep.txt"), b"keep").unwrap();
|
||||||
|
|
||||||
|
cleanup_instance_leftovers(&instances);
|
||||||
|
|
||||||
|
assert!(!mc.join(".mcl-shim.jar").exists());
|
||||||
|
assert!(!mc.join(".mcl-log4j2.xml").exists());
|
||||||
|
assert!(mc.join("keep.txt").exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cleanup_instance_leftovers_handles_missing_dir() {
|
||||||
|
let nowhere = unique_tmp("missing").join("does-not-exist");
|
||||||
|
cleanup_instance_leftovers(&nowhere);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
fn rewrite_linux_desktop_entries_renames_and_rewrites_exec() {
|
||||||
|
let root = unique_tmp("linux_desk");
|
||||||
|
let data = root.clone();
|
||||||
|
let instances = data.join("rmcl").join("instances");
|
||||||
|
let apps = data.join("applications");
|
||||||
|
fs::create_dir_all(instances.join("MyPack")).unwrap();
|
||||||
|
fs::create_dir_all(&apps).unwrap();
|
||||||
|
let old_entry = apps.join("mcl-MyPack.desktop");
|
||||||
|
fs::write(
|
||||||
|
&old_entry,
|
||||||
|
"[Desktop Entry]\nName=Test\nExec=mcl instance launch \"MyPack\"\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
rewrite_linux_desktop_entries(&data, &instances);
|
||||||
|
|
||||||
|
let new_entry = apps.join("rmcl-MyPack.desktop");
|
||||||
|
assert!(!old_entry.exists(), "old .desktop should be removed");
|
||||||
|
assert!(new_entry.exists(), "new .desktop should exist");
|
||||||
|
let content = fs::read_to_string(&new_entry).unwrap();
|
||||||
|
assert!(content.contains("Exec=rmcl instance launch \"MyPack\""));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn copy_dir_recursive_copies_nested_tree() {
|
||||||
|
let root = unique_tmp("copy");
|
||||||
|
let src = root.join("a");
|
||||||
|
let dst = root.join("b");
|
||||||
|
fs::create_dir_all(src.join("nested")).unwrap();
|
||||||
|
fs::write(src.join("top.txt"), b"top").unwrap();
|
||||||
|
fs::write(src.join("nested").join("inner.txt"), b"inner").unwrap();
|
||||||
|
|
||||||
|
copy_dir_recursive(&src, &dst).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(fs::read(dst.join("top.txt")).unwrap(), b"top");
|
||||||
|
assert_eq!(
|
||||||
|
fs::read(dst.join("nested").join("inner.txt")).unwrap(),
|
||||||
|
b"inner"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-2
@@ -6,7 +6,7 @@ use std::path::Path;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::instance::loader::GameVersion;
|
use crate::instance::loader::GameVersion;
|
||||||
use crate::net::{download_file, HttpClient, NetError};
|
use crate::net::{HttpClient, NetError, download_file};
|
||||||
use crate::tui::progress::set_sub_action;
|
use crate::tui::progress::set_sub_action;
|
||||||
|
|
||||||
const FABRIC_META_BASE: &str = "https://meta.fabricmc.net/v2";
|
const FABRIC_META_BASE: &str = "https://meta.fabricmc.net/v2";
|
||||||
@@ -152,5 +152,4 @@ mod tests {
|
|||||||
Err(e) => panic!("fetch_fabric_game_versions failed: {}", e),
|
Err(e) => panic!("fetch_fabric_game_versions failed: {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+20
-23
@@ -87,10 +87,7 @@ pub async fn download_forge_installer(
|
|||||||
|
|
||||||
let mut last_err = None;
|
let mut last_err = None;
|
||||||
for slug in &slugs {
|
for slug in &slugs {
|
||||||
let url = format!(
|
let url = format!("{}/{slug}/forge-{slug}-installer.jar", FORGE_MAVEN_BASE,);
|
||||||
"{}/{slug}/forge-{slug}-installer.jar",
|
|
||||||
FORGE_MAVEN_BASE,
|
|
||||||
);
|
|
||||||
match download_file(client, &url, dest, |downloaded, total| {
|
match download_file(client, &url, dest, |downloaded, total| {
|
||||||
crate::tui::progress::set_progress(downloaded, total);
|
crate::tui::progress::set_progress(downloaded, total);
|
||||||
})
|
})
|
||||||
@@ -179,25 +176,23 @@ pub(crate) async fn install_forge_from_profile(
|
|||||||
set_action("Installing legacy Forge from profile...");
|
set_action("Installing legacy Forge from profile...");
|
||||||
|
|
||||||
let file = std::fs::File::open(installer_path)?;
|
let file = std::fs::File::open(installer_path)?;
|
||||||
let mut archive = zip::ZipArchive::new(file).map_err(|e| {
|
let mut archive = zip::ZipArchive::new(file)
|
||||||
NetError::Parse(format!("Failed to open installer as ZIP: {e}"))
|
.map_err(|e| NetError::Parse(format!("Failed to open installer as ZIP: {e}")))?;
|
||||||
})?;
|
|
||||||
|
|
||||||
let profile_data: serde_json::Value = {
|
let profile_data: serde_json::Value = {
|
||||||
let entry = archive.by_name("install_profile.json").map_err(|e| {
|
let entry = archive.by_name("install_profile.json").map_err(|e| {
|
||||||
NetError::Parse(format!("install_profile.json not found in installer: {e}"))
|
NetError::Parse(format!("install_profile.json not found in installer: {e}"))
|
||||||
})?;
|
})?;
|
||||||
serde_json::from_reader(entry).map_err(|e| {
|
serde_json::from_reader(entry)
|
||||||
NetError::Parse(format!("Failed to parse install_profile.json: {e}"))
|
.map_err(|e| NetError::Parse(format!("Failed to parse install_profile.json: {e}")))?
|
||||||
})?
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let version_info = profile_data.get("versionInfo").ok_or_else(|| {
|
let version_info = profile_data
|
||||||
NetError::Parse("install_profile.json missing versionInfo".into())
|
.get("versionInfo")
|
||||||
})?;
|
.ok_or_else(|| NetError::Parse("install_profile.json missing versionInfo".into()))?;
|
||||||
let install_info = profile_data.get("install").ok_or_else(|| {
|
let install_info = profile_data
|
||||||
NetError::Parse("install_profile.json missing install section".into())
|
.get("install")
|
||||||
})?;
|
.ok_or_else(|| NetError::Parse("install_profile.json missing install section".into()))?;
|
||||||
|
|
||||||
let main_class = version_info
|
let main_class = version_info
|
||||||
.get("mainClass")
|
.get("mainClass")
|
||||||
@@ -221,9 +216,11 @@ pub(crate) async fn install_forge_from_profile(
|
|||||||
.ok_or_else(|| NetError::Parse("missing install.path".into()))?;
|
.ok_or_else(|| NetError::Parse("missing install.path".into()))?;
|
||||||
|
|
||||||
// extract the universal jar to the correct maven location
|
// extract the universal jar to the correct maven location
|
||||||
let universal_maven_path = crate::net::maven_coord_to_path(install_path_coord)
|
let universal_maven_path =
|
||||||
.ok_or_else(|| {
|
crate::net::maven_coord_to_path(install_path_coord).ok_or_else(|| {
|
||||||
NetError::Parse(format!("Invalid maven coord in install.path: {install_path_coord}"))
|
NetError::Parse(format!(
|
||||||
|
"Invalid maven coord in install.path: {install_path_coord}"
|
||||||
|
))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
set_sub_action("Extracting universal JAR...");
|
set_sub_action("Extracting universal JAR...");
|
||||||
@@ -234,7 +231,9 @@ pub(crate) async fn install_forge_from_profile(
|
|||||||
|
|
||||||
{
|
{
|
||||||
let mut entry = archive.by_name(file_path).map_err(|e| {
|
let mut entry = archive.by_name(file_path).map_err(|e| {
|
||||||
NetError::Parse(format!("Universal JAR '{file_path}' not found in installer: {e}"))
|
NetError::Parse(format!(
|
||||||
|
"Universal JAR '{file_path}' not found in installer: {e}"
|
||||||
|
))
|
||||||
})?;
|
})?;
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
entry.read_to_end(&mut buf)?;
|
entry.read_to_end(&mut buf)?;
|
||||||
@@ -252,9 +251,7 @@ pub(crate) async fn install_forge_from_profile(
|
|||||||
let maven_path = match crate::net::maven_coord_to_path(name) {
|
let maven_path = match crate::net::maven_coord_to_path(name) {
|
||||||
Some(p) => p,
|
Some(p) => p,
|
||||||
None => {
|
None => {
|
||||||
return Err(NetError::Parse(format!(
|
return Err(NetError::Parse(format!("Invalid Maven coordinate: {name}")));
|
||||||
"Invalid Maven coordinate: {name}"
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -44,7 +44,7 @@ impl HttpClient {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let client = Client::builder()
|
let client = Client::builder()
|
||||||
.user_agent(format!(
|
.user_agent(format!(
|
||||||
"mcl/{} (Minecraft Launcher)",
|
"rmcl/{} (Minecraft Launcher)",
|
||||||
env!("CARGO_PKG_VERSION")
|
env!("CARGO_PKG_VERSION")
|
||||||
))
|
))
|
||||||
.timeout(std::time::Duration::from_secs(30))
|
.timeout(std::time::Duration::from_secs(30))
|
||||||
@@ -90,7 +90,12 @@ pub async fn download_file(
|
|||||||
for attempt in 0..=MAX_RETRIES {
|
for attempt in 0..=MAX_RETRIES {
|
||||||
if attempt > 0 {
|
if attempt > 0 {
|
||||||
let delay = RETRY_BASE_DELAY_MS * 2u64.pow(attempt - 1);
|
let delay = RETRY_BASE_DELAY_MS * 2u64.pow(attempt - 1);
|
||||||
tracing::warn!("retrying download (attempt {}/{}): {}", attempt + 1, MAX_RETRIES + 1, url);
|
tracing::warn!(
|
||||||
|
"retrying download (attempt {}/{}): {}",
|
||||||
|
attempt + 1,
|
||||||
|
MAX_RETRIES + 1,
|
||||||
|
url
|
||||||
|
);
|
||||||
tokio::time::sleep(std::time::Duration::from_millis(delay)).await;
|
tokio::time::sleep(std::time::Duration::from_millis(delay)).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -55,7 +55,9 @@ use crate::instance::models::ModLoader;
|
|||||||
|
|
||||||
// mrpack dependencies use keys like "fabric-loader", "forge", etc.
|
// mrpack dependencies use keys like "fabric-loader", "forge", etc.
|
||||||
// checks in priority order and returns the first match.
|
// checks in priority order and returns the first match.
|
||||||
pub fn loader_from_dependencies(deps: &HashMap<String, String>) -> (Option<ModLoader>, Option<String>) {
|
pub fn loader_from_dependencies(
|
||||||
|
deps: &HashMap<String, String>,
|
||||||
|
) -> (Option<ModLoader>, Option<String>) {
|
||||||
let loaders = [
|
let loaders = [
|
||||||
("fabric-loader", ModLoader::Fabric),
|
("fabric-loader", ModLoader::Fabric),
|
||||||
("forge", ModLoader::Forge),
|
("forge", ModLoader::Forge),
|
||||||
@@ -108,7 +110,8 @@ pub async fn fetch_versions(
|
|||||||
) -> Result<Vec<VersionInfo>, crate::net::NetError> {
|
) -> Result<Vec<VersionInfo>, crate::net::NetError> {
|
||||||
let url = format!(
|
let url = format!(
|
||||||
"{}/project/{}/version?loaders=[\"fabric\",\"forge\",\"neoforge\",\"quilt\"]",
|
"{}/project/{}/version?loaders=[\"fabric\",\"forge\",\"neoforge\",\"quilt\"]",
|
||||||
API_BASE, url_encode(slug_or_id)
|
API_BASE,
|
||||||
|
url_encode(slug_or_id)
|
||||||
);
|
);
|
||||||
client.get_json(&url).await
|
client.get_json(&url).await
|
||||||
}
|
}
|
||||||
@@ -187,7 +190,10 @@ mod tests {
|
|||||||
fn game_version_from_deps() {
|
fn game_version_from_deps() {
|
||||||
let mut deps = HashMap::new();
|
let mut deps = HashMap::new();
|
||||||
deps.insert("minecraft".to_string(), "1.21.4".to_string());
|
deps.insert("minecraft".to_string(), "1.21.4".to_string());
|
||||||
assert_eq!(game_version_from_dependencies(&deps), Some("1.21.4".to_string()));
|
assert_eq!(
|
||||||
|
game_version_from_dependencies(&deps),
|
||||||
|
Some("1.21.4".to_string())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+5
-4
@@ -78,10 +78,11 @@ pub fn register_kill(name: &str, tx: tokio::sync::oneshot::Sender<()>) {
|
|||||||
|
|
||||||
pub fn send_kill(name: &str) -> bool {
|
pub fn send_kill(name: &str) -> bool {
|
||||||
if let Ok(mut map) = KILL_SENDERS.lock()
|
if let Ok(mut map) = KILL_SENDERS.lock()
|
||||||
&& let Some(tx) = map.remove(name) {
|
&& let Some(tx) = map.remove(name)
|
||||||
let _ = tx.send(());
|
{
|
||||||
return true;
|
let _ = tx.send(());
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -3,9 +3,9 @@ use crossterm::event::{self, Event};
|
|||||||
use ratatui::crossterm::event::KeyEventKind;
|
use ratatui::crossterm::event::KeyEventKind;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use super::Tui;
|
||||||
use super::app::{App, PENDING_INSTANCES};
|
use super::app::{App, PENDING_INSTANCES};
|
||||||
use super::widgets::{self, popups::import_modpack, popups::new_instance};
|
use super::widgets::{self, popups::import_modpack, popups::new_instance};
|
||||||
use super::Tui;
|
|
||||||
use crate::instance::InstanceManager;
|
use crate::instance::InstanceManager;
|
||||||
use crate::tui::error_buffer;
|
use crate::tui::error_buffer;
|
||||||
use crate::tui::progress;
|
use crate::tui::progress;
|
||||||
@@ -31,13 +31,13 @@ impl App {
|
|||||||
self.drain_pending_instances();
|
self.drain_pending_instances();
|
||||||
self.drain_pending_last_played();
|
self.drain_pending_last_played();
|
||||||
self.mods_state.drain_pending();
|
self.mods_state.drain_pending();
|
||||||
self.mods_state.try_rescan();
|
self.mods_state.drain_watcher();
|
||||||
self.resource_packs_state.drain_pending();
|
self.resource_packs_state.drain_pending();
|
||||||
self.resource_packs_state.try_rescan();
|
self.resource_packs_state.drain_watcher();
|
||||||
self.shaders_state.drain_pending();
|
self.shaders_state.drain_pending();
|
||||||
self.shaders_state.try_rescan();
|
self.shaders_state.drain_watcher();
|
||||||
self.worlds_state.drain_pending();
|
self.worlds_state.drain_pending();
|
||||||
self.worlds_state.try_rescan();
|
self.worlds_state.drain_watcher();
|
||||||
self.logs_state.drain_pending();
|
self.logs_state.drain_pending();
|
||||||
self.logs_state.try_rescan();
|
self.logs_state.try_rescan();
|
||||||
self.account_state.drain_auth_result();
|
self.account_state.drain_auth_result();
|
||||||
@@ -153,10 +153,10 @@ impl App {
|
|||||||
// editor fights with ratatui for the terminal. GUI editors just get spawned detached.
|
// editor fights with ratatui for the terminal. GUI editors just get spawned detached.
|
||||||
fn run_editor(terminal: &mut ratatui::DefaultTerminal, path: &std::path::Path) -> bool {
|
fn run_editor(terminal: &mut ratatui::DefaultTerminal, path: &std::path::Path) -> bool {
|
||||||
use ratatui::crossterm::{
|
use ratatui::crossterm::{
|
||||||
terminal::{
|
|
||||||
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen,
|
|
||||||
},
|
|
||||||
ExecutableCommand,
|
ExecutableCommand,
|
||||||
|
terminal::{
|
||||||
|
EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use std::io::stdout;
|
use std::io::stdout;
|
||||||
|
|
||||||
|
|||||||
+20
-12
@@ -6,7 +6,9 @@
|
|||||||
use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
|
|
||||||
use super::app::{App, FocusedArea};
|
use super::app::{App, FocusedArea};
|
||||||
use super::widgets::{self, popups::confirm as confirm_popup, popups::import_modpack, popups::new_instance, WidgetKey};
|
use super::widgets::{
|
||||||
|
self, WidgetKey, popups::confirm as confirm_popup, popups::import_modpack, popups::new_instance,
|
||||||
|
};
|
||||||
use crate::tui::error_buffer;
|
use crate::tui::error_buffer;
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
@@ -15,6 +17,9 @@ impl App {
|
|||||||
if self.focused == FocusedArea::OverviewExpanded {
|
if self.focused == FocusedArea::OverviewExpanded {
|
||||||
if self.log_overlay_search.active {
|
if self.log_overlay_search.active {
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
|
KeyCode::Enter => {
|
||||||
|
self.log_overlay_search.confirm();
|
||||||
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
self.log_overlay_search.deactivate();
|
self.log_overlay_search.deactivate();
|
||||||
}
|
}
|
||||||
@@ -103,7 +108,8 @@ impl App {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
} else if self.content_tab == widgets::content::ContentTab::Worlds {
|
} else if self.content_tab == widgets::content::ContentTab::Worlds {
|
||||||
if widgets::content::list::handle_key_no_toggle(&key_event, &mut self.worlds_state) {
|
if widgets::content::list::handle_key_no_toggle(&key_event, &mut self.worlds_state)
|
||||||
|
{
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -116,9 +122,10 @@ impl App {
|
|||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
if let Some(state) = state
|
if let Some(state) = state
|
||||||
&& widgets::content::list::handle_key(&key_event, state) {
|
&& widgets::content::list::handle_key(&key_event, state)
|
||||||
return Ok(());
|
{
|
||||||
}
|
return Ok(());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,17 +136,17 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.focused == FocusedArea::Settings {
|
if self.focused == FocusedArea::Settings {
|
||||||
match widgets::details::handle_key(
|
match widgets::settings::handle_key(
|
||||||
&key_event,
|
&key_event,
|
||||||
self.instances_state.selected_instance(),
|
self.instances_state.selected_instance(),
|
||||||
&self.instance_manager.instances_dir,
|
&self.instance_manager.instances_dir,
|
||||||
) {
|
) {
|
||||||
widgets::details::SettingsAction::EditInstance(path)
|
widgets::settings::SettingsAction::EditInstance(path)
|
||||||
| widgets::details::SettingsAction::EditGlobal(path) => {
|
| widgets::settings::SettingsAction::EditGlobal(path) => {
|
||||||
self.pending_editor = Some(path);
|
self.pending_editor = Some(path);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
widgets::details::SettingsAction::ToggleDesktop => {
|
widgets::settings::SettingsAction::ToggleDesktop => {
|
||||||
if let Some(inst) = self.instances_state.selected_instance() {
|
if let Some(inst) = self.instances_state.selected_instance() {
|
||||||
let name = inst.name.clone();
|
let name = inst.name.clone();
|
||||||
match crate::instance::desktop::toggle(inst) {
|
match crate::instance::desktop::toggle(inst) {
|
||||||
@@ -166,7 +173,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
widgets::details::SettingsAction::None => {}
|
widgets::settings::SettingsAction::None => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +185,8 @@ impl App {
|
|||||||
import_modpack::handle_key(&key_event, &mut self.instances_state);
|
import_modpack::handle_key(&key_event, &mut self.instances_state);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if self.focused == FocusedArea::Instances && self.instances_state.renaming.is_some() {
|
if self.focused == FocusedArea::Instances && self.instances_state.renaming.is_some()
|
||||||
|
{
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
let new_name = self.instances_state.renaming.take().unwrap_or_default();
|
let new_name = self.instances_state.renaming.take().unwrap_or_default();
|
||||||
@@ -267,7 +275,7 @@ impl App {
|
|||||||
.instances_dir
|
.instances_dir
|
||||||
.join(&instance.name)
|
.join(&instance.name)
|
||||||
.join(".minecraft");
|
.join(".minecraft");
|
||||||
if let Err(e) = open::that(&dir) {
|
if let Err(e) = open::that_detached(&dir) {
|
||||||
tracing::error!("Failed to open instance directory: {}", e);
|
tracing::error!("Failed to open instance directory: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -34,13 +34,13 @@ fn push_app_log(line: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns a WorkerGuard that must be held alive for the duration of the
|
// returns a WorkerGuard that must be held alive for the duration of the
|
||||||
// program, otherwise the file logging thread gets dropped immediately.
|
// program, otherwise the file logging thread gets dropped immediately.
|
||||||
// yes, you will spend 30 minutes debugging "why aren't my logs writing"
|
// yes, you will spend 30 minutes debugging "why aren't my logs writing"
|
||||||
// before you remember this. ask me how i know.
|
// before you remember this. ask me how i know.
|
||||||
pub fn init() -> WorkerGuard {
|
pub fn init() -> WorkerGuard {
|
||||||
let log_dir = match dirs_next::cache_dir() {
|
let log_dir = match dirs_next::cache_dir() {
|
||||||
Some(d) => d.join("mcl"),
|
Some(d) => d.join("rmcl"),
|
||||||
None => std::path::PathBuf::from("./cache"),
|
None => std::path::PathBuf::from("./cache"),
|
||||||
};
|
};
|
||||||
match std::fs::create_dir_all(&log_dir) {
|
match std::fs::create_dir_all(&log_dir) {
|
||||||
@@ -55,7 +55,7 @@ pub fn init() -> WorkerGuard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S");
|
let now = chrono::Local::now().format("%Y-%m-%d_%H-%M-%S");
|
||||||
let file_appender = tracing_appender::rolling::never(&log_dir, format!("mcl_{now}.log"));
|
let file_appender = tracing_appender::rolling::never(&log_dir, format!("rmcl_{now}.log"));
|
||||||
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
|
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
|
||||||
|
|
||||||
let env_filter = EnvFilter::builder()
|
let env_filter = EnvFilter::builder()
|
||||||
|
|||||||
@@ -12,6 +12,18 @@ pub mod widgets;
|
|||||||
pub type Tui = ratatui::DefaultTerminal;
|
pub type Tui = ratatui::DefaultTerminal;
|
||||||
|
|
||||||
pub async fn show() -> color_eyre::Result<()> {
|
pub async fn show() -> color_eyre::Result<()> {
|
||||||
|
// restore the terminal before printing a panic. without this, a panic
|
||||||
|
// leaves raw mode + alternate screen active and looks like a freeze
|
||||||
|
let default_hook = std::panic::take_hook();
|
||||||
|
std::panic::set_hook(Box::new(move |info| {
|
||||||
|
let _ = crossterm::execute!(
|
||||||
|
std::io::stdout(),
|
||||||
|
crossterm::event::PopKeyboardEnhancementFlags
|
||||||
|
);
|
||||||
|
ratatui::restore();
|
||||||
|
default_hook(info);
|
||||||
|
}));
|
||||||
|
|
||||||
let mut terminal = ratatui::init();
|
let mut terminal = ratatui::init();
|
||||||
|
|
||||||
// opt into enhanced keyboard protocol to distinguish key press vs release
|
// opt into enhanced keyboard protocol to distinguish key press vs release
|
||||||
|
|||||||
+35
-16
@@ -4,22 +4,24 @@
|
|||||||
// popups and error toasts render on top of everything.
|
// popups and error toasts render on top of everything.
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::{Constraint, Direction, Layout},
|
|
||||||
Frame,
|
Frame,
|
||||||
|
layout::{Constraint, Direction, Layout},
|
||||||
};
|
};
|
||||||
use tachyonfx::{fx, EffectRenderer, Interpolation, Motion};
|
use tachyonfx::{EffectRenderer, Interpolation, Motion, fx};
|
||||||
|
|
||||||
use super::app::{App, ErrorEffectState, FocusedArea};
|
use super::app::{App, ErrorEffectState, FocusedArea};
|
||||||
use super::widgets::{self, popups::confirm as confirm_popup, popups::import_modpack, popups::new_instance};
|
use super::widgets::{
|
||||||
|
self, popups::confirm as confirm_popup, popups::import_modpack, popups::new_instance,
|
||||||
|
};
|
||||||
use crate::tui::error_buffer;
|
use crate::tui::error_buffer;
|
||||||
use crate::tui::widgets::popups::confirm::{confirm_popup_area, ConfirmPopup};
|
use crate::tui::widgets::popups::confirm::{ConfirmPopup, confirm_popup_area};
|
||||||
use crate::tui::widgets::popups::error::{popup_area, ErrorPopup};
|
use crate::tui::widgets::popups::error::{ErrorPopup, popup_area};
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub(super) fn render_frame(&mut self, frame: &mut Frame) {
|
pub(super) fn render_frame(&mut self, frame: &mut Frame) {
|
||||||
use crate::config::theme::THEME;
|
use crate::config::theme::THEME;
|
||||||
use ratatui::widgets::Block;
|
|
||||||
use ratatui::style::Style;
|
use ratatui::style::Style;
|
||||||
|
use ratatui::widgets::Block;
|
||||||
|
|
||||||
let theme = THEME.as_ref();
|
let theme = THEME.as_ref();
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
@@ -29,10 +31,7 @@ impl App {
|
|||||||
|
|
||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([
|
.constraints([Constraint::Percentage(20), Constraint::Percentage(80)])
|
||||||
Constraint::Percentage(20),
|
|
||||||
Constraint::Percentage(80),
|
|
||||||
])
|
|
||||||
.split(frame.area());
|
.split(frame.area());
|
||||||
|
|
||||||
widgets::instances::render(frame, chunks[0], self.focused, &mut self.instances_state);
|
widgets::instances::render(frame, chunks[0], self.focused, &mut self.instances_state);
|
||||||
@@ -83,7 +82,7 @@ impl App {
|
|||||||
self.focused,
|
self.focused,
|
||||||
&mut self.account_state,
|
&mut self.account_state,
|
||||||
);
|
);
|
||||||
widgets::details::render(
|
widgets::settings::render(
|
||||||
frame,
|
frame,
|
||||||
bottom_chunks[1],
|
bottom_chunks[1],
|
||||||
self.focused,
|
self.focused,
|
||||||
@@ -136,7 +135,7 @@ impl App {
|
|||||||
// full-screen log viewer with search highlighting and auto-scroll.
|
// full-screen log viewer with search highlighting and auto-scroll.
|
||||||
// auto-sticks to the bottom unless the user scrolled up manually
|
// auto-sticks to the bottom unless the user scrolled up manually
|
||||||
fn render_log_overlay(&mut self, frame: &mut Frame) {
|
fn render_log_overlay(&mut self, frame: &mut Frame) {
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crate::tui::logging::get_app_logs;
|
use crate::tui::logging::get_app_logs;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::{Alignment, Margin},
|
layout::{Alignment, Margin},
|
||||||
@@ -247,7 +246,13 @@ impl App {
|
|||||||
for event in events {
|
for event in events {
|
||||||
self.error_effects.entry(event.id).or_insert_with(|| {
|
self.error_effects.entry(event.id).or_insert_with(|| {
|
||||||
ErrorEffectState::SlidingIn(
|
ErrorEffectState::SlidingIn(
|
||||||
fx::slide_in(Motion::RightToLeft, 4, 0, bg, (250, Interpolation::CubicOut)),
|
fx::slide_in(
|
||||||
|
Motion::RightToLeft,
|
||||||
|
4,
|
||||||
|
0,
|
||||||
|
bg,
|
||||||
|
(250, Interpolation::CubicOut),
|
||||||
|
),
|
||||||
std::time::Instant::now(),
|
std::time::Instant::now(),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@@ -278,7 +283,13 @@ impl App {
|
|||||||
.or_insert(ErrorEffectState::Idle);
|
.or_insert(ErrorEffectState::Idle);
|
||||||
if !matches!(entry, ErrorEffectState::FadingOut(..)) {
|
if !matches!(entry, ErrorEffectState::FadingOut(..)) {
|
||||||
*entry = ErrorEffectState::FadingOut(
|
*entry = ErrorEffectState::FadingOut(
|
||||||
fx::slide_out(Motion::LeftToRight, 4, 0, bg, (fly_out_ms as u32, Interpolation::CubicIn)),
|
fx::slide_out(
|
||||||
|
Motion::LeftToRight,
|
||||||
|
4,
|
||||||
|
0,
|
||||||
|
bg,
|
||||||
|
(fly_out_ms as u32, Interpolation::CubicIn),
|
||||||
|
),
|
||||||
std::time::Instant::now(),
|
std::time::Instant::now(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -289,7 +300,11 @@ impl App {
|
|||||||
ErrorEffectState::SlidingIn(effect, started) => {
|
ErrorEffectState::SlidingIn(effect, started) => {
|
||||||
let dt = started.elapsed().as_millis() as u32;
|
let dt = started.elapsed().as_millis() as u32;
|
||||||
if effect.running() {
|
if effect.running() {
|
||||||
frame.render_effect(effect, area, tachyonfx::Duration::from_millis(dt.min(32)));
|
frame.render_effect(
|
||||||
|
effect,
|
||||||
|
area,
|
||||||
|
tachyonfx::Duration::from_millis(dt.min(32)),
|
||||||
|
);
|
||||||
*started = std::time::Instant::now();
|
*started = std::time::Instant::now();
|
||||||
} else {
|
} else {
|
||||||
*effect_state = ErrorEffectState::Idle;
|
*effect_state = ErrorEffectState::Idle;
|
||||||
@@ -299,7 +314,11 @@ impl App {
|
|||||||
ErrorEffectState::FadingOut(effect, started) => {
|
ErrorEffectState::FadingOut(effect, started) => {
|
||||||
let dt = started.elapsed().as_millis() as u32;
|
let dt = started.elapsed().as_millis() as u32;
|
||||||
if effect.running() {
|
if effect.running() {
|
||||||
frame.render_effect(effect, area, tachyonfx::Duration::from_millis(dt.min(32)));
|
frame.render_effect(
|
||||||
|
effect,
|
||||||
|
area,
|
||||||
|
tachyonfx::Duration::from_millis(dt.min(32)),
|
||||||
|
);
|
||||||
*started = std::time::Instant::now();
|
*started = std::time::Instant::now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-38
@@ -6,17 +6,17 @@ use std::sync::{Arc, Mutex};
|
|||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Block, Borders, Paragraph, Widget},
|
widgets::{Block, Borders, Paragraph, Widget},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
||||||
|
|
||||||
use crate::auth::{self, AccountStore, AccountType, AuthResult, DeviceCodeInfo};
|
use crate::auth::{self, AccountStore, AccountType, AuthResult, DeviceCodeInfo};
|
||||||
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crate::tui::app::FocusedArea;
|
use crate::tui::app::FocusedArea;
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
|
||||||
|
|
||||||
use super::styled_title;
|
use super::styled_title;
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ pub enum AddMode {
|
|||||||
None,
|
None,
|
||||||
ChooseType,
|
ChooseType,
|
||||||
OfflineNameInput(String),
|
OfflineNameInput(String),
|
||||||
|
OfflineBlocked,
|
||||||
ConfirmDelete(usize),
|
ConfirmDelete(usize),
|
||||||
DeviceCodeWaiting {
|
DeviceCodeWaiting {
|
||||||
info: DeviceCodeInfo,
|
info: DeviceCodeInfo,
|
||||||
@@ -59,11 +60,10 @@ impl AccountState {
|
|||||||
// can't block on it because the TUI needs to keep rendering
|
// can't block on it because the TUI needs to keep rendering
|
||||||
pub fn drain_auth_result(&mut self) {
|
pub fn drain_auth_result(&mut self) {
|
||||||
if let AddMode::DeviceCodeWaiting { pending, .. } = &self.add_mode {
|
if let AddMode::DeviceCodeWaiting { pending, .. } = &self.add_mode {
|
||||||
let result = match pending.lock() { Ok(mut slot) => {
|
let result = match pending.lock() {
|
||||||
slot.take()
|
Ok(mut slot) => slot.take(),
|
||||||
} _ => {
|
_ => None,
|
||||||
None
|
};
|
||||||
}};
|
|
||||||
|
|
||||||
if let Some(result) = result {
|
if let Some(result) = result {
|
||||||
match result {
|
match result {
|
||||||
@@ -99,7 +99,11 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut AccountState) -> bool {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
KeyCode::Char('o') | KeyCode::Char('2') => {
|
KeyCode::Char('o') | KeyCode::Char('2') => {
|
||||||
state.add_mode = AddMode::OfflineNameInput(String::new());
|
state.add_mode = if state.store.has_microsoft_account() {
|
||||||
|
AddMode::OfflineNameInput(String::new())
|
||||||
|
} else {
|
||||||
|
AddMode::OfflineBlocked
|
||||||
|
};
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
@@ -112,13 +116,19 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut AccountState) -> bool {
|
|||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
let trimmed = name.trim().to_string();
|
let trimmed = name.trim().to_string();
|
||||||
if !trimmed.is_empty() {
|
if !trimmed.is_empty() {
|
||||||
let account = auth::create_offline_account(&trimmed);
|
if state.store.has_microsoft_account() {
|
||||||
state.store.add(account);
|
let account = auth::create_offline_account(&trimmed);
|
||||||
if state.list_state.selected.is_none() && !state.store.accounts.is_empty() {
|
state.store.add(account);
|
||||||
state.list_state.selected = Some(0);
|
if state.list_state.selected.is_none() && !state.store.accounts.is_empty() {
|
||||||
|
state.list_state.selected = Some(0);
|
||||||
|
}
|
||||||
|
state.add_mode = AddMode::None;
|
||||||
|
} else {
|
||||||
|
state.add_mode = AddMode::OfflineBlocked;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
state.add_mode = AddMode::None;
|
||||||
}
|
}
|
||||||
state.add_mode = AddMode::None;
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
KeyCode::Char(c) => {
|
KeyCode::Char(c) => {
|
||||||
@@ -139,6 +149,13 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut AccountState) -> bool {
|
|||||||
}
|
}
|
||||||
_ => true,
|
_ => true,
|
||||||
},
|
},
|
||||||
|
AddMode::OfflineBlocked => match key_event.code {
|
||||||
|
KeyCode::Enter | KeyCode::Esc => {
|
||||||
|
state.add_mode = AddMode::None;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
_ => true,
|
||||||
|
},
|
||||||
AddMode::DeviceCodeWaiting { .. } => match key_event.code {
|
AddMode::DeviceCodeWaiting { .. } => match key_event.code {
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
state.add_mode = AddMode::None;
|
state.add_mode = AddMode::None;
|
||||||
@@ -210,11 +227,12 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut AccountState) -> bool {
|
|||||||
pub fn drain_device_code(state: &mut AccountState) {
|
pub fn drain_device_code(state: &mut AccountState) {
|
||||||
if let AddMode::DeviceCodeWaiting { info, .. } = &mut state.add_mode
|
if let AddMode::DeviceCodeWaiting { info, .. } = &mut state.add_mode
|
||||||
&& info.user_code.is_empty()
|
&& info.user_code.is_empty()
|
||||||
&& let Ok(mut slot) = auth::DEVICE_CODE_DISPLAY.lock()
|
&& let Ok(mut slot) = auth::DEVICE_CODE_DISPLAY.lock()
|
||||||
&& let Some(dc_info) = slot.take() {
|
&& let Some(dc_info) = slot.take()
|
||||||
info.user_code = dc_info.user_code;
|
{
|
||||||
info.verification_uri = dc_info.verification_uri;
|
info.user_code = dc_info.user_code;
|
||||||
}
|
info.verification_uri = dc_info.verification_uri;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut AccountState) {
|
pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut AccountState) {
|
||||||
@@ -246,8 +264,7 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut A
|
|||||||
|
|
||||||
if state.store.accounts.is_empty() {
|
if state.store.accounts.is_empty() {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("No accounts.")
|
Paragraph::new("No accounts.").style(Style::default().fg(theme.text_dim())),
|
||||||
.style(Style::default().fg(theme.text_dim())),
|
|
||||||
inner,
|
inner,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -258,6 +275,7 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut A
|
|||||||
match &state.add_mode {
|
match &state.add_mode {
|
||||||
AddMode::ChooseType => render_choose_popup(frame),
|
AddMode::ChooseType => render_choose_popup(frame),
|
||||||
AddMode::OfflineNameInput(name) => render_offline_popup(frame, name),
|
AddMode::OfflineNameInput(name) => render_offline_popup(frame, name),
|
||||||
|
AddMode::OfflineBlocked => render_offline_blocked_popup(frame),
|
||||||
AddMode::ConfirmDelete(idx) => render_confirm_delete(frame, state, *idx),
|
AddMode::ConfirmDelete(idx) => render_confirm_delete(frame, state, *idx),
|
||||||
AddMode::DeviceCodeWaiting { info, .. } => render_device_code_popup(frame, info),
|
AddMode::DeviceCodeWaiting { info, .. } => render_device_code_popup(frame, info),
|
||||||
AddMode::None => {}
|
AddMode::None => {}
|
||||||
@@ -299,7 +317,9 @@ fn render_account_list(
|
|||||||
let active_marker = if *is_active { "\u{25b8} " } else { " " };
|
let active_marker = if *is_active { "\u{25b8} " } else { " " };
|
||||||
|
|
||||||
let style = if show_selected {
|
let style = if show_selected {
|
||||||
Style::default().fg(theme.accent()).add_modifier(Modifier::BOLD)
|
Style::default()
|
||||||
|
.fg(theme.accent())
|
||||||
|
.add_modifier(Modifier::BOLD)
|
||||||
} else if *is_active {
|
} else if *is_active {
|
||||||
Style::default()
|
Style::default()
|
||||||
.fg(theme.text())
|
.fg(theme.text())
|
||||||
@@ -315,7 +335,9 @@ fn render_account_list(
|
|||||||
|
|
||||||
if *acc_type == AccountType::Offline {
|
if *acc_type == AccountType::Offline {
|
||||||
let offline_style = if show_selected {
|
let offline_style = if show_selected {
|
||||||
Style::default().fg(theme.accent()).add_modifier(Modifier::BOLD)
|
Style::default()
|
||||||
|
.fg(theme.accent())
|
||||||
|
.add_modifier(Modifier::BOLD)
|
||||||
} else {
|
} else {
|
||||||
Style::default().fg(theme.text_dim())
|
Style::default().fg(theme.text_dim())
|
||||||
};
|
};
|
||||||
@@ -372,10 +394,7 @@ fn render_choose_popup(frame: &mut Frame) {
|
|||||||
.fg(accent_color)
|
.fg(accent_color)
|
||||||
.add_modifier(Modifier::BOLD),
|
.add_modifier(Modifier::BOLD),
|
||||||
),
|
),
|
||||||
Span::styled(
|
Span::styled("Microsoft Account", Style::default().fg(text_color)),
|
||||||
"Microsoft Account",
|
|
||||||
Style::default().fg(text_color),
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
Span::styled(
|
Span::styled(
|
||||||
@@ -384,10 +403,7 @@ fn render_choose_popup(frame: &mut Frame) {
|
|||||||
.fg(accent_color)
|
.fg(accent_color)
|
||||||
.add_modifier(Modifier::BOLD),
|
.add_modifier(Modifier::BOLD),
|
||||||
),
|
),
|
||||||
Span::styled(
|
Span::styled("Offline Account", Style::default().fg(text_color)),
|
||||||
"Offline Account",
|
|
||||||
Style::default().fg(text_color),
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
Paragraph::new(text).render(inner, buf);
|
Paragraph::new(text).render(inner, buf);
|
||||||
@@ -422,10 +438,7 @@ fn render_offline_popup(frame: &mut Frame, name: &str) {
|
|||||||
content: Box::new(move |inner, buf| {
|
content: Box::new(move |inner, buf| {
|
||||||
let line = if name.is_empty() {
|
let line = if name.is_empty() {
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
Span::styled(
|
Span::styled("Username...", Style::default().fg(dim_color)),
|
||||||
"Username...",
|
|
||||||
Style::default().fg(dim_color),
|
|
||||||
),
|
|
||||||
Span::styled(
|
Span::styled(
|
||||||
"\u{2588}",
|
"\u{2588}",
|
||||||
Style::default()
|
Style::default()
|
||||||
@@ -450,6 +463,36 @@ fn render_offline_popup(frame: &mut Frame, name: &str) {
|
|||||||
.render(area, frame.buffer_mut());
|
.render(area, frame.buffer_mut());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn render_offline_blocked_popup(frame: &mut Frame) {
|
||||||
|
use super::popups::{base::PopupFrame, keybind_line};
|
||||||
|
let theme = THEME.as_ref();
|
||||||
|
let area = popup_area(frame, 58, 5);
|
||||||
|
|
||||||
|
let border_color = theme.text_dim();
|
||||||
|
let bg_color = theme.surface();
|
||||||
|
let text_color = theme.text();
|
||||||
|
|
||||||
|
PopupFrame {
|
||||||
|
title: Line::from(Span::styled(
|
||||||
|
" Offline Account ",
|
||||||
|
Style::default()
|
||||||
|
.fg(border_color)
|
||||||
|
.add_modifier(Modifier::BOLD),
|
||||||
|
))
|
||||||
|
.centered(),
|
||||||
|
border_color,
|
||||||
|
bg: Some(bg_color),
|
||||||
|
keybinds: Some(keybind_line(&[("Enter", " close")])),
|
||||||
|
search_line: None,
|
||||||
|
content: Box::new(move |inner, buf| {
|
||||||
|
Paragraph::new("Add a Microsoft account that owns Minecraft first.")
|
||||||
|
.style(Style::default().fg(text_color))
|
||||||
|
.render(inner, buf);
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
.render(area, frame.buffer_mut());
|
||||||
|
}
|
||||||
|
|
||||||
fn render_confirm_delete(frame: &mut Frame, state: &AccountState, idx: usize) {
|
fn render_confirm_delete(frame: &mut Frame, state: &AccountState, idx: usize) {
|
||||||
use super::popups::{base::PopupFrame, keybind_line};
|
use super::popups::{base::PopupFrame, keybind_line};
|
||||||
let theme = THEME.as_ref();
|
let theme = THEME.as_ref();
|
||||||
@@ -534,10 +577,7 @@ fn render_device_code_popup(frame: &mut Frame, info: &DeviceCodeInfo) {
|
|||||||
)),
|
)),
|
||||||
Line::from(""),
|
Line::from(""),
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
Span::styled(
|
Span::styled("Enter code: ", Style::default().fg(dim_color)),
|
||||||
"Enter code: ",
|
|
||||||
Style::default().fg(dim_color),
|
|
||||||
),
|
|
||||||
Span::styled(
|
Span::styled(
|
||||||
code.as_str(),
|
code.as_str(),
|
||||||
Style::default()
|
Style::default()
|
||||||
|
|||||||
+339
-80
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex, mpsc};
|
||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
@@ -21,14 +21,21 @@ use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
|||||||
use crate::config::theme::THEME;
|
use crate::config::theme::THEME;
|
||||||
use crate::instance::content::mods::{ContentEntry, IconCell};
|
use crate::instance::content::mods::{ContentEntry, IconCell};
|
||||||
|
|
||||||
type PendingContent = Arc<Mutex<Option<(String, Vec<ContentEntry>)>>>;
|
|
||||||
type SnapshotRow = (String, String, bool, Option<Vec<Vec<IconCell>>>);
|
type SnapshotRow = (String, String, bool, Option<Vec<Vec<IconCell>>>);
|
||||||
|
type ScanOneFn = fn(&Path, &str, bool) -> ContentEntry;
|
||||||
|
|
||||||
struct CachedList {
|
struct CachedList {
|
||||||
entries: Vec<ContentEntry>,
|
entries: Vec<ContentEntry>,
|
||||||
selected: Option<usize>,
|
selected: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// result from the notify-triggered background diff
|
||||||
|
struct WatcherDiff {
|
||||||
|
toggled: Vec<(String, bool, std::path::PathBuf)>,
|
||||||
|
removed: Vec<String>,
|
||||||
|
added: Vec<ContentEntry>,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct ContentListState {
|
pub struct ContentListState {
|
||||||
pub entries: Vec<ContentEntry>,
|
pub entries: Vec<ContentEntry>,
|
||||||
pub list_state: TuiListState,
|
pub list_state: TuiListState,
|
||||||
@@ -37,10 +44,16 @@ pub struct ContentListState {
|
|||||||
pub loading: bool,
|
pub loading: bool,
|
||||||
pub search: crate::tui::widgets::search::SearchState,
|
pub search: crate::tui::widgets::search::SearchState,
|
||||||
cache: HashMap<String, CachedList>,
|
cache: HashMap<String, CachedList>,
|
||||||
pending: PendingContent,
|
// streaming: individual entries arrive here during initial load
|
||||||
check_counter: u16,
|
stream_rx: Option<mpsc::Receiver<ContentEntry>>,
|
||||||
|
// file watcher: notify callback spawns background work,
|
||||||
|
// precomputed diff lands here for the UI to pick up
|
||||||
|
watcher_diff: Arc<Mutex<Option<WatcherDiff>>>,
|
||||||
|
_watcher: Option<notify::RecommendedWatcher>,
|
||||||
watched_dir: Option<std::path::PathBuf>,
|
watched_dir: Option<std::path::PathBuf>,
|
||||||
last_dir_mtime: Option<std::time::SystemTime>,
|
// stored for the watcher to scan individual new files
|
||||||
|
scan_one_fn: Option<ScanOneFn>,
|
||||||
|
content_ext: Option<&'static str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ContentListState {
|
impl Default for ContentListState {
|
||||||
@@ -53,41 +66,229 @@ impl Default for ContentListState {
|
|||||||
loading: false,
|
loading: false,
|
||||||
search: crate::tui::widgets::search::SearchState::default(),
|
search: crate::tui::widgets::search::SearchState::default(),
|
||||||
cache: HashMap::new(),
|
cache: HashMap::new(),
|
||||||
pending: Arc::new(Mutex::new(None)),
|
stream_rx: None,
|
||||||
check_counter: 0,
|
watcher_diff: Arc::new(Mutex::new(None)),
|
||||||
|
_watcher: None,
|
||||||
watched_dir: None,
|
watched_dir: None,
|
||||||
last_dir_mtime: None,
|
scan_one_fn: None,
|
||||||
|
content_ext: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ContentListState {
|
impl ContentListState {
|
||||||
// poll the content directory for changes every ~120 ticks.
|
// drain streaming entries from the initial load. each entry arrives
|
||||||
// if the dir's mtime changed, invalidate the cache to pick up
|
// individually and is inserted in sorted position for a smooth fill-in
|
||||||
// mods/packs the user dropped in from outside the launcher
|
pub fn drain_pending(&mut self) {
|
||||||
pub fn try_rescan(&mut self) {
|
let Some(rx) = &self.stream_rx else {
|
||||||
self.check_counter = self.check_counter.wrapping_add(1);
|
|
||||||
if !self.check_counter.is_multiple_of(120) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let Some(dir) = &self.watched_dir else {
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let current_mtime = std::fs::metadata(dir).ok().and_then(|m| m.modified().ok());
|
let mut received = false;
|
||||||
|
let mut finished = false;
|
||||||
if current_mtime != self.last_dir_mtime {
|
loop {
|
||||||
self.last_dir_mtime = current_mtime;
|
match rx.try_recv() {
|
||||||
if let Some(name) = &self.loaded_for {
|
Ok(entry) => {
|
||||||
self.cache.remove(name);
|
received = true;
|
||||||
self.loaded_for = None;
|
let pos = self
|
||||||
|
.entries
|
||||||
|
.binary_search_by(|e| {
|
||||||
|
e.name.to_lowercase().cmp(&entry.name.to_lowercase())
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|i| i);
|
||||||
|
self.entries.insert(pos, entry);
|
||||||
|
}
|
||||||
|
Err(mpsc::TryRecvError::Empty) => break,
|
||||||
|
Err(mpsc::TryRecvError::Disconnected) => {
|
||||||
|
self.stream_rx = None;
|
||||||
|
finished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if received || finished {
|
||||||
|
self.loading = false;
|
||||||
|
if self.list_state.selected.is_none() && !self.entries.is_empty() {
|
||||||
|
self.list_state.selected = Some(0);
|
||||||
|
}
|
||||||
|
self.update_scrollbar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pick up the precomputed diff from the notify watcher callback.
|
||||||
|
// skip while streaming is in progress to avoid duplicate entries.
|
||||||
|
pub fn drain_watcher(&mut self) {
|
||||||
|
if self.stream_rx.is_some() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let diff = match self.watcher_diff.lock() {
|
||||||
|
Ok(mut slot) => slot.take(),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
let Some(diff) = diff else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
// apply toggles (enabled/path changes)
|
||||||
|
for (stem, enabled, path) in &diff.toggled {
|
||||||
|
if let Some(entry) = self.entries.iter_mut().find(|e| &e.file_stem == stem) {
|
||||||
|
entry.enabled = *enabled;
|
||||||
|
entry.path = path.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply removals
|
||||||
|
if !diff.removed.is_empty() {
|
||||||
|
self.entries
|
||||||
|
.retain(|e| !diff.removed.contains(&e.file_stem));
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert new entries in sorted position
|
||||||
|
for entry in diff.added {
|
||||||
|
let pos = self
|
||||||
|
.entries
|
||||||
|
.binary_search_by(|e| e.name.to_lowercase().cmp(&entry.name.to_lowercase()))
|
||||||
|
.unwrap_or_else(|i| i);
|
||||||
|
self.entries.insert(pos, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clamp selected
|
||||||
|
if let Some(sel) = self.list_state.selected {
|
||||||
|
if self.entries.is_empty() {
|
||||||
|
self.list_state.selected = None;
|
||||||
|
} else {
|
||||||
|
self.list_state.selected =
|
||||||
|
Some(sel.min(self.entries.len().saturating_sub(1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.update_scrollbar();
|
||||||
|
}
|
||||||
|
|
||||||
|
// starts a notify file watcher on the given directory. changes trigger
|
||||||
|
// a background diff that lands in watcher_diff for drain_watcher to apply.
|
||||||
pub fn watch_dir(&mut self, dir: std::path::PathBuf) {
|
pub fn watch_dir(&mut self, dir: std::path::PathBuf) {
|
||||||
self.last_dir_mtime = std::fs::metadata(&dir).ok().and_then(|m| m.modified().ok());
|
use notify::{RecursiveMode, Watcher};
|
||||||
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
|
// drop previous watcher
|
||||||
|
self._watcher = None;
|
||||||
|
|
||||||
|
let watcher_diff = self.watcher_diff.clone();
|
||||||
|
let ext: &'static str = self.content_ext.unwrap_or(".jar");
|
||||||
|
let scan_one = self.scan_one_fn;
|
||||||
|
|
||||||
|
let dirty = Arc::new(AtomicBool::new(false));
|
||||||
|
let running = Arc::new(AtomicBool::new(false));
|
||||||
|
let dirty_cb = dirty.clone();
|
||||||
|
let running_cb = running.clone();
|
||||||
|
|
||||||
|
// initialize known stems from the current directory state so existing
|
||||||
|
// files are not treated as "new" on the first notify event
|
||||||
|
let known_stems = Arc::new(Mutex::new(read_dir_stems(&dir, ext)));
|
||||||
|
|
||||||
|
let watch_dir = dir.clone();
|
||||||
|
let watcher = notify::recommended_watcher(move |res: Result<notify::Event, _>| {
|
||||||
|
if res.is_err() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mark dirty. if a thread is already running it will loop to
|
||||||
|
// pick up the change after its current diff
|
||||||
|
dirty_cb.store(true, Ordering::Relaxed);
|
||||||
|
|
||||||
|
if running_cb.swap(true, Ordering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let dir = watch_dir.clone();
|
||||||
|
let diff_slot = watcher_diff.clone();
|
||||||
|
let dirty = dirty_cb.clone();
|
||||||
|
let running = running_cb.clone();
|
||||||
|
let known = known_stems.clone();
|
||||||
|
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
// always clear `running` even if we panic
|
||||||
|
struct ResetOnDrop(Arc<AtomicBool>);
|
||||||
|
impl Drop for ResetOnDrop {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
self.0.store(false, Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let _guard = ResetOnDrop(running);
|
||||||
|
|
||||||
|
loop {
|
||||||
|
dirty.store(false, Ordering::Relaxed);
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||||
|
|
||||||
|
let result = (|| {
|
||||||
|
let on_disk = read_dir_stems(&dir, ext);
|
||||||
|
let mut known_map = known.lock().ok()?;
|
||||||
|
|
||||||
|
let mut toggled = Vec::new();
|
||||||
|
let mut removed = Vec::new();
|
||||||
|
let mut added = Vec::new();
|
||||||
|
|
||||||
|
for (stem, (old_path, old_enabled)) in known_map.iter() {
|
||||||
|
if let Some((disk_path, disk_enabled)) = on_disk.get(stem) {
|
||||||
|
if *disk_enabled != *old_enabled || *disk_path != *old_path {
|
||||||
|
toggled.push((
|
||||||
|
stem.clone(),
|
||||||
|
*disk_enabled,
|
||||||
|
disk_path.clone(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removed.push(stem.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (stem, (path, enabled)) in &on_disk {
|
||||||
|
if !known_map.contains_key(stem)
|
||||||
|
&& let Some(scan_one) = scan_one
|
||||||
|
{
|
||||||
|
added.push(scan_one(path, stem, *enabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*known_map = on_disk;
|
||||||
|
|
||||||
|
Some(WatcherDiff {
|
||||||
|
toggled,
|
||||||
|
removed,
|
||||||
|
added,
|
||||||
|
})
|
||||||
|
})();
|
||||||
|
|
||||||
|
if let Some(diff) = result
|
||||||
|
&& let Ok(mut slot) = diff_slot.lock()
|
||||||
|
{
|
||||||
|
*slot = Some(diff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if !dirty.load(Ordering::Relaxed) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
match watcher {
|
||||||
|
Ok(mut w) => {
|
||||||
|
if let Err(e) = w.watch(&dir, RecursiveMode::NonRecursive) {
|
||||||
|
tracing::warn!("Failed to watch {}: {e}", dir.display());
|
||||||
|
} else {
|
||||||
|
self._watcher = Some(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
tracing::warn!("Failed to create file watcher: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.watched_dir = Some(dir);
|
self.watched_dir = Some(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,11 +304,19 @@ impl ContentListState {
|
|||||||
|
|
||||||
impl ContentListState {
|
impl ContentListState {
|
||||||
// saves current entries to cache before loading new ones, and restores
|
// saves current entries to cache before loading new ones, and restores
|
||||||
// from cache if this instance was seen before (avoids re-scanning)
|
// from cache if this instance was seen before (avoids re-scanning).
|
||||||
pub fn start_load<F>(&mut self, instances_dir: &Path, instance_name: &str, scan_fn: F)
|
// content_dir is the actual directory to scan (e.g. .minecraft/mods).
|
||||||
where
|
pub fn start_load(
|
||||||
F: FnOnce(&Path, &str) -> Vec<ContentEntry> + Send + 'static,
|
&mut self,
|
||||||
{
|
content_dir: &Path,
|
||||||
|
instance_name: &str,
|
||||||
|
scan_one_fn: ScanOneFn,
|
||||||
|
ext: &'static str,
|
||||||
|
) {
|
||||||
|
self.scan_one_fn = Some(scan_one_fn);
|
||||||
|
self.content_ext = Some(ext);
|
||||||
|
|
||||||
|
// save current entries to cache
|
||||||
if let Some(prev) = self.loaded_for.take()
|
if let Some(prev) = self.loaded_for.take()
|
||||||
&& !self.entries.is_empty()
|
&& !self.entries.is_empty()
|
||||||
{
|
{
|
||||||
@@ -120,68 +329,64 @@ impl ContentListState {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try cache first
|
||||||
if let Some(cached) = self.cache.remove(instance_name) {
|
if let Some(cached) = self.cache.remove(instance_name) {
|
||||||
self.entries = cached.entries;
|
self.entries = cached.entries;
|
||||||
self.list_state.selected = cached.selected;
|
self.list_state.selected = cached.selected;
|
||||||
self.loading = false;
|
self.loading = false;
|
||||||
} else {
|
self.stream_rx = None;
|
||||||
self.entries.clear();
|
self.loaded_for = Some(instance_name.to_string());
|
||||||
self.list_state = TuiListState::default();
|
self.update_scrollbar();
|
||||||
self.loading = true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no cache, stream entries one by one as each file is scanned
|
||||||
|
self.entries.clear();
|
||||||
|
self.list_state = TuiListState::default();
|
||||||
|
self.loading = true;
|
||||||
self.loaded_for = Some(instance_name.to_string());
|
self.loaded_for = Some(instance_name.to_string());
|
||||||
self.update_scrollbar();
|
self.update_scrollbar();
|
||||||
|
|
||||||
let dir = instances_dir.to_path_buf();
|
let (tx, rx) = mpsc::channel();
|
||||||
let tag = instance_name.to_string();
|
self.stream_rx = Some(rx);
|
||||||
let pending = self.pending.clone();
|
|
||||||
|
let dir = content_dir.to_path_buf();
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let scan_dir = dir.clone();
|
let _ = tokio::task::spawn_blocking(move || {
|
||||||
let scan_name = tag.clone();
|
let read_dir = match std::fs::read_dir(&dir) {
|
||||||
let entries = tokio::task::spawn_blocking(move || scan_fn(&scan_dir, &scan_name))
|
Ok(rd) => rd,
|
||||||
.await
|
Err(_) => return,
|
||||||
.unwrap_or_default();
|
};
|
||||||
|
let disabled_ext = format!("{ext}.disabled");
|
||||||
|
|
||||||
if let Ok(mut slot) = pending.lock() {
|
for dir_entry in read_dir.flatten() {
|
||||||
*slot = Some((tag, entries));
|
let path = dir_entry.path();
|
||||||
}
|
let Some(fname) = path.file_name().and_then(|n| n.to_str()) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
let (enabled, file_stem) =
|
||||||
|
if let Some(stem) = fname.strip_suffix(&disabled_ext) {
|
||||||
|
(false, stem.to_owned())
|
||||||
|
} else if let Some(stem) = fname.strip_suffix(ext) {
|
||||||
|
(true, stem.to_owned())
|
||||||
|
} else if path.is_dir() {
|
||||||
|
crate::instance::content::parse_enabled_stem_dir(fname)
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
let entry = scan_one_fn(&path, &file_stem, enabled);
|
||||||
|
if tx.send(entry).is_err() {
|
||||||
|
break; // receiver dropped (instance switched)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn drain_pending(&mut self) {
|
|
||||||
let taken = match self.pending.lock() {
|
|
||||||
Ok(mut slot) => slot.take(),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some((instance_name, entries)) = taken
|
|
||||||
&& (self.loaded_for.as_deref() == Some(&instance_name) || instance_name.is_empty())
|
|
||||||
{
|
|
||||||
let selected_name = self
|
|
||||||
.list_state
|
|
||||||
.selected
|
|
||||||
.and_then(|i| self.entries.get(i))
|
|
||||||
.map(|e| e.name.clone());
|
|
||||||
|
|
||||||
self.entries = entries;
|
|
||||||
self.loading = false;
|
|
||||||
|
|
||||||
if !self.entries.is_empty() {
|
|
||||||
let new_index = selected_name
|
|
||||||
.and_then(|name| self.entries.iter().position(|e| e.name == name))
|
|
||||||
.or(self.list_state.selected)
|
|
||||||
.map(|i| i.min(self.entries.len().saturating_sub(1)))
|
|
||||||
.unwrap_or(0);
|
|
||||||
self.list_state.selected = Some(new_index);
|
|
||||||
} else {
|
|
||||||
self.list_state.selected = None;
|
|
||||||
}
|
|
||||||
self.update_scrollbar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn update_scrollbar(&mut self) {
|
fn update_scrollbar(&mut self) {
|
||||||
let count = self.entries.len();
|
let count = self.entries.len();
|
||||||
let max = count.saturating_sub(1);
|
let max = count.saturating_sub(1);
|
||||||
@@ -233,6 +438,11 @@ impl ContentListState {
|
|||||||
fn handle_search_keys(key_event: &KeyEvent, state: &mut ContentListState) -> bool {
|
fn handle_search_keys(key_event: &KeyEvent, state: &mut ContentListState) -> bool {
|
||||||
if state.search.active {
|
if state.search.active {
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
|
KeyCode::Enter => {
|
||||||
|
state.search.confirm();
|
||||||
|
state.list_state.selected = Some(0);
|
||||||
|
state.update_scrollbar();
|
||||||
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
state.search.deactivate();
|
state.search.deactivate();
|
||||||
state.list_state.selected = Some(0);
|
state.list_state.selected = Some(0);
|
||||||
@@ -286,7 +496,7 @@ pub fn handle_key_no_toggle(key_event: &KeyEvent, state: &mut ContentListState)
|
|||||||
KeyCode::Enter if key_event.modifiers.contains(KeyModifiers::SHIFT) => {
|
KeyCode::Enter if key_event.modifiers.contains(KeyModifiers::SHIFT) => {
|
||||||
if let Some(&real_idx) = state.list_state.selected.and_then(|i| filtered.get(i))
|
if let Some(&real_idx) = state.list_state.selected.and_then(|i| filtered.get(i))
|
||||||
&& let Some(dir) = state.entries[real_idx].path.parent()
|
&& let Some(dir) = state.entries[real_idx].path.parent()
|
||||||
&& let Err(e) = open::that(dir)
|
&& let Err(e) = open::that_detached(dir)
|
||||||
{
|
{
|
||||||
tracing::error!("Failed to open directory: {}", e);
|
tracing::error!("Failed to open directory: {}", e);
|
||||||
}
|
}
|
||||||
@@ -321,7 +531,7 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut ContentListState) -> bool {
|
|||||||
KeyCode::Enter if key_event.modifiers.contains(KeyModifiers::SHIFT) => {
|
KeyCode::Enter if key_event.modifiers.contains(KeyModifiers::SHIFT) => {
|
||||||
if let Some(&real_idx) = state.list_state.selected.and_then(|i| filtered.get(i))
|
if let Some(&real_idx) = state.list_state.selected.and_then(|i| filtered.get(i))
|
||||||
&& let Some(dir) = state.entries[real_idx].path.parent()
|
&& let Some(dir) = state.entries[real_idx].path.parent()
|
||||||
&& let Err(e) = open::that(dir)
|
&& let Err(e) = open::that_detached(dir)
|
||||||
{
|
{
|
||||||
tracing::error!("Failed to open directory: {}", e);
|
tracing::error!("Failed to open directory: {}", e);
|
||||||
}
|
}
|
||||||
@@ -360,6 +570,7 @@ pub fn render(
|
|||||||
let filtered = state.filtered_indices();
|
let filtered = state.filtered_indices();
|
||||||
|
|
||||||
if filtered.is_empty() {
|
if filtered.is_empty() {
|
||||||
|
state.list_state.selected = None;
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new(empty_text).style(Style::default().fg(theme.text_dim())),
|
Paragraph::new(empty_text).style(Style::default().fg(theme.text_dim())),
|
||||||
area,
|
area,
|
||||||
@@ -369,6 +580,13 @@ pub fn render(
|
|||||||
|
|
||||||
let count = filtered.len();
|
let count = filtered.len();
|
||||||
|
|
||||||
|
// clamp selected so the ListView builder never gets an out-of-bounds index
|
||||||
|
if let Some(sel) = state.list_state.selected
|
||||||
|
&& sel >= count
|
||||||
|
{
|
||||||
|
state.list_state.selected = Some(count.saturating_sub(1));
|
||||||
|
}
|
||||||
|
|
||||||
let snapshot: Vec<SnapshotRow> = filtered
|
let snapshot: Vec<SnapshotRow> = filtered
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&i| {
|
.map(|&i| {
|
||||||
@@ -656,3 +874,44 @@ fn icon_spans(icon_pixels: Option<&Vec<Vec<IconCell>>>, row: usize) -> Vec<Span<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reads a content directory and builds a stem -> (path, enabled) map.
|
||||||
|
// used both by watch_dir to initialize known state and by the watcher
|
||||||
|
// thread to detect changes. when ext is empty (worlds), only directories
|
||||||
|
// are included.
|
||||||
|
fn read_dir_stems(
|
||||||
|
dir: &std::path::Path,
|
||||||
|
ext: &str,
|
||||||
|
) -> HashMap<String, (std::path::PathBuf, bool)> {
|
||||||
|
let mut map = HashMap::new();
|
||||||
|
let Ok(read_dir) = std::fs::read_dir(dir) else {
|
||||||
|
return map;
|
||||||
|
};
|
||||||
|
let dirs_only = ext.is_empty();
|
||||||
|
let disabled_ext = format!("{ext}.disabled");
|
||||||
|
|
||||||
|
for dir_entry in read_dir.flatten() {
|
||||||
|
let path = dir_entry.path();
|
||||||
|
let Some(fname) = path.file_name().and_then(|n| n.to_str()) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if dirs_only {
|
||||||
|
if !path.is_dir() && !fname.ends_with(".disabled") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let (enabled, stem) = crate::instance::content::parse_enabled_stem_dir(fname);
|
||||||
|
map.insert(stem, (path, enabled));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if let Some(stem) = fname.strip_suffix(&disabled_ext) {
|
||||||
|
map.insert(stem.to_owned(), (path, false));
|
||||||
|
} else if let Some(stem) = fname.strip_suffix(ext) {
|
||||||
|
map.insert(stem.to_owned(), (path, true));
|
||||||
|
} else if path.is_dir() {
|
||||||
|
let (enabled, stem) = crate::instance::content::parse_enabled_stem_dir(fname);
|
||||||
|
map.insert(stem, (path, enabled));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map
|
||||||
|
}
|
||||||
@@ -3,5 +3,5 @@
|
|||||||
pub mod list;
|
pub mod list;
|
||||||
pub mod tabs;
|
pub mod tabs;
|
||||||
|
|
||||||
pub use tabs::{ContentTab, render, title};
|
|
||||||
pub use list::{ContentListState, handle_key, handle_key_no_toggle};
|
pub use list::{ContentListState, handle_key, handle_key_no_toggle};
|
||||||
|
pub use tabs::{ContentTab, render, title};
|
||||||
@@ -3,16 +3,16 @@
|
|||||||
// also renders the instance name/version header with run state indicators.
|
// also renders the instance name/version header with run state indicators.
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::{Alignment, Constraint, Layout, Rect},
|
layout::{Alignment, Constraint, Layout, Rect},
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Block, Borders, Paragraph},
|
widgets::{Block, Borders, Paragraph},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
use throbber_widgets_tui::{Throbber, ThrobberState};
|
use throbber_widgets_tui::{Throbber, ThrobberState};
|
||||||
|
|
||||||
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crate::tui::app::FocusedArea;
|
use crate::tui::app::FocusedArea;
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
|
||||||
|
|
||||||
use crate::tui::widgets::styled_title;
|
use crate::tui::widgets::styled_title;
|
||||||
|
|
||||||
@@ -200,7 +200,8 @@ pub fn render(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some(kb) = kb {
|
if let Some(kb) = kb {
|
||||||
let lines = crate::tui::widgets::popups::keybind_lines_wrapped(kb, area.width.saturating_sub(2));
|
let lines =
|
||||||
|
crate::tui::widgets::popups::keybind_lines_wrapped(kb, area.width.saturating_sub(2));
|
||||||
for line in lines {
|
for line in lines {
|
||||||
block = block.title_bottom(line);
|
block = block.title_bottom(line);
|
||||||
}
|
}
|
||||||
@@ -214,12 +215,9 @@ pub fn render(
|
|||||||
ContentTab::Mods => {
|
ContentTab::Mods => {
|
||||||
if let Some(instance) = instance {
|
if let Some(instance) = instance {
|
||||||
if mods_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
if mods_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
||||||
mods_state.start_load(
|
let content_dir = instances_dir.join(&instance.name).join(".minecraft").join("mods");
|
||||||
instances_dir,
|
mods_state.start_load(&content_dir, &instance.name, crate::instance::scan_one_mod, ".jar");
|
||||||
&instance.name,
|
mods_state.watch_dir(content_dir);
|
||||||
crate::instance::scan_mods,
|
|
||||||
);
|
|
||||||
mods_state.watch_dir(instances_dir.join(&instance.name).join(".minecraft").join("mods"));
|
|
||||||
}
|
}
|
||||||
super::list::render(
|
super::list::render(
|
||||||
frame,
|
frame,
|
||||||
@@ -240,12 +238,9 @@ pub fn render(
|
|||||||
ContentTab::ResourcePacks => {
|
ContentTab::ResourcePacks => {
|
||||||
if let Some(instance) = instance {
|
if let Some(instance) = instance {
|
||||||
if resource_packs_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
if resource_packs_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
||||||
resource_packs_state.start_load(
|
let content_dir = instances_dir.join(&instance.name).join(".minecraft").join("resourcepacks");
|
||||||
instances_dir,
|
resource_packs_state.start_load(&content_dir, &instance.name, crate::instance::scan_one_resource_pack, ".zip");
|
||||||
&instance.name,
|
resource_packs_state.watch_dir(content_dir);
|
||||||
crate::instance::scan_resource_packs,
|
|
||||||
);
|
|
||||||
resource_packs_state.watch_dir(instances_dir.join(&instance.name).join(".minecraft").join("resourcepacks"));
|
|
||||||
}
|
}
|
||||||
super::list::render(
|
super::list::render(
|
||||||
frame,
|
frame,
|
||||||
@@ -266,12 +261,9 @@ pub fn render(
|
|||||||
ContentTab::Shaders => {
|
ContentTab::Shaders => {
|
||||||
if let Some(instance) = instance {
|
if let Some(instance) = instance {
|
||||||
if shaders_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
if shaders_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
||||||
shaders_state.start_load(
|
let content_dir = instances_dir.join(&instance.name).join(".minecraft").join("shaderpacks");
|
||||||
instances_dir,
|
shaders_state.start_load(&content_dir, &instance.name, crate::instance::scan_one_shader, ".zip");
|
||||||
&instance.name,
|
shaders_state.watch_dir(content_dir);
|
||||||
crate::instance::scan_shaders,
|
|
||||||
);
|
|
||||||
shaders_state.watch_dir(instances_dir.join(&instance.name).join(".minecraft").join("shaderpacks"));
|
|
||||||
}
|
}
|
||||||
super::list::render(
|
super::list::render(
|
||||||
frame,
|
frame,
|
||||||
@@ -294,7 +286,12 @@ pub fn render(
|
|||||||
if logs_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
if logs_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
||||||
logs_state.start_load(instances_dir, &instance.name);
|
logs_state.start_load(instances_dir, &instance.name);
|
||||||
}
|
}
|
||||||
crate::tui::widgets::logs_viewer::render(frame, content_area, logs_state, is_focused);
|
crate::tui::widgets::logs_viewer::render(
|
||||||
|
frame,
|
||||||
|
content_area,
|
||||||
|
logs_state,
|
||||||
|
is_focused,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("No instance selected.")
|
Paragraph::new("No instance selected.")
|
||||||
@@ -308,7 +305,12 @@ pub fn render(
|
|||||||
if screenshots_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
if screenshots_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
||||||
screenshots_state.start_load(instances_dir, &instance.name);
|
screenshots_state.start_load(instances_dir, &instance.name);
|
||||||
}
|
}
|
||||||
crate::tui::widgets::screenshots_grid::render(frame, content_area, screenshots_state, is_focused);
|
crate::tui::widgets::screenshots_grid::render(
|
||||||
|
frame,
|
||||||
|
content_area,
|
||||||
|
screenshots_state,
|
||||||
|
is_focused,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("No instance selected.")
|
Paragraph::new("No instance selected.")
|
||||||
@@ -320,12 +322,9 @@ pub fn render(
|
|||||||
ContentTab::Worlds => {
|
ContentTab::Worlds => {
|
||||||
if let Some(instance) = instance {
|
if let Some(instance) = instance {
|
||||||
if worlds_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
if worlds_state.loaded_for.as_deref() != Some(instance.name.as_str()) {
|
||||||
worlds_state.start_load(
|
let content_dir = instances_dir.join(&instance.name).join(".minecraft").join("saves");
|
||||||
instances_dir,
|
worlds_state.start_load(&content_dir, &instance.name, crate::instance::scan_one_world, "");
|
||||||
&instance.name,
|
worlds_state.watch_dir(content_dir);
|
||||||
crate::instance::scan_worlds,
|
|
||||||
);
|
|
||||||
worlds_state.watch_dir(instances_dir.join(&instance.name).join(".minecraft").join("saves"));
|
|
||||||
}
|
}
|
||||||
super::list::render(
|
super::list::render(
|
||||||
frame,
|
frame,
|
||||||
@@ -374,8 +373,7 @@ pub fn title(
|
|||||||
match instance {
|
match instance {
|
||||||
None => {
|
None => {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("No instance selected")
|
Paragraph::new("No instance selected").style(Style::default().fg(theme.text_dim())),
|
||||||
.style(Style::default().fg(theme.text_dim())),
|
|
||||||
inner,
|
inner,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
// handles search/filter, scrollbar sync, and inline renaming.
|
// handles search/filter, scrollbar sync, and inline renaming.
|
||||||
// each row shows instance name + "last played" or current run state.
|
// each row shows instance name + "last played" or current run state.
|
||||||
|
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crossterm::event::KeyCode;
|
use crossterm::event::KeyCode;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span, Text},
|
text::{Line, Span, Text},
|
||||||
widgets::{Block, Borders, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
widgets::{Block, Borders, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
||||||
|
|
||||||
use crate::instance::models::InstanceConfig;
|
use crate::instance::models::InstanceConfig;
|
||||||
use crate::running::{get as get_run_state, RunState};
|
use crate::running::{RunState, get as get_run_state};
|
||||||
use crate::tui::app::FocusedArea;
|
use crate::tui::app::FocusedArea;
|
||||||
|
|
||||||
use super::{search::SearchState, styled_title, WidgetKey};
|
use super::{WidgetKey, search::SearchState, styled_title};
|
||||||
|
|
||||||
// rough human-friendly time delta. not trying to be precise here,
|
// rough human-friendly time delta. not trying to be precise here,
|
||||||
// "2 months ago" is close enough when months are ~30 days
|
// "2 months ago" is close enough when months are ~30 days
|
||||||
@@ -168,6 +168,11 @@ impl WidgetKey for State {
|
|||||||
fn handle_key(&mut self, key_event: &crossterm::event::KeyEvent) {
|
fn handle_key(&mut self, key_event: &crossterm::event::KeyEvent) {
|
||||||
if self.search.active {
|
if self.search.active {
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
|
KeyCode::Enter => {
|
||||||
|
self.search.confirm();
|
||||||
|
self.list_state.selected = Some(0);
|
||||||
|
self.update_scrollbar();
|
||||||
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
self.search.deactivate();
|
self.search.deactivate();
|
||||||
self.list_state.selected = Some(0);
|
self.list_state.selected = Some(0);
|
||||||
@@ -250,7 +255,9 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut S
|
|||||||
|
|
||||||
let (name_style, meta_style, bg) = if context.is_selected {
|
let (name_style, meta_style, bg) = if context.is_selected {
|
||||||
(
|
(
|
||||||
Style::default().fg(theme.accent()).add_modifier(Modifier::BOLD),
|
Style::default()
|
||||||
|
.fg(theme.accent())
|
||||||
|
.add_modifier(Modifier::BOLD),
|
||||||
Style::default().fg(theme.text_dim()),
|
Style::default().fg(theme.text_dim()),
|
||||||
stripe_bg,
|
stripe_bg,
|
||||||
)
|
)
|
||||||
@@ -295,14 +302,16 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut S
|
|||||||
"Authenticating".to_string(),
|
"Authenticating".to_string(),
|
||||||
Style::default().fg(theme.success()),
|
Style::default().fg(theme.success()),
|
||||||
),
|
),
|
||||||
Some(RunState::Running) | Some(RunState::Starting) => (
|
Some(RunState::Running) | Some(RunState::Starting) => {
|
||||||
"Playing".to_string(),
|
("Playing".to_string(), Style::default().fg(theme.success()))
|
||||||
Style::default().fg(theme.success()),
|
}
|
||||||
),
|
|
||||||
_ => (format_last_played(instance.last_played), meta_style),
|
_ => (format_last_played(instance.last_played), meta_style),
|
||||||
};
|
};
|
||||||
|
|
||||||
let meta_line = Line::from(vec![selector.clone(), Span::styled(meta_text, meta_text_style)]);
|
let meta_line = Line::from(vec![
|
||||||
|
selector.clone(),
|
||||||
|
Span::styled(meta_text, meta_text_style),
|
||||||
|
]);
|
||||||
|
|
||||||
let item = Text::from(vec![name_line, meta_line]).style(Style::default().bg(bg));
|
let item = Text::from(vec![name_line, meta_line]).style(Style::default().bg(bg));
|
||||||
(item, 2)
|
(item, 2)
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ use std::sync::{Arc, Mutex};
|
|||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Block, Borders, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
widgets::{Block, Borders, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
use tui_widget_list::{ListBuilder, ListState as TuiListState, ListView};
|
||||||
|
|
||||||
use crate::instance::log_files::{read_log_file, scan_log_files, LogFileEntry};
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
use crate::instance::log_files::{LogFileEntry, read_log_file, scan_log_files};
|
||||||
|
|
||||||
type PendingLogs = Arc<Mutex<Option<(String, Vec<LogFileEntry>)>>>;
|
type PendingLogs = Arc<Mutex<Option<(String, Vec<LogFileEntry>)>>>;
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ pub struct LogsState {
|
|||||||
pending: PendingLogs,
|
pending: PendingLogs,
|
||||||
rescan_counter: u8,
|
rescan_counter: u8,
|
||||||
instances_dir_cache: Option<std::path::PathBuf>,
|
instances_dir_cache: Option<std::path::PathBuf>,
|
||||||
|
was_live: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LogsState {
|
impl Default for LogsState {
|
||||||
@@ -59,6 +60,7 @@ impl Default for LogsState {
|
|||||||
pending: Arc::new(Mutex::new(None)),
|
pending: Arc::new(Mutex::new(None)),
|
||||||
rescan_counter: 0,
|
rescan_counter: 0,
|
||||||
instances_dir_cache: None,
|
instances_dir_cache: None,
|
||||||
|
was_live: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,29 +96,39 @@ impl LogsState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn drain_pending(&mut self) {
|
pub fn drain_pending(&mut self) {
|
||||||
let taken = match self.pending.lock() { Ok(mut slot) => {
|
// when the instance stops while viewing the live log, transition
|
||||||
slot.take()
|
// to the on-disk log file so the viewer doesn't go blank
|
||||||
} _ => {
|
let live_now = self.has_live();
|
||||||
None
|
if self.was_live && !live_now && self.list_state.selected == Some(0) {
|
||||||
}};
|
self.load_selected_content();
|
||||||
|
}
|
||||||
|
self.was_live = live_now;
|
||||||
|
|
||||||
|
let taken = match self.pending.lock() {
|
||||||
|
Ok(mut slot) => slot.take(),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
if let Some((instance_name, entries)) = taken
|
if let Some((instance_name, entries)) = taken
|
||||||
&& self.loaded_for.as_deref() == Some(&instance_name) {
|
&& self.loaded_for.as_deref() == Some(&instance_name)
|
||||||
let prev_selected = self.list_state.selected;
|
{
|
||||||
self.entries = entries;
|
let prev_selected = self.list_state.selected;
|
||||||
self.loading = false;
|
self.entries = entries;
|
||||||
|
self.loading = false;
|
||||||
|
|
||||||
let display_count = self.display_count();
|
let display_count = self.display_count();
|
||||||
|
|
||||||
if display_count > 0 && prev_selected.is_none() {
|
if display_count > 0 && prev_selected.is_none() {
|
||||||
self.list_state.selected = Some(0);
|
self.list_state.selected = Some(0);
|
||||||
self.load_selected_content();
|
self.load_selected_content();
|
||||||
} else if let Some(sel) = prev_selected
|
} else if let Some(sel) = prev_selected
|
||||||
&& sel >= display_count && display_count > 0 {
|
&& sel >= display_count
|
||||||
self.list_state.selected = Some(display_count - 1);
|
&& display_count > 0
|
||||||
}
|
{
|
||||||
self.update_scrollbar();
|
self.list_state.selected = Some(display_count - 1);
|
||||||
}
|
}
|
||||||
|
self.update_scrollbar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// periodically re-scan log files in case new ones appeared while playing.
|
// periodically re-scan log files in case new ones appeared while playing.
|
||||||
@@ -225,6 +237,10 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut LogsState) -> bool {
|
|||||||
if state.viewer_focused {
|
if state.viewer_focused {
|
||||||
if state.viewer_search.active {
|
if state.viewer_search.active {
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
|
KeyCode::Enter => {
|
||||||
|
state.viewer_search.confirm();
|
||||||
|
state.viewer_scroll = 0;
|
||||||
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
state.viewer_search.deactivate();
|
state.viewer_search.deactivate();
|
||||||
state.viewer_scroll = 0;
|
state.viewer_scroll = 0;
|
||||||
@@ -288,6 +304,11 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut LogsState) -> bool {
|
|||||||
} else {
|
} else {
|
||||||
if state.search.active {
|
if state.search.active {
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
|
KeyCode::Enter => {
|
||||||
|
state.search.confirm();
|
||||||
|
state.list_state.selected = Some(0);
|
||||||
|
state.update_scrollbar();
|
||||||
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
state.search.deactivate();
|
state.search.deactivate();
|
||||||
state.list_state.selected = Some(0);
|
state.list_state.selected = Some(0);
|
||||||
@@ -408,7 +429,12 @@ fn render_list(
|
|||||||
let entries_snapshot: Vec<(String, bool)> = {
|
let entries_snapshot: Vec<(String, bool)> = {
|
||||||
let mut v = Vec::new();
|
let mut v = Vec::new();
|
||||||
if has_live {
|
if has_live {
|
||||||
v.push(("\u{25cf} Live".to_string(), true));
|
let live_name = state
|
||||||
|
.entries
|
||||||
|
.first()
|
||||||
|
.map(|e| e.name.trim_end_matches(".log"))
|
||||||
|
.unwrap_or("Live");
|
||||||
|
v.push((live_name.to_string(), true));
|
||||||
}
|
}
|
||||||
for e in &state.entries {
|
for e in &state.entries {
|
||||||
v.push((e.name.trim_end_matches(".log").to_string(), false));
|
v.push((e.name.trim_end_matches(".log").to_string(), false));
|
||||||
@@ -421,11 +447,15 @@ fn render_list(
|
|||||||
let show_selected = list_focused && context.is_selected;
|
let show_selected = list_focused && context.is_selected;
|
||||||
|
|
||||||
let style = if *is_live && show_selected {
|
let style = if *is_live && show_selected {
|
||||||
Style::default().fg(theme.success()).add_modifier(Modifier::BOLD)
|
Style::default()
|
||||||
|
.fg(theme.success())
|
||||||
|
.add_modifier(Modifier::BOLD)
|
||||||
} else if *is_live {
|
} else if *is_live {
|
||||||
Style::default().fg(theme.success())
|
Style::default().fg(theme.success())
|
||||||
} else if show_selected {
|
} else if show_selected {
|
||||||
Style::default().fg(theme.accent()).add_modifier(Modifier::BOLD)
|
Style::default()
|
||||||
|
.fg(theme.accent())
|
||||||
|
.add_modifier(Modifier::BOLD)
|
||||||
} else {
|
} else {
|
||||||
Style::default().fg(theme.text())
|
Style::default().fg(theme.text())
|
||||||
};
|
};
|
||||||
@@ -441,8 +471,11 @@ fn render_list(
|
|||||||
} else {
|
} else {
|
||||||
Span::raw(" ")
|
Span::raw(" ")
|
||||||
};
|
};
|
||||||
let item = ratatui::text::Text::from(Line::from(vec![selector, Span::styled(name.clone(), style)]))
|
let item = ratatui::text::Text::from(Line::from(vec![
|
||||||
.style(Style::default().bg(bg));
|
selector,
|
||||||
|
Span::styled(name.clone(), style),
|
||||||
|
]))
|
||||||
|
.style(Style::default().bg(bg));
|
||||||
(item, 1)
|
(item, 1)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ use ratatui::{
|
|||||||
|
|
||||||
pub mod account;
|
pub mod account;
|
||||||
pub mod content;
|
pub mod content;
|
||||||
pub mod details;
|
pub mod settings;
|
||||||
|
pub mod instances;
|
||||||
pub mod logs_viewer;
|
pub mod logs_viewer;
|
||||||
pub mod popups;
|
pub mod popups;
|
||||||
pub mod instances;
|
|
||||||
pub mod screenshots_grid;
|
pub mod screenshots_grid;
|
||||||
pub mod search;
|
pub mod search;
|
||||||
pub mod status;
|
pub mod status;
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ use ratatui::{
|
|||||||
|
|
||||||
use crate::config::theme::THEME;
|
use crate::config::theme::THEME;
|
||||||
|
|
||||||
static CONFIRM_STATE: LazyLock<Mutex<ConfirmState>> = LazyLock::new(|| Mutex::new(ConfirmState::default()));
|
static CONFIRM_STATE: LazyLock<Mutex<ConfirmState>> =
|
||||||
|
LazyLock::new(|| Mutex::new(ConfirmState::default()));
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
struct ConfirmState {
|
struct ConfirmState {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ use tracing::Level;
|
|||||||
|
|
||||||
use super::base::PopupFrame;
|
use super::base::PopupFrame;
|
||||||
use crate::config::SETTINGS;
|
use crate::config::SETTINGS;
|
||||||
use crate::tui::error_buffer::ErrorEvent;
|
|
||||||
use crate::config::theme::THEME;
|
use crate::config::theme::THEME;
|
||||||
|
use crate::tui::error_buffer::ErrorEvent;
|
||||||
|
|
||||||
pub struct ErrorPopup {
|
pub struct ErrorPopup {
|
||||||
pub event: ErrorEvent,
|
pub event: ErrorEvent,
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ mod render;
|
|||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
pub use render::{popup_rect, render};
|
pub use render::{popup_rect, render};
|
||||||
pub use state::{handle_key, take_result, ImportResult, ImportStep, ImportWizardState};
|
pub use state::{ImportResult, ImportStep, ImportWizardState, handle_key, take_result};
|
||||||
@@ -3,15 +3,15 @@
|
|||||||
|
|
||||||
use super::super::base::PopupFrame;
|
use super::super::base::PopupFrame;
|
||||||
use super::super::new_instance::LoadState;
|
use super::super::new_instance::LoadState;
|
||||||
use super::state::{ImportStep, ImportWizardState, IMPORT_STATE};
|
use super::state::{IMPORT_STATE, ImportStep, ImportWizardState};
|
||||||
use crate::tui::app::FocusedArea;
|
|
||||||
use crate::config::theme::THEME;
|
use crate::config::theme::THEME;
|
||||||
|
use crate::tui::app::FocusedArea;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::{Constraint, Direction, Layout, Rect},
|
layout::{Constraint, Direction, Layout, Rect},
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{List, ListItem, ListState, Paragraph, StatefulWidget, Widget, Wrap},
|
widgets::{List, ListItem, ListState, Paragraph, StatefulWidget, Widget, Wrap},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) {
|
pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) {
|
||||||
@@ -85,11 +85,7 @@ pub fn popup_rect(frame_area: Rect) -> Rect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_input_step(
|
fn render_input_step(state: &ImportWizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
|
||||||
state: &ImportWizardState,
|
|
||||||
area: Rect,
|
|
||||||
buf: &mut ratatui::buffer::Buffer,
|
|
||||||
) {
|
|
||||||
let theme = THEME.as_ref();
|
let theme = THEME.as_ref();
|
||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
@@ -115,10 +111,7 @@ fn render_input_step(
|
|||||||
])
|
])
|
||||||
} else {
|
} else {
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
Span::styled(
|
Span::styled(state.input.clone(), Style::default().fg(theme.text())),
|
||||||
state.input.clone(),
|
|
||||||
Style::default().fg(theme.text()),
|
|
||||||
),
|
|
||||||
Span::styled(
|
Span::styled(
|
||||||
"\u{2588}",
|
"\u{2588}",
|
||||||
Style::default()
|
Style::default()
|
||||||
@@ -137,11 +130,7 @@ fn render_fetching_step(area: Rect, buf: &mut ratatui::buffer::Buffer) {
|
|||||||
.render(area, buf);
|
.render(area, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_version_step(
|
fn render_version_step(state: &ImportWizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
|
||||||
state: &ImportWizardState,
|
|
||||||
area: Rect,
|
|
||||||
buf: &mut ratatui::buffer::Buffer,
|
|
||||||
) {
|
|
||||||
let theme = THEME.as_ref();
|
let theme = THEME.as_ref();
|
||||||
match &state.versions {
|
match &state.versions {
|
||||||
LoadState::Idle | LoadState::Loading => {
|
LoadState::Idle | LoadState::Loading => {
|
||||||
@@ -182,11 +171,7 @@ fn render_version_step(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_confirm_step(
|
fn render_confirm_step(state: &ImportWizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
|
||||||
state: &ImportWizardState,
|
|
||||||
area: Rect,
|
|
||||||
buf: &mut ratatui::buffer::Buffer,
|
|
||||||
) {
|
|
||||||
let theme = THEME.as_ref();
|
let theme = THEME.as_ref();
|
||||||
let summary = match &state.summary {
|
let summary = match &state.summary {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
@@ -247,11 +232,9 @@ fn step_keybinds(state: &ImportWizardState) -> Line<'static> {
|
|||||||
match state.step {
|
match state.step {
|
||||||
ImportStep::Input => keybind_line(&[("Enter", " fetch")]),
|
ImportStep::Input => keybind_line(&[("Enter", " fetch")]),
|
||||||
ImportStep::Fetching => keybind_line(&[("Esc", " cancel")]),
|
ImportStep::Fetching => keybind_line(&[("Esc", " cancel")]),
|
||||||
ImportStep::Version => keybind_line(&[
|
ImportStep::Version => {
|
||||||
("/", " search"),
|
keybind_line(&[("/", " search"), ("h", " back"), ("Enter", " select")])
|
||||||
("h", " back"),
|
}
|
||||||
("Enter", " select"),
|
|
||||||
]),
|
|
||||||
ImportStep::Confirm => keybind_line(&[("h", " back"), ("Enter", " import")]),
|
ImportStep::Confirm => keybind_line(&[("h", " back"), ("Enter", " import")]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
// local files skip straight to the confirm step.
|
// local files skip straight to the confirm step.
|
||||||
|
|
||||||
use super::super::new_instance::LoadState;
|
use super::super::new_instance::LoadState;
|
||||||
use crate::instance::import::{parse_import_input, ImportInput, ImportSummary};
|
use crate::instance::import::{ImportInput, ImportSummary, parse_import_input};
|
||||||
use crate::net::modrinth::{self, VersionInfo};
|
use crate::net::modrinth::{self, VersionInfo};
|
||||||
use crate::tui::widgets::instances;
|
use crate::tui::widgets::instances;
|
||||||
use crate::tui::widgets::search::SearchState;
|
use crate::tui::widgets::search::SearchState;
|
||||||
@@ -164,10 +164,8 @@ fn handle_version_key(
|
|||||||
state.version_idx = 0;
|
state.version_idx = 0;
|
||||||
state.version_search.deactivate();
|
state.version_search.deactivate();
|
||||||
}
|
}
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down if visible_count > 0 => {
|
||||||
if visible_count > 0 {
|
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
||||||
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
state.version_idx = state.version_idx.saturating_sub(1);
|
state.version_idx = state.version_idx.saturating_sub(1);
|
||||||
@@ -309,21 +307,19 @@ async fn resolve_version_id(
|
|||||||
}
|
}
|
||||||
|
|
||||||
match modrinth::download_mrpack(client, &version, &tmp_dir).await {
|
match modrinth::download_mrpack(client, &version, &tmp_dir).await {
|
||||||
Ok(mrpack_path) => {
|
Ok(mrpack_path) => match crate::instance::import::build_summary(&mrpack_path) {
|
||||||
match crate::instance::import::build_summary(&mrpack_path) {
|
Ok(summary) => {
|
||||||
Ok(summary) => {
|
if let Ok(mut s) = state_arc.lock() {
|
||||||
if let Ok(mut s) = state_arc.lock() {
|
s.summary = Some(summary);
|
||||||
s.summary = Some(summary);
|
s.step = ImportStep::Confirm;
|
||||||
s.step = ImportStep::Confirm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(e) => set_error_and_back(
|
|
||||||
&state_arc,
|
|
||||||
format!("Failed to build summary: {}", e),
|
|
||||||
ImportStep::Input,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
Err(e) => set_error_and_back(
|
||||||
|
&state_arc,
|
||||||
|
format!("Failed to build summary: {}", e),
|
||||||
|
ImportStep::Input,
|
||||||
|
),
|
||||||
|
},
|
||||||
Err(e) => set_error_and_back(
|
Err(e) => set_error_and_back(
|
||||||
&state_arc,
|
&state_arc,
|
||||||
format!("Failed to download mrpack: {}", e),
|
format!("Failed to download mrpack: {}", e),
|
||||||
@@ -383,21 +379,19 @@ fn start_version_download(state: &mut ImportWizardState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match modrinth::download_mrpack(&client, &version, &tmp_dir).await {
|
match modrinth::download_mrpack(&client, &version, &tmp_dir).await {
|
||||||
Ok(mrpack_path) => {
|
Ok(mrpack_path) => match crate::instance::import::build_summary(&mrpack_path) {
|
||||||
match crate::instance::import::build_summary(&mrpack_path) {
|
Ok(summary) => {
|
||||||
Ok(summary) => {
|
if let Ok(mut s) = state_arc.lock() {
|
||||||
if let Ok(mut s) = state_arc.lock() {
|
s.summary = Some(summary);
|
||||||
s.summary = Some(summary);
|
s.step = ImportStep::Confirm;
|
||||||
s.step = ImportStep::Confirm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(e) => set_error_and_back(
|
|
||||||
&state_arc,
|
|
||||||
format!("Failed to build summary: {}", e),
|
|
||||||
ImportStep::Version,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
Err(e) => set_error_and_back(
|
||||||
|
&state_arc,
|
||||||
|
format!("Failed to build summary: {}", e),
|
||||||
|
ImportStep::Version,
|
||||||
|
),
|
||||||
|
},
|
||||||
Err(e) => set_error_and_back(
|
Err(e) => set_error_and_back(
|
||||||
&state_arc,
|
&state_arc,
|
||||||
format!("Failed to download mrpack: {}", e),
|
format!("Failed to download mrpack: {}", e),
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ mod render;
|
|||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
pub use render::{popup_rect, render};
|
pub use render::{popup_rect, render};
|
||||||
pub use state::{handle_key, take_result, LoadState, WizardParams, WizardStep, WizardState};
|
pub use state::{LoadState, WizardParams, WizardState, WizardStep, handle_key, take_result};
|
||||||
@@ -2,21 +2,21 @@
|
|||||||
// and the popup resizes itself based on which step is active.
|
// and the popup resizes itself based on which step is active.
|
||||||
|
|
||||||
use super::state::{
|
use super::state::{
|
||||||
clamp_loader_version_index, clamp_version_index, ensure_loader_versions_loaded,
|
LoadState, WIZARD_STATE, WizardState, WizardStep, clamp_loader_version_index,
|
||||||
ensure_versions_loaded, visible_versions, LoadState, WizardState, WizardStep, WIZARD_STATE,
|
clamp_version_index, ensure_loader_versions_loaded, ensure_versions_loaded, visible_versions,
|
||||||
};
|
};
|
||||||
|
use crate::config::theme::THEME;
|
||||||
use crate::instance::models::ModLoader;
|
use crate::instance::models::ModLoader;
|
||||||
use crate::tui::app::FocusedArea;
|
use crate::tui::app::FocusedArea;
|
||||||
use crate::config::theme::THEME;
|
|
||||||
use crate::tui::widgets::popups::base::PopupFrame;
|
use crate::tui::widgets::popups::base::PopupFrame;
|
||||||
use tui_prompts::State as PromptState;
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::{Constraint, Direction, Layout, Rect},
|
layout::{Constraint, Direction, Layout, Rect},
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{List, ListItem, ListState, Paragraph, StatefulWidget, Widget, Wrap},
|
widgets::{List, ListItem, ListState, Paragraph, StatefulWidget, Widget, Wrap},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
|
use tui_prompts::State as PromptState;
|
||||||
|
|
||||||
pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) {
|
pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) {
|
||||||
// grab the lock, kick off any lazy-loading, then clone and release.
|
// grab the lock, kick off any lazy-loading, then clone and release.
|
||||||
@@ -140,10 +140,7 @@ fn render_name_step(state: &WizardState, area: Rect, buf: &mut ratatui::buffer::
|
|||||||
// \u{2588} is the full block char used as a fake blinking cursor
|
// \u{2588} is the full block char used as a fake blinking cursor
|
||||||
let line = if value.is_empty() {
|
let line = if value.is_empty() {
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
Span::styled(
|
Span::styled("Instance name...", Style::default().fg(theme.text_dim())),
|
||||||
"Instance name...",
|
|
||||||
Style::default().fg(theme.text_dim()),
|
|
||||||
),
|
|
||||||
Span::styled(
|
Span::styled(
|
||||||
"\u{2588}",
|
"\u{2588}",
|
||||||
Style::default()
|
Style::default()
|
||||||
|
|||||||
@@ -202,10 +202,8 @@ fn handle_version_key(
|
|||||||
KeyCode::Left | KeyCode::Char('h') if !state.version_search.active => {
|
KeyCode::Left | KeyCode::Char('h') if !state.version_search.active => {
|
||||||
state.step = WizardStep::Loader;
|
state.step = WizardStep::Loader;
|
||||||
}
|
}
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down if visible_count > 0 => {
|
||||||
if visible_count > 0 {
|
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
||||||
state.version_idx = (state.version_idx + 1).min(visible_count.saturating_sub(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
state.version_idx = state.version_idx.saturating_sub(1);
|
state.version_idx = state.version_idx.saturating_sub(1);
|
||||||
@@ -286,11 +284,9 @@ fn handle_loader_version_key(
|
|||||||
match key_event.code {
|
match key_event.code {
|
||||||
KeyCode::Esc => close_popup(state, instances_state),
|
KeyCode::Esc => close_popup(state, instances_state),
|
||||||
KeyCode::Left | KeyCode::Char('h') => state.step = WizardStep::Version,
|
KeyCode::Left | KeyCode::Char('h') => state.step = WizardStep::Version,
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down if version_count > 0 => {
|
||||||
if version_count > 0 {
|
state.loader_version_idx =
|
||||||
state.loader_version_idx =
|
(state.loader_version_idx + 1).min(version_count.saturating_sub(1));
|
||||||
(state.loader_version_idx + 1).min(version_count.saturating_sub(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyCode::Char('k') | KeyCode::Up => {
|
KeyCode::Char('k') | KeyCode::Up => {
|
||||||
state.loader_version_idx = state.loader_version_idx.saturating_sub(1);
|
state.loader_version_idx = state.loader_version_idx.saturating_sub(1);
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ use std::sync::{Arc, Mutex};
|
|||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::Span,
|
text::Span,
|
||||||
widgets::{Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
widgets::{Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
use ratatui_image::{protocol::StatefulProtocol, Resize, StatefulImage};
|
use ratatui_image::{Resize, StatefulImage, protocol::StatefulProtocol};
|
||||||
|
|
||||||
use crate::instance::screenshots::ScreenshotEntry;
|
|
||||||
use crate::config::theme::THEME;
|
use crate::config::theme::THEME;
|
||||||
|
use crate::instance::screenshots::ScreenshotEntry;
|
||||||
|
|
||||||
// grid cell sizing constraints in terminal columns.
|
// grid cell sizing constraints in terminal columns.
|
||||||
// the grid auto-fits columns within these bounds depending on terminal width
|
// the grid auto-fits columns within these bounds depending on terminal width
|
||||||
@@ -97,27 +97,26 @@ impl ScreenshotsState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn drain_pending_entries(&mut self) {
|
pub fn drain_pending_entries(&mut self) {
|
||||||
let taken = match self.pending_entries.lock() { Ok(mut slot) => {
|
let taken = match self.pending_entries.lock() {
|
||||||
slot.take()
|
Ok(mut slot) => slot.take(),
|
||||||
} _ => {
|
_ => None,
|
||||||
None
|
};
|
||||||
}};
|
|
||||||
|
|
||||||
if let Some((instance_name, entries)) = taken
|
if let Some((instance_name, entries)) = taken
|
||||||
&& self.loaded_for.as_deref() == Some(&instance_name) {
|
&& self.loaded_for.as_deref() == Some(&instance_name)
|
||||||
self.entries = entries;
|
{
|
||||||
self.loading = false;
|
self.entries = entries;
|
||||||
self.selected = 0;
|
self.loading = false;
|
||||||
self.scroll_row = 0;
|
self.selected = 0;
|
||||||
}
|
self.scroll_row = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn take_pending_images(&mut self) -> Vec<(usize, image::DynamicImage)> {
|
pub fn take_pending_images(&mut self) -> Vec<(usize, image::DynamicImage)> {
|
||||||
match self.pending_images.lock() { Ok(mut slot) => {
|
match self.pending_images.lock() {
|
||||||
std::mem::take(&mut *slot)
|
Ok(mut slot) => std::mem::take(&mut *slot),
|
||||||
} _ => {
|
_ => Vec::new(),
|
||||||
Vec::new()
|
}
|
||||||
}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_protocol(&mut self, idx: usize, proto: StatefulProtocol) {
|
pub fn set_protocol(&mut self, idx: usize, proto: StatefulProtocol) {
|
||||||
@@ -146,20 +145,17 @@ impl ScreenshotsState {
|
|||||||
.unwrap_or(None);
|
.unwrap_or(None);
|
||||||
|
|
||||||
if let Some(img) = img
|
if let Some(img) = img
|
||||||
&& let Ok(mut slot) = pending.lock() {
|
&& let Ok(mut slot) = pending.lock()
|
||||||
slot.push((idx, img));
|
{
|
||||||
}
|
slot.push((idx, img));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ensure_visible(&mut self) {
|
fn ensure_visible(&mut self) {
|
||||||
let row = if self.cols > 0 {
|
let row = self.selected.checked_div(self.cols).unwrap_or(0);
|
||||||
self.selected / self.cols
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
if row < self.scroll_row {
|
if row < self.scroll_row {
|
||||||
self.scroll_row = row;
|
self.scroll_row = row;
|
||||||
@@ -182,6 +178,10 @@ impl ScreenshotsState {
|
|||||||
pub fn handle_key(key_event: &KeyEvent, state: &mut ScreenshotsState) -> bool {
|
pub fn handle_key(key_event: &KeyEvent, state: &mut ScreenshotsState) -> bool {
|
||||||
if state.search.active {
|
if state.search.active {
|
||||||
match key_event.code {
|
match key_event.code {
|
||||||
|
KeyCode::Enter => {
|
||||||
|
state.search.confirm();
|
||||||
|
state.selected = 0;
|
||||||
|
}
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
state.search.deactivate();
|
state.search.deactivate();
|
||||||
state.selected = 0;
|
state.selected = 0;
|
||||||
@@ -225,16 +225,18 @@ pub fn handle_key(key_event: &KeyEvent, state: &mut ScreenshotsState) -> bool {
|
|||||||
KeyCode::Enter if key_event.modifiers.contains(KeyModifiers::SHIFT) => {
|
KeyCode::Enter if key_event.modifiers.contains(KeyModifiers::SHIFT) => {
|
||||||
if let Some(entry) = state.entries.get(state.selected)
|
if let Some(entry) = state.entries.get(state.selected)
|
||||||
&& let Some(dir) = entry.path.parent()
|
&& let Some(dir) = entry.path.parent()
|
||||||
&& let Err(e) = open::that(dir) {
|
&& let Err(e) = open::that_detached(dir)
|
||||||
tracing::error!("Failed to open directory: {}", e);
|
{
|
||||||
}
|
tracing::error!("Failed to open directory: {}", e);
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
if let Some(entry) = state.entries.get(state.selected)
|
if let Some(entry) = state.entries.get(state.selected)
|
||||||
&& let Err(e) = open::that(&entry.path) {
|
&& let Err(e) = open::that_detached(&entry.path)
|
||||||
tracing::error!("Failed to open file: {}", e);
|
{
|
||||||
}
|
tracing::error!("Failed to open file: {}", e);
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
KeyCode::Char('L') | KeyCode::Right
|
KeyCode::Char('L') | KeyCode::Right
|
||||||
@@ -272,8 +274,7 @@ pub fn render(frame: &mut Frame, area: Rect, state: &mut ScreenshotsState, is_fo
|
|||||||
let theme = THEME.as_ref();
|
let theme = THEME.as_ref();
|
||||||
if state.loading {
|
if state.loading {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("Loading screenshots...")
|
Paragraph::new("Loading screenshots...").style(Style::default().fg(theme.text_dim())),
|
||||||
.style(Style::default().fg(theme.text_dim())),
|
|
||||||
area,
|
area,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -281,8 +282,7 @@ pub fn render(frame: &mut Frame, area: Rect, state: &mut ScreenshotsState, is_fo
|
|||||||
|
|
||||||
if state.entries.is_empty() {
|
if state.entries.is_empty() {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("No screenshots.")
|
Paragraph::new("No screenshots.").style(Style::default().fg(theme.text_dim())),
|
||||||
.style(Style::default().fg(theme.text_dim())),
|
|
||||||
area,
|
area,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ impl SearchState {
|
|||||||
self.query.clear();
|
self.query.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exit search mode but keep the filter active so the user can
|
||||||
|
// navigate the filtered results
|
||||||
|
pub fn confirm(&mut self) {
|
||||||
|
self.active = false;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn push(&mut self, c: char) {
|
pub fn push(&mut self, c: char) {
|
||||||
self.query.push(c);
|
self.query.push(c);
|
||||||
}
|
}
|
||||||
@@ -103,3 +109,47 @@ impl SearchState {
|
|||||||
Some(Line::from(spans).right_aligned())
|
Some(Line::from(spans).right_aligned())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn confirm_keeps_query_but_deactivates() {
|
||||||
|
let mut s = SearchState::default();
|
||||||
|
s.activate();
|
||||||
|
s.push('a');
|
||||||
|
s.push('b');
|
||||||
|
s.confirm();
|
||||||
|
assert!(!s.active);
|
||||||
|
assert_eq!(s.query, "ab");
|
||||||
|
// filter should still match
|
||||||
|
assert!(s.matches("abc"));
|
||||||
|
assert!(!s.matches("xyz"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn deactivate_clears_query() {
|
||||||
|
let mut s = SearchState::default();
|
||||||
|
s.activate();
|
||||||
|
s.push('x');
|
||||||
|
s.deactivate();
|
||||||
|
assert!(!s.active);
|
||||||
|
assert!(s.query.is_empty());
|
||||||
|
// with empty query, everything matches
|
||||||
|
assert!(s.matches("anything"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn confirm_then_reactivate_preserves_query() {
|
||||||
|
let mut s = SearchState::default();
|
||||||
|
s.activate();
|
||||||
|
s.push('t');
|
||||||
|
s.push('e');
|
||||||
|
s.confirm();
|
||||||
|
// user presses search key again to edit
|
||||||
|
s.activate();
|
||||||
|
assert!(s.active);
|
||||||
|
assert_eq!(s.query, "te");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
// and provides keybinds to open config files in $EDITOR
|
// and provides keybinds to open config files in $EDITOR
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Block, Borders, Paragraph},
|
widgets::{Block, Borders, Paragraph},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crate::instance::models::InstanceConfig;
|
use crate::instance::models::InstanceConfig;
|
||||||
use crate::tui::app::FocusedArea;
|
use crate::tui::app::FocusedArea;
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
|
||||||
|
|
||||||
use super::styled_title;
|
use super::styled_title;
|
||||||
|
|
||||||
@@ -54,8 +54,7 @@ pub fn render(
|
|||||||
|
|
||||||
let Some(inst) = instance else {
|
let Some(inst) = instance else {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new("No instance selected.")
|
Paragraph::new("No instance selected.").style(Style::default().fg(theme.text_dim())),
|
||||||
.style(Style::default().fg(theme.text_dim())),
|
|
||||||
inner,
|
inner,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
// shows a gauge when the total is known, or a spinner when it's not.
|
// shows a gauge when the total is known, or a spinner when it's not.
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
style::{Modifier, Style},
|
style::{Modifier, Style},
|
||||||
text::Span,
|
text::Span,
|
||||||
widgets::{Block, Borders, Gauge, Paragraph},
|
widgets::{Block, Borders, Gauge, Paragraph},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
use throbber_widgets_tui::{Throbber, ThrobberState};
|
use throbber_widgets_tui::{Throbber, ThrobberState};
|
||||||
|
|
||||||
|
use crate::config::theme::{BORDER_STYLE, THEME};
|
||||||
use crate::tui::app::FocusedArea;
|
use crate::tui::app::FocusedArea;
|
||||||
use crate::tui::progress::PROGRESS;
|
use crate::tui::progress::PROGRESS;
|
||||||
use crate::config::theme::{THEME, BORDER_STYLE};
|
|
||||||
|
|
||||||
use super::styled_title;
|
use super::styled_title;
|
||||||
|
|
||||||
@@ -39,11 +39,8 @@ pub fn render(
|
|||||||
Ok(s) => s.clone(),
|
Ok(s) => s.clone(),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new(Span::styled(
|
Paragraph::new(Span::styled("Ready", Style::default().fg(theme.text_dim())))
|
||||||
"Ready",
|
.block(block),
|
||||||
Style::default().fg(theme.text_dim()),
|
|
||||||
))
|
|
||||||
.block(block),
|
|
||||||
area,
|
area,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -52,11 +49,8 @@ pub fn render(
|
|||||||
|
|
||||||
if state.current_action.is_none() {
|
if state.current_action.is_none() {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new(Span::styled(
|
Paragraph::new(Span::styled("Ready", Style::default().fg(theme.text_dim())))
|
||||||
"Ready",
|
.block(block),
|
||||||
Style::default().fg(theme.text_dim()),
|
|
||||||
))
|
|
||||||
.block(block),
|
|
||||||
area,
|
area,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|||||||
+228
@@ -0,0 +1,228 @@
|
|||||||
|
<?xml version='1.0' encoding='windows-1252'?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2017 Christopher R. Field.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The "cargo wix" subcommand provides a variety of predefined variables available
|
||||||
|
for customization of this template. The values for each variable are set at
|
||||||
|
installer creation time. The following variables are available:
|
||||||
|
|
||||||
|
TargetTriple = The rustc target triple name.
|
||||||
|
TargetEnv = The rustc target environment. This is typically either
|
||||||
|
"msvc" or "gnu" depending on the toolchain downloaded and
|
||||||
|
installed.
|
||||||
|
TargetVendor = The rustc target vendor. This is typically "pc", but Rust
|
||||||
|
does support other vendors, like "uwp".
|
||||||
|
CargoTargetBinDir = The complete path to the directory containing the
|
||||||
|
binaries (exes) to include. The default would be
|
||||||
|
"target\release\". If an explicit rustc target triple is
|
||||||
|
used, i.e. cross-compiling, then the default path would
|
||||||
|
be "target\<CARGO_TARGET>\<CARGO_PROFILE>",
|
||||||
|
where "<CARGO_TARGET>" is replaced with the "CargoTarget"
|
||||||
|
variable value and "<CARGO_PROFILE>" is replaced with the
|
||||||
|
value from the "CargoProfile" variable. This can also
|
||||||
|
be overridden manually with the "target-bin-dir" flag.
|
||||||
|
CargoTargetDir = The path to the directory for the build artifacts, i.e.
|
||||||
|
"target".
|
||||||
|
CargoProfile = The cargo profile used to build the binaries
|
||||||
|
(usually "debug" or "release").
|
||||||
|
Version = The version for the installer. The default is the
|
||||||
|
"Major.Minor.Fix" semantic versioning number of the Rust
|
||||||
|
package.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please do not remove these pre-processor If-Else blocks. These are used with
|
||||||
|
the `cargo wix` subcommand to automatically determine the installation
|
||||||
|
destination for 32-bit versus 64-bit installers. Removal of these lines will
|
||||||
|
cause installation errors.
|
||||||
|
-->
|
||||||
|
<?if $(sys.BUILDARCH) = x64 or $(sys.BUILDARCH) = arm64 ?>
|
||||||
|
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||||
|
<?else ?>
|
||||||
|
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||||
|
<?endif ?>
|
||||||
|
|
||||||
|
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
|
||||||
|
|
||||||
|
<Product
|
||||||
|
Id='*'
|
||||||
|
Name='rmcl'
|
||||||
|
UpgradeCode='BEC08BE4-6A8F-4C1D-A1B4-B1AC963000AE'
|
||||||
|
Manufacturer='objz'
|
||||||
|
Language='1033'
|
||||||
|
Codepage='1252'
|
||||||
|
Version='$(var.Version)'>
|
||||||
|
|
||||||
|
<Package Id='*'
|
||||||
|
Keywords='Installer'
|
||||||
|
Description='A fully featured Minecraft launcher TUI'
|
||||||
|
Manufacturer='objz'
|
||||||
|
InstallerVersion='450'
|
||||||
|
Languages='1033'
|
||||||
|
Compressed='yes'
|
||||||
|
InstallScope='perMachine'
|
||||||
|
SummaryCodepage='1252'
|
||||||
|
/>
|
||||||
|
|
||||||
|
<MajorUpgrade
|
||||||
|
Schedule='afterInstallInitialize'
|
||||||
|
DowngradeErrorMessage='A newer version of [ProductName] is already installed. Setup will now exit.'/>
|
||||||
|
|
||||||
|
<Media Id='1' Cabinet='media1.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1'/>
|
||||||
|
<Property Id='DiskPrompt' Value='rmcl Installation'/>
|
||||||
|
|
||||||
|
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||||
|
<Directory Id='$(var.PlatformProgramFilesFolder)' Name='PFiles'>
|
||||||
|
<Directory Id='APPLICATIONFOLDER' Name='rmcl'>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Enabling the license sidecar file in the installer is a four step process:
|
||||||
|
|
||||||
|
1. Uncomment the `Component` tag and its contents.
|
||||||
|
2. Change the value for the `Source` attribute in the `File` tag to a path
|
||||||
|
to the file that should be included as the license sidecar file. The path
|
||||||
|
can, and probably should be, relative to this file.
|
||||||
|
3. Change the value for the `Name` attribute in the `File` tag to the
|
||||||
|
desired name for the file when it is installed alongside the `bin` folder
|
||||||
|
in the installation directory. This can be omitted if the desired name is
|
||||||
|
the same as the file name.
|
||||||
|
4. Uncomment the `ComponentRef` tag with the Id attribute value of "License"
|
||||||
|
further down in this file.
|
||||||
|
-->
|
||||||
|
<!--
|
||||||
|
<Component Id='License' Guid='*'>
|
||||||
|
<File Id='LicenseFile' Name='ChangeMe' DiskId='1' Source='C:\Path\To\File' KeyPath='yes'/>
|
||||||
|
</Component>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Directory Id='Bin' Name='bin'>
|
||||||
|
<Component Id='Path' Guid='E5863AC2-13FC-45C8-B79D-55338F371A8A' KeyPath='yes'>
|
||||||
|
<Environment
|
||||||
|
Id='PATH'
|
||||||
|
Name='PATH'
|
||||||
|
Value='[Bin]'
|
||||||
|
Permanent='no'
|
||||||
|
Part='last'
|
||||||
|
Action='set'
|
||||||
|
System='yes'/>
|
||||||
|
</Component>
|
||||||
|
<Component Id='binary0' Guid='*'>
|
||||||
|
<File
|
||||||
|
Id='exe0'
|
||||||
|
Name='rmcl.exe'
|
||||||
|
DiskId='1'
|
||||||
|
Source='$(var.CargoTargetBinDir)\rmcl.exe'
|
||||||
|
KeyPath='yes'/>
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id='Binaries'
|
||||||
|
Title='Application'
|
||||||
|
Description='Installs all binaries and the license.'
|
||||||
|
Level='1'
|
||||||
|
ConfigurableDirectory='APPLICATIONFOLDER'
|
||||||
|
AllowAdvertise='no'
|
||||||
|
Display='expand'
|
||||||
|
Absent='disallow'>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Uncomment the following `ComponentRef` tag to add the license
|
||||||
|
sidecar file to the installer.
|
||||||
|
-->
|
||||||
|
<!--<ComponentRef Id='License'/>-->
|
||||||
|
|
||||||
|
<ComponentRef Id='binary0'/>
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id='Environment'
|
||||||
|
Title='PATH Environment Variable'
|
||||||
|
Description='Add the install location of the [ProductName] executable to the PATH system environment variable. This allows the [ProductName] executable to be called from any location.'
|
||||||
|
Level='1'
|
||||||
|
Absent='allow'>
|
||||||
|
<ComponentRef Id='Path'/>
|
||||||
|
</Feature>
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<SetProperty Id='ARPINSTALLLOCATION' Value='[APPLICATIONFOLDER]' After='CostFinalize'/>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Uncomment the following `Icon` and `Property` tags to change the product icon.
|
||||||
|
|
||||||
|
The product icon is the graphic that appears in the Add/Remove
|
||||||
|
Programs control panel for the application.
|
||||||
|
-->
|
||||||
|
<!--<Icon Id='ProductICO' SourceFile='wix\Product.ico'/>-->
|
||||||
|
<!--<Property Id='ARPPRODUCTICON' Value='ProductICO' />-->
|
||||||
|
|
||||||
|
<Property Id='ARPHELPLINK' Value='https://github.com/objz/rmcl'/>
|
||||||
|
|
||||||
|
<UI>
|
||||||
|
<UIRef Id='WixUI_FeatureTree'/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Enabling the EULA dialog in the installer is a three step process:
|
||||||
|
|
||||||
|
1. Comment out or remove the two `Publish` tags that follow the
|
||||||
|
`WixVariable` tag.
|
||||||
|
2. Uncomment the `<WixVariable Id='WixUILicenseRtf' Value='Path\to\Eula.rft'>` tag further down
|
||||||
|
3. Replace the `Value` attribute of the `WixVariable` tag with
|
||||||
|
the path to a RTF file that will be used as the EULA and
|
||||||
|
displayed in the license agreement dialog.
|
||||||
|
-->
|
||||||
|
<Publish Dialog='WelcomeDlg' Control='Next' Event='NewDialog' Value='CustomizeDlg' Order='99'>1</Publish>
|
||||||
|
<Publish Dialog='CustomizeDlg' Control='Back' Event='NewDialog' Value='WelcomeDlg' Order='99'>1</Publish>
|
||||||
|
|
||||||
|
</UI>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Enabling the EULA dialog in the installer requires uncommenting
|
||||||
|
the following `WixUILicenseRTF` tag and changing the `Value`
|
||||||
|
attribute.
|
||||||
|
-->
|
||||||
|
<!-- <WixVariable Id='WixUILicenseRtf' Value='Relative\Path\to\Eula.rtf'/> -->
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Uncomment the next `WixVariable` tag to customize the installer's
|
||||||
|
Graphical User Interface (GUI) and add a custom banner image across
|
||||||
|
the top of each screen. See the WiX Toolset documentation for details
|
||||||
|
about customization.
|
||||||
|
|
||||||
|
The banner BMP dimensions are 493 x 58 pixels.
|
||||||
|
-->
|
||||||
|
<!--<WixVariable Id='WixUIBannerBmp' Value='wix\Banner.bmp'/>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Uncomment the next `WixVariable` tag to customize the installer's
|
||||||
|
Graphical User Interface (GUI) and add a custom image to the first
|
||||||
|
dialog, or screen. See the WiX Toolset documentation for details about
|
||||||
|
customization.
|
||||||
|
|
||||||
|
The dialog BMP dimensions are 493 x 312 pixels.
|
||||||
|
-->
|
||||||
|
<!--<WixVariable Id='WixUIDialogBmp' Value='wix\Dialog.bmp'/>-->
|
||||||
|
|
||||||
|
</Product>
|
||||||
|
|
||||||
|
</Wix>
|
||||||
Reference in new issue
Block a user