adjust resources path

This commit is contained in:
pompurin404 2024-08-08 10:09:38 +08:00
parent 7d6ca923db
commit 090e4d3cfa
No known key found for this signature in database
7 changed files with 83 additions and 3 deletions

View File

@ -101,6 +101,9 @@ jobs:
dist/*.deb dist/*.deb
dist/*.rpm dist/*.rpm
if-no-files-found: error if-no-files-found: error
- name: Rename
if: startsWith(github.ref, 'refs/tags/v')
run: mv dist/linux-unpacked/resources/app.asar dist/mihomo-party-linux-$(echo ${{ github.ref }} | tr -d 'refs/tags/v')-${{ matrix.arch }}.asar
- name: Publish Release - name: Publish Release
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
@ -108,6 +111,7 @@ jobs:
files: | files: |
dist/*.deb dist/*.deb
dist/*.rpm dist/*.rpm
dist/*.asar
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
macos: macos:
@ -162,6 +166,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
pkgname: pkgname:
- mihomo-party-electron
- mihomo-party-bin - mihomo-party-bin
- mihomo-party - mihomo-party
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
@ -175,10 +180,11 @@ jobs:
sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party-bin/PKGBUILD sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party-bin/PKGBUILD
sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party/PKGBUILD sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party/PKGBUILD
- name: Update Checksums - name: Update Checksums
if: ${{ matrix.pkgname == 'mihomo-party' }} if: matrix.pkgname == 'mihomo-party' || matrix.pkgname == 'mihomo-party-electron'
run: | run: |
wget https://github.com/pompurin404/mihomo-party/archive/refs/tags/$(echo ${{ github.ref }} | tr -d 'refs/tags/').tar.gz -O release.tar.gz wget https://github.com/pompurin404/mihomo-party/archive/refs/tags/$(echo ${{ github.ref }} | tr -d 'refs/tags/').tar.gz -O release.tar.gz
sed -i "s/sha256sums=.*/sha256sums=(\"$(sha256sum ./release.tar.gz | awk '{print $1}')\")/" aur/mihomo-party/PKGBUILD sed -i "s/sha256sums=.*/sha256sums=(\"$(sha256sum ./release.tar.gz | awk '{print $1}')\")/" aur/mihomo-party/PKGBUILD
sed -i "s/sha256sums=.*/sha256sums=(\"$(sha256sum ./release.tar.gz | awk '{print $1}')\")/" aur/mihomo-party-electron/PKGBUILD
- name: Update Checksums - name: Update Checksums
if: ${{ matrix.pkgname == 'mihomo-party-bin' }} if: ${{ matrix.pkgname == 'mihomo-party-bin' }}
run: | run: |

View File

@ -0,0 +1,38 @@
pkgname=mihomo-party-electron
_pkgname=mihomo-party
pkgver=0.1.3
pkgrel=1
pkgdesc="Another Mihomo GUI."
arch=('x86_64' 'aarch64')
url="https://github.com/pompurin404/mihomo-party"
license=('GPL3')
conflicts=("mihomo-party-git" 'mihomo-party-bin' 'mihomo-party')
depends=('electron' 'gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'libsecret')
optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).')
makedepends=('nodejs' 'pnpm' 'libxcrypt-compat' 'asar')
install=$_pkgname.install
source=("${_pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=("52d761e9432e17477acb8adb5744676df946476e0eb5210fee2b6d45f497f218")
options=('!lto')
prepare(){
cd $srcdir/${_pkgname}-${pkgver}
pnpm install
}
build(){
cd $srcdir/${_pkgname}-${pkgver}
pnpm build:linux deb
}
package() {
asar extract $srcdir/${_pkgname}-${pkgver}/dist/linux-unpacked/resources/app.asar ${pkgdir}/opt/mihomo-party
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha
cd ${pkgdir}/../..
install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"
install -Dm644 "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
install -Dm644 "$srcdir/${_pkgname}-${pkgver}/dist/linux-unpacked/resources/icon.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png"
chown -R root:root ${pkgdir}
}

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Name=mihomo-party
Exec=mihomo-party %U
Terminal=false
Type=Application
Icon=mihomo-party
StartupWMClass=mihomo-party
MimeType=x-scheme-handler/clash;x-scheme-handler/mihomo;
Comment=Mihomo Party
Categories=Utility;

View File

@ -0,0 +1,14 @@
# Colored makepkg-like functions
note() {
printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1"
}
_all_off="$(tput sgr0)"
_bold="${_all_off}$(tput bold)"
_blue="${_bold}$(tput setaf 4)"
_yellow="${_bold}$(tput setaf 3)"
post_install() {
note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf"
note "The launcher is called: 'mihomo-party'"
}

View File

@ -0,0 +1,12 @@
#!/usr/bin/bash
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
# Allow users to override command-line options
if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then
mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")"
echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]}
fi
# Launch
exec electron /opt/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@"

View File

@ -1,6 +1,6 @@
{ {
"name": "mihomo-party", "name": "mihomo-party",
"version": "0.2.0", "version": "0.2.1",
"description": "Mihomo Party", "description": "Mihomo Party",
"main": "./out/main/index.js", "main": "./out/main/index.js",
"author": "mihomo-party", "author": "mihomo-party",

View File

@ -12,7 +12,7 @@ export function resourcesDir(): string {
if (is.dev) { if (is.dev) {
return path.join(__dirname, '../../resources') return path.join(__dirname, '../../resources')
} else { } else {
return path.join(process.resourcesPath) return path.join(app.getAppPath(), 'resources')
} }
} }