diff --git a/src-tauri/capabilities/TeyvatGuide.json b/src-tauri/capabilities/TeyvatGuide.json new file mode 100644 index 00000000..72a8a3ed --- /dev/null +++ b/src-tauri/capabilities/TeyvatGuide.json @@ -0,0 +1,65 @@ +{ + "$schema": "./schemas/desktop-schema.json", + "identifier": "TeyvatGuide", + "description": "Capability for the main window", + "windows": ["TeyvatGuide"], + "permissions": [ + "core:app:default", + "core:app:allow-version", + "core:event:default", + "core:event:allow-listen", + "core:path:default", + "core:path:allow-resolve-directory", + "core:webview:default", + "core:webview:allow-create-webview-window", + "core:webview:allow-set-webview-zoom", + "core:window:default", + "core:window:allow-center", + "core:window:allow-close", + "core:window:allow-destroy", + "core:window:allow-is-minimized", + "core:window:allow-set-focus", + "core:window:allow-set-size", + "core:window:allow-set-title", + "core:window:allow-show", + "core:window:allow-unminimize", + "cli:default", + "cli:allow-cli-matches", + "dialog:default", + "dialog:allow-save", + "fs:default", + "http:allow-fetch", + "log:default", + "log:allow-log", + "machine-uid:default", + "machine-uid:allow-get-machine-uid", + "notification:default", + "opener:default", + "process:default", + "process:allow-exit", + "sql:default", + "sql:allow-load", + "sql:allow-execute", + { "identifier": "fs:allow-exists", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-mkdir", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-read-dir", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-read-text-file", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-read-text-file-lines", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-remove", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-write-file", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-write-text-file", "allow": [{ "path": "**" }] }, + { "identifier": "opener:allow-open-path", "allow": [{ "path": "**" }] }, + { "identifier": "opener:allow-open-url", "allow": [{ "url": "**" }] }, + { + "identifier": "http:default", + "allow": [ + { "url": "https://*.miyoushe.com/*" }, + { "url": "https://*.mihoyo.com/*" }, + { "url": "https://homa.gentle.house/*" }, + { "url": "https://*.hoyoverse.com/*" }, + { "url": "https://api.hakush.in/*" } + ] + } + ], + "platforms": ["windows", "macOS"] +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 325a725b..50fe7b23 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -26,7 +26,7 @@ fn window_event_handler(app: &Window, event: &WindowEvent) { match event { WindowEvent::CloseRequested { api, .. } => { api.prevent_close(); - if app.label() == "Teyvat.Guide" { + if app.label() == "TeyvatGuide" { // 主窗口:发送事件让前端根据配置决定是隐藏还是退出 let _ = app.emit("main-window-close-requested", ()); } else { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d5597b29..142ba914 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "TeyvatGuide", - "identifier": "Teyvat.Guide", + "identifier": "TeyvatGuide", "version": "0.9.1", "build": { "beforeDevCommand": "pnpm vite:dev", @@ -30,8 +30,7 @@ ], "targets": ["msi", "app", "dmg"], "windows": { "wix": { "language": "zh-CN" } }, - "macOS": {}, - "resources": { "lib/YaeAchievementLib.dll": "resources/YaeAchievementLib.dll" } + "macOS": {} }, "app": { "withGlobalTauri": true, @@ -48,7 +47,7 @@ "visible": false } ], - "security": { "capabilities": ["Teyvat.Guide", "Mys", "SubWindow", "DevJson"] } + "security": { "capabilities": ["TeyvatGuide", "Mys", "SubWindow", "DevJson"] } }, "plugins": { "deep-link": { "desktop": { "schemes": ["teyvatguide"] }, "mobile": [] }, diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json new file mode 100644 index 00000000..1305d5f4 --- /dev/null +++ b/src-tauri/tauri.linux.conf.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "identifier": "Teyvat.Guide", + "app": { + "security": { "capabilities": ["Teyvat.Guide", "Mys", "SubWindow", "DevJson"] } + } +} diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json new file mode 100644 index 00000000..9e155081 --- /dev/null +++ b/src-tauri/tauri.windows.conf.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "bundle": { + "resources": { "lib/YaeAchievementLib.dll": "resources/YaeAchievementLib.dll" } + } +}