update: store persist
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
"checksVoidReturn": false
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-confusing-void-expression":"off"
|
||||
"@typescript-eslint/no-confusing-void-expression":"off",
|
||||
"@typescript-eslint/no-unsafe-return": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
"@typescript-eslint/prefer-nullish-coalescing": "off"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@icon-park/react": "^1.4.2",
|
||||
"@reactuses/core": "^5.0.21",
|
||||
"@tauri-apps/api": "2.0.0-rc.5",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.2",
|
||||
"@tauri-apps/plugin-dialog": "2.0.0-rc.1",
|
||||
@@ -27,6 +28,8 @@
|
||||
"@tauri-apps/plugin-os": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-shell": "2.0.0-rc.1",
|
||||
"@tauri-apps/plugin-store": "^2.0.0-rc",
|
||||
"jotai": "^2.10.0",
|
||||
"next": "^14.2.13",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
||||
93
pnpm-lock.yaml
generated
93
pnpm-lock.yaml
generated
@@ -11,6 +11,9 @@ importers:
|
||||
'@icon-park/react':
|
||||
specifier: ^1.4.2
|
||||
version: 1.4.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@reactuses/core':
|
||||
specifier: ^5.0.21
|
||||
version: 5.0.21(react@18.3.1)
|
||||
'@tauri-apps/api':
|
||||
specifier: 2.0.0-rc.5
|
||||
version: 2.0.0-rc.5
|
||||
@@ -41,6 +44,12 @@ importers:
|
||||
'@tauri-apps/plugin-shell':
|
||||
specifier: 2.0.0-rc.1
|
||||
version: 2.0.0-rc.1
|
||||
'@tauri-apps/plugin-store':
|
||||
specifier: ^2.0.0-rc
|
||||
version: 2.0.0-rc.1
|
||||
jotai:
|
||||
specifier: ^2.10.0
|
||||
version: 2.10.0(@types/react@18.3.8)(react@18.3.1)
|
||||
next:
|
||||
specifier: ^14.2.13
|
||||
version: 14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
@@ -52,7 +61,7 @@ importers:
|
||||
version: 18.3.1(react@18.3.1)
|
||||
zustand:
|
||||
specifier: 5.0.0-rc.2
|
||||
version: 5.0.0-rc.2(@types/react@18.3.8)(react@18.3.1)
|
||||
version: 5.0.0-rc.2(@types/react@18.3.8)(react@18.3.1)(use-sync-external-store@1.2.2(react@18.3.1))
|
||||
devDependencies:
|
||||
'@biomejs/biome':
|
||||
specifier: ^1.9.2
|
||||
@@ -180,24 +189,28 @@ packages:
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@biomejs/cli-linux-arm64@1.9.2':
|
||||
resolution: {integrity: sha512-T8TJuSxuBDeQCQzxZu2o3OU4eyLumTofhCxxFd3+aH2AEWVMnH7Z/c3QP1lHI5RRMBP9xIJeMORqDQ5j+gVZzw==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@biomejs/cli-linux-x64-musl@1.9.2':
|
||||
resolution: {integrity: sha512-CjPM6jT1miV5pry9C7qv8YJk0FIZvZd86QRD3atvDgfgeh9WQU0k2Aoo0xUcPdTnoz0WNwRtDicHxwik63MmSg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@biomejs/cli-linux-x64@1.9.2':
|
||||
resolution: {integrity: sha512-T0cPk3C3Jr2pVlsuQVTBqk2qPjTm8cYcTD9p/wmR9MeVqui1C/xTVfOIwd3miRODFMrJaVQ8MYSXnVIhV9jTjg==}
|
||||
engines: {node: '>=14.21.3'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@biomejs/cli-win32-arm64@1.9.2':
|
||||
resolution: {integrity: sha512-2x7gSty75bNIeD23ZRPXyox6Z/V0M71ObeJtvQBhi1fgrvPdtkEuw7/0wEHg6buNCubzOFuN9WYJm6FKoUHfhg==}
|
||||
@@ -318,24 +331,28 @@ packages:
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@next/swc-linux-arm64-musl@14.2.13':
|
||||
resolution: {integrity: sha512-v5jZ/FV/eHGoWhMKYrsAweQ7CWb8xsWGM/8m1mwwZQ/sutJjoFaXchwK4pX8NqwImILEvQmZWyb8pPTcP7htWg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@next/swc-linux-x64-gnu@14.2.13':
|
||||
resolution: {integrity: sha512-aVc7m4YL7ViiRv7SOXK3RplXzOEe/qQzRA5R2vpXboHABs3w8vtFslGTz+5tKiQzWUmTmBNVW0UQdhkKRORmGA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@next/swc-linux-x64-musl@14.2.13':
|
||||
resolution: {integrity: sha512-4wWY7/OsSaJOOKvMsu1Teylku7vKyTuocvDLTZQq0TYv9OjiYYWt63PiE1nTuZnqQ4RPvME7Xai+9enoiN0Wrg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@next/swc-win32-arm64-msvc@14.2.13':
|
||||
resolution: {integrity: sha512-uP1XkqCqV2NVH9+g2sC7qIw+w2tRbcMiXFEbMihkQ8B1+V6m28sshBwAB0SDmOe0u44ne1vFU66+gx/28RsBVQ==}
|
||||
@@ -375,6 +392,15 @@ packages:
|
||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@reactuses/core@5.0.21':
|
||||
resolution: {integrity: sha512-AaTxnd/b80x4h7qMfj0+DhEIpENa6PF2rAvquYRqkohiQ+TD4Onru7JOOgJTIRajttX63pJTsCtl9q9QaZrctg==}
|
||||
peerDependencies:
|
||||
qrcode: ^1.5
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
qrcode:
|
||||
optional: true
|
||||
|
||||
'@rtsao/scc@1.1.0':
|
||||
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
|
||||
|
||||
@@ -416,24 +442,28 @@ packages:
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.16':
|
||||
resolution: {integrity: sha512-SNEDcB+sWOls/B0a+UpUHVa/oegvlXXKYWsTxuXtgWIr5VbWG7rXLZ3fZpLLP3SpRVGTGTnABcyqshFbWSqqKQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.16':
|
||||
resolution: {integrity: sha512-Zsq29MM1ooeH1+chQBa7ffDFnzAZebBBFdsvs4e05tS1H8gn4oKE+PSMn9p/okzVXykEk9ri2/n7BG1XFeifMA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tauri-apps/cli-linux-x64-musl@2.0.0-rc.16':
|
||||
resolution: {integrity: sha512-g+pwSuis2YMxhJJ/pJYwp/Nps5CWvlv/5MV5UfDvClkCkeAyzIqVX+HbBLPcs5S0CePUQNeP0j4d4jBWUqZZQg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.16':
|
||||
resolution: {integrity: sha512-PpPqdMTwJSDAK4KnNjvh77ShSkY+7pih1f6e50EtXar8bjC17e3XcEqFhDNne5mxEVTLYhibs6p1JLPad0ZjRA==}
|
||||
@@ -485,6 +515,9 @@ packages:
|
||||
'@tauri-apps/plugin-shell@2.0.0-rc.1':
|
||||
resolution: {integrity: sha512-JtNROc0rqEwN/g93ig5pK4cl1vUo2yn+osCpY9de64cy/d9hRzof7AuYOgvt/Xcd5VPQmlgo2AGvUh5sQRSR1A==}
|
||||
|
||||
'@tauri-apps/plugin-store@2.0.0-rc.1':
|
||||
resolution: {integrity: sha512-rW71Tkr7OifxoL8NkWgPy5Os4Gn3oJTbv/j/nJ03HDuYsq+F4+8kU8o4epRFJnr6VKmgB/2CtiacSC3dnSSRnA==}
|
||||
|
||||
'@testing-library/dom@10.4.0':
|
||||
resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -1555,6 +1588,22 @@ packages:
|
||||
resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==}
|
||||
hasBin: true
|
||||
|
||||
jotai@2.10.0:
|
||||
resolution: {integrity: sha512-8W4u0aRlOIwGlLQ0sqfl/c6+eExl5D8lZgAUolirZLktyaj4WnxO/8a0HEPmtriQAB6X5LMhXzZVmw02X0P0qQ==}
|
||||
engines: {node: '>=12.20.0'}
|
||||
peerDependencies:
|
||||
'@types/react': '>=17.0.0'
|
||||
react: '>=17.0.0'
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
react:
|
||||
optional: true
|
||||
|
||||
js-cookie@3.0.5:
|
||||
resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
js-tokens@4.0.0:
|
||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||
|
||||
@@ -1617,6 +1666,9 @@ packages:
|
||||
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
lodash-es@4.17.21:
|
||||
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
|
||||
|
||||
lodash.memoize@4.1.2:
|
||||
resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}
|
||||
|
||||
@@ -2180,6 +2232,10 @@ packages:
|
||||
scheduler@0.23.2:
|
||||
resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
|
||||
|
||||
screenfull@5.2.0:
|
||||
resolution: {integrity: sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
semver@6.3.1:
|
||||
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
||||
hasBin: true
|
||||
@@ -2428,6 +2484,11 @@ packages:
|
||||
uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
|
||||
use-sync-external-store@1.2.2:
|
||||
resolution: {integrity: sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==}
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
|
||||
util-deprecate@1.0.2:
|
||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
||||
|
||||
@@ -2697,6 +2758,14 @@ snapshots:
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
optional: true
|
||||
|
||||
'@reactuses/core@5.0.21(react@18.3.1)':
|
||||
dependencies:
|
||||
js-cookie: 3.0.5
|
||||
lodash-es: 4.17.21
|
||||
react: 18.3.1
|
||||
screenfull: 5.2.0
|
||||
use-sync-external-store: 1.2.2(react@18.3.1)
|
||||
|
||||
'@rtsao/scc@1.1.0': {}
|
||||
|
||||
'@rushstack/eslint-patch@1.10.4': {}
|
||||
@@ -2791,6 +2860,10 @@ snapshots:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.0-rc.5
|
||||
|
||||
'@tauri-apps/plugin-store@2.0.0-rc.1':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.0-rc.5
|
||||
|
||||
'@testing-library/dom@10.4.0':
|
||||
dependencies:
|
||||
'@babel/code-frame': 7.24.7
|
||||
@@ -4121,6 +4194,13 @@ snapshots:
|
||||
|
||||
jiti@1.21.6: {}
|
||||
|
||||
jotai@2.10.0(@types/react@18.3.8)(react@18.3.1):
|
||||
optionalDependencies:
|
||||
'@types/react': 18.3.8
|
||||
react: 18.3.1
|
||||
|
||||
js-cookie@3.0.5: {}
|
||||
|
||||
js-tokens@4.0.0: {}
|
||||
|
||||
js-yaml@4.1.0:
|
||||
@@ -4193,6 +4273,8 @@ snapshots:
|
||||
dependencies:
|
||||
p-locate: 5.0.0
|
||||
|
||||
lodash-es@4.17.21: {}
|
||||
|
||||
lodash.memoize@4.1.2: {}
|
||||
|
||||
lodash.merge@4.6.2: {}
|
||||
@@ -4734,6 +4816,8 @@ snapshots:
|
||||
dependencies:
|
||||
loose-envify: 1.4.0
|
||||
|
||||
screenfull@5.2.0: {}
|
||||
|
||||
semver@6.3.1: {}
|
||||
|
||||
semver@7.6.3: {}
|
||||
@@ -5035,6 +5119,10 @@ snapshots:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
|
||||
use-sync-external-store@1.2.2(react@18.3.1):
|
||||
dependencies:
|
||||
react: 18.3.1
|
||||
|
||||
util-deprecate@1.0.2: {}
|
||||
|
||||
which-boxed-primitive@1.0.2:
|
||||
@@ -5105,7 +5193,8 @@ snapshots:
|
||||
|
||||
yocto-queue@0.1.0: {}
|
||||
|
||||
zustand@5.0.0-rc.2(@types/react@18.3.8)(react@18.3.1):
|
||||
zustand@5.0.0-rc.2(@types/react@18.3.8)(react@18.3.1)(use-sync-external-store@1.2.2(react@18.3.1)):
|
||||
optionalDependencies:
|
||||
'@types/react': 18.3.8
|
||||
react: 18.3.1
|
||||
use-sync-external-store: 1.2.2(react@18.3.1)
|
||||
|
||||
16
src-tauri/Cargo.lock
generated
16
src-tauri/Cargo.lock
generated
@@ -19,6 +19,7 @@ dependencies = [
|
||||
"tauri-plugin-os",
|
||||
"tauri-plugin-process",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-store",
|
||||
"window-vibrancy",
|
||||
"winreg",
|
||||
]
|
||||
@@ -4391,6 +4392,21 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-store"
|
||||
version = "2.0.0-rc.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e54ba1a0c0c60a6a08e711e184239f8a50354988b6fe1af8b5ce2215b2e79a2"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.0.0-rc.12"
|
||||
|
||||
@@ -29,6 +29,7 @@ tauri-plugin-clipboard-manager = "2.0.0-alpha.2"
|
||||
tauri-plugin-shell = "2.0.0-rc"
|
||||
tauri-plugin-http = "2.0.0-rc"
|
||||
tauri-plugin-notification = "2.0.0-rc"
|
||||
tauri-plugin-store = "2.0.0-rc"
|
||||
[target.'cfg(windows)'.dependencies] # Windows Only
|
||||
winreg = "0.52.0"
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
{
|
||||
"identifier": "desktop-capability",
|
||||
"platforms": ["macOS", "windows", "linux"],
|
||||
"permissions": ["global-shortcut:default"]
|
||||
}
|
||||
"platforms": [
|
||||
"macOS",
|
||||
"windows",
|
||||
"linux"
|
||||
],
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"global-shortcut:default",
|
||||
"store:allow-set",
|
||||
"store:allow-get",
|
||||
"store:allow-has",
|
||||
"store:allow-delete",
|
||||
"store:allow-clear",
|
||||
"store:allow-values",
|
||||
"store:allow-save",
|
||||
"store:allow-load",
|
||||
"store:allow-reset",
|
||||
"store:allow-entries"
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"permissions":["global-shortcut:default"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:allow-set","store:allow-get","store:allow-has","store:allow-delete","store:allow-clear","store:allow-values","store:allow-save","store:allow-load","store:allow-reset","store:allow-entries"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]}}
|
||||
@@ -5333,6 +5333,131 @@
|
||||
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "shell:deny-stdin-write"
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
||||
"type": "string",
|
||||
"const": "store:default"
|
||||
},
|
||||
{
|
||||
"description": "Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-clear"
|
||||
},
|
||||
{
|
||||
"description": "Enables the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-delete"
|
||||
},
|
||||
{
|
||||
"description": "Enables the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-entries"
|
||||
},
|
||||
{
|
||||
"description": "Enables the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-get"
|
||||
},
|
||||
{
|
||||
"description": "Enables the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-has"
|
||||
},
|
||||
{
|
||||
"description": "Enables the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-keys"
|
||||
},
|
||||
{
|
||||
"description": "Enables the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-length"
|
||||
},
|
||||
{
|
||||
"description": "Enables the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-load"
|
||||
},
|
||||
{
|
||||
"description": "Enables the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-reset"
|
||||
},
|
||||
{
|
||||
"description": "Enables the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-save"
|
||||
},
|
||||
{
|
||||
"description": "Enables the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-set"
|
||||
},
|
||||
{
|
||||
"description": "Enables the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-values"
|
||||
},
|
||||
{
|
||||
"description": "Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-clear"
|
||||
},
|
||||
{
|
||||
"description": "Denies the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-delete"
|
||||
},
|
||||
{
|
||||
"description": "Denies the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-entries"
|
||||
},
|
||||
{
|
||||
"description": "Denies the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-get"
|
||||
},
|
||||
{
|
||||
"description": "Denies the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-has"
|
||||
},
|
||||
{
|
||||
"description": "Denies the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-keys"
|
||||
},
|
||||
{
|
||||
"description": "Denies the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-length"
|
||||
},
|
||||
{
|
||||
"description": "Denies the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-load"
|
||||
},
|
||||
{
|
||||
"description": "Denies the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-reset"
|
||||
},
|
||||
{
|
||||
"description": "Denies the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-save"
|
||||
},
|
||||
{
|
||||
"description": "Denies the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-set"
|
||||
},
|
||||
{
|
||||
"description": "Denies the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-values"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
{
|
||||
"description": "A list of capabilities.",
|
||||
"type": "object",
|
||||
"required": ["capabilities"],
|
||||
"required": [
|
||||
"capabilities"
|
||||
],
|
||||
"properties": {
|
||||
"capabilities": {
|
||||
"description": "The list of capabilities.",
|
||||
@@ -37,7 +39,10 @@
|
||||
"Capability": {
|
||||
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, \"platforms\": [\"macOS\",\"windows\"] } ```",
|
||||
"type": "object",
|
||||
"required": ["identifier", "permissions"],
|
||||
"required": [
|
||||
"identifier",
|
||||
"permissions"
|
||||
],
|
||||
"properties": {
|
||||
"identifier": {
|
||||
"description": "Identifier of the capability.\n\n## Example\n\n`main-user-files-write`",
|
||||
@@ -88,7 +93,10 @@
|
||||
},
|
||||
"platforms": {
|
||||
"description": "Limit which target platforms this capability applies to.\n\nBy default all platforms are targeted.\n\n## Example\n\n`[\"macOS\",\"windows\"]`",
|
||||
"type": ["array", "null"],
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/definitions/Target"
|
||||
}
|
||||
@@ -98,7 +106,9 @@
|
||||
"CapabilityRemote": {
|
||||
"description": "Configuration for remote URLs that are associated with the capability.",
|
||||
"type": "object",
|
||||
"required": ["urls"],
|
||||
"required": [
|
||||
"urls"
|
||||
],
|
||||
"properties": {
|
||||
"urls": {
|
||||
"description": "Remote domains this capability refers to using the [URLPattern standard](https://urlpattern.spec.whatwg.org/).\n\n## Examples\n\n- \"https://*.mydomain.dev\": allows subdomains of mydomain.dev - \"https://mydomain.dev/api/*\": allows any subpath of mydomain.dev/api",
|
||||
@@ -1576,7 +1586,9 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["path"],
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"description": "FS scope path.",
|
||||
@@ -1598,7 +1610,9 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["path"],
|
||||
"required": [
|
||||
"path"
|
||||
],
|
||||
"properties": {
|
||||
"path": {
|
||||
"description": "FS scope path.",
|
||||
@@ -1689,7 +1703,9 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["url"],
|
||||
"required": [
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"url": {
|
||||
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
|
||||
@@ -1711,7 +1727,9 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["url"],
|
||||
"required": [
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"url": {
|
||||
"description": "A URL that can be accessed by the webview when using the HTTP APIs. Wildcards can be used following the URL pattern standard.\n\nSee [the URL Pattern spec](https://urlpattern.spec.whatwg.org/) for more information.\n\nExamples:\n\n- \"https://*\" : allows all HTTPS origin on port 443\n\n- \"https://*:*\" : allows all HTTPS origin on any port\n\n- \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path\n\n- \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
|
||||
@@ -1806,7 +1824,12 @@
|
||||
"title": "Entry",
|
||||
"description": "A command allowed to be executed by the webview API.",
|
||||
"type": "object",
|
||||
"required": ["args", "cmd", "name", "sidecar"],
|
||||
"required": [
|
||||
"args",
|
||||
"cmd",
|
||||
"name",
|
||||
"sidecar"
|
||||
],
|
||||
"properties": {
|
||||
"args": {
|
||||
"description": "The allowed arguments for the command execution.",
|
||||
@@ -1836,7 +1859,12 @@
|
||||
"title": "Entry",
|
||||
"description": "A command allowed to be executed by the webview API.",
|
||||
"type": "object",
|
||||
"required": ["args", "cmd", "name", "sidecar"],
|
||||
"required": [
|
||||
"args",
|
||||
"cmd",
|
||||
"name",
|
||||
"sidecar"
|
||||
],
|
||||
"properties": {
|
||||
"args": {
|
||||
"description": "The allowed arguments for the command execution.",
|
||||
@@ -1886,14 +1914,20 @@
|
||||
},
|
||||
"allow": {
|
||||
"description": "Data that defines what is allowed by the scope.",
|
||||
"type": ["array", "null"],
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/definitions/Value"
|
||||
}
|
||||
},
|
||||
"deny": {
|
||||
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
|
||||
"type": ["array", "null"],
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/definitions/Value"
|
||||
}
|
||||
@@ -1901,7 +1935,9 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"required": ["identifier"]
|
||||
"required": [
|
||||
"identifier"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -5297,6 +5333,131 @@
|
||||
"description": "Denies the stdin_write command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "shell:deny-stdin-write"
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
||||
"type": "string",
|
||||
"const": "store:default"
|
||||
},
|
||||
{
|
||||
"description": "Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-clear"
|
||||
},
|
||||
{
|
||||
"description": "Enables the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-delete"
|
||||
},
|
||||
{
|
||||
"description": "Enables the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-entries"
|
||||
},
|
||||
{
|
||||
"description": "Enables the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-get"
|
||||
},
|
||||
{
|
||||
"description": "Enables the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-has"
|
||||
},
|
||||
{
|
||||
"description": "Enables the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-keys"
|
||||
},
|
||||
{
|
||||
"description": "Enables the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-length"
|
||||
},
|
||||
{
|
||||
"description": "Enables the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-load"
|
||||
},
|
||||
{
|
||||
"description": "Enables the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-reset"
|
||||
},
|
||||
{
|
||||
"description": "Enables the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-save"
|
||||
},
|
||||
{
|
||||
"description": "Enables the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-set"
|
||||
},
|
||||
{
|
||||
"description": "Enables the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:allow-values"
|
||||
},
|
||||
{
|
||||
"description": "Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-clear"
|
||||
},
|
||||
{
|
||||
"description": "Denies the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-delete"
|
||||
},
|
||||
{
|
||||
"description": "Denies the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-entries"
|
||||
},
|
||||
{
|
||||
"description": "Denies the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-get"
|
||||
},
|
||||
{
|
||||
"description": "Denies the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-has"
|
||||
},
|
||||
{
|
||||
"description": "Denies the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-keys"
|
||||
},
|
||||
{
|
||||
"description": "Denies the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-length"
|
||||
},
|
||||
{
|
||||
"description": "Denies the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-load"
|
||||
},
|
||||
{
|
||||
"description": "Denies the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-reset"
|
||||
},
|
||||
{
|
||||
"description": "Denies the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-save"
|
||||
},
|
||||
{
|
||||
"description": "Denies the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-set"
|
||||
},
|
||||
{
|
||||
"description": "Denies the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "store:deny-values"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -5360,27 +5521,37 @@
|
||||
{
|
||||
"description": "MacOS.",
|
||||
"type": "string",
|
||||
"enum": ["macOS"]
|
||||
"enum": [
|
||||
"macOS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Windows.",
|
||||
"type": "string",
|
||||
"enum": ["windows"]
|
||||
"enum": [
|
||||
"windows"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Linux.",
|
||||
"type": "string",
|
||||
"enum": ["linux"]
|
||||
"enum": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Android.",
|
||||
"type": "string",
|
||||
"enum": ["android"]
|
||||
"enum": [
|
||||
"android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "iOS.",
|
||||
"type": "string",
|
||||
"enum": ["iOS"]
|
||||
"enum": [
|
||||
"iOS"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -5394,7 +5565,9 @@
|
||||
{
|
||||
"description": "A variable that is set while calling the command from the webview API.",
|
||||
"type": "object",
|
||||
"required": ["validator"],
|
||||
"required": [
|
||||
"validator"
|
||||
],
|
||||
"properties": {
|
||||
"raw": {
|
||||
"description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
|
||||
@@ -5427,4 +5600,4 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ fn on_button_clicked() -> String {
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_http::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
|
||||
@@ -101,4 +101,4 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
|
||||
// }
|
||||
// })
|
||||
// .build(app)
|
||||
// .unwrap();
|
||||
// .unwrap();
|
||||
|
||||
@@ -7,8 +7,10 @@ import {
|
||||
Card,
|
||||
} from "@/components/window/Card";
|
||||
import { ToolButton } from "../window/ToolButton";
|
||||
import useAppStore from "@/store/app";
|
||||
|
||||
const Notice = () => {
|
||||
const app = useAppStore();
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -22,9 +24,9 @@ const Notice = () => {
|
||||
</ToolButton>
|
||||
</CardTool>
|
||||
</CardHeader>
|
||||
<CardBody>不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl</CardBody>
|
||||
<CardBody>{app.notice || "不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl"}</CardBody>
|
||||
</Card>
|
||||
);
|
||||
)
|
||||
};
|
||||
|
||||
export default Notice;
|
||||
|
||||
@@ -1,47 +1,43 @@
|
||||
"use client"
|
||||
import { ReactNode } from "react";
|
||||
import clsx from "clsx";
|
||||
import {
|
||||
Home,
|
||||
MonitorOne,
|
||||
Movie,
|
||||
Setting,
|
||||
Terminal,
|
||||
Toolkit,
|
||||
} from "@icon-park/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ReactNode } from "react"
|
||||
import clsx from "clsx"
|
||||
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import useAppStore from "@/store/app"
|
||||
|
||||
interface SideButtonProps {
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
className?: string
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
const SideButton = ({ className, children, ...rest }: SideButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
|
||||
const SideButton = ({
|
||||
className,
|
||||
children,
|
||||
...rest
|
||||
}: SideButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
|
||||
return (
|
||||
<button
|
||||
className={clsx(
|
||||
className,
|
||||
"p-2.5 hover:bg-black/5 rounded-lg transition"
|
||||
)}
|
||||
{...rest}
|
||||
>
|
||||
<button className={clsx(className, "p-2.5 hover:bg-black/5 rounded-lg transition")} {...rest}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
const Avatar = () => {
|
||||
const router = useRouter();
|
||||
const router = useRouter()
|
||||
|
||||
return (
|
||||
<div onClick={() => router.push('/users')} className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer">
|
||||
<div
|
||||
onClick={() => router.push("/users")}
|
||||
className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer"
|
||||
>
|
||||
<img src="favicon.ico" alt="avatar" draggable={false} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
const SideBar = () => {
|
||||
const router = useRouter();
|
||||
const router = useRouter()
|
||||
const { version, setVersion } = useAppStore()
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -76,15 +72,12 @@ const SideBar = () => {
|
||||
</SideButton>
|
||||
</section>
|
||||
|
||||
<div
|
||||
className="mx-auto text-sm text-center text-zinc-500"
|
||||
data-tauri-drag-region
|
||||
>
|
||||
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
|
||||
<p>版本号</p>
|
||||
<p>0.0.1</p>
|
||||
<p onClick={()=> setVersion("x.y.z")}>{version}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export default SideBar;
|
||||
export default SideBar
|
||||
|
||||
@@ -1,24 +1,41 @@
|
||||
import { create } from 'zustand'
|
||||
import { tauriStore } from '@/utils/persist'
|
||||
import { createJSONStorage, persist } from 'zustand/middleware'
|
||||
|
||||
|
||||
interface AppState {
|
||||
version: number
|
||||
version: string
|
||||
hasUpdate: boolean
|
||||
hasInit: boolean
|
||||
notice: string
|
||||
useMirror: boolean
|
||||
setVersion: (version: string) => void
|
||||
init: () => void
|
||||
}
|
||||
|
||||
const useAppStore = create<AppState>()((/* set */) => ({
|
||||
version: 0,
|
||||
hasUpdate: false,
|
||||
hasInit: false,
|
||||
notice: "",
|
||||
useMirror: true,
|
||||
init: () => {
|
||||
console.log('init')
|
||||
},
|
||||
// increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
|
||||
}))
|
||||
const { /* store, */storage } = tauriStore("app-test")
|
||||
|
||||
const useAppStore = create<AppState>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
version: "0.0.1",
|
||||
hasUpdate: false,
|
||||
hasInit: false,
|
||||
notice: "Man! What can I say?",
|
||||
useMirror: true,
|
||||
setVersion: (version: string) => set(() => ({ version: version })),
|
||||
init: () => {
|
||||
console.log('init')
|
||||
console.log(get().version)
|
||||
// const version = await store.get("version")
|
||||
// set(() => ({ version: version }))
|
||||
},
|
||||
// increasePopulation: () => set((state) => ({ bears: state.bears + 1 })),
|
||||
}),
|
||||
{
|
||||
name: 'app', // name of item in the storage (must be unique)
|
||||
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
||||
},
|
||||
))
|
||||
|
||||
export default useAppStore
|
||||
62
src/utils/persist.ts
Normal file
62
src/utils/persist.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { StateStorage } from 'zustand/middleware'
|
||||
import { Store } from "@tauri-apps/plugin-store"
|
||||
// import { appConfigDir } from "@tauri-apps/api/path"
|
||||
// import { useThrottleFn } from "@reactuses/core"
|
||||
// import { create } from 'zustand'
|
||||
// import { createJSONStorage, persist } from 'zustand/middleware'
|
||||
|
||||
// 节流设置
|
||||
// const THROTTLE_TIME = 300
|
||||
// const THROTTLE_TIME_STORE = 5000
|
||||
// const THROTTLE_LEADING = false
|
||||
// const THROTTLE_TRAILING = true
|
||||
|
||||
// 自定义Store覆盖get, set等方法,以适应tauri+zustand
|
||||
export function tauriStore(name: string) {
|
||||
const store = new Store(`${name || "store"}.settings.json`)
|
||||
|
||||
const get = (key: string) => {
|
||||
return store.get(key)
|
||||
}
|
||||
|
||||
console.log(store.path)
|
||||
|
||||
const set = (key: string, value: unknown) => {
|
||||
// autoSave.run()
|
||||
setTimeout(async () => {
|
||||
await store.save()
|
||||
})
|
||||
return store.set(key, value)
|
||||
}
|
||||
|
||||
// 自动保存
|
||||
// const autoSave = useThrottleFn(
|
||||
// async () => {
|
||||
// await store.save()
|
||||
// // console.log("store saved")
|
||||
// },
|
||||
// THROTTLE_TIME,
|
||||
// {
|
||||
// 'trailing': THROTTLE_TRAILING,
|
||||
// 'leading': THROTTLE_LEADING
|
||||
// }
|
||||
// )
|
||||
|
||||
// 自定义存储对象
|
||||
const storage: StateStorage = {
|
||||
getItem: async (name: string): Promise<string | null> => {
|
||||
console.log(name)
|
||||
return (await store.get(name)) || null
|
||||
},
|
||||
setItem: async (name: string, value: string): Promise<void> => {
|
||||
console.log(name, 'with value', value, 'has been saved')
|
||||
await store.set(name, value)
|
||||
},
|
||||
removeItem: async (name: string): Promise<void> => {
|
||||
console.log(name, 'has been deleted')
|
||||
await store.delete(name)
|
||||
},
|
||||
}
|
||||
|
||||
return { store, get, set/* , autoSave */, storage }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "ESNext",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
@@ -41,4 +41,4 @@
|
||||
"node_modules",
|
||||
"src-tauri"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user