This commit is contained in:
汐殇 2024-12-21 20:13:44 +08:00
parent 8abce96232
commit e3a99c84c7
10 changed files with 100 additions and 172 deletions

View File

@ -1,5 +1,11 @@
name: Build name: Build
permissions: write-all
on: on:
workflow_dispatch:
inputs:
version:
description: "Tag version to release"
required: false
push: push:
branches: branches:
- master - master
@ -10,171 +16,62 @@ on:
- '.github/ISSUE_TEMPLATE/**' - '.github/ISSUE_TEMPLATE/**'
- '.github/workflows/issues.yml' - '.github/workflows/issues.yml'
permissions: write-all
jobs: jobs:
windows: build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
arch: os: [windows-latest, ubuntu-latest, macos-latest]
- x64 arch: [x64, arm64]
- ia32 runs-on: ${{ matrix.os }}
- arm64
runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup pnpm
run: npm install -g pnpm
- name: Install Dependencies
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: |
pnpm install
pnpm add @mihomo-party/sysproxy-win32-${{ matrix.arch }}-msvc
pnpm prepare --${{ matrix.arch }}
- name: Build
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: pnpm build:win --${{ matrix.arch }}
- name: Add Portable Flag
run: |
New-Item -Path "PORTABLE" -ItemType File
Get-ChildItem dist/*portable.7z | ForEach-Object {
7z a $_.FullName PORTABLE
}
- name: Generate checksums
run: pnpm checksum setup.exe portable.7z
- name: Upload Artifacts
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4
with:
name: Windows ${{ matrix.arch }}
path: |
dist/*.sha256
dist/*setup.exe
dist/*portable.7z
if-no-files-found: error
- name: Publish Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.sha256
dist/*setup.exe
dist/*portable.7z
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
linux:
strategy:
fail-fast: false
matrix:
arch:
- x64
- arm64
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm - name: Setup pnpm
run: npm install -g pnpm run: npm install -g pnpm
- name: Install Dependencies
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: |
pnpm install
pnpm add @mihomo-party/sysproxy-linux-${{ matrix.arch }}-gnu
sed -i "s/productName: Mihomo Party/productName: mihomo-party/" electron-builder.yml
pnpm prepare --${{ matrix.arch }}
- name: Build
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: pnpm build:linux --${{ matrix.arch }}
- name: Generate checksums
run: pnpm checksum .deb .rpm
- name: Upload Artifacts
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4
with:
name: Linux ${{ matrix.arch }}
path: |
dist/*.sha256
dist/*.deb
dist/*.rpm
if-no-files-found: error
- name: Publish Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.sha256
dist/*.deb
dist/*.rpm
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
macos: - name: Install Dependencies and Prepare
strategy:
fail-fast: false
matrix:
arch:
- x64
- arm64
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
run: npm install -g pnpm
- name: Install Dependencies
env: env:
npm_config_arch: ${{ matrix.arch }} npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }} npm_config_target_arch: ${{ matrix.arch }}
run: | run: |
pnpm install pnpm install
pnpm add @mihomo-party/sysproxy-darwin-${{ matrix.arch }} pnpm add @mihomo-party/sysproxy-${{ matrix.os == 'windows-latest' && 'win32' || matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}-${{ matrix.arch }}${{ matrix.os == 'ubuntu-latest' && '-gnu' || matrix.os == 'windows-latest' && '-msvc' || '' }}
pnpm prepare --${{ matrix.arch }} pnpm prepare --${{ matrix.arch }}
- name: Build - name: Build
env: env:
npm_config_arch: ${{ matrix.arch }} npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }} npm_config_target_arch: ${{ matrix.arch }}
run: | run: |
chmod +x build/pkg-scripts/postinstall chmod +x build/pkg-scripts/postinstall
pnpm build:mac --${{ matrix.arch }} pnpm build:${{ matrix.os == 'windows-latest' && 'win' || matrix.os == 'ubuntu-latest' && 'linux' || 'mac' }} --${{ matrix.arch }}
- name: Generate checksums
run: pnpm checksum .pkg - name: Add Portable Flag
if: matrix.os == 'windows-latest'
run: |
New-Item -Path "PORTABLE" -ItemType File
Get-ChildItem dist/*portable.7z | ForEach-Object {
7z a $_.FullName PORTABLE
}
- name: Generate latest.yml
run: pnpm updater
- name: Upload Artifacts - name: Upload Artifacts
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: MacOS ${{ matrix.arch }} name: ${{ matrix.os }}-${{ matrix.arch }}
path: | path: |
dist/*.sha256 dist/mihomo-party-*
dist/*.pkg latest.yml
if-no-files-found: error changelog.md
- name: Publish Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.sha256
dist/*.pkg
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
artifact: pre-release:
if: startsWith(github.ref, 'refs/heads/') if: startsWith(github.ref, 'refs/heads/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.version == '')
needs: [windows, linux, macos] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
concurrency:
group: artifact
cancel-in-progress: false
steps: steps:
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@ -182,31 +79,52 @@ jobs:
path: bin/ path: bin/
merge-multiple: true merge-multiple: true
- name: Upload Prerelease - name: Delete Current
uses: softprops/action-gh-release@v1 uses: 8Mi-Tech/delete-release-assets-action@main
if: ${{ success() }} with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: pre-release
deleteOnlyFromDrafts: false
- name: Publish Prerelease
if: success()
uses: softprops/action-gh-release@v2
with: with:
tag_name: pre-release tag_name: pre-release
files: | files: |
bin/* bin/latest.yml
bin/dist/*
prerelease: true prerelease: true
updater: release:
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.version != '')
needs: [windows, macos, linux] needs: [build]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/download-artifact@v4
uses: actions/checkout@v4 with:
- name: Setup pnpm path: bin/
run: npm install -g pnpm merge-multiple: true
- name: Install Dependencies
run: pnpm install - name: Debug event inputs
- name: Generate latest.yml run: |
run: pnpm updater echo "github.ref: ${{ github.ref }}"
echo "github.event_name: ${{ github.event_name }}"
echo "github.event.inputs.version: ${{ github.event.inputs.version }}"
- name: Delete Current
uses: 8Mi-Tech/delete-release-assets-action@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.inputs.version != '' && github.event.inputs.version || github.ref }}
deleteOnlyFromDrafts: false
- name: Publish Release - name: Publish Release
if: success()
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: latest.yml tag_name: ${{ github.event.inputs.version != '' && github.event.inputs.version || github.ref }}
body_path: changelog.md body_path: bin/changelog.md
token: ${{ secrets.GITHUB_TOKEN }} files: |
bin/latest.yml
bin/dist/*

View File

@ -7,9 +7,9 @@
### Features ### Features
- 支持编辑/查看外部资源 - 添加出站接口查看
- 支持重置应用 - 添加更多嗅探配置
### Bug Fixes ### Bug Fixes
- 修复某些系统下应用白屏的问题 - null

View File

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

View File

@ -4,22 +4,16 @@ import { readFileSync, writeFileSync } from 'fs'
const pkg = readFileSync('package.json', 'utf-8') const pkg = readFileSync('package.json', 'utf-8')
let changelog = readFileSync('changelog.md', 'utf-8') let changelog = readFileSync('changelog.md', 'utf-8')
const { version } = JSON.parse(pkg) const { version } = JSON.parse(pkg)
const downloadUrl = `https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}` const downloadUrl = `https://github.com/xishang0128/mihomo-party/releases/download/v${version}`
const latest = { const latest = {
version, version,
changelog changelog
} }
changelog += '\n### 下载地址:\n\n#### Windows10/11\n\n' changelog += '\n### 下载地址:\n\n#### Windows10/11\n\n'
changelog += `- 安装版:[64位](${downloadUrl}/mihomo-party-windows-${version}-x64-setup.exe) | [32位](${downloadUrl}/mihomo-party-windows-${version}-ia32-setup.exe) | [ARM64](${downloadUrl}/mihomo-party-windows-${version}-arm64-setup.exe)\n\n` changelog += `- 安装版:[64位](${downloadUrl}/mihomo-party-windows-${version}-x64-setup.exe) | [ARM64](${downloadUrl}/mihomo-party-windows-${version}-arm64-setup.exe)\n\n`
changelog += `- 便携版:[64位](${downloadUrl}/mihomo-party-windows-${version}-x64-portable.7z) | [32位](${downloadUrl}/mihomo-party-windows-${version}-ia32-portable.7z) | [ARM64](${downloadUrl}/mihomo-party-windows-${version}-arm64-portable.7z)\n\n`
changelog += '\n#### Windows7/8\n\n'
changelog += `- 安装版:[64位](${downloadUrl}/mihomo-party-win7-${version}-x64-setup.exe) | [32位](${downloadUrl}/mihomo-party-win7-${version}-ia32-setup.exe)\n\n`
changelog += `- 便携版:[64位](${downloadUrl}/mihomo-party-win7-${version}-x64-portable.7z) | [32位](${downloadUrl}/mihomo-party-win7-${version}-ia32-portable.7z)\n\n`
changelog += '\n#### macOS 11+\n\n' changelog += '\n#### macOS 11+\n\n'
changelog += `- PKG[Intel](${downloadUrl}/mihomo-party-macos-${version}-x64.pkg) | [Apple Silicon](${downloadUrl}/mihomo-party-macos-${version}-arm64.pkg)\n\n` changelog += `- PKG[Intel](${downloadUrl}/mihomo-party-macos-${version}-x64.pkg) | [Apple Silicon](${downloadUrl}/mihomo-party-macos-${version}-arm64.pkg)\n\n`
changelog += '\n#### macOS 10.15+\n\n'
changelog += `- PKG[Intel](${downloadUrl}/mihomo-party-catalina-${version}-x64.pkg) | [Apple Silicon](${downloadUrl}/mihomo-party-catalina-${version}-arm64.pkg)\n\n`
changelog += '\n#### Linux\n\n' changelog += '\n#### Linux\n\n'
changelog += `- DEB[64位](${downloadUrl}/mihomo-party-linux-${version}-amd64.deb) | [ARM64](${downloadUrl}/mihomo-party-linux-${version}-arm64.deb)\n\n` changelog += `- DEB[64位](${downloadUrl}/mihomo-party-linux-${version}-amd64.deb) | [ARM64](${downloadUrl}/mihomo-party-linux-${version}-arm64.deb)\n\n`
changelog += `- RPM[64位](${downloadUrl}/mihomo-party-linux-${version}-x86_64.rpm) | [ARM64](${downloadUrl}/mihomo-party-linux-${version}-aarch64.rpm)` changelog += `- RPM[64位](${downloadUrl}/mihomo-party-linux-${version}-x86_64.rpm) | [ARM64](${downloadUrl}/mihomo-party-linux-${version}-aarch64.rpm)`

View File

@ -13,7 +13,7 @@ import { promisify } from 'util'
export async function checkUpdate(): Promise<IAppVersion | undefined> { export async function checkUpdate(): Promise<IAppVersion | undefined> {
const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig() const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig()
const res = await axios.get( const res = await axios.get(
'https://github.com/mihomo-party-org/mihomo-party/releases/latest/download/latest.yml', 'https://github.com/xishang0128/mihomo-party/releases/latest/download/latest.yml',
{ {
headers: { 'Content-Type': 'application/octet-stream' }, headers: { 'Content-Type': 'application/octet-stream' },
proxy: { proxy: {
@ -35,7 +35,7 @@ export async function checkUpdate(): Promise<IAppVersion | undefined> {
export async function downloadAndInstallUpdate(version: string): Promise<void> { export async function downloadAndInstallUpdate(version: string): Promise<void> {
const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig() const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig()
const baseUrl = `https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}/` const baseUrl = `https://github.com/xishang0128/mihomo-party/releases/download/v${version}/`
const fileMap = { const fileMap = {
'win32-x64': `mihomo-party-windows-${version}-x64-setup.exe`, 'win32-x64': `mihomo-party-windows-${version}-x64-setup.exe`,
'win32-ia32': `mihomo-party-windows-${version}-ia32-setup.exe`, 'win32-ia32': `mihomo-party-windows-${version}-ia32-setup.exe`,

View File

@ -135,8 +135,8 @@ const ConnectionDetailModal: React.FC<Props> = (props) => {
<ModalBody> <ModalBody>
<SettingItem title="连接建立时间">{dayjs(connection.start).fromNow()}</SettingItem> <SettingItem title="连接建立时间">{dayjs(connection.start).fromNow()}</SettingItem>
<SettingItem title="规则"> <SettingItem title="规则">
{connection.rule} {connection.rule ? connection.rule : '未命中任何规则'}
{connection.rulePayload ? `(${connection.rulePayload})` : '未命中任何规则'} {connection.rulePayload ? `(${connection.rulePayload})` : ''}
</SettingItem> </SettingItem>
<SettingItem title="代理链">{[...connection.chains].reverse().join('>>')}</SettingItem> <SettingItem title="代理链">{[...connection.chains].reverse().join('>>')}</SettingItem>
<SettingItem title="上传速度">{calcTraffic(connection.uploadSpeed || 0)}/s</SettingItem> <SettingItem title="上传速度">{calcTraffic(connection.uploadSpeed || 0)}/s</SettingItem>

View File

@ -50,6 +50,7 @@ const GeneralConfig: React.FC = () => {
customTheme = 'default.css', customTheme = 'default.css',
envType = [platform === 'win32' ? 'powershell' : 'bash'], envType = [platform === 'win32' ? 'powershell' : 'bash'],
autoCheckUpdate, autoCheckUpdate,
updateChannel = 'release',
appTheme = 'system' appTheme = 'system'
} = appConfig || {} } = appConfig || {}
@ -101,6 +102,20 @@ const GeneralConfig: React.FC = () => {
}} }}
/> />
</SettingItem> </SettingItem>
{/* <SettingItem title="" divider>
<Select
classNames={{ trigger: 'data-[hover=true]:bg-default-200' }}
className="w-[150px]"
size="sm"
selectedKeys={new Set([updateChannel])}
onSelectionChange={async (v) => {
patchAppConfig({ updateChannel: v.currentKey as string })
}}
>
<SelectItem key="release"></SelectItem>
<SelectItem key="testing"></SelectItem>
</Select>
</SettingItem> */}
<SettingItem title="静默启动" divider> <SettingItem title="静默启动" divider>
<Switch <Switch
size="sm" size="sm"

View File

@ -44,7 +44,7 @@ const UpdaterModal: React.FC<Props> = (props) => {
size="sm" size="sm"
className="flex app-nodrag" className="flex app-nodrag"
onPress={() => { onPress={() => {
open(`https://github.com/mihomo-party-org/mihomo-party/releases/tag/v${version}`) open(`https://github.com/xishang0128/mihomo-party/releases/tag/v${version}`)
}} }}
> >

View File

@ -36,7 +36,7 @@ const Settings: React.FC = () => {
className="app-nodrag" className="app-nodrag"
title="GitHub 仓库" title="GitHub 仓库"
onPress={() => { onPress={() => {
window.open('https://github.com/mihomo-party-org/mihomo-party') window.open('https://github.com/xishang0128/mihomo-party')
}} }}
> >
<IoLogoGithub className="text-lg" /> <IoLogoGithub className="text-lg" />

View File

@ -304,6 +304,7 @@ interface IAppConfig {
appTheme: AppTheme appTheme: AppTheme
customTheme?: string customTheme?: string
autoCheckUpdate: boolean autoCheckUpdate: boolean
updateChannel: string
silentStart: boolean silentStart: boolean
autoCloseConnection: boolean autoCloseConnection: boolean
sysProxy: ISysProxyConfig sysProxy: ISysProxyConfig