Skip to content

Commit ba73a5e

Browse files
committed
feat: Add security warning for non-GitHub built versions and update download confirmation
1 parent e344083 commit ba73a5e

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

frontend/src/lang/locale/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,8 @@ export default {
586586
stable: 'Stable version',
587587
alpha: 'Alpha version',
588588
grant: 'Grant Privileges',
589+
risk: 'This version is not auto-built by GitHub and may pose a security risk.',
590+
stillDownload: 'Still download',
589591
},
590592
userAgent: {
591593
name: 'User-Agent',

frontend/src/lang/locale/zh.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ export default {
585585
stable: '稳定版',
586586
alpha: '内测版',
587587
grant: '授予特权',
588+
risk: '该版本非GitHub自动构建,有安全风险。',
589+
stillDownload: '仍要下载',
588590
},
589591
userAgent: {
590592
name: '用户代理(User-Agent)',

frontend/src/views/KernelView/components/AlphaBranch.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useI18n } from 'vue-i18n'
33
import { computed, ref } from 'vue'
44
5-
import { useMessage } from '@/hooks'
5+
import { useConfirm, useMessage } from '@/hooks'
66
import { useAppSettingsStore, useEnvStore, useKernelApiStore } from '@/stores'
77
import {
88
GrantTUNPermission,
@@ -47,6 +47,7 @@ const needUpdate = computed(() => remoteVersion.value && localVersion.value !==
4747
4848
const { t } = useI18n()
4949
const { message } = useMessage()
50+
const { confirm } = useConfirm()
5051
const envStore = useEnvStore()
5152
const appSettings = useAppSettingsStore()
5253
const kernelApiStore = useKernelApiStore()
@@ -77,6 +78,13 @@ const downloadCore = async () => {
7778
const asset = assets.find((v: any) => v.name === assetName)
7879
if (!asset) throw 'Asset Not Found:' + assetName
7980
81+
if (asset.uploader.type !== 'Bot') {
82+
await confirm('common.warning', 'settings.kernel.risk', {
83+
type: 'text',
84+
okText: 'settings.kernel.stillDownload',
85+
})
86+
}
87+
8088
const tmp = `data/core-alpha${suffix}` // data/core-alpha.zip or data/core-alpha.gz
8189
8290
await Makedir('data/mihomo')
@@ -123,7 +131,7 @@ const downloadCore = async () => {
123131
124132
downloadSuccessful.value = true
125133
126-
message.success('Download Successful')
134+
message.success('common.success')
127135
} catch (error: any) {
128136
console.log(error)
129137
message.error(error)

frontend/src/views/KernelView/components/StableBranch.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useI18n } from 'vue-i18n'
33
import { computed, ref } from 'vue'
44
5-
import { useMessage } from '@/hooks'
5+
import { useConfirm, useMessage } from '@/hooks'
66
import { CoreWorkingDirectory } from '@/constant'
77
import { useAppSettingsStore, useEnvStore, useKernelApiStore } from '@/stores'
88
import {
@@ -45,6 +45,7 @@ const needUpdate = computed(() => remoteVersion.value && localVersion.value !==
4545
4646
const { t } = useI18n()
4747
const { message } = useMessage()
48+
const { confirm } = useConfirm()
4849
const envStore = useEnvStore()
4950
const appSettings = useAppSettingsStore()
5051
const kernelApiStore = useKernelApiStore()
@@ -75,6 +76,13 @@ const downloadCore = async () => {
7576
const asset = assets.find((v: any) => v.name === assetName)
7677
if (!asset) throw 'Asset Not Found:' + assetName
7778
79+
if (asset.uploader.type !== 'Bot') {
80+
await confirm('common.warning', 'settings.kernel.risk', {
81+
type: 'text',
82+
okText: 'settings.kernel.stillDownload',
83+
})
84+
}
85+
7886
const tmp = `data/core${suffix}` // data/core.zip or data/core.gz
7987
8088
await Makedir('data/mihomo')
@@ -119,7 +127,7 @@ const downloadCore = async () => {
119127
120128
downloadSuccessful.value = true
121129
122-
message.success('Download Successful')
130+
message.success('common.success')
123131
} catch (error: any) {
124132
console.log(error)
125133
message.error(error)

frontend/tsconfig.node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"vitest.config.*",
66
"cypress.config.*",
77
"nightwatch.conf.*",
8-
"playwright.config.*"
8+
"playwright.config.*",
9+
"eslint.config.*"
910
],
1011
"compilerOptions": {
1112
"composite": true,

0 commit comments

Comments
 (0)