diff --git a/src/main/index.ts b/src/main/index.ts
index 3b3fd4f..593c573 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -27,7 +27,7 @@ if (process.platform === 'win32' && !is.dev) {
if (process.argv.slice(1).length > 0) {
writeFileSync(path.join(dataDir(), 'param.txt'), process.argv.slice(1).join(' '))
} else {
- writeFileSync(path.join(dataDir(), 'param.txt'), '')
+ writeFileSync(path.join(dataDir(), 'param.txt'), 'empty')
}
execSync('schtasks /run /tn mihomo-party-run')
} catch (e) {
diff --git a/src/main/sys/misc.ts b/src/main/sys/misc.ts
index b73a03a..3ede42c 100644
--- a/src/main/sys/misc.ts
+++ b/src/main/sys/misc.ts
@@ -81,25 +81,27 @@ const elevateTaskXml = `
- powershell
- -WindowStyle Hidden -File "${path.join(dataDir(), `mihomo-party-run.ps1`)}"
+ wscript.exe
+ "${path.join(dataDir(), `mihomo-party-run.vbs`)}"
`
-const startScript = `$paramFilePath = Join-Path -Path $PSScriptRoot -ChildPath "param.txt"
-if (Test-Path -Path $paramFilePath) {
- $paramContent = Get-Content -Path $paramFilePath
- & "${exePath()}" $paramContent
-} else {
- & "${exePath()}"
-}
+const startScript = `Dim fso, file, params, shell, currentPath
+Set fso = CreateObject("Scripting.FileSystemObject")
+currentPath = fso.GetParentFolderName(WScript.ScriptFullName)
+Set file = fso.OpenTextFile(currentPath & "\\param.txt", 1)
+params = file.ReadAll
+file.Close
+Set shell = CreateObject("WScript.Shell")
+commandLine = """" & "${exePath()}"" " & params
+shell.Run commandLine, 0, false
`
export function createElevateTask(): void {
const taskFilePath = path.join(dataDir(), `mihomo-party-run.xml`)
- writeFileSync(path.join(dataDir(), `mihomo-party-run.ps1`), startScript)
+ writeFileSync(path.join(dataDir(), `mihomo-party-run.vbs`), startScript)
writeFileSync(taskFilePath, Buffer.from(`\ufeff${elevateTaskXml}`, 'utf-16le'))
execSync(`schtasks /create /tn "mihomo-party-run" /xml "${taskFilePath}" /f`)
}
diff --git a/src/renderer/src/components/sider/rule-card.tsx b/src/renderer/src/components/sider/rule-card.tsx
index 97d992f..4079b80 100644
--- a/src/renderer/src/components/sider/rule-card.tsx
+++ b/src/renderer/src/components/sider/rule-card.tsx
@@ -10,9 +10,7 @@ const RuleCard: React.FC = () => {
const navigate = useNavigate()
const location = useLocation()
const match = location.pathname.includes('/rules')
- const { data: rules } = useSWR('mihomoRules', mihomoRules, {
- refreshInterval: 5000
- })
+ const { data: rules } = useSWR('mihomoRules', mihomoRules)
const {
attributes,
listeners,