Skip to content

Commit

Permalink
fix: Upgrade UI url and action update problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Elziy committed Jun 4, 2024
1 parent 7204768 commit 31d3a9f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ jobs:
tag: Prerelease
deleteOnlyFromDrafts: false

- name: Set Env
run: |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
shell: bash

- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
tag_name: Prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Prerelease
uses: softprops/action-gh-release@v1
with:
Expand Down
3 changes: 2 additions & 1 deletion src/api/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const flushFakeIPPoolEndpoint = '/cache/fakeip/flush';
const flushTrafficStatisticEndpoint = '/resetStatistic';
const restartCoreEndpoint = '/restart';
const upgradeCoreEndpoint = '/upgrade';
const upgradeUIEndpoint = '/upgrade/ui';

export async function fetchConfigs(apiConfig: ClashAPIConfig) {
const { url, init } = getURLAndInit(apiConfig);
Expand Down Expand Up @@ -54,7 +55,7 @@ export async function restartCore(apiConfig: ClashAPIConfig) {

export async function upgradeUI(apiConfig: ClashAPIConfig) {
const { url, init } = getURLAndInit(apiConfig);
return await fetch(url + upgradeCoreEndpoint, { ...init, method: 'POST' });
return await fetch(url + upgradeUIEndpoint, { ...init, method: 'POST' });
}

export async function upgradeCore(apiConfig: ClashAPIConfig) {
Expand Down
7 changes: 1 addition & 6 deletions src/store/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,7 @@ export function upgradeUI(apiConfig: ClashAPIConfig) {
if (res.ok === false) {
// eslint-disable-next-line no-console
console.log('Error upgrade UI', res.statusText);
if (res.status === 500) {
const json = await res.json();
if ("update error: already using latest version" === json.message) {
notifyError('面板界面已经是最新版本');
}
}
notifyError('面板界面更新失败');
} else {
notifySuccess('面板界面已升级');
}
Expand Down

0 comments on commit 31d3a9f

Please sign in to comment.