mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10:30 +08:00
fix resources path
This commit is contained in:
parent
c399e00aa4
commit
6b537085b4
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mihomo-party",
|
"name": "mihomo-party",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"description": "Mihomo Party",
|
"description": "Mihomo Party",
|
||||||
"main": "./out/main/index.js",
|
"main": "./out/main/index.js",
|
||||||
"author": "mihomo-party",
|
"author": "mihomo-party",
|
||||||
|
|||||||
@ -11,9 +11,13 @@ export function exePath(): string {
|
|||||||
export function resourcesDir(): string {
|
export function resourcesDir(): string {
|
||||||
if (is.dev) {
|
if (is.dev) {
|
||||||
return path.join(__dirname, '../../resources')
|
return path.join(__dirname, '../../resources')
|
||||||
|
} else {
|
||||||
|
if (app.getAppPath().endsWith('asar')) {
|
||||||
|
return process.resourcesPath
|
||||||
} else {
|
} else {
|
||||||
return path.join(app.getAppPath(), 'resources')
|
return path.join(app.getAppPath(), 'resources')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resourcesFilesDir(): string {
|
export function resourcesFilesDir(): string {
|
||||||
|
|||||||
@ -55,9 +55,9 @@ const DNS: React.FC = () => {
|
|||||||
}
|
}
|
||||||
const handleHostsChange = (domain: string, value: string, index: number): void => {
|
const handleHostsChange = (domain: string, value: string, index: number): void => {
|
||||||
const processValue = (val: string): string | string[] =>
|
const processValue = (val: string): string | string[] =>
|
||||||
val.includes(',') ? val.split(',').map(s => s.trim()) : val.trim()
|
val.includes(',') ? val.split(',').map((s) => s.trim()) : val.trim()
|
||||||
const isEmpty = (d: string, v: string | string[]): boolean =>
|
const isEmpty = (d: string, v: string | string[]): boolean =>
|
||||||
d === '' && (Array.isArray(v) ? v.every(item => item === '') : v === '')
|
d === '' && (Array.isArray(v) ? v.every((item) => item === '') : v === '')
|
||||||
|
|
||||||
const newHosts = [...values.hosts]
|
const newHosts = [...values.hosts]
|
||||||
if (!isEmpty(domain.trim(), processValue(value))) {
|
if (!isEmpty(domain.trim(), processValue(value))) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user