[feat] basic system info with tauri plugin
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"tauri-plugin-system-info-api": "^2.0.9",
|
||||
"tauri-plugin-valtio": "1.1.1",
|
||||
"throttle-debounce": "^5.0.2",
|
||||
"zustand": "5.0.1"
|
||||
|
||||
142
src-tauri/Cargo.lock
generated
142
src-tauri/Cargo.lock
generated
@@ -20,6 +20,7 @@ dependencies = [
|
||||
"tauri-plugin-process",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-store",
|
||||
"tauri-plugin-system-info",
|
||||
"tauri-plugin-valtio",
|
||||
"window-vibrancy",
|
||||
"winreg 0.55.0",
|
||||
@@ -742,6 +743,25 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.20"
|
||||
@@ -2107,6 +2127,12 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libappindicator"
|
||||
version = "0.9.0"
|
||||
@@ -2208,6 +2234,15 @@ dependencies = [
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach2"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
@@ -2396,6 +2431,15 @@ dependencies = [
|
||||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
@@ -3323,6 +3367,26 @@ version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.7"
|
||||
@@ -3919,6 +3983,23 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "starship-battery"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "725bc1c7374f435ef65746eb1a5789cb7d02b8e997f9a3edf979bfb42da68311"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation 0.9.4",
|
||||
"lazycell",
|
||||
"libc",
|
||||
"mach2",
|
||||
"nix 0.28.0",
|
||||
"num-traits",
|
||||
"uom 0.36.0",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
@@ -4014,6 +4095,21 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.30.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"ntapi",
|
||||
"once_cell",
|
||||
"rayon",
|
||||
"windows 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.6.1"
|
||||
@@ -4411,6 +4507,21 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-system-info"
|
||||
version = "2.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aea0f3227b3b739079d0c5751d2f19eca9e08ff09d378ad92412b966a0e3ad1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"starship-battery",
|
||||
"sysinfo",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror 1.0.65",
|
||||
"uom 0.35.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-valtio"
|
||||
version = "1.1.1"
|
||||
@@ -4982,6 +5093,27 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "uom"
|
||||
version = "0.35.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8362194c7a9845a7a7f3562173d6e1da3f24f7132018cb78fe77a5b4474187b2"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"serde",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uom"
|
||||
version = "0.36.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffd36e5350a65d112584053ee91843955826bf9e56ec0d1351214e01f6d7cd9c"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.2"
|
||||
@@ -5401,6 +5533,16 @@ dependencies = [
|
||||
"windows-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
||||
dependencies = [
|
||||
"windows-core 0.52.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.56.0"
|
||||
|
||||
@@ -31,6 +31,7 @@ tauri-plugin-http = "2.4.0"
|
||||
tauri-plugin-notification = "2.2.2"
|
||||
tauri-plugin-valtio = "1.1.1"
|
||||
tauri-plugin-store = "2.2.0"
|
||||
tauri-plugin-system-info = "2.0.9"
|
||||
[target.'cfg(windows)'.dependencies] # Windows Only
|
||||
winreg = "0.55.0"
|
||||
|
||||
|
||||
9
src-tauri/capabilities/system-info.json
Normal file
9
src-tauri/capabilities/system-info.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"identifier": "system-info",
|
||||
"windows": [
|
||||
"*"
|
||||
],
|
||||
"permissions": [
|
||||
"system-info:allow-all"
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"notice":"","inited":false,"hasUpdate":false,"version":"x.y.z","useMirror":true}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
{"powerPlan":0,"launchOptions":["sdfasdfasdf","-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder","-novid -high -freq 144 -fullscreen -allow_third_party_software"],"launchIndex":0}
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:default","store:allow-set","store:allow-get-store","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"]},"valtio":{"identifier":"valtio","description":"","local":true,"windows":["*"],"permissions":["valtio:default","core:event:default"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:default","store:allow-set","store:allow-get-store","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"]},"system-info":{"identifier":"system-info","description":"","local":true,"windows":["*"],"permissions":["system-info:allow-all"]},"valtio":{"identifier":"valtio","description":"","local":true,"windows":["*"],"permissions":["valtio:default","core:event:default"]}}
|
||||
@@ -5669,6 +5669,261 @@
|
||||
"type": "string",
|
||||
"const": "store:deny-values"
|
||||
},
|
||||
{
|
||||
"description": "This enables all permissions for system info plugin",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-all"
|
||||
},
|
||||
{
|
||||
"description": "Enables the all_sys_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-all-sys-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the batteries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-batteries"
|
||||
},
|
||||
{
|
||||
"description": "Enables the components command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-components"
|
||||
},
|
||||
{
|
||||
"description": "Enables the cpu_count command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-cpu-count"
|
||||
},
|
||||
{
|
||||
"description": "Enables the cpu_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-cpu-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the cpus command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-cpus"
|
||||
},
|
||||
{
|
||||
"description": "Enables the disks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-disks"
|
||||
},
|
||||
{
|
||||
"description": "Enables the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-execute"
|
||||
},
|
||||
{
|
||||
"description": "Enables the hostname command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-hostname"
|
||||
},
|
||||
{
|
||||
"description": "Enables the kernel_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-kernel-version"
|
||||
},
|
||||
{
|
||||
"description": "Enables the memory_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-memory-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-name"
|
||||
},
|
||||
{
|
||||
"description": "Enables the networks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-networks"
|
||||
},
|
||||
{
|
||||
"description": "Enables the os_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-os-version"
|
||||
},
|
||||
{
|
||||
"description": "Enables the ping command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-ping"
|
||||
},
|
||||
{
|
||||
"description": "Enables the processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-processes"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-all"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_cpu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-cpu"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-memory"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-processes"
|
||||
},
|
||||
{
|
||||
"description": "Enables the static_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-static-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the total_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-total-memory"
|
||||
},
|
||||
{
|
||||
"description": "Enables the total_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-total-swap"
|
||||
},
|
||||
{
|
||||
"description": "Enables the used_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-used-memory"
|
||||
},
|
||||
{
|
||||
"description": "Enables the used_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-used-swap"
|
||||
},
|
||||
{
|
||||
"description": "Denies the all_sys_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-all-sys-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the batteries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-batteries"
|
||||
},
|
||||
{
|
||||
"description": "Denies the components command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-components"
|
||||
},
|
||||
{
|
||||
"description": "Denies the cpu_count command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-cpu-count"
|
||||
},
|
||||
{
|
||||
"description": "Denies the cpu_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-cpu-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the cpus command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-cpus"
|
||||
},
|
||||
{
|
||||
"description": "Denies the disks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-disks"
|
||||
},
|
||||
{
|
||||
"description": "Denies the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-execute"
|
||||
},
|
||||
{
|
||||
"description": "Denies the hostname command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-hostname"
|
||||
},
|
||||
{
|
||||
"description": "Denies the kernel_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-kernel-version"
|
||||
},
|
||||
{
|
||||
"description": "Denies the memory_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-memory-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-name"
|
||||
},
|
||||
{
|
||||
"description": "Denies the networks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-networks"
|
||||
},
|
||||
{
|
||||
"description": "Denies the os_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-os-version"
|
||||
},
|
||||
{
|
||||
"description": "Denies the ping command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-ping"
|
||||
},
|
||||
{
|
||||
"description": "Denies the processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-processes"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-all"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_cpu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-cpu"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-memory"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-processes"
|
||||
},
|
||||
{
|
||||
"description": "Denies the static_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-static-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the total_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-total-memory"
|
||||
},
|
||||
{
|
||||
"description": "Denies the total_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-total-swap"
|
||||
},
|
||||
{
|
||||
"description": "Denies the used_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-used-memory"
|
||||
},
|
||||
{
|
||||
"description": "Denies the used_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-used-swap"
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for tauri-plugin-valtio.",
|
||||
"type": "string",
|
||||
|
||||
@@ -5669,6 +5669,261 @@
|
||||
"type": "string",
|
||||
"const": "store:deny-values"
|
||||
},
|
||||
{
|
||||
"description": "This enables all permissions for system info plugin",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-all"
|
||||
},
|
||||
{
|
||||
"description": "Enables the all_sys_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-all-sys-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the batteries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-batteries"
|
||||
},
|
||||
{
|
||||
"description": "Enables the components command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-components"
|
||||
},
|
||||
{
|
||||
"description": "Enables the cpu_count command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-cpu-count"
|
||||
},
|
||||
{
|
||||
"description": "Enables the cpu_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-cpu-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the cpus command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-cpus"
|
||||
},
|
||||
{
|
||||
"description": "Enables the disks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-disks"
|
||||
},
|
||||
{
|
||||
"description": "Enables the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-execute"
|
||||
},
|
||||
{
|
||||
"description": "Enables the hostname command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-hostname"
|
||||
},
|
||||
{
|
||||
"description": "Enables the kernel_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-kernel-version"
|
||||
},
|
||||
{
|
||||
"description": "Enables the memory_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-memory-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-name"
|
||||
},
|
||||
{
|
||||
"description": "Enables the networks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-networks"
|
||||
},
|
||||
{
|
||||
"description": "Enables the os_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-os-version"
|
||||
},
|
||||
{
|
||||
"description": "Enables the ping command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-ping"
|
||||
},
|
||||
{
|
||||
"description": "Enables the processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-processes"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-all"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_cpu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-cpu"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-memory"
|
||||
},
|
||||
{
|
||||
"description": "Enables the refresh_processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-refresh-processes"
|
||||
},
|
||||
{
|
||||
"description": "Enables the static_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-static-info"
|
||||
},
|
||||
{
|
||||
"description": "Enables the total_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-total-memory"
|
||||
},
|
||||
{
|
||||
"description": "Enables the total_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-total-swap"
|
||||
},
|
||||
{
|
||||
"description": "Enables the used_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-used-memory"
|
||||
},
|
||||
{
|
||||
"description": "Enables the used_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:allow-used-swap"
|
||||
},
|
||||
{
|
||||
"description": "Denies the all_sys_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-all-sys-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the batteries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-batteries"
|
||||
},
|
||||
{
|
||||
"description": "Denies the components command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-components"
|
||||
},
|
||||
{
|
||||
"description": "Denies the cpu_count command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-cpu-count"
|
||||
},
|
||||
{
|
||||
"description": "Denies the cpu_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-cpu-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the cpus command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-cpus"
|
||||
},
|
||||
{
|
||||
"description": "Denies the disks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-disks"
|
||||
},
|
||||
{
|
||||
"description": "Denies the execute command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-execute"
|
||||
},
|
||||
{
|
||||
"description": "Denies the hostname command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-hostname"
|
||||
},
|
||||
{
|
||||
"description": "Denies the kernel_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-kernel-version"
|
||||
},
|
||||
{
|
||||
"description": "Denies the memory_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-memory-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the name command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-name"
|
||||
},
|
||||
{
|
||||
"description": "Denies the networks command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-networks"
|
||||
},
|
||||
{
|
||||
"description": "Denies the os_version command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-os-version"
|
||||
},
|
||||
{
|
||||
"description": "Denies the ping command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-ping"
|
||||
},
|
||||
{
|
||||
"description": "Denies the processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-processes"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_all command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-all"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_cpu command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-cpu"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-memory"
|
||||
},
|
||||
{
|
||||
"description": "Denies the refresh_processes command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-refresh-processes"
|
||||
},
|
||||
{
|
||||
"description": "Denies the static_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-static-info"
|
||||
},
|
||||
{
|
||||
"description": "Denies the total_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-total-memory"
|
||||
},
|
||||
{
|
||||
"description": "Denies the total_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-total-swap"
|
||||
},
|
||||
{
|
||||
"description": "Denies the used_memory command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-used-memory"
|
||||
},
|
||||
{
|
||||
"description": "Denies the used_swap command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "system-info:deny-used-swap"
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for tauri-plugin-valtio.",
|
||||
"type": "string",
|
||||
|
||||
@@ -44,6 +44,7 @@ fn main() {
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_system_info::init())
|
||||
// .plugin(tauri_plugin_store::Builder::default().build())
|
||||
// .plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.setup(|app| {
|
||||
|
||||
@@ -1,3 +1,78 @@
|
||||
"use client"
|
||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "@/components/window/Card"
|
||||
import { ToolButton } from "@/components/window/ToolButton"
|
||||
import { Chip } from "@heroui/react"
|
||||
import { SettingConfig, Refresh, UploadOne, HardDisk } from "@icon-park/react"
|
||||
import { useState, useEffect } from "react"
|
||||
import {
|
||||
allSysInfo,
|
||||
memoryInfo,
|
||||
cpuInfo,
|
||||
AllSystemInfo,
|
||||
StaticInfo,
|
||||
MemoryInfo,
|
||||
CpuInfo,
|
||||
Batteries,
|
||||
batteries,
|
||||
staticInfo,
|
||||
} from "tauri-plugin-system-info-api"
|
||||
export default function Page() {
|
||||
return <div>Gear</div>
|
||||
return (
|
||||
<Card className="h-full">
|
||||
<CardHeader>
|
||||
<CardIcon type="menu">
|
||||
<SettingConfig /> 硬件
|
||||
</CardIcon>
|
||||
<CardTool>
|
||||
{/* <ToolButton>
|
||||
<UploadOne />
|
||||
云同步
|
||||
</ToolButton> */}
|
||||
<ToolButton>
|
||||
<Refresh /> 刷新
|
||||
</ToolButton>
|
||||
</CardTool>
|
||||
</CardHeader>
|
||||
|
||||
<CardBody>
|
||||
<HardwareInfo />
|
||||
</CardBody>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
function HardwareInfo() {
|
||||
const [allSysData, setAllSysData] = useState<AllSystemInfo>()
|
||||
// const [memInfo, setMemInfo] = useState("")
|
||||
// const [staticData, setStaticData] = useState("")
|
||||
// const [cpuData, setCpuData] = useState("")
|
||||
// const [batteryData, setBatteryData] = useState("")
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const sys = await allSysInfo()
|
||||
console.log(sys)
|
||||
setAllSysData(sys)
|
||||
// console.log(await memoryInfo())
|
||||
// console.log(await staticInfo())
|
||||
// console.log(await cpuInfo())
|
||||
// console.log(await batteries())
|
||||
}
|
||||
|
||||
fetchData()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<Chip>CPU型号: {allSysData?.cpus[0]?.brand}</Chip>
|
||||
<Chip>线程数: {allSysData?.cpu_count}</Chip>
|
||||
<Chip>
|
||||
系统: {allSysData?.name} {allSysData?.os_version}
|
||||
</Chip>
|
||||
<Chip>
|
||||
内存:{allSysData?.total_memory &&
|
||||
(allSysData?.total_memory / 1024 / 1024 / 1024).toFixed(0) + "GB"}
|
||||
</Chip>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user