├── .changes ├── V1.0.md ├── config.json ├── initial-release.md └── readme.md ├── .github ├── FUNDING.yml └── workflows │ ├── jsr-publish.yml │ └── npm-publish.yml ├── .gitignore ├── Cargo.toml ├── LICENSE ├── README.md ├── build.rs ├── dist-js ├── api.d.ts ├── api.d.ts.map ├── index.cjs ├── index.d.ts ├── index.d.ts.map ├── index.js ├── type.d.ts └── type.d.ts.map ├── examples └── sveltekit │ ├── .gitignore │ ├── .npmrc │ ├── README.md │ ├── package.json │ ├── pnpm-lock.yaml │ ├── postcss.config.js │ ├── src-tauri │ ├── .gitignore │ ├── Cargo.toml │ ├── build.rs │ ├── capabilities │ │ └── default.json │ ├── icons │ │ ├── 128x128.png │ │ ├── 128x128@2x.png │ │ ├── 32x32.png │ │ ├── Square107x107Logo.png │ │ ├── Square142x142Logo.png │ │ ├── Square150x150Logo.png │ │ ├── Square284x284Logo.png │ │ ├── Square30x30Logo.png │ │ ├── Square310x310Logo.png │ │ ├── Square44x44Logo.png │ │ ├── Square71x71Logo.png │ │ ├── Square89x89Logo.png │ │ ├── StoreLogo.png │ │ ├── icon.icns │ │ ├── icon.ico │ │ └── icon.png │ ├── src │ │ ├── lib.rs │ │ └── main.rs │ └── tauri.conf.json │ ├── src │ ├── app.d.ts │ ├── app.html │ ├── lib │ │ ├── app.css │ │ └── index.ts │ └── routes │ │ ├── +layout.svelte │ │ ├── +layout.ts │ │ └── +page.svelte │ ├── static │ └── favicon.png │ ├── svelte.config.js │ ├── tailwind.config.js │ ├── tsconfig.json │ └── vite.config.ts ├── guest-js ├── api.ts ├── index.ts └── type.ts ├── jsr.json ├── package.json ├── permissions ├── all.toml ├── autogenerated │ ├── commands │ │ ├── all_sys_info.toml │ │ ├── batteries.toml │ │ ├── components.toml │ │ ├── cpu_count.toml │ │ ├── cpu_info.toml │ │ ├── cpus.toml │ │ ├── disks.toml │ │ ├── execute.toml │ │ ├── hostname.toml │ │ ├── kernel_version.toml │ │ ├── load_average.toml │ │ ├── memory_info.toml │ │ ├── name.toml │ │ ├── networks.toml │ │ ├── os_version.toml │ │ ├── ping.toml │ │ ├── processes.toml │ │ ├── refresh_all.toml │ │ ├── refresh_cpu.toml │ │ ├── refresh_memory.toml │ │ ├── refresh_processes.toml │ │ ├── static_info.toml │ │ ├── total_memory.toml │ │ ├── total_swap.toml │ │ ├── uptime.toml │ │ ├── used_memory.toml │ │ └── used_swap.toml │ └── reference.md └── schemas │ └── schema.json ├── pnpm-lock.yaml ├── rollup.config.js ├── src ├── commands │ ├── battery.rs │ ├── component.rs │ ├── cpu.rs │ ├── disk.rs │ ├── memory.rs │ ├── mod.rs │ ├── network.rs │ ├── process.rs │ ├── refresh.rs │ └── static_info.rs ├── desktop.rs ├── error.rs ├── lib.rs ├── mobile.rs ├── model │ ├── aggregate.rs │ ├── common.rs │ └── mod.rs └── utils │ ├── mod.rs │ └── sysinfo.rs └── tsconfig.json /.changes/V1.0.md: -------------------------------------------------------------------------------- 1 | --- 2 | "tauri-plugin-system-info": "major" 3 | "tauri-plugin-system-info-api": "major" 4 | --- 5 | 6 | Version 1.0. v1.x will be for Tauri v1, and v2.x will be for Tauri v2. -------------------------------------------------------------------------------- /.changes/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "gitSiteUrl": "https://www.github.com/your-org/tauri-plugin-system-info/", 3 | "pkgManagers": { 4 | "rust": { 5 | "version": true, 6 | "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p' -", 7 | "prepublish": [ 8 | "sudo apt-get update", 9 | "sudo apt-get install -y webkit2gtk-4.0", 10 | "cargo install cargo-audit", 11 | { 12 | "command": "cargo generate-lockfile", 13 | "dryRunCommand": true, 14 | "pipe": true 15 | }, 16 | { 17 | "command": "echo '
\n

Cargo Audit

\n\n```'", 18 | "dryRunCommand": true, 19 | "pipe": true 20 | }, 21 | { 22 | "command": "cargo audit ${ process.env.CARGO_AUDIT_OPTIONS || '' }", 23 | "dryRunCommand": true, 24 | "pipe": true 25 | }, 26 | { 27 | "command": "echo '```\n\n
\n'", 28 | "dryRunCommand": true, 29 | "pipe": true 30 | } 31 | ], 32 | "publish": [ 33 | { 34 | "command": "cargo package --no-verify", 35 | "dryRunCommand": true 36 | }, 37 | { 38 | "command": "echo '
\n

Cargo Publish

\n\n```'", 39 | "dryRunCommand": true, 40 | "pipe": true 41 | }, 42 | { 43 | "command": "cargo publish", 44 | "dryRunCommand": "cargo publish --dry-run", 45 | "pipe": true 46 | }, 47 | { 48 | "command": "echo '```\n\n
\n'", 49 | "dryRunCommand": true, 50 | "pipe": true 51 | } 52 | ] 53 | }, 54 | "javascript": { 55 | "version": true, 56 | "getPublishedVersion": "npm view ${ pkgFile.pkg.name } version", 57 | "publish": [ 58 | { 59 | "command": "echo '
\n

Yarn Publish

\n\n```'", 60 | "dryRunCommand": true, 61 | "pipe": true 62 | }, 63 | { 64 | "command": "yarn publish --access public --loglevel silly", 65 | "dryRunCommand": "npm publish --dry-run --access public", 66 | "pipe": true 67 | }, 68 | { 69 | "command": "echo '```\n\n
\n'", 70 | "dryRunCommand": true, 71 | "pipe": true 72 | } 73 | ] 74 | } 75 | }, 76 | "packages": { 77 | "tauri-plugin-system-info": { 78 | "path": ".", 79 | "manager": "rust", 80 | "releaseTag": "crate-v${ pkgFile.version }" 81 | }, 82 | "tauri-plugin-system-info-api": { 83 | "path": ".", 84 | "manager": "javascript", 85 | "dependencies": [ 86 | "tauri-plugin-system-info" 87 | ], 88 | "releaseTag": "npm-v${ pkgFile.version }" 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /.changes/initial-release.md: -------------------------------------------------------------------------------- 1 | --- 2 | "tauri-plugin-system-info": "minor" 3 | "tauri-plugin-system-info-api": "minor" 4 | --- 5 | 6 | Initial release. 7 | -------------------------------------------------------------------------------- /.changes/readme.md: -------------------------------------------------------------------------------- 1 | # Changes 2 | ##### via https://github.com/jbolda/covector 3 | 4 | As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version *number*, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend it represents the overall change for our sanity. 5 | 6 | When you select the version bump required, you do *not* need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. 7 | 8 | Use the following format: 9 | ```md 10 | --- 11 | "tauri-plugin-system-info": patch 12 | --- 13 | 14 | Change summary goes here 15 | 16 | ``` 17 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [HuakunShen] 2 | buy_me_a_coffee: huakun -------------------------------------------------------------------------------- /.github/workflows/jsr-publish.yml: -------------------------------------------------------------------------------- 1 | name: JSR Publish 2 | on: 3 | push: 4 | branches: 5 | - v2 6 | - main 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | 12 | permissions: 13 | contents: read 14 | id-token: write 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | - uses: actions/setup-node@v4 19 | with: 20 | node-version: 22 21 | registry-url: https://registry.npmjs.org/ 22 | - uses: pnpm/action-setup@v4 23 | - run: | 24 | pnpm install 25 | pnpm build 26 | - name: Publish package 27 | run: npx jsr publish --allow-slow-types 28 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages 3 | 4 | name: NPM Package Publish 5 | 6 | on: 7 | push: 8 | branches: 9 | - main 10 | - v2 11 | release: 12 | types: [created] 13 | workflow_dispatch: 14 | 15 | jobs: 16 | publish-npm: 17 | runs-on: ubuntu-latest 18 | permissions: 19 | contents: read 20 | id-token: write 21 | steps: 22 | - uses: actions/checkout@v4 23 | - uses: oven-sh/setup-bun@v2 24 | - uses: denoland/setup-deno@v2 25 | with: 26 | deno-version: v2.x 27 | - uses: actions/setup-node@v4 28 | with: 29 | node-version: 22 30 | registry-url: https://registry.npmjs.org/ 31 | - uses: pnpm/action-setup@v4 32 | - run: | 33 | pnpm install 34 | pnpm build 35 | - name: Check if version is already published 36 | run: | 37 | PACKAGE_VERSION=$(node -p "require('./package.json').version") 38 | PACKAGE_NAME=$(jq -r '.name' ./package.json) 39 | npm view $PACKAGE_NAME@$PACKAGE_VERSION 40 | continue-on-error: true 41 | id: check_version 42 | - name: Publish 43 | if: steps.check_version.outcome != 'success' 44 | run: npm publish --provenance --access public 45 | env: 46 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vs 2 | .DS_Store 3 | .Thumbs.db 4 | *.sublime* 5 | .idea/ 6 | debug.log 7 | package-lock.json 8 | .vscode/settings.json 9 | yarn.lock 10 | 11 | /target 12 | Cargo.lock 13 | node_modules/ 14 | docs/ 15 | .turbo 16 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tauri-plugin-system-info" 3 | version = "2.0.9" 4 | authors = ["Huakun"] 5 | edition = "2021" 6 | rust-version = "1.70" 7 | exclude = ["/examples", "/dist-js", "/guest-js", "/node_modules"] 8 | links = "tauri-plugin-system-info" 9 | description = "A tauri plugin for retrieving system info" 10 | license = "MIT" 11 | repository = "https://github.com/HuakunShen/tauri-plugin-system-info" 12 | 13 | [package.metadata.docs.rs] 14 | rustc-args = ["--cfg", "docsrs"] 15 | rustdoc-args = ["--cfg", "docsrs"] 16 | 17 | [dependencies] 18 | tauri = { version = "2.0.1" } 19 | serde = "1.0" 20 | thiserror = "1.0" 21 | sysinfo = { version = "0.30.13" } 22 | starship-battery = "0.8.2" 23 | uom = { version = "0.35.0", features = ["serde"] } 24 | 25 | [build-dependencies] 26 | tauri-plugin = { version = "2.0.1", features = ["build"] } 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Huakun Shen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tauri Plugin system-info 2 | 3 | TypeScript Documentation: https://huakunshen.github.io/tauri-plugin-system-info 4 | Rust Documentation: https://docs.rs/crate/tauri-plugin-system-info 5 | 6 | > This is a Tauri plugin for reading system information. 7 | 8 | - Rust Crate: https://crates.io/crates/tauri-plugin-system-info 9 | - TypeScript API: https://www.npmjs.com/package/tauri-plugin-system-info-api 10 | 11 | ## Demo App 12 | 13 | ![](https://i.imgur.com/tcuNU4K.png) 14 | 15 | ## Installation 16 | 17 | > If you are installing from npm and crates.io package registry, make sure the versions for both packages are the same, otherwise, the API may not match. 18 | 19 | > For Tauri v1 app, use version 1.x, for Tauri v2 app, use version 2.x. (this applies to both npm and crates.io packages) 20 | 21 | ### Rust Install 22 | 23 | `cargo add tauri-plugin-system-info` within `src-tauri` to add the package. 24 | 25 | Or add the following to your `Cargo.toml` for the latest unpublished version (not recommanded). 26 | 27 | ```toml 28 | tauri-plugin-system-info = { git = "https://github.com/HuakunShen/tauri-plugin-system-info", branch = "v1" } # use v2 branch for Tauri v2 plugin 29 | ``` 30 | 31 | ### NPM Install 32 | 33 | Run the following to install JavaScript/TypeScript API package. 34 | 35 | ```bash 36 | npm i tauri-plugin-system-info-api 37 | # npm add https://github.com/HuakunShen/tauri-plugin-system-info # or this for latest unpublished version (not recommended) 38 | ``` 39 | 40 | In `main.rs`, add the following to your `tauri::Builder`: 41 | 42 | ```rust 43 | fn main() { 44 | tauri::Builder::default() 45 | .plugin(tauri_plugin_system_info::init()) 46 | .run(tauri::generate_context!()) 47 | .expect("error while running tauri application"); 48 | } 49 | ``` 50 | 51 | ## Info Supported 52 | 53 | - [x] CPU 54 | - [x] Network 55 | - [x] Process 56 | - [x] Memory 57 | - [x] Hostname 58 | - [x] Kernel Version 59 | - [x] OS Version 60 | - [x] Battery 61 | 62 | ## Third Party Libraries Used 63 | 64 | - [`sysinfo`](https://crates.io/crates/sysinfo) 65 | 66 | ## API 67 | 68 | ### TypeScript 69 | 70 | All TypeScript APIs can be found in [api.ts](./webview-src/api.ts). 71 | 72 | Return type of each API is added. The object structures can be found in [type.ts](./webview-src/type.ts). 73 | 74 | Valibot was used to define type schema and infer TypeScript types. You can import the types exported from the npm package. 75 | 76 | The exported Valibot schemas can be used to parse data and make sure the data returned from rust APIs match the desired structure defined in schema. 77 | 78 | ```typescript 79 | import { 80 | allSysInfo, 81 | memoryInfo, 82 | staticInfo, 83 | cpuInfo, 84 | AllSystemInfo, 85 | StaticInfo, 86 | MemoryInfo, 87 | CpuInfo, 88 | batteries, 89 | Batteries, 90 | } from "tauri-plugin-system-info-api"; 91 | 92 | console.log(AllSystemInfo.parse(await allSysInfo())); 93 | console.log(MemoryInfo.parse(await memoryInfo())); 94 | console.log(StaticInfo.parse(await staticInfo())); 95 | console.log(CpuInfo.parse(await cpuInfo())); 96 | console.log(Batteries.parse(await batteries())); 97 | ``` 98 | 99 | ### Rust 100 | 101 | The API functions in Rust are all exported, so that you can also build your own commands. 102 | 103 | Here is a simple example: 104 | 105 | ```rust 106 | use tauri_plugin_system_info::utils::{SysInfo, SysInfoState}; 107 | use tauri_plugin_system_info::commands; 108 | use tauri_plugin_system_info::model::Cpu; 109 | 110 | #[tauri::command] 111 | fn cpu_count() -> Result { 112 | let state = SysInfoState::default(); 113 | let sysinfo = state.sysinfo.lock().unwrap(); 114 | let cpu_count = sysinfo.cpu_count(); 115 | Ok(cpu_count) 116 | } 117 | ``` 118 | 119 | See https://docs.rs/crate/tauri-plugin-system-info/ for full rust documentation. 120 | 121 | `SysInfo` is the API struct that can be used to access all information. It's like a wrapper for `sysinfo` APIs and other crates. The reason for doing this is, some structs in third party libraries cannot be cloned or serialized, and thus cannot be sent to the frontend. 122 | 123 | I aggregate all the APIs, do structure conversion and serilization with custom code. 124 | 125 | ## Usage 126 | 127 | See [SvelteKit Example](./examples/sveltekit/README.md) for an example written with SvelteKit. 128 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | const COMMANDS: &[&str] = &[ 2 | "all_sys_info", 3 | "total_memory", 4 | "used_memory", 5 | "total_swap", 6 | "used_swap", 7 | "memory_info", 8 | "hostname", 9 | "name", 10 | "kernel_version", 11 | "os_version", 12 | "static_info", 13 | "components", 14 | "cpus", 15 | "cpu_count", 16 | "cpu_info", 17 | "disks", 18 | "networks", 19 | "processes", 20 | "refresh_all", 21 | "refresh_memory", 22 | "refresh_cpu", 23 | "refresh_processes", 24 | "batteries", 25 | "load_average", 26 | "uptime", 27 | ]; 28 | 29 | fn main() { 30 | tauri_plugin::Builder::new(COMMANDS) 31 | .android_path("android") 32 | .ios_path("ios") 33 | .build(); 34 | } 35 | -------------------------------------------------------------------------------- /dist-js/api.d.ts: -------------------------------------------------------------------------------- 1 | import { Cpu, Disk, Network, Component, Process, StaticInfo, MemoryInfo, CpuInfo, AllSystemInfo, Battery, LoadAverage } from "./type"; 2 | export declare function allSysInfo(): Promise; 3 | export declare function totalMemory(): Promise; 4 | export declare function usedMemory(): Promise; 5 | export declare function totalSwap(): Promise; 6 | export declare function usedSwap(): Promise; 7 | export declare function memoryInfo(): Promise; 8 | export declare function hostname(): Promise; 9 | export declare function name(): Promise; 10 | export declare function kernelVersion(): Promise; 11 | export declare function osVersion(): Promise; 12 | export declare function staticInfo(): Promise; 13 | export declare function components(): Promise; 14 | export declare function cpus(): Promise; 15 | export declare function cpuCount(): Promise; 16 | export declare function cpuInfo(): Promise; 17 | export declare function disks(): Promise; 18 | export declare function networks(): Promise; 19 | export declare function processes(): Promise; 20 | export declare function refreshAll(): Promise; 21 | export declare function refreshMemory(): Promise; 22 | export declare function refreshCpu(): Promise; 23 | export declare function refreshProcesses(): Promise; 24 | export declare function debugCommand(): Promise; 25 | export declare function batteries(): Promise; 26 | export declare function uptime(): Promise; 27 | export declare function loadAverage(): Promise; 28 | //# sourceMappingURL=api.d.ts.map -------------------------------------------------------------------------------- /dist-js/api.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../guest-js/api.ts"],"names":[],"mappings":"AACA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,OAAO,EACP,WAAW,EACZ,MAAM,QAAQ,CAAC;AAEhB,wBAAgB,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC,CAEnD;AAED,wBAAgB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAE7C;AACD,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5C;AACD,wBAAgB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAE3C;AACD,wBAAgB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAE1C;AACD,wBAAgB,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CAEhD;AAED,wBAAgB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAE1C;AACD,wBAAgB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAEtC;AACD,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/C;AACD,wBAAgB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAE3C;AACD,wBAAgB,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CAEhD;AAED,wBAAgB,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAEjD;AAED,wBAAgB,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAErC;AACD,wBAAgB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAE1C;AACD,wBAAgB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAE1C;AAED,wBAAgB,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAEvC;AAED,wBAAgB,QAAQ,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAE7C;AAED,wBAAgB,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAE9C;AAED,wBAAgB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1C;AACD,wBAAgB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAE7C;AACD,wBAAgB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1C;AACD,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEhD;AAED,wBAAgB,YAAY,qBAE3B;AAED,wBAAgB,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAE9C;AAED,wBAAgB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAExC;AAED,wBAAgB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAElD"} -------------------------------------------------------------------------------- /dist-js/index.cjs: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var core = require('@tauri-apps/api/core'); 4 | var valibot = require('valibot'); 5 | 6 | function allSysInfo() { 7 | return core.invoke("plugin:system-info|all_sys_info"); 8 | } 9 | // Memory 10 | function totalMemory() { 11 | return core.invoke("plugin:system-info|total_memory"); 12 | } 13 | function usedMemory() { 14 | return core.invoke("plugin:system-info|used_memory"); 15 | } 16 | function totalSwap() { 17 | return core.invoke("plugin:system-info|total_swap"); 18 | } 19 | function usedSwap() { 20 | return core.invoke("plugin:system-info|used_swap"); 21 | } 22 | function memoryInfo() { 23 | return core.invoke("plugin:system-info|memory_info"); 24 | } 25 | // Static Info 26 | function hostname() { 27 | return core.invoke("plugin:system-info|hostname"); 28 | } 29 | function name() { 30 | return core.invoke("plugin:system-info|name"); 31 | } 32 | function kernelVersion() { 33 | return core.invoke("plugin:system-info|kernel_version"); 34 | } 35 | function osVersion() { 36 | return core.invoke("plugin:system-info|os_version"); 37 | } 38 | function staticInfo() { 39 | return core.invoke("plugin:system-info|static_info"); 40 | } 41 | // Components 42 | function components() { 43 | return core.invoke("plugin:system-info|components"); 44 | } 45 | // Cpu 46 | function cpus() { 47 | return core.invoke("plugin:system-info|cpus"); 48 | } 49 | function cpuCount() { 50 | return core.invoke("plugin:system-info|cpu_count"); 51 | } 52 | function cpuInfo() { 53 | return core.invoke("plugin:system-info|cpu_info"); 54 | } 55 | // Disk 56 | function disks() { 57 | return core.invoke("plugin:system-info|disks"); 58 | } 59 | // Network 60 | function networks() { 61 | return core.invoke("plugin:system-info|networks"); 62 | } 63 | // Process 64 | function processes() { 65 | return core.invoke("plugin:system-info|processes"); 66 | } 67 | // Refresh 68 | function refreshAll() { 69 | return core.invoke("plugin:system-info|refresh_all"); 70 | } 71 | function refreshMemory() { 72 | return core.invoke("plugin:system-info|refresh_memory"); 73 | } 74 | function refreshCpu() { 75 | return core.invoke("plugin:system-info|refresh_cpu"); 76 | } 77 | function refreshProcesses() { 78 | return core.invoke("plugin:system-info|refresh_processes"); 79 | } 80 | function debugCommand() { 81 | return core.invoke("plugin:system-info|debug"); 82 | } 83 | function batteries() { 84 | return core.invoke("plugin:system-info|batteries"); 85 | } 86 | function uptime() { 87 | return core.invoke("plugin:system-info|uptime"); 88 | } 89 | function loadAverage() { 90 | return core.invoke("plugin:system-info|load_average"); 91 | } 92 | 93 | var BatteryStateEnum; 94 | (function (BatteryStateEnum) { 95 | BatteryStateEnum["Unknown"] = "Unknown"; 96 | BatteryStateEnum["Charging"] = "Charging"; 97 | BatteryStateEnum["Discharging"] = "Discharging"; 98 | BatteryStateEnum["Empty"] = "Empty"; 99 | BatteryStateEnum["Full"] = "Full"; 100 | })(BatteryStateEnum || (BatteryStateEnum = {})); 101 | const BatteryState = valibot.enum_(BatteryStateEnum); 102 | var BatteryTechnologyEnum; 103 | (function (BatteryTechnologyEnum) { 104 | BatteryTechnologyEnum["Unknown"] = "Unknown"; 105 | BatteryTechnologyEnum["LithiumIon"] = "LithiumIon"; 106 | BatteryTechnologyEnum["LeadAcid"] = "LeadAcid"; 107 | BatteryTechnologyEnum["LithiumPolymer"] = "LithiumPolymer"; 108 | BatteryTechnologyEnum["NickelMetalHydride"] = "NickelMetalHydride"; 109 | BatteryTechnologyEnum["NickelCadmium"] = "NickelCadmium"; 110 | BatteryTechnologyEnum["NickelZinc"] = "NickelZinc"; 111 | BatteryTechnologyEnum["LithiumIronPhosphate"] = "LithiumIronPhosphate"; 112 | BatteryTechnologyEnum["RechargeableAlkalineManganese"] = "RechargeableAlkalineManganese"; 113 | })(BatteryTechnologyEnum || (BatteryTechnologyEnum = {})); 114 | const BatteryTechnology = valibot.enum_(BatteryTechnologyEnum); 115 | const Battery = valibot.object({ 116 | state_of_charge: valibot.number(), 117 | energy: valibot.number(), 118 | energy_full: valibot.number(), 119 | energy_full_design: valibot.number(), 120 | energy_rate: valibot.number(), 121 | // .describe("Amount of energy being drained from the battery."), 122 | voltage: valibot.number(), 123 | state_of_health: valibot.number(), 124 | state: BatteryState, 125 | technology: BatteryTechnology, 126 | temperature_kelvin: valibot.nullable(valibot.number()), 127 | temperature_celsius: valibot.nullable(valibot.number()), 128 | temperature_fahrenheit: valibot.nullable(valibot.number()), 129 | cycle_count: valibot.nullable(valibot.number()), 130 | vendor: valibot.nullable(valibot.string()), 131 | model: valibot.nullable(valibot.string()), 132 | serial_number: valibot.nullable(valibot.string()), 133 | time_to_full: valibot.nullable(valibot.number()), 134 | time_to_empty: valibot.nullable(valibot.number()), 135 | }); 136 | const Batteries = valibot.array(Battery); 137 | // TODO: verify actual value returned from rust for "Unknown" enum 138 | // export const DiskKind = enum_(["HDD", "SSD", "Unknown"]); 139 | const DiskKind = valibot.union([ 140 | valibot.literal("HDD"), 141 | valibot.literal("SSD"), 142 | valibot.object({ 143 | Unknown: valibot.number(), 144 | }), 145 | ]); 146 | const MacAddress = valibot.pipe(valibot.array(valibot.number()), valibot.length(6)); 147 | const ProcessStatus = valibot.union([ 148 | valibot.literal("Idle"), 149 | valibot.literal("Run"), 150 | valibot.literal("Sleep"), 151 | valibot.literal("Stop"), 152 | valibot.literal("Zombie"), 153 | valibot.literal("Tracing"), 154 | valibot.literal("Dead"), 155 | valibot.literal("Wakekill"), 156 | valibot.literal("Waking"), 157 | valibot.literal("Parked"), 158 | valibot.literal("LockBlocked"), 159 | valibot.literal("UninterruptibleDiskSleep"), 160 | valibot.object({ 161 | Unknown: valibot.number(), 162 | }), 163 | ]); 164 | const DiskUsage = valibot.object({ 165 | total_written_bytes: valibot.number(), 166 | written_bytes: valibot.number(), 167 | total_read_bytes: valibot.number(), 168 | read_bytes: valibot.number(), 169 | }); 170 | const Cpu = valibot.object({ 171 | name: valibot.string(), 172 | frequency: valibot.number(), 173 | cpu_usage: valibot.number(), 174 | vendor_id: valibot.string(), 175 | brand: valibot.string(), 176 | }); 177 | const Disk = valibot.object({ 178 | kind: DiskKind, 179 | name: valibot.string(), 180 | file_system: valibot.string(), 181 | mount_point: valibot.string(), 182 | total_space: valibot.number(), 183 | available_space: valibot.number(), 184 | is_removable: valibot.boolean(), 185 | }); 186 | const Network = valibot.object({ 187 | interface_name: valibot.string(), 188 | received: valibot.number(), 189 | total_received: valibot.number(), 190 | transmitted: valibot.number(), 191 | total_transmitted: valibot.number(), 192 | packets_received: valibot.number(), 193 | total_packets_received: valibot.number(), 194 | packets_transmitted: valibot.number(), 195 | total_packets_transmitted: valibot.number(), 196 | errors_on_received: valibot.number(), 197 | total_errors_on_received: valibot.number(), 198 | errors_on_transmitted: valibot.number(), 199 | total_errors_on_transmitted: valibot.number(), 200 | mac_address: valibot.array(valibot.number()), 201 | mac_address_str: valibot.string(), 202 | }); 203 | const Component = valibot.object({ 204 | temperature: valibot.number(), 205 | max: valibot.number(), 206 | critical: valibot.nullable(valibot.number()), 207 | label: valibot.string(), 208 | }); 209 | const Process = valibot.object({ 210 | name: valibot.string(), 211 | cmd: valibot.array(valibot.string()), 212 | exe: valibot.nullable(valibot.string()), 213 | pid: valibot.number(), 214 | environ: valibot.array(valibot.string()), 215 | cwd: valibot.nullable(valibot.string()), 216 | root: valibot.nullable(valibot.string()), 217 | memory: valibot.number(), 218 | virtual_memory: valibot.number(), 219 | parent: valibot.nullable(valibot.number()), 220 | status: ProcessStatus, 221 | start_time: valibot.number(), 222 | run_time: valibot.number(), 223 | cpu_usage: valibot.number(), 224 | disk_usage: DiskUsage, 225 | user_id: valibot.nullable(valibot.string()), 226 | effective_user_id: valibot.nullable(valibot.string()), 227 | group_id: valibot.nullable(valibot.string()), 228 | effective_group_id: valibot.nullable(valibot.string()), 229 | session_id: valibot.nullable(valibot.number()), 230 | }); 231 | // aggregate info 232 | const StaticInfo = valibot.object({ 233 | hostname: valibot.nullable(valibot.string()), 234 | kernel_version: valibot.nullable(valibot.string()), 235 | os_version: valibot.nullable(valibot.string()), 236 | name: valibot.nullable(valibot.string()), 237 | }); 238 | const MemoryInfo = valibot.object({ 239 | total_memory: valibot.number(), 240 | used_memory: valibot.number(), 241 | total_swap: valibot.number(), 242 | used_swap: valibot.number(), 243 | }); 244 | const CpuInfo = valibot.object({ 245 | cpus: valibot.array(Cpu), 246 | cpu_count: valibot.number(), 247 | }); 248 | const AllSystemInfo = valibot.object({ 249 | hostname: valibot.nullable(valibot.string()), 250 | kernel_version: valibot.nullable(valibot.string()), 251 | os_version: valibot.nullable(valibot.string()), 252 | name: valibot.nullable(valibot.string()), 253 | total_memory: valibot.number(), 254 | used_memory: valibot.number(), 255 | total_swap: valibot.number(), 256 | used_swap: valibot.number(), 257 | cpus: valibot.array(Cpu), 258 | cpu_count: valibot.number(), 259 | disks: valibot.array(Disk), 260 | networks: valibot.array(Network), 261 | components: valibot.array(Component), 262 | processes: valibot.array(Process), 263 | batteries: Batteries, 264 | }); 265 | const LoadAverage = valibot.object({ 266 | one: valibot.number(), 267 | five: valibot.number(), 268 | fifteen: valibot.number(), 269 | }); 270 | 271 | exports.AllSystemInfo = AllSystemInfo; 272 | exports.Batteries = Batteries; 273 | exports.Battery = Battery; 274 | exports.BatteryState = BatteryState; 275 | exports.BatteryTechnology = BatteryTechnology; 276 | exports.Component = Component; 277 | exports.Cpu = Cpu; 278 | exports.CpuInfo = CpuInfo; 279 | exports.Disk = Disk; 280 | exports.DiskKind = DiskKind; 281 | exports.DiskUsage = DiskUsage; 282 | exports.LoadAverage = LoadAverage; 283 | exports.MacAddress = MacAddress; 284 | exports.MemoryInfo = MemoryInfo; 285 | exports.Network = Network; 286 | exports.Process = Process; 287 | exports.ProcessStatus = ProcessStatus; 288 | exports.StaticInfo = StaticInfo; 289 | exports.allSysInfo = allSysInfo; 290 | exports.batteries = batteries; 291 | exports.components = components; 292 | exports.cpuCount = cpuCount; 293 | exports.cpuInfo = cpuInfo; 294 | exports.cpus = cpus; 295 | exports.debugCommand = debugCommand; 296 | exports.disks = disks; 297 | exports.hostname = hostname; 298 | exports.kernelVersion = kernelVersion; 299 | exports.loadAverage = loadAverage; 300 | exports.memoryInfo = memoryInfo; 301 | exports.name = name; 302 | exports.networks = networks; 303 | exports.osVersion = osVersion; 304 | exports.processes = processes; 305 | exports.refreshAll = refreshAll; 306 | exports.refreshCpu = refreshCpu; 307 | exports.refreshMemory = refreshMemory; 308 | exports.refreshProcesses = refreshProcesses; 309 | exports.staticInfo = staticInfo; 310 | exports.totalMemory = totalMemory; 311 | exports.totalSwap = totalSwap; 312 | exports.uptime = uptime; 313 | exports.usedMemory = usedMemory; 314 | exports.usedSwap = usedSwap; 315 | -------------------------------------------------------------------------------- /dist-js/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./type"; 3 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /dist-js/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../guest-js/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"} -------------------------------------------------------------------------------- /dist-js/index.js: -------------------------------------------------------------------------------- 1 | import { invoke } from '@tauri-apps/api/core'; 2 | import { enum_, object, nullable, number, string, array, union, literal, pipe, length, boolean } from 'valibot'; 3 | 4 | function allSysInfo() { 5 | return invoke("plugin:system-info|all_sys_info"); 6 | } 7 | // Memory 8 | function totalMemory() { 9 | return invoke("plugin:system-info|total_memory"); 10 | } 11 | function usedMemory() { 12 | return invoke("plugin:system-info|used_memory"); 13 | } 14 | function totalSwap() { 15 | return invoke("plugin:system-info|total_swap"); 16 | } 17 | function usedSwap() { 18 | return invoke("plugin:system-info|used_swap"); 19 | } 20 | function memoryInfo() { 21 | return invoke("plugin:system-info|memory_info"); 22 | } 23 | // Static Info 24 | function hostname() { 25 | return invoke("plugin:system-info|hostname"); 26 | } 27 | function name() { 28 | return invoke("plugin:system-info|name"); 29 | } 30 | function kernelVersion() { 31 | return invoke("plugin:system-info|kernel_version"); 32 | } 33 | function osVersion() { 34 | return invoke("plugin:system-info|os_version"); 35 | } 36 | function staticInfo() { 37 | return invoke("plugin:system-info|static_info"); 38 | } 39 | // Components 40 | function components() { 41 | return invoke("plugin:system-info|components"); 42 | } 43 | // Cpu 44 | function cpus() { 45 | return invoke("plugin:system-info|cpus"); 46 | } 47 | function cpuCount() { 48 | return invoke("plugin:system-info|cpu_count"); 49 | } 50 | function cpuInfo() { 51 | return invoke("plugin:system-info|cpu_info"); 52 | } 53 | // Disk 54 | function disks() { 55 | return invoke("plugin:system-info|disks"); 56 | } 57 | // Network 58 | function networks() { 59 | return invoke("plugin:system-info|networks"); 60 | } 61 | // Process 62 | function processes() { 63 | return invoke("plugin:system-info|processes"); 64 | } 65 | // Refresh 66 | function refreshAll() { 67 | return invoke("plugin:system-info|refresh_all"); 68 | } 69 | function refreshMemory() { 70 | return invoke("plugin:system-info|refresh_memory"); 71 | } 72 | function refreshCpu() { 73 | return invoke("plugin:system-info|refresh_cpu"); 74 | } 75 | function refreshProcesses() { 76 | return invoke("plugin:system-info|refresh_processes"); 77 | } 78 | function debugCommand() { 79 | return invoke("plugin:system-info|debug"); 80 | } 81 | function batteries() { 82 | return invoke("plugin:system-info|batteries"); 83 | } 84 | function uptime() { 85 | return invoke("plugin:system-info|uptime"); 86 | } 87 | function loadAverage() { 88 | return invoke("plugin:system-info|load_average"); 89 | } 90 | 91 | var BatteryStateEnum; 92 | (function (BatteryStateEnum) { 93 | BatteryStateEnum["Unknown"] = "Unknown"; 94 | BatteryStateEnum["Charging"] = "Charging"; 95 | BatteryStateEnum["Discharging"] = "Discharging"; 96 | BatteryStateEnum["Empty"] = "Empty"; 97 | BatteryStateEnum["Full"] = "Full"; 98 | })(BatteryStateEnum || (BatteryStateEnum = {})); 99 | const BatteryState = enum_(BatteryStateEnum); 100 | var BatteryTechnologyEnum; 101 | (function (BatteryTechnologyEnum) { 102 | BatteryTechnologyEnum["Unknown"] = "Unknown"; 103 | BatteryTechnologyEnum["LithiumIon"] = "LithiumIon"; 104 | BatteryTechnologyEnum["LeadAcid"] = "LeadAcid"; 105 | BatteryTechnologyEnum["LithiumPolymer"] = "LithiumPolymer"; 106 | BatteryTechnologyEnum["NickelMetalHydride"] = "NickelMetalHydride"; 107 | BatteryTechnologyEnum["NickelCadmium"] = "NickelCadmium"; 108 | BatteryTechnologyEnum["NickelZinc"] = "NickelZinc"; 109 | BatteryTechnologyEnum["LithiumIronPhosphate"] = "LithiumIronPhosphate"; 110 | BatteryTechnologyEnum["RechargeableAlkalineManganese"] = "RechargeableAlkalineManganese"; 111 | })(BatteryTechnologyEnum || (BatteryTechnologyEnum = {})); 112 | const BatteryTechnology = enum_(BatteryTechnologyEnum); 113 | const Battery = object({ 114 | state_of_charge: number(), 115 | energy: number(), 116 | energy_full: number(), 117 | energy_full_design: number(), 118 | energy_rate: number(), 119 | // .describe("Amount of energy being drained from the battery."), 120 | voltage: number(), 121 | state_of_health: number(), 122 | state: BatteryState, 123 | technology: BatteryTechnology, 124 | temperature_kelvin: nullable(number()), 125 | temperature_celsius: nullable(number()), 126 | temperature_fahrenheit: nullable(number()), 127 | cycle_count: nullable(number()), 128 | vendor: nullable(string()), 129 | model: nullable(string()), 130 | serial_number: nullable(string()), 131 | time_to_full: nullable(number()), 132 | time_to_empty: nullable(number()), 133 | }); 134 | const Batteries = array(Battery); 135 | // TODO: verify actual value returned from rust for "Unknown" enum 136 | // export const DiskKind = enum_(["HDD", "SSD", "Unknown"]); 137 | const DiskKind = union([ 138 | literal("HDD"), 139 | literal("SSD"), 140 | object({ 141 | Unknown: number(), 142 | }), 143 | ]); 144 | const MacAddress = pipe(array(number()), length(6)); 145 | const ProcessStatus = union([ 146 | literal("Idle"), 147 | literal("Run"), 148 | literal("Sleep"), 149 | literal("Stop"), 150 | literal("Zombie"), 151 | literal("Tracing"), 152 | literal("Dead"), 153 | literal("Wakekill"), 154 | literal("Waking"), 155 | literal("Parked"), 156 | literal("LockBlocked"), 157 | literal("UninterruptibleDiskSleep"), 158 | object({ 159 | Unknown: number(), 160 | }), 161 | ]); 162 | const DiskUsage = object({ 163 | total_written_bytes: number(), 164 | written_bytes: number(), 165 | total_read_bytes: number(), 166 | read_bytes: number(), 167 | }); 168 | const Cpu = object({ 169 | name: string(), 170 | frequency: number(), 171 | cpu_usage: number(), 172 | vendor_id: string(), 173 | brand: string(), 174 | }); 175 | const Disk = object({ 176 | kind: DiskKind, 177 | name: string(), 178 | file_system: string(), 179 | mount_point: string(), 180 | total_space: number(), 181 | available_space: number(), 182 | is_removable: boolean(), 183 | }); 184 | const Network = object({ 185 | interface_name: string(), 186 | received: number(), 187 | total_received: number(), 188 | transmitted: number(), 189 | total_transmitted: number(), 190 | packets_received: number(), 191 | total_packets_received: number(), 192 | packets_transmitted: number(), 193 | total_packets_transmitted: number(), 194 | errors_on_received: number(), 195 | total_errors_on_received: number(), 196 | errors_on_transmitted: number(), 197 | total_errors_on_transmitted: number(), 198 | mac_address: array(number()), 199 | mac_address_str: string(), 200 | }); 201 | const Component = object({ 202 | temperature: number(), 203 | max: number(), 204 | critical: nullable(number()), 205 | label: string(), 206 | }); 207 | const Process = object({ 208 | name: string(), 209 | cmd: array(string()), 210 | exe: nullable(string()), 211 | pid: number(), 212 | environ: array(string()), 213 | cwd: nullable(string()), 214 | root: nullable(string()), 215 | memory: number(), 216 | virtual_memory: number(), 217 | parent: nullable(number()), 218 | status: ProcessStatus, 219 | start_time: number(), 220 | run_time: number(), 221 | cpu_usage: number(), 222 | disk_usage: DiskUsage, 223 | user_id: nullable(string()), 224 | effective_user_id: nullable(string()), 225 | group_id: nullable(string()), 226 | effective_group_id: nullable(string()), 227 | session_id: nullable(number()), 228 | }); 229 | // aggregate info 230 | const StaticInfo = object({ 231 | hostname: nullable(string()), 232 | kernel_version: nullable(string()), 233 | os_version: nullable(string()), 234 | name: nullable(string()), 235 | }); 236 | const MemoryInfo = object({ 237 | total_memory: number(), 238 | used_memory: number(), 239 | total_swap: number(), 240 | used_swap: number(), 241 | }); 242 | const CpuInfo = object({ 243 | cpus: array(Cpu), 244 | cpu_count: number(), 245 | }); 246 | const AllSystemInfo = object({ 247 | hostname: nullable(string()), 248 | kernel_version: nullable(string()), 249 | os_version: nullable(string()), 250 | name: nullable(string()), 251 | total_memory: number(), 252 | used_memory: number(), 253 | total_swap: number(), 254 | used_swap: number(), 255 | cpus: array(Cpu), 256 | cpu_count: number(), 257 | disks: array(Disk), 258 | networks: array(Network), 259 | components: array(Component), 260 | processes: array(Process), 261 | batteries: Batteries, 262 | }); 263 | const LoadAverage = object({ 264 | one: number(), 265 | five: number(), 266 | fifteen: number(), 267 | }); 268 | 269 | export { AllSystemInfo, Batteries, Battery, BatteryState, BatteryTechnology, Component, Cpu, CpuInfo, Disk, DiskKind, DiskUsage, LoadAverage, MacAddress, MemoryInfo, Network, Process, ProcessStatus, StaticInfo, allSysInfo, batteries, components, cpuCount, cpuInfo, cpus, debugCommand, disks, hostname, kernelVersion, loadAverage, memoryInfo, name, networks, osVersion, processes, refreshAll, refreshCpu, refreshMemory, refreshProcesses, staticInfo, totalMemory, totalSwap, uptime, usedMemory, usedSwap }; 270 | -------------------------------------------------------------------------------- /dist-js/type.d.ts: -------------------------------------------------------------------------------- 1 | import { type InferOutput } from "valibot"; 2 | declare enum BatteryStateEnum { 3 | Unknown = "Unknown", 4 | Charging = "Charging", 5 | Discharging = "Discharging", 6 | Empty = "Empty", 7 | Full = "Full" 8 | } 9 | export declare const BatteryState: import("valibot").EnumSchema; 10 | export type BatteryState = InferOutput; 11 | declare enum BatteryTechnologyEnum { 12 | Unknown = "Unknown", 13 | LithiumIon = "LithiumIon", 14 | LeadAcid = "LeadAcid", 15 | LithiumPolymer = "LithiumPolymer", 16 | NickelMetalHydride = "NickelMetalHydride", 17 | NickelCadmium = "NickelCadmium", 18 | NickelZinc = "NickelZinc", 19 | LithiumIronPhosphate = "LithiumIronPhosphate", 20 | RechargeableAlkalineManganese = "RechargeableAlkalineManganese" 21 | } 22 | export declare const BatteryTechnology: import("valibot").EnumSchema; 23 | export type BatteryTechnology = InferOutput; 24 | export declare const Battery: import("valibot").ObjectSchema<{ 25 | readonly state_of_charge: import("valibot").NumberSchema; 26 | readonly energy: import("valibot").NumberSchema; 27 | readonly energy_full: import("valibot").NumberSchema; 28 | readonly energy_full_design: import("valibot").NumberSchema; 29 | readonly energy_rate: import("valibot").NumberSchema; 30 | readonly voltage: import("valibot").NumberSchema; 31 | readonly state_of_health: import("valibot").NumberSchema; 32 | readonly state: import("valibot").EnumSchema; 33 | readonly technology: import("valibot").EnumSchema; 34 | readonly temperature_kelvin: import("valibot").NullableSchema, undefined>; 35 | readonly temperature_celsius: import("valibot").NullableSchema, undefined>; 36 | readonly temperature_fahrenheit: import("valibot").NullableSchema, undefined>; 37 | readonly cycle_count: import("valibot").NullableSchema, undefined>; 38 | readonly vendor: import("valibot").NullableSchema, undefined>; 39 | readonly model: import("valibot").NullableSchema, undefined>; 40 | readonly serial_number: import("valibot").NullableSchema, undefined>; 41 | readonly time_to_full: import("valibot").NullableSchema, undefined>; 42 | readonly time_to_empty: import("valibot").NullableSchema, undefined>; 43 | }, undefined>; 44 | export type Battery = InferOutput; 45 | export declare const Batteries: import("valibot").ArraySchema; 47 | readonly energy: import("valibot").NumberSchema; 48 | readonly energy_full: import("valibot").NumberSchema; 49 | readonly energy_full_design: import("valibot").NumberSchema; 50 | readonly energy_rate: import("valibot").NumberSchema; 51 | readonly voltage: import("valibot").NumberSchema; 52 | readonly state_of_health: import("valibot").NumberSchema; 53 | readonly state: import("valibot").EnumSchema; 54 | readonly technology: import("valibot").EnumSchema; 55 | readonly temperature_kelvin: import("valibot").NullableSchema, undefined>; 56 | readonly temperature_celsius: import("valibot").NullableSchema, undefined>; 57 | readonly temperature_fahrenheit: import("valibot").NullableSchema, undefined>; 58 | readonly cycle_count: import("valibot").NullableSchema, undefined>; 59 | readonly vendor: import("valibot").NullableSchema, undefined>; 60 | readonly model: import("valibot").NullableSchema, undefined>; 61 | readonly serial_number: import("valibot").NullableSchema, undefined>; 62 | readonly time_to_full: import("valibot").NullableSchema, undefined>; 63 | readonly time_to_empty: import("valibot").NullableSchema, undefined>; 64 | }, undefined>, undefined>; 65 | export type Batteries = InferOutput; 66 | export declare const DiskKind: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"HDD", undefined>, import("valibot").LiteralSchema<"SSD", undefined>, import("valibot").ObjectSchema<{ 67 | readonly Unknown: import("valibot").NumberSchema; 68 | }, undefined>], undefined>; 69 | export type DiskKind = InferOutput; 70 | export declare const MacAddress: import("valibot").SchemaWithPipe<[import("valibot").ArraySchema, undefined>, import("valibot").LengthAction]>; 71 | export type MacAddress = InferOutput; 72 | export declare const ProcessStatus: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"Idle", undefined>, import("valibot").LiteralSchema<"Run", undefined>, import("valibot").LiteralSchema<"Sleep", undefined>, import("valibot").LiteralSchema<"Stop", undefined>, import("valibot").LiteralSchema<"Zombie", undefined>, import("valibot").LiteralSchema<"Tracing", undefined>, import("valibot").LiteralSchema<"Dead", undefined>, import("valibot").LiteralSchema<"Wakekill", undefined>, import("valibot").LiteralSchema<"Waking", undefined>, import("valibot").LiteralSchema<"Parked", undefined>, import("valibot").LiteralSchema<"LockBlocked", undefined>, import("valibot").LiteralSchema<"UninterruptibleDiskSleep", undefined>, import("valibot").ObjectSchema<{ 73 | readonly Unknown: import("valibot").NumberSchema; 74 | }, undefined>], undefined>; 75 | export type ProcessStatus = InferOutput; 76 | export declare const DiskUsage: import("valibot").ObjectSchema<{ 77 | readonly total_written_bytes: import("valibot").NumberSchema; 78 | readonly written_bytes: import("valibot").NumberSchema; 79 | readonly total_read_bytes: import("valibot").NumberSchema; 80 | readonly read_bytes: import("valibot").NumberSchema; 81 | }, undefined>; 82 | export type DiskUsage = InferOutput; 83 | export declare const Cpu: import("valibot").ObjectSchema<{ 84 | readonly name: import("valibot").StringSchema; 85 | readonly frequency: import("valibot").NumberSchema; 86 | readonly cpu_usage: import("valibot").NumberSchema; 87 | readonly vendor_id: import("valibot").StringSchema; 88 | readonly brand: import("valibot").StringSchema; 89 | }, undefined>; 90 | export type Cpu = InferOutput; 91 | export declare const Disk: import("valibot").ObjectSchema<{ 92 | readonly kind: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"HDD", undefined>, import("valibot").LiteralSchema<"SSD", undefined>, import("valibot").ObjectSchema<{ 93 | readonly Unknown: import("valibot").NumberSchema; 94 | }, undefined>], undefined>; 95 | readonly name: import("valibot").StringSchema; 96 | readonly file_system: import("valibot").StringSchema; 97 | readonly mount_point: import("valibot").StringSchema; 98 | readonly total_space: import("valibot").NumberSchema; 99 | readonly available_space: import("valibot").NumberSchema; 100 | readonly is_removable: import("valibot").BooleanSchema; 101 | }, undefined>; 102 | export type Disk = InferOutput; 103 | export declare const Network: import("valibot").ObjectSchema<{ 104 | readonly interface_name: import("valibot").StringSchema; 105 | readonly received: import("valibot").NumberSchema; 106 | readonly total_received: import("valibot").NumberSchema; 107 | readonly transmitted: import("valibot").NumberSchema; 108 | readonly total_transmitted: import("valibot").NumberSchema; 109 | readonly packets_received: import("valibot").NumberSchema; 110 | readonly total_packets_received: import("valibot").NumberSchema; 111 | readonly packets_transmitted: import("valibot").NumberSchema; 112 | readonly total_packets_transmitted: import("valibot").NumberSchema; 113 | readonly errors_on_received: import("valibot").NumberSchema; 114 | readonly total_errors_on_received: import("valibot").NumberSchema; 115 | readonly errors_on_transmitted: import("valibot").NumberSchema; 116 | readonly total_errors_on_transmitted: import("valibot").NumberSchema; 117 | readonly mac_address: import("valibot").ArraySchema, undefined>; 118 | readonly mac_address_str: import("valibot").StringSchema; 119 | }, undefined>; 120 | export type Network = InferOutput; 121 | export declare const Component: import("valibot").ObjectSchema<{ 122 | readonly temperature: import("valibot").NumberSchema; 123 | readonly max: import("valibot").NumberSchema; 124 | readonly critical: import("valibot").NullableSchema, undefined>; 125 | readonly label: import("valibot").StringSchema; 126 | }, undefined>; 127 | export type Component = InferOutput; 128 | export declare const Process: import("valibot").ObjectSchema<{ 129 | readonly name: import("valibot").StringSchema; 130 | readonly cmd: import("valibot").ArraySchema, undefined>; 131 | readonly exe: import("valibot").NullableSchema, undefined>; 132 | readonly pid: import("valibot").NumberSchema; 133 | readonly environ: import("valibot").ArraySchema, undefined>; 134 | readonly cwd: import("valibot").NullableSchema, undefined>; 135 | readonly root: import("valibot").NullableSchema, undefined>; 136 | readonly memory: import("valibot").NumberSchema; 137 | readonly virtual_memory: import("valibot").NumberSchema; 138 | readonly parent: import("valibot").NullableSchema, undefined>; 139 | readonly status: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"Idle", undefined>, import("valibot").LiteralSchema<"Run", undefined>, import("valibot").LiteralSchema<"Sleep", undefined>, import("valibot").LiteralSchema<"Stop", undefined>, import("valibot").LiteralSchema<"Zombie", undefined>, import("valibot").LiteralSchema<"Tracing", undefined>, import("valibot").LiteralSchema<"Dead", undefined>, import("valibot").LiteralSchema<"Wakekill", undefined>, import("valibot").LiteralSchema<"Waking", undefined>, import("valibot").LiteralSchema<"Parked", undefined>, import("valibot").LiteralSchema<"LockBlocked", undefined>, import("valibot").LiteralSchema<"UninterruptibleDiskSleep", undefined>, import("valibot").ObjectSchema<{ 140 | readonly Unknown: import("valibot").NumberSchema; 141 | }, undefined>], undefined>; 142 | readonly start_time: import("valibot").NumberSchema; 143 | readonly run_time: import("valibot").NumberSchema; 144 | readonly cpu_usage: import("valibot").NumberSchema; 145 | readonly disk_usage: import("valibot").ObjectSchema<{ 146 | readonly total_written_bytes: import("valibot").NumberSchema; 147 | readonly written_bytes: import("valibot").NumberSchema; 148 | readonly total_read_bytes: import("valibot").NumberSchema; 149 | readonly read_bytes: import("valibot").NumberSchema; 150 | }, undefined>; 151 | readonly user_id: import("valibot").NullableSchema, undefined>; 152 | readonly effective_user_id: import("valibot").NullableSchema, undefined>; 153 | readonly group_id: import("valibot").NullableSchema, undefined>; 154 | readonly effective_group_id: import("valibot").NullableSchema, undefined>; 155 | readonly session_id: import("valibot").NullableSchema, undefined>; 156 | }, undefined>; 157 | export type Process = InferOutput; 158 | export declare const StaticInfo: import("valibot").ObjectSchema<{ 159 | readonly hostname: import("valibot").NullableSchema, undefined>; 160 | readonly kernel_version: import("valibot").NullableSchema, undefined>; 161 | readonly os_version: import("valibot").NullableSchema, undefined>; 162 | readonly name: import("valibot").NullableSchema, undefined>; 163 | }, undefined>; 164 | export type StaticInfo = InferOutput; 165 | export declare const MemoryInfo: import("valibot").ObjectSchema<{ 166 | readonly total_memory: import("valibot").NumberSchema; 167 | readonly used_memory: import("valibot").NumberSchema; 168 | readonly total_swap: import("valibot").NumberSchema; 169 | readonly used_swap: import("valibot").NumberSchema; 170 | }, undefined>; 171 | export type MemoryInfo = InferOutput; 172 | export declare const CpuInfo: import("valibot").ObjectSchema<{ 173 | readonly cpus: import("valibot").ArraySchema; 175 | readonly frequency: import("valibot").NumberSchema; 176 | readonly cpu_usage: import("valibot").NumberSchema; 177 | readonly vendor_id: import("valibot").StringSchema; 178 | readonly brand: import("valibot").StringSchema; 179 | }, undefined>, undefined>; 180 | readonly cpu_count: import("valibot").NumberSchema; 181 | }, undefined>; 182 | export type CpuInfo = InferOutput; 183 | export declare const AllSystemInfo: import("valibot").ObjectSchema<{ 184 | readonly hostname: import("valibot").NullableSchema, undefined>; 185 | readonly kernel_version: import("valibot").NullableSchema, undefined>; 186 | readonly os_version: import("valibot").NullableSchema, undefined>; 187 | readonly name: import("valibot").NullableSchema, undefined>; 188 | readonly total_memory: import("valibot").NumberSchema; 189 | readonly used_memory: import("valibot").NumberSchema; 190 | readonly total_swap: import("valibot").NumberSchema; 191 | readonly used_swap: import("valibot").NumberSchema; 192 | readonly cpus: import("valibot").ArraySchema; 194 | readonly frequency: import("valibot").NumberSchema; 195 | readonly cpu_usage: import("valibot").NumberSchema; 196 | readonly vendor_id: import("valibot").StringSchema; 197 | readonly brand: import("valibot").StringSchema; 198 | }, undefined>, undefined>; 199 | readonly cpu_count: import("valibot").NumberSchema; 200 | readonly disks: import("valibot").ArraySchema, import("valibot").LiteralSchema<"SSD", undefined>, import("valibot").ObjectSchema<{ 202 | readonly Unknown: import("valibot").NumberSchema; 203 | }, undefined>], undefined>; 204 | readonly name: import("valibot").StringSchema; 205 | readonly file_system: import("valibot").StringSchema; 206 | readonly mount_point: import("valibot").StringSchema; 207 | readonly total_space: import("valibot").NumberSchema; 208 | readonly available_space: import("valibot").NumberSchema; 209 | readonly is_removable: import("valibot").BooleanSchema; 210 | }, undefined>, undefined>; 211 | readonly networks: import("valibot").ArraySchema; 213 | readonly received: import("valibot").NumberSchema; 214 | readonly total_received: import("valibot").NumberSchema; 215 | readonly transmitted: import("valibot").NumberSchema; 216 | readonly total_transmitted: import("valibot").NumberSchema; 217 | readonly packets_received: import("valibot").NumberSchema; 218 | readonly total_packets_received: import("valibot").NumberSchema; 219 | readonly packets_transmitted: import("valibot").NumberSchema; 220 | readonly total_packets_transmitted: import("valibot").NumberSchema; 221 | readonly errors_on_received: import("valibot").NumberSchema; 222 | readonly total_errors_on_received: import("valibot").NumberSchema; 223 | readonly errors_on_transmitted: import("valibot").NumberSchema; 224 | readonly total_errors_on_transmitted: import("valibot").NumberSchema; 225 | readonly mac_address: import("valibot").ArraySchema, undefined>; 226 | readonly mac_address_str: import("valibot").StringSchema; 227 | }, undefined>, undefined>; 228 | readonly components: import("valibot").ArraySchema; 230 | readonly max: import("valibot").NumberSchema; 231 | readonly critical: import("valibot").NullableSchema, undefined>; 232 | readonly label: import("valibot").StringSchema; 233 | }, undefined>, undefined>; 234 | readonly processes: import("valibot").ArraySchema; 236 | readonly cmd: import("valibot").ArraySchema, undefined>; 237 | readonly exe: import("valibot").NullableSchema, undefined>; 238 | readonly pid: import("valibot").NumberSchema; 239 | readonly environ: import("valibot").ArraySchema, undefined>; 240 | readonly cwd: import("valibot").NullableSchema, undefined>; 241 | readonly root: import("valibot").NullableSchema, undefined>; 242 | readonly memory: import("valibot").NumberSchema; 243 | readonly virtual_memory: import("valibot").NumberSchema; 244 | readonly parent: import("valibot").NullableSchema, undefined>; 245 | readonly status: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"Idle", undefined>, import("valibot").LiteralSchema<"Run", undefined>, import("valibot").LiteralSchema<"Sleep", undefined>, import("valibot").LiteralSchema<"Stop", undefined>, import("valibot").LiteralSchema<"Zombie", undefined>, import("valibot").LiteralSchema<"Tracing", undefined>, import("valibot").LiteralSchema<"Dead", undefined>, import("valibot").LiteralSchema<"Wakekill", undefined>, import("valibot").LiteralSchema<"Waking", undefined>, import("valibot").LiteralSchema<"Parked", undefined>, import("valibot").LiteralSchema<"LockBlocked", undefined>, import("valibot").LiteralSchema<"UninterruptibleDiskSleep", undefined>, import("valibot").ObjectSchema<{ 246 | readonly Unknown: import("valibot").NumberSchema; 247 | }, undefined>], undefined>; 248 | readonly start_time: import("valibot").NumberSchema; 249 | readonly run_time: import("valibot").NumberSchema; 250 | readonly cpu_usage: import("valibot").NumberSchema; 251 | readonly disk_usage: import("valibot").ObjectSchema<{ 252 | readonly total_written_bytes: import("valibot").NumberSchema; 253 | readonly written_bytes: import("valibot").NumberSchema; 254 | readonly total_read_bytes: import("valibot").NumberSchema; 255 | readonly read_bytes: import("valibot").NumberSchema; 256 | }, undefined>; 257 | readonly user_id: import("valibot").NullableSchema, undefined>; 258 | readonly effective_user_id: import("valibot").NullableSchema, undefined>; 259 | readonly group_id: import("valibot").NullableSchema, undefined>; 260 | readonly effective_group_id: import("valibot").NullableSchema, undefined>; 261 | readonly session_id: import("valibot").NullableSchema, undefined>; 262 | }, undefined>, undefined>; 263 | readonly batteries: import("valibot").ArraySchema; 265 | readonly energy: import("valibot").NumberSchema; 266 | readonly energy_full: import("valibot").NumberSchema; 267 | readonly energy_full_design: import("valibot").NumberSchema; 268 | readonly energy_rate: import("valibot").NumberSchema; 269 | readonly voltage: import("valibot").NumberSchema; 270 | readonly state_of_health: import("valibot").NumberSchema; 271 | readonly state: import("valibot").EnumSchema; 272 | readonly technology: import("valibot").EnumSchema; 273 | readonly temperature_kelvin: import("valibot").NullableSchema, undefined>; 274 | readonly temperature_celsius: import("valibot").NullableSchema, undefined>; 275 | readonly temperature_fahrenheit: import("valibot").NullableSchema, undefined>; 276 | readonly cycle_count: import("valibot").NullableSchema, undefined>; 277 | readonly vendor: import("valibot").NullableSchema, undefined>; 278 | readonly model: import("valibot").NullableSchema, undefined>; 279 | readonly serial_number: import("valibot").NullableSchema, undefined>; 280 | readonly time_to_full: import("valibot").NullableSchema, undefined>; 281 | readonly time_to_empty: import("valibot").NullableSchema, undefined>; 282 | }, undefined>, undefined>; 283 | }, undefined>; 284 | export type AllSystemInfo = InferOutput; 285 | export declare const LoadAverage: import("valibot").ObjectSchema<{ 286 | readonly one: import("valibot").NumberSchema; 287 | readonly five: import("valibot").NumberSchema; 288 | readonly fifteen: import("valibot").NumberSchema; 289 | }, undefined>; 290 | export type LoadAverage = InferOutput; 291 | export {}; 292 | //# sourceMappingURL=type.d.ts.map -------------------------------------------------------------------------------- /dist-js/type.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../guest-js/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AAEjB,aAAK,gBAAgB;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,eAAO,MAAM,YAAY,kEAA0B,CAAC;AACpD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D,aAAK,qBAAqB;IACxB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,oBAAoB,yBAAyB;IAC7C,6BAA6B,kCAAkC;CAChE;AACD,eAAO,MAAM,iBAAiB,uEAA+B,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEtE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;aAoBlB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC;AAElD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;yBAAiB,CAAC;AACxC,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC;AAKtD,eAAO,MAAM,QAAQ;;0BAMnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEpD,eAAO,MAAM,UAAU,iLAAmC,CAAC;AAC3D,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAExD,eAAO,MAAM,aAAa;;0BAgBxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,eAAO,MAAM,SAAS;;;;;aAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC;AAEtD,eAAO,MAAM,GAAG;;;;;;aAMd,CAAC;AACH,MAAM,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,GAAG,CAAC,CAAC;AAE1C,eAAO,MAAM,IAAI;;;;;;;;;;aAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,IAAI,CAAC,CAAC;AAE5C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;aAgBlB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC;AAElD,eAAO,MAAM,SAAS;;;;;aAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,SAAS,CAAC,CAAC;AAEtD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAqBlB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC;AAGlD,eAAO,MAAM,UAAU;;;;;aAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAExD,eAAO,MAAM,UAAU;;;;;aAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAExD,eAAO,MAAM,OAAO;;;;;;;;;aAGlB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,OAAO,CAAC,CAAC;AAElD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAmBxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,eAAO,MAAM,WAAW;;;;aAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,WAAW,CAAC,CAAC"} -------------------------------------------------------------------------------- /examples/sveltekit/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /build 4 | /.svelte-kit 5 | /package 6 | .env 7 | .env.* 8 | !.env.example 9 | vite.config.js.timestamp-* 10 | vite.config.ts.timestamp-* 11 | -------------------------------------------------------------------------------- /examples/sveltekit/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | resolution-mode=highest 3 | -------------------------------------------------------------------------------- /examples/sveltekit/README.md: -------------------------------------------------------------------------------- 1 | # Example for tauri-plugin-system-info 2 | 3 | 1. Run `npm i` to install dependencies. 4 | 2. Run `npm run tauri dev` to start dev app. 5 | 3. Right click to open console. Check data logged in console 6 | 1. There is too much data, I simply logged the data out for now. 7 | 2. I may add some UI components in the future. 8 | -------------------------------------------------------------------------------- /examples/sveltekit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sveltekit", 3 | "version": "0.2.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "vite dev", 7 | "build": "vite build", 8 | "preview": "vite preview", 9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", 10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", 11 | "tauri": "tauri" 12 | }, 13 | "devDependencies": { 14 | "@sveltejs/adapter-auto": "^3.0.0", 15 | "@sveltejs/adapter-static": "^3.0.0", 16 | "@sveltejs/kit": "^2.0.0", 17 | "@sveltejs/vite-plugin-svelte": "^3.0.0", 18 | "@tauri-apps/cli": "2.0.1", 19 | "autoprefixer": "^10.4.15", 20 | "daisyui": "^3.5.1", 21 | "postcss": "^8.4.27", 22 | "svelte": "^5.0.0", 23 | "svelte-check": "^3.4.3", 24 | "tailwindcss": "^3.3.3", 25 | "tslib": "^2.4.1", 26 | "typescript": "^5.0.0", 27 | "vite": "^5.4.9" 28 | }, 29 | "dependencies": { 30 | "@tauri-apps/api": "^2.0.1", 31 | "svelte-inspect-value": "^0.5.0", 32 | "tauri-plugin-system-info-api": "link:../../", 33 | "valibot": "^1.0.0" 34 | }, 35 | "type": "module" 36 | } 37 | -------------------------------------------------------------------------------- /examples/sveltekit/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | /gen/schemas 5 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "app" 3 | version = "0.1.0" 4 | description = "A Tauri App" 5 | authors = ["you"] 6 | license = "" 7 | repository = "" 8 | edition = "2021" 9 | rust-version = "1.70" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [lib] 14 | name = "app_lib" 15 | crate-type = ["staticlib", "cdylib", "rlib"] 16 | 17 | [build-dependencies] 18 | tauri-build = { version = "2.0.1", features = [] } 19 | 20 | [dependencies] 21 | serde_json = "1.0" 22 | serde = { version = "1.0", features = ["derive"] } 23 | tauri = { version = "2.0.1", features = [] } 24 | tauri-plugin-system-info = { path = "../../../" } 25 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | tauri_build::build() 3 | } 4 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/capabilities/default.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../gen/schemas/desktop-schema.json", 3 | "identifier": "default", 4 | "description": "enables the default permissions", 5 | "windows": ["main"], 6 | "permissions": [ 7 | "core:path:default", 8 | "core:event:default", 9 | "core:window:default", 10 | "core:webview:default", 11 | "core:app:default", 12 | "core:resources:default", 13 | "core:image:default", 14 | "core:menu:default", 15 | "core:tray:default", 16 | "system-info:allow-all" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/128x128.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/128x128@2x.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/32x32.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square107x107Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square107x107Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square142x142Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square142x142Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square150x150Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square150x150Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square284x284Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square284x284Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square30x30Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square30x30Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square310x310Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square310x310Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square44x44Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square44x44Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square71x71Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square71x71Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/Square89x89Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/Square89x89Logo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/StoreLogo.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/icon.icns -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/icon.ico -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/src-tauri/icons/icon.png -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg_attr(mobile, tauri::mobile_entry_point)] 2 | use tauri::Manager; 3 | use tauri_plugin_system_info::utils::{SysInfo, SysInfoState}; 4 | use tauri_plugin_system_info::commands; 5 | use tauri_plugin_system_info::model::Cpu; 6 | 7 | #[tauri::command] 8 | fn cpu_count() -> Result { 9 | let state = SysInfoState::default(); 10 | let sysinfo = state.sysinfo.lock().unwrap(); 11 | let cpu_count = sysinfo.cpu_count(); 12 | Ok(cpu_count) 13 | } 14 | 15 | pub fn run() { 16 | tauri::Builder::default() 17 | .plugin(tauri_plugin_system_info::init()) 18 | .invoke_handler(tauri::generate_handler![ 19 | cpu_count 20 | ]) 21 | .setup(|app| { 22 | #[cfg(debug_assertions)] // only include this code on debug builds 23 | { 24 | let window = app.get_webview_window("main").unwrap(); 25 | window.open_devtools(); 26 | } 27 | Ok(()) 28 | }) 29 | .run(tauri::generate_context!()) 30 | .expect("error while running tauri application"); 31 | } 32 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/src/main.rs: -------------------------------------------------------------------------------- 1 | // Prevents additional console window on Windows in release, DO NOT REMOVE!! 2 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] 3 | 4 | fn main() { 5 | app_lib::run(); 6 | } 7 | -------------------------------------------------------------------------------- /examples/sveltekit/src-tauri/tauri.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "productName": "demo", 3 | "version": "0.1.0", 4 | "identifier": "com.tauri.dev", 5 | "build": { 6 | "frontendDist": "../build", 7 | "devUrl": "http://localhost:5173", 8 | "beforeDevCommand": "npm run dev", 9 | "beforeBuildCommand": "npm run build" 10 | }, 11 | "app": { 12 | "windows": [ 13 | { 14 | "title": "demo", 15 | "width": 800, 16 | "height": 600, 17 | "resizable": true, 18 | "fullscreen": false 19 | } 20 | ], 21 | "security": { 22 | "csp": null 23 | } 24 | }, 25 | "bundle": { 26 | "active": true, 27 | "targets": "all", 28 | "icon": [ 29 | "icons/32x32.png", 30 | "icons/128x128.png", 31 | "icons/128x128@2x.png", 32 | "icons/icon.icns", 33 | "icons/icon.ico" 34 | ] 35 | }, 36 | "$schema": "../node_modules/@tauri-apps/cli/schema.json" 37 | } 38 | -------------------------------------------------------------------------------- /examples/sveltekit/src/app.d.ts: -------------------------------------------------------------------------------- 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface Platform {} 9 | } 10 | } 11 | 12 | export {}; 13 | -------------------------------------------------------------------------------- /examples/sveltekit/src/app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %sveltekit.head% 8 | 9 | 10 |
%sveltekit.body%
11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/sveltekit/src/lib/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /examples/sveltekit/src/lib/index.ts: -------------------------------------------------------------------------------- 1 | // place files you want to import through the `$lib` alias in this folder. 2 | -------------------------------------------------------------------------------- /examples/sveltekit/src/routes/+layout.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 | 7 |
8 | -------------------------------------------------------------------------------- /examples/sveltekit/src/routes/+layout.ts: -------------------------------------------------------------------------------- 1 | export const prerender = true 2 | export const ssr = false -------------------------------------------------------------------------------- /examples/sveltekit/src/routes/+page.svelte: -------------------------------------------------------------------------------- 1 | 89 | 90 |
91 |

System Info

92 | 93 | 94 |

Load Average

95 | 96 | 97 |

Uptime

98 | 99 | 100 |

Memory Info

101 | 102 | 103 |

CPU Info

104 | 105 | 106 |

Static Info

107 | 108 | 109 |

Batteries

110 | 111 | 112 |

Processes

113 | 114 | 115 | 116 |

All System Info

117 | 118 |
119 | -------------------------------------------------------------------------------- /examples/sveltekit/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HuakunShen/tauri-plugin-system-info/afb2b7fe50f337500937eb946c1204a728353b63/examples/sveltekit/static/favicon.png -------------------------------------------------------------------------------- /examples/sveltekit/svelte.config.js: -------------------------------------------------------------------------------- 1 | import adapter from '@sveltejs/adapter-static'; 2 | import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; 3 | 4 | /** @type {import('@sveltejs/kit').Config} */ 5 | const config = { 6 | // Consult https://kit.svelte.dev/docs/integrations#preprocessors 7 | // for more information about preprocessors 8 | preprocess: vitePreprocess(), 9 | 10 | kit: { 11 | // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. 12 | // If your environment is not supported or you settled on a specific environment, switch out the adapter. 13 | // See https://kit.svelte.dev/docs/adapters for more information about adapters. 14 | adapter: adapter() 15 | } 16 | }; 17 | 18 | export default config; 19 | -------------------------------------------------------------------------------- /examples/sveltekit/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | export default { 3 | content: ['./src/**/*.{html,js,svelte,ts}'], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [require("daisyui")], 8 | } 9 | 10 | -------------------------------------------------------------------------------- /examples/sveltekit/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.svelte-kit/tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "checkJs": true, 6 | "esModuleInterop": true, 7 | "forceConsistentCasingInFileNames": true, 8 | "resolveJsonModule": true, 9 | "skipLibCheck": true, 10 | "sourceMap": true, 11 | "strict": true 12 | } 13 | // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias 14 | // 15 | // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes 16 | // from the referenced tsconfig.json - TypeScript does not merge them in 17 | } 18 | -------------------------------------------------------------------------------- /examples/sveltekit/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { sveltekit } from '@sveltejs/kit/vite'; 2 | import { defineConfig } from 'vite'; 3 | 4 | export default defineConfig({ 5 | plugins: [sveltekit()] 6 | }); 7 | -------------------------------------------------------------------------------- /guest-js/api.ts: -------------------------------------------------------------------------------- 1 | import { invoke } from "@tauri-apps/api/core"; 2 | import { 3 | Cpu, 4 | Disk, 5 | Network, 6 | Component, 7 | Process, 8 | StaticInfo, 9 | MemoryInfo, 10 | CpuInfo, 11 | AllSystemInfo, 12 | Battery, 13 | LoadAverage, 14 | } from "./type"; 15 | 16 | export function allSysInfo(): Promise { 17 | return invoke("plugin:system-info|all_sys_info"); 18 | } 19 | // Memory 20 | export function totalMemory(): Promise { 21 | return invoke("plugin:system-info|total_memory"); 22 | } 23 | export function usedMemory(): Promise { 24 | return invoke("plugin:system-info|used_memory"); 25 | } 26 | export function totalSwap(): Promise { 27 | return invoke("plugin:system-info|total_swap"); 28 | } 29 | export function usedSwap(): Promise { 30 | return invoke("plugin:system-info|used_swap"); 31 | } 32 | export function memoryInfo(): Promise { 33 | return invoke("plugin:system-info|memory_info"); 34 | } 35 | // Static Info 36 | export function hostname(): Promise { 37 | return invoke("plugin:system-info|hostname"); 38 | } 39 | export function name(): Promise { 40 | return invoke("plugin:system-info|name"); 41 | } 42 | export function kernelVersion(): Promise { 43 | return invoke("plugin:system-info|kernel_version"); 44 | } 45 | export function osVersion(): Promise { 46 | return invoke("plugin:system-info|os_version"); 47 | } 48 | export function staticInfo(): Promise { 49 | return invoke("plugin:system-info|static_info"); 50 | } 51 | // Components 52 | export function components(): Promise { 53 | return invoke("plugin:system-info|components"); 54 | } 55 | // Cpu 56 | export function cpus(): Promise { 57 | return invoke("plugin:system-info|cpus"); 58 | } 59 | export function cpuCount(): Promise { 60 | return invoke("plugin:system-info|cpu_count"); 61 | } 62 | export function cpuInfo(): Promise { 63 | return invoke("plugin:system-info|cpu_info"); 64 | } 65 | // Disk 66 | export function disks(): Promise { 67 | return invoke("plugin:system-info|disks"); 68 | } 69 | // Network 70 | export function networks(): Promise { 71 | return invoke("plugin:system-info|networks"); 72 | } 73 | // Process 74 | export function processes(): Promise { 75 | return invoke("plugin:system-info|processes"); 76 | } 77 | // Refresh 78 | export function refreshAll(): Promise { 79 | return invoke("plugin:system-info|refresh_all"); 80 | } 81 | export function refreshMemory(): Promise { 82 | return invoke("plugin:system-info|refresh_memory"); 83 | } 84 | export function refreshCpu(): Promise { 85 | return invoke("plugin:system-info|refresh_cpu"); 86 | } 87 | export function refreshProcesses(): Promise { 88 | return invoke("plugin:system-info|refresh_processes"); 89 | } 90 | 91 | export function debugCommand() { 92 | return invoke("plugin:system-info|debug"); 93 | } 94 | 95 | export function batteries(): Promise { 96 | return invoke("plugin:system-info|batteries"); 97 | } 98 | 99 | export function uptime(): Promise { 100 | return invoke("plugin:system-info|uptime"); 101 | } 102 | 103 | export function loadAverage(): Promise { 104 | return invoke("plugin:system-info|load_average"); 105 | } 106 | -------------------------------------------------------------------------------- /guest-js/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./type"; 3 | -------------------------------------------------------------------------------- /guest-js/type.ts: -------------------------------------------------------------------------------- 1 | import { 2 | array, 3 | boolean, 4 | enum_, 5 | length, 6 | literal, 7 | nullable, 8 | number, 9 | object, 10 | pipe, 11 | string, 12 | union, 13 | type InferOutput, 14 | } from "valibot"; 15 | 16 | enum BatteryStateEnum { 17 | Unknown = "Unknown", 18 | Charging = "Charging", 19 | Discharging = "Discharging", 20 | Empty = "Empty", 21 | Full = "Full", 22 | } 23 | 24 | export const BatteryState = enum_(BatteryStateEnum); 25 | export type BatteryState = InferOutput; 26 | 27 | enum BatteryTechnologyEnum { 28 | Unknown = "Unknown", 29 | LithiumIon = "LithiumIon", 30 | LeadAcid = "LeadAcid", 31 | LithiumPolymer = "LithiumPolymer", 32 | NickelMetalHydride = "NickelMetalHydride", 33 | NickelCadmium = "NickelCadmium", 34 | NickelZinc = "NickelZinc", 35 | LithiumIronPhosphate = "LithiumIronPhosphate", 36 | RechargeableAlkalineManganese = "RechargeableAlkalineManganese", 37 | } 38 | export const BatteryTechnology = enum_(BatteryTechnologyEnum); 39 | export type BatteryTechnology = InferOutput; 40 | 41 | export const Battery = object({ 42 | state_of_charge: number(), 43 | energy: number(), 44 | energy_full: number(), 45 | energy_full_design: number(), 46 | energy_rate: number(), 47 | // .describe("Amount of energy being drained from the battery."), 48 | voltage: number(), 49 | state_of_health: number(), 50 | state: BatteryState, 51 | technology: BatteryTechnology, 52 | temperature_kelvin: nullable(number()), 53 | temperature_celsius: nullable(number()), 54 | temperature_fahrenheit: nullable(number()), 55 | cycle_count: nullable(number()), 56 | vendor: nullable(string()), 57 | model: nullable(string()), 58 | serial_number: nullable(string()), 59 | time_to_full: nullable(number()), 60 | time_to_empty: nullable(number()), 61 | }); 62 | export type Battery = InferOutput; 63 | 64 | export const Batteries = array(Battery); 65 | export type Batteries = InferOutput; 66 | 67 | // TODO: verify actual value returned from rust for "Unknown" enum 68 | 69 | // export const DiskKind = enum_(["HDD", "SSD", "Unknown"]); 70 | export const DiskKind = union([ 71 | literal("HDD"), 72 | literal("SSD"), 73 | object({ 74 | Unknown: number(), 75 | }), 76 | ]); 77 | export type DiskKind = InferOutput; 78 | 79 | export const MacAddress = pipe(array(number()), length(6)); 80 | export type MacAddress = InferOutput; 81 | 82 | export const ProcessStatus = union([ 83 | literal("Idle"), 84 | literal("Run"), 85 | literal("Sleep"), 86 | literal("Stop"), 87 | literal("Zombie"), 88 | literal("Tracing"), 89 | literal("Dead"), 90 | literal("Wakekill"), 91 | literal("Waking"), 92 | literal("Parked"), 93 | literal("LockBlocked"), 94 | literal("UninterruptibleDiskSleep"), 95 | object({ 96 | Unknown: number(), 97 | }), 98 | ]); 99 | export type ProcessStatus = InferOutput; 100 | 101 | export const DiskUsage = object({ 102 | total_written_bytes: number(), 103 | written_bytes: number(), 104 | total_read_bytes: number(), 105 | read_bytes: number(), 106 | }); 107 | export type DiskUsage = InferOutput; 108 | 109 | export const Cpu = object({ 110 | name: string(), 111 | frequency: number(), 112 | cpu_usage: number(), 113 | vendor_id: string(), 114 | brand: string(), 115 | }); 116 | export type Cpu = InferOutput; 117 | 118 | export const Disk = object({ 119 | kind: DiskKind, 120 | name: string(), 121 | file_system: string(), 122 | mount_point: string(), 123 | total_space: number(), 124 | available_space: number(), 125 | is_removable: boolean(), 126 | }); 127 | export type Disk = InferOutput; 128 | 129 | export const Network = object({ 130 | interface_name: string(), 131 | received: number(), 132 | total_received: number(), 133 | transmitted: number(), 134 | total_transmitted: number(), 135 | packets_received: number(), 136 | total_packets_received: number(), 137 | packets_transmitted: number(), 138 | total_packets_transmitted: number(), 139 | errors_on_received: number(), 140 | total_errors_on_received: number(), 141 | errors_on_transmitted: number(), 142 | total_errors_on_transmitted: number(), 143 | mac_address: array(number()), 144 | mac_address_str: string(), 145 | }); 146 | export type Network = InferOutput; 147 | 148 | export const Component = object({ 149 | temperature: number(), 150 | max: number(), 151 | critical: nullable(number()), 152 | label: string(), 153 | }); 154 | export type Component = InferOutput; 155 | 156 | export const Process = object({ 157 | name: string(), 158 | cmd: array(string()), 159 | exe: nullable(string()), 160 | pid: number(), 161 | environ: array(string()), 162 | cwd: nullable(string()), 163 | root: nullable(string()), 164 | memory: number(), 165 | virtual_memory: number(), 166 | parent: nullable(number()), 167 | status: ProcessStatus, 168 | start_time: number(), 169 | run_time: number(), 170 | cpu_usage: number(), 171 | disk_usage: DiskUsage, 172 | user_id: nullable(string()), 173 | effective_user_id: nullable(string()), 174 | group_id: nullable(string()), 175 | effective_group_id: nullable(string()), 176 | session_id: nullable(number()), 177 | }); 178 | export type Process = InferOutput; 179 | 180 | // aggregate info 181 | export const StaticInfo = object({ 182 | hostname: nullable(string()), 183 | kernel_version: nullable(string()), 184 | os_version: nullable(string()), 185 | name: nullable(string()), 186 | }); 187 | export type StaticInfo = InferOutput; 188 | 189 | export const MemoryInfo = object({ 190 | total_memory: number(), 191 | used_memory: number(), 192 | total_swap: number(), 193 | used_swap: number(), 194 | }); 195 | export type MemoryInfo = InferOutput; 196 | 197 | export const CpuInfo = object({ 198 | cpus: array(Cpu), 199 | cpu_count: number(), 200 | }); 201 | export type CpuInfo = InferOutput; 202 | 203 | export const AllSystemInfo = object({ 204 | hostname: nullable(string()), 205 | kernel_version: nullable(string()), 206 | os_version: nullable(string()), 207 | name: nullable(string()), 208 | 209 | total_memory: number(), 210 | used_memory: number(), 211 | total_swap: number(), 212 | used_swap: number(), 213 | 214 | cpus: array(Cpu), 215 | cpu_count: number(), 216 | 217 | disks: array(Disk), 218 | networks: array(Network), 219 | components: array(Component), 220 | processes: array(Process), 221 | batteries: Batteries, 222 | }); 223 | export type AllSystemInfo = InferOutput; 224 | 225 | export const LoadAverage = object({ 226 | one: number(), 227 | five: number(), 228 | fifteen: number(), 229 | }); 230 | export type LoadAverage = InferOutput; 231 | -------------------------------------------------------------------------------- /jsr.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@hk/tauri-plugin-system-info-api", 3 | "version": "2.0.10", 4 | "exports": "./guest-js/index.ts", 5 | "publishConfig": { 6 | "include": ["guest-js/**/*", "README.md", "package.json"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tauri-plugin-system-info-api", 3 | "version": "2.0.10", 4 | "author": "Huakun", 5 | "description": "System Info Plugin for Tauri Apps", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/HuakunShen/tauri-plugin-system-info.git" 9 | }, 10 | "type": "module", 11 | "types": "./dist-js/index.d.ts", 12 | "main": "./dist-js/index.cjs", 13 | "module": "./dist-js/index.js", 14 | "exports": { 15 | "types": "./dist-js/index.d.ts", 16 | "import": "./dist-js/index.js", 17 | "require": "./dist-js/index.cjs" 18 | }, 19 | "files": [ 20 | "dist-js", 21 | "guest-js", 22 | "README.md" 23 | ], 24 | "scripts": { 25 | "build": "rollup -c", 26 | "prepublishOnly": "pnpm build", 27 | "pretest": "pnpm build" 28 | }, 29 | "dependencies": { 30 | "valibot": "^1.0.0", 31 | "@tauri-apps/api": "^2.2.0" 32 | }, 33 | "devDependencies": { 34 | "@rollup/plugin-typescript": "^12.1.2", 35 | "rollup": "^4.30.1", 36 | "tslib": "^2.8.1", 37 | "typedoc": "^0.27.6", 38 | "typescript": "^5.7.2" 39 | }, 40 | "packageManager": "pnpm@9.15.3" 41 | } 42 | -------------------------------------------------------------------------------- /permissions/all.toml: -------------------------------------------------------------------------------- 1 | "$schema" = "schemas/schema.json" 2 | 3 | [[permission]] 4 | identifier = "allow-all" 5 | description = "This enables all permissions for system info plugin" 6 | commands.allow = [ 7 | "all_sys_info", 8 | "total_memory", 9 | "used_memory", 10 | "total_swap", 11 | "used_swap", 12 | "memory_info", 13 | "hostname", 14 | "name", 15 | "kernel_version", 16 | "os_version", 17 | "static_info", 18 | "components", 19 | "cpus", 20 | "cpu_count", 21 | "cpu_info", 22 | "disks", 23 | "networks", 24 | "processes", 25 | "refresh_all", 26 | "refresh_memory", 27 | "refresh_cpu", 28 | "refresh_processes", 29 | "batteries", 30 | "load_average", 31 | "uptime", 32 | ] 33 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/all_sys_info.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-all-sys-info" 7 | description = "Enables the all_sys_info command without any pre-configured scope." 8 | commands.allow = ["all_sys_info"] 9 | 10 | [[permission]] 11 | identifier = "deny-all-sys-info" 12 | description = "Denies the all_sys_info command without any pre-configured scope." 13 | commands.deny = ["all_sys_info"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/batteries.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-batteries" 7 | description = "Enables the batteries command without any pre-configured scope." 8 | commands.allow = ["batteries"] 9 | 10 | [[permission]] 11 | identifier = "deny-batteries" 12 | description = "Denies the batteries command without any pre-configured scope." 13 | commands.deny = ["batteries"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/components.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-components" 7 | description = "Enables the components command without any pre-configured scope." 8 | commands.allow = ["components"] 9 | 10 | [[permission]] 11 | identifier = "deny-components" 12 | description = "Denies the components command without any pre-configured scope." 13 | commands.deny = ["components"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/cpu_count.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-cpu-count" 7 | description = "Enables the cpu_count command without any pre-configured scope." 8 | commands.allow = ["cpu_count"] 9 | 10 | [[permission]] 11 | identifier = "deny-cpu-count" 12 | description = "Denies the cpu_count command without any pre-configured scope." 13 | commands.deny = ["cpu_count"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/cpu_info.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-cpu-info" 7 | description = "Enables the cpu_info command without any pre-configured scope." 8 | commands.allow = ["cpu_info"] 9 | 10 | [[permission]] 11 | identifier = "deny-cpu-info" 12 | description = "Denies the cpu_info command without any pre-configured scope." 13 | commands.deny = ["cpu_info"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/cpus.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-cpus" 7 | description = "Enables the cpus command without any pre-configured scope." 8 | commands.allow = ["cpus"] 9 | 10 | [[permission]] 11 | identifier = "deny-cpus" 12 | description = "Denies the cpus command without any pre-configured scope." 13 | commands.deny = ["cpus"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/disks.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-disks" 7 | description = "Enables the disks command without any pre-configured scope." 8 | commands.allow = ["disks"] 9 | 10 | [[permission]] 11 | identifier = "deny-disks" 12 | description = "Denies the disks command without any pre-configured scope." 13 | commands.deny = ["disks"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/execute.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-execute" 7 | description = "Enables the execute command without any pre-configured scope." 8 | commands.allow = ["execute"] 9 | 10 | [[permission]] 11 | identifier = "deny-execute" 12 | description = "Denies the execute command without any pre-configured scope." 13 | commands.deny = ["execute"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/hostname.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-hostname" 7 | description = "Enables the hostname command without any pre-configured scope." 8 | commands.allow = ["hostname"] 9 | 10 | [[permission]] 11 | identifier = "deny-hostname" 12 | description = "Denies the hostname command without any pre-configured scope." 13 | commands.deny = ["hostname"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/kernel_version.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-kernel-version" 7 | description = "Enables the kernel_version command without any pre-configured scope." 8 | commands.allow = ["kernel_version"] 9 | 10 | [[permission]] 11 | identifier = "deny-kernel-version" 12 | description = "Denies the kernel_version command without any pre-configured scope." 13 | commands.deny = ["kernel_version"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/load_average.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-load-average" 7 | description = "Enables the load_average command without any pre-configured scope." 8 | commands.allow = ["load_average"] 9 | 10 | [[permission]] 11 | identifier = "deny-load-average" 12 | description = "Denies the load_average command without any pre-configured scope." 13 | commands.deny = ["load_average"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/memory_info.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-memory-info" 7 | description = "Enables the memory_info command without any pre-configured scope." 8 | commands.allow = ["memory_info"] 9 | 10 | [[permission]] 11 | identifier = "deny-memory-info" 12 | description = "Denies the memory_info command without any pre-configured scope." 13 | commands.deny = ["memory_info"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/name.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-name" 7 | description = "Enables the name command without any pre-configured scope." 8 | commands.allow = ["name"] 9 | 10 | [[permission]] 11 | identifier = "deny-name" 12 | description = "Denies the name command without any pre-configured scope." 13 | commands.deny = ["name"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/networks.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-networks" 7 | description = "Enables the networks command without any pre-configured scope." 8 | commands.allow = ["networks"] 9 | 10 | [[permission]] 11 | identifier = "deny-networks" 12 | description = "Denies the networks command without any pre-configured scope." 13 | commands.deny = ["networks"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/os_version.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-os-version" 7 | description = "Enables the os_version command without any pre-configured scope." 8 | commands.allow = ["os_version"] 9 | 10 | [[permission]] 11 | identifier = "deny-os-version" 12 | description = "Denies the os_version command without any pre-configured scope." 13 | commands.deny = ["os_version"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/ping.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-ping" 7 | description = "Enables the ping command without any pre-configured scope." 8 | commands.allow = ["ping"] 9 | 10 | [[permission]] 11 | identifier = "deny-ping" 12 | description = "Denies the ping command without any pre-configured scope." 13 | commands.deny = ["ping"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/processes.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-processes" 7 | description = "Enables the processes command without any pre-configured scope." 8 | commands.allow = ["processes"] 9 | 10 | [[permission]] 11 | identifier = "deny-processes" 12 | description = "Denies the processes command without any pre-configured scope." 13 | commands.deny = ["processes"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/refresh_all.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-refresh-all" 7 | description = "Enables the refresh_all command without any pre-configured scope." 8 | commands.allow = ["refresh_all"] 9 | 10 | [[permission]] 11 | identifier = "deny-refresh-all" 12 | description = "Denies the refresh_all command without any pre-configured scope." 13 | commands.deny = ["refresh_all"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/refresh_cpu.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-refresh-cpu" 7 | description = "Enables the refresh_cpu command without any pre-configured scope." 8 | commands.allow = ["refresh_cpu"] 9 | 10 | [[permission]] 11 | identifier = "deny-refresh-cpu" 12 | description = "Denies the refresh_cpu command without any pre-configured scope." 13 | commands.deny = ["refresh_cpu"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/refresh_memory.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-refresh-memory" 7 | description = "Enables the refresh_memory command without any pre-configured scope." 8 | commands.allow = ["refresh_memory"] 9 | 10 | [[permission]] 11 | identifier = "deny-refresh-memory" 12 | description = "Denies the refresh_memory command without any pre-configured scope." 13 | commands.deny = ["refresh_memory"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/refresh_processes.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-refresh-processes" 7 | description = "Enables the refresh_processes command without any pre-configured scope." 8 | commands.allow = ["refresh_processes"] 9 | 10 | [[permission]] 11 | identifier = "deny-refresh-processes" 12 | description = "Denies the refresh_processes command without any pre-configured scope." 13 | commands.deny = ["refresh_processes"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/static_info.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-static-info" 7 | description = "Enables the static_info command without any pre-configured scope." 8 | commands.allow = ["static_info"] 9 | 10 | [[permission]] 11 | identifier = "deny-static-info" 12 | description = "Denies the static_info command without any pre-configured scope." 13 | commands.deny = ["static_info"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/total_memory.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-total-memory" 7 | description = "Enables the total_memory command without any pre-configured scope." 8 | commands.allow = ["total_memory"] 9 | 10 | [[permission]] 11 | identifier = "deny-total-memory" 12 | description = "Denies the total_memory command without any pre-configured scope." 13 | commands.deny = ["total_memory"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/total_swap.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-total-swap" 7 | description = "Enables the total_swap command without any pre-configured scope." 8 | commands.allow = ["total_swap"] 9 | 10 | [[permission]] 11 | identifier = "deny-total-swap" 12 | description = "Denies the total_swap command without any pre-configured scope." 13 | commands.deny = ["total_swap"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/uptime.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-uptime" 7 | description = "Enables the uptime command without any pre-configured scope." 8 | commands.allow = ["uptime"] 9 | 10 | [[permission]] 11 | identifier = "deny-uptime" 12 | description = "Denies the uptime command without any pre-configured scope." 13 | commands.deny = ["uptime"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/used_memory.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-used-memory" 7 | description = "Enables the used_memory command without any pre-configured scope." 8 | commands.allow = ["used_memory"] 9 | 10 | [[permission]] 11 | identifier = "deny-used-memory" 12 | description = "Denies the used_memory command without any pre-configured scope." 13 | commands.deny = ["used_memory"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/commands/used_swap.toml: -------------------------------------------------------------------------------- 1 | # Automatically generated - DO NOT EDIT! 2 | 3 | "$schema" = "../../schemas/schema.json" 4 | 5 | [[permission]] 6 | identifier = "allow-used-swap" 7 | description = "Enables the used_swap command without any pre-configured scope." 8 | commands.allow = ["used_swap"] 9 | 10 | [[permission]] 11 | identifier = "deny-used-swap" 12 | description = "Denies the used_swap command without any pre-configured scope." 13 | commands.deny = ["used_swap"] 14 | -------------------------------------------------------------------------------- /permissions/autogenerated/reference.md: -------------------------------------------------------------------------------- 1 | 2 | ## Permission Table 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 22 | 23 | 24 | 25 | 30 | 35 | 36 | 37 | 38 | 43 | 48 | 49 | 50 | 51 | 56 | 61 | 62 | 63 | 64 | 69 | 74 | 75 | 76 | 77 | 82 | 87 | 88 | 89 | 90 | 95 | 100 | 101 | 102 | 103 | 108 | 113 | 114 | 115 | 116 | 121 | 126 | 127 | 128 | 129 | 134 | 139 | 140 | 141 | 142 | 147 | 152 | 153 | 154 | 155 | 160 | 165 | 166 | 167 | 168 | 173 | 178 | 179 | 180 | 181 | 186 | 191 | 192 | 193 | 194 | 199 | 204 | 205 | 206 | 207 | 212 | 217 | 218 | 219 | 220 | 225 | 230 | 231 | 232 | 233 | 238 | 243 | 244 | 245 | 246 | 251 | 256 | 257 | 258 | 259 | 264 | 269 | 270 | 271 | 272 | 277 | 282 | 283 | 284 | 285 | 290 | 295 | 296 | 297 | 298 | 303 | 308 | 309 | 310 | 311 | 316 | 321 | 322 | 323 | 324 | 329 | 334 | 335 | 336 | 337 | 342 | 347 | 348 | 349 | 350 | 355 | 360 | 361 | 362 | 363 | 368 | 373 | 374 | 375 | 376 | 381 | 386 | 387 | 388 | 389 | 394 | 399 | 400 | 401 | 402 | 407 | 412 | 413 | 414 | 415 | 420 | 425 | 426 | 427 | 428 | 433 | 438 | 439 | 440 | 441 | 446 | 451 | 452 | 453 | 454 | 459 | 464 | 465 | 466 | 467 | 472 | 477 | 478 | 479 | 480 | 485 | 490 | 491 | 492 | 493 | 498 | 503 | 504 | 505 | 506 | 511 | 516 | 517 | 518 | 519 | 524 | 529 | 530 | 531 | 532 | 537 | 542 | 543 | 544 | 545 | 550 | 555 | 556 | 557 | 558 | 563 | 568 | 569 | 570 | 571 | 576 | 581 | 582 | 583 | 584 | 589 | 594 | 595 | 596 | 597 | 602 | 607 | 608 | 609 | 610 | 615 | 620 | 621 | 622 | 623 | 628 | 633 | 634 | 635 | 636 | 641 | 646 | 647 | 648 | 649 | 654 | 659 | 660 | 661 | 662 | 667 | 672 | 673 | 674 | 675 | 680 | 685 | 686 | 687 | 688 | 693 | 698 | 699 | 700 | 701 | 706 | 711 | 712 | 713 | 714 | 719 | 724 | 725 |
IdentifierDescription
13 | 14 | `system-info:allow-all` 15 | 16 | 18 | 19 | This enables all permissions for system info plugin 20 | 21 |
26 | 27 | `system-info:allow-all-sys-info` 28 | 29 | 31 | 32 | Enables the all_sys_info command without any pre-configured scope. 33 | 34 |
39 | 40 | `system-info:deny-all-sys-info` 41 | 42 | 44 | 45 | Denies the all_sys_info command without any pre-configured scope. 46 | 47 |
52 | 53 | `system-info:allow-batteries` 54 | 55 | 57 | 58 | Enables the batteries command without any pre-configured scope. 59 | 60 |
65 | 66 | `system-info:deny-batteries` 67 | 68 | 70 | 71 | Denies the batteries command without any pre-configured scope. 72 | 73 |
78 | 79 | `system-info:allow-components` 80 | 81 | 83 | 84 | Enables the components command without any pre-configured scope. 85 | 86 |
91 | 92 | `system-info:deny-components` 93 | 94 | 96 | 97 | Denies the components command without any pre-configured scope. 98 | 99 |
104 | 105 | `system-info:allow-cpu-count` 106 | 107 | 109 | 110 | Enables the cpu_count command without any pre-configured scope. 111 | 112 |
117 | 118 | `system-info:deny-cpu-count` 119 | 120 | 122 | 123 | Denies the cpu_count command without any pre-configured scope. 124 | 125 |
130 | 131 | `system-info:allow-cpu-info` 132 | 133 | 135 | 136 | Enables the cpu_info command without any pre-configured scope. 137 | 138 |
143 | 144 | `system-info:deny-cpu-info` 145 | 146 | 148 | 149 | Denies the cpu_info command without any pre-configured scope. 150 | 151 |
156 | 157 | `system-info:allow-cpus` 158 | 159 | 161 | 162 | Enables the cpus command without any pre-configured scope. 163 | 164 |
169 | 170 | `system-info:deny-cpus` 171 | 172 | 174 | 175 | Denies the cpus command without any pre-configured scope. 176 | 177 |
182 | 183 | `system-info:allow-disks` 184 | 185 | 187 | 188 | Enables the disks command without any pre-configured scope. 189 | 190 |
195 | 196 | `system-info:deny-disks` 197 | 198 | 200 | 201 | Denies the disks command without any pre-configured scope. 202 | 203 |
208 | 209 | `system-info:allow-execute` 210 | 211 | 213 | 214 | Enables the execute command without any pre-configured scope. 215 | 216 |
221 | 222 | `system-info:deny-execute` 223 | 224 | 226 | 227 | Denies the execute command without any pre-configured scope. 228 | 229 |
234 | 235 | `system-info:allow-hostname` 236 | 237 | 239 | 240 | Enables the hostname command without any pre-configured scope. 241 | 242 |
247 | 248 | `system-info:deny-hostname` 249 | 250 | 252 | 253 | Denies the hostname command without any pre-configured scope. 254 | 255 |
260 | 261 | `system-info:allow-kernel-version` 262 | 263 | 265 | 266 | Enables the kernel_version command without any pre-configured scope. 267 | 268 |
273 | 274 | `system-info:deny-kernel-version` 275 | 276 | 278 | 279 | Denies the kernel_version command without any pre-configured scope. 280 | 281 |
286 | 287 | `system-info:allow-load-average` 288 | 289 | 291 | 292 | Enables the load_average command without any pre-configured scope. 293 | 294 |
299 | 300 | `system-info:deny-load-average` 301 | 302 | 304 | 305 | Denies the load_average command without any pre-configured scope. 306 | 307 |
312 | 313 | `system-info:allow-memory-info` 314 | 315 | 317 | 318 | Enables the memory_info command without any pre-configured scope. 319 | 320 |
325 | 326 | `system-info:deny-memory-info` 327 | 328 | 330 | 331 | Denies the memory_info command without any pre-configured scope. 332 | 333 |
338 | 339 | `system-info:allow-name` 340 | 341 | 343 | 344 | Enables the name command without any pre-configured scope. 345 | 346 |
351 | 352 | `system-info:deny-name` 353 | 354 | 356 | 357 | Denies the name command without any pre-configured scope. 358 | 359 |
364 | 365 | `system-info:allow-networks` 366 | 367 | 369 | 370 | Enables the networks command without any pre-configured scope. 371 | 372 |
377 | 378 | `system-info:deny-networks` 379 | 380 | 382 | 383 | Denies the networks command without any pre-configured scope. 384 | 385 |
390 | 391 | `system-info:allow-os-version` 392 | 393 | 395 | 396 | Enables the os_version command without any pre-configured scope. 397 | 398 |
403 | 404 | `system-info:deny-os-version` 405 | 406 | 408 | 409 | Denies the os_version command without any pre-configured scope. 410 | 411 |
416 | 417 | `system-info:allow-ping` 418 | 419 | 421 | 422 | Enables the ping command without any pre-configured scope. 423 | 424 |
429 | 430 | `system-info:deny-ping` 431 | 432 | 434 | 435 | Denies the ping command without any pre-configured scope. 436 | 437 |
442 | 443 | `system-info:allow-processes` 444 | 445 | 447 | 448 | Enables the processes command without any pre-configured scope. 449 | 450 |
455 | 456 | `system-info:deny-processes` 457 | 458 | 460 | 461 | Denies the processes command without any pre-configured scope. 462 | 463 |
468 | 469 | `system-info:allow-refresh-all` 470 | 471 | 473 | 474 | Enables the refresh_all command without any pre-configured scope. 475 | 476 |
481 | 482 | `system-info:deny-refresh-all` 483 | 484 | 486 | 487 | Denies the refresh_all command without any pre-configured scope. 488 | 489 |
494 | 495 | `system-info:allow-refresh-cpu` 496 | 497 | 499 | 500 | Enables the refresh_cpu command without any pre-configured scope. 501 | 502 |
507 | 508 | `system-info:deny-refresh-cpu` 509 | 510 | 512 | 513 | Denies the refresh_cpu command without any pre-configured scope. 514 | 515 |
520 | 521 | `system-info:allow-refresh-memory` 522 | 523 | 525 | 526 | Enables the refresh_memory command without any pre-configured scope. 527 | 528 |
533 | 534 | `system-info:deny-refresh-memory` 535 | 536 | 538 | 539 | Denies the refresh_memory command without any pre-configured scope. 540 | 541 |
546 | 547 | `system-info:allow-refresh-processes` 548 | 549 | 551 | 552 | Enables the refresh_processes command without any pre-configured scope. 553 | 554 |
559 | 560 | `system-info:deny-refresh-processes` 561 | 562 | 564 | 565 | Denies the refresh_processes command without any pre-configured scope. 566 | 567 |
572 | 573 | `system-info:allow-static-info` 574 | 575 | 577 | 578 | Enables the static_info command without any pre-configured scope. 579 | 580 |
585 | 586 | `system-info:deny-static-info` 587 | 588 | 590 | 591 | Denies the static_info command without any pre-configured scope. 592 | 593 |
598 | 599 | `system-info:allow-total-memory` 600 | 601 | 603 | 604 | Enables the total_memory command without any pre-configured scope. 605 | 606 |
611 | 612 | `system-info:deny-total-memory` 613 | 614 | 616 | 617 | Denies the total_memory command without any pre-configured scope. 618 | 619 |
624 | 625 | `system-info:allow-total-swap` 626 | 627 | 629 | 630 | Enables the total_swap command without any pre-configured scope. 631 | 632 |
637 | 638 | `system-info:deny-total-swap` 639 | 640 | 642 | 643 | Denies the total_swap command without any pre-configured scope. 644 | 645 |
650 | 651 | `system-info:allow-uptime` 652 | 653 | 655 | 656 | Enables the uptime command without any pre-configured scope. 657 | 658 |
663 | 664 | `system-info:deny-uptime` 665 | 666 | 668 | 669 | Denies the uptime command without any pre-configured scope. 670 | 671 |
676 | 677 | `system-info:allow-used-memory` 678 | 679 | 681 | 682 | Enables the used_memory command without any pre-configured scope. 683 | 684 |
689 | 690 | `system-info:deny-used-memory` 691 | 692 | 694 | 695 | Denies the used_memory command without any pre-configured scope. 696 | 697 |
702 | 703 | `system-info:allow-used-swap` 704 | 705 | 707 | 708 | Enables the used_swap command without any pre-configured scope. 709 | 710 |
715 | 716 | `system-info:deny-used-swap` 717 | 718 | 720 | 721 | Denies the used_swap command without any pre-configured scope. 722 | 723 |
726 | -------------------------------------------------------------------------------- /permissions/schemas/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "title": "PermissionFile", 4 | "description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.", 5 | "type": "object", 6 | "properties": { 7 | "default": { 8 | "description": "The default permission set for the plugin", 9 | "anyOf": [ 10 | { 11 | "$ref": "#/definitions/DefaultPermission" 12 | }, 13 | { 14 | "type": "null" 15 | } 16 | ] 17 | }, 18 | "set": { 19 | "description": "A list of permissions sets defined", 20 | "type": "array", 21 | "items": { 22 | "$ref": "#/definitions/PermissionSet" 23 | } 24 | }, 25 | "permission": { 26 | "description": "A list of inlined permissions", 27 | "default": [], 28 | "type": "array", 29 | "items": { 30 | "$ref": "#/definitions/Permission" 31 | } 32 | } 33 | }, 34 | "definitions": { 35 | "DefaultPermission": { 36 | "description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.", 37 | "type": "object", 38 | "required": [ 39 | "permissions" 40 | ], 41 | "properties": { 42 | "version": { 43 | "description": "The version of the permission.", 44 | "type": [ 45 | "integer", 46 | "null" 47 | ], 48 | "format": "uint64", 49 | "minimum": 1.0 50 | }, 51 | "description": { 52 | "description": "Human-readable description of what the permission does. Tauri convention is to use

headings in markdown content for Tauri documentation generation purposes.", 53 | "type": [ 54 | "string", 55 | "null" 56 | ] 57 | }, 58 | "permissions": { 59 | "description": "All permissions this set contains.", 60 | "type": "array", 61 | "items": { 62 | "type": "string" 63 | } 64 | } 65 | } 66 | }, 67 | "PermissionSet": { 68 | "description": "A set of direct permissions grouped together under a new name.", 69 | "type": "object", 70 | "required": [ 71 | "description", 72 | "identifier", 73 | "permissions" 74 | ], 75 | "properties": { 76 | "identifier": { 77 | "description": "A unique identifier for the permission.", 78 | "type": "string" 79 | }, 80 | "description": { 81 | "description": "Human-readable description of what the permission does.", 82 | "type": "string" 83 | }, 84 | "permissions": { 85 | "description": "All permissions this set contains.", 86 | "type": "array", 87 | "items": { 88 | "$ref": "#/definitions/PermissionKind" 89 | } 90 | } 91 | } 92 | }, 93 | "Permission": { 94 | "description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.", 95 | "type": "object", 96 | "required": [ 97 | "identifier" 98 | ], 99 | "properties": { 100 | "version": { 101 | "description": "The version of the permission.", 102 | "type": [ 103 | "integer", 104 | "null" 105 | ], 106 | "format": "uint64", 107 | "minimum": 1.0 108 | }, 109 | "identifier": { 110 | "description": "A unique identifier for the permission.", 111 | "type": "string" 112 | }, 113 | "description": { 114 | "description": "Human-readable description of what the permission does. Tauri internal convention is to use

headings in markdown content for Tauri documentation generation purposes.", 115 | "type": [ 116 | "string", 117 | "null" 118 | ] 119 | }, 120 | "commands": { 121 | "description": "Allowed or denied commands when using this permission.", 122 | "default": { 123 | "allow": [], 124 | "deny": [] 125 | }, 126 | "allOf": [ 127 | { 128 | "$ref": "#/definitions/Commands" 129 | } 130 | ] 131 | }, 132 | "scope": { 133 | "description": "Allowed or denied scoped when using this permission.", 134 | "allOf": [ 135 | { 136 | "$ref": "#/definitions/Scopes" 137 | } 138 | ] 139 | }, 140 | "platforms": { 141 | "description": "Target platforms this permission applies. By default all platforms are affected by this permission.", 142 | "type": [ 143 | "array", 144 | "null" 145 | ], 146 | "items": { 147 | "$ref": "#/definitions/Target" 148 | } 149 | } 150 | } 151 | }, 152 | "Commands": { 153 | "description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.", 154 | "type": "object", 155 | "properties": { 156 | "allow": { 157 | "description": "Allowed command.", 158 | "default": [], 159 | "type": "array", 160 | "items": { 161 | "type": "string" 162 | } 163 | }, 164 | "deny": { 165 | "description": "Denied command, which takes priority.", 166 | "default": [], 167 | "type": "array", 168 | "items": { 169 | "type": "string" 170 | } 171 | } 172 | } 173 | }, 174 | "Scopes": { 175 | "description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```", 176 | "type": "object", 177 | "properties": { 178 | "allow": { 179 | "description": "Data that defines what is allowed by the scope.", 180 | "type": [ 181 | "array", 182 | "null" 183 | ], 184 | "items": { 185 | "$ref": "#/definitions/Value" 186 | } 187 | }, 188 | "deny": { 189 | "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.", 190 | "type": [ 191 | "array", 192 | "null" 193 | ], 194 | "items": { 195 | "$ref": "#/definitions/Value" 196 | } 197 | } 198 | } 199 | }, 200 | "Value": { 201 | "description": "All supported ACL values.", 202 | "anyOf": [ 203 | { 204 | "description": "Represents a null JSON value.", 205 | "type": "null" 206 | }, 207 | { 208 | "description": "Represents a [`bool`].", 209 | "type": "boolean" 210 | }, 211 | { 212 | "description": "Represents a valid ACL [`Number`].", 213 | "allOf": [ 214 | { 215 | "$ref": "#/definitions/Number" 216 | } 217 | ] 218 | }, 219 | { 220 | "description": "Represents a [`String`].", 221 | "type": "string" 222 | }, 223 | { 224 | "description": "Represents a list of other [`Value`]s.", 225 | "type": "array", 226 | "items": { 227 | "$ref": "#/definitions/Value" 228 | } 229 | }, 230 | { 231 | "description": "Represents a map of [`String`] keys to [`Value`]s.", 232 | "type": "object", 233 | "additionalProperties": { 234 | "$ref": "#/definitions/Value" 235 | } 236 | } 237 | ] 238 | }, 239 | "Number": { 240 | "description": "A valid ACL number.", 241 | "anyOf": [ 242 | { 243 | "description": "Represents an [`i64`].", 244 | "type": "integer", 245 | "format": "int64" 246 | }, 247 | { 248 | "description": "Represents a [`f64`].", 249 | "type": "number", 250 | "format": "double" 251 | } 252 | ] 253 | }, 254 | "Target": { 255 | "description": "Platform target.", 256 | "oneOf": [ 257 | { 258 | "description": "MacOS.", 259 | "type": "string", 260 | "enum": [ 261 | "macOS" 262 | ] 263 | }, 264 | { 265 | "description": "Windows.", 266 | "type": "string", 267 | "enum": [ 268 | "windows" 269 | ] 270 | }, 271 | { 272 | "description": "Linux.", 273 | "type": "string", 274 | "enum": [ 275 | "linux" 276 | ] 277 | }, 278 | { 279 | "description": "Android.", 280 | "type": "string", 281 | "enum": [ 282 | "android" 283 | ] 284 | }, 285 | { 286 | "description": "iOS.", 287 | "type": "string", 288 | "enum": [ 289 | "iOS" 290 | ] 291 | } 292 | ] 293 | }, 294 | "PermissionKind": { 295 | "type": "string", 296 | "oneOf": [ 297 | { 298 | "description": "This enables all permissions for system info plugin", 299 | "type": "string", 300 | "const": "allow-all" 301 | }, 302 | { 303 | "description": "Enables the all_sys_info command without any pre-configured scope.", 304 | "type": "string", 305 | "const": "allow-all-sys-info" 306 | }, 307 | { 308 | "description": "Denies the all_sys_info command without any pre-configured scope.", 309 | "type": "string", 310 | "const": "deny-all-sys-info" 311 | }, 312 | { 313 | "description": "Enables the batteries command without any pre-configured scope.", 314 | "type": "string", 315 | "const": "allow-batteries" 316 | }, 317 | { 318 | "description": "Denies the batteries command without any pre-configured scope.", 319 | "type": "string", 320 | "const": "deny-batteries" 321 | }, 322 | { 323 | "description": "Enables the components command without any pre-configured scope.", 324 | "type": "string", 325 | "const": "allow-components" 326 | }, 327 | { 328 | "description": "Denies the components command without any pre-configured scope.", 329 | "type": "string", 330 | "const": "deny-components" 331 | }, 332 | { 333 | "description": "Enables the cpu_count command without any pre-configured scope.", 334 | "type": "string", 335 | "const": "allow-cpu-count" 336 | }, 337 | { 338 | "description": "Denies the cpu_count command without any pre-configured scope.", 339 | "type": "string", 340 | "const": "deny-cpu-count" 341 | }, 342 | { 343 | "description": "Enables the cpu_info command without any pre-configured scope.", 344 | "type": "string", 345 | "const": "allow-cpu-info" 346 | }, 347 | { 348 | "description": "Denies the cpu_info command without any pre-configured scope.", 349 | "type": "string", 350 | "const": "deny-cpu-info" 351 | }, 352 | { 353 | "description": "Enables the cpus command without any pre-configured scope.", 354 | "type": "string", 355 | "const": "allow-cpus" 356 | }, 357 | { 358 | "description": "Denies the cpus command without any pre-configured scope.", 359 | "type": "string", 360 | "const": "deny-cpus" 361 | }, 362 | { 363 | "description": "Enables the disks command without any pre-configured scope.", 364 | "type": "string", 365 | "const": "allow-disks" 366 | }, 367 | { 368 | "description": "Denies the disks command without any pre-configured scope.", 369 | "type": "string", 370 | "const": "deny-disks" 371 | }, 372 | { 373 | "description": "Enables the execute command without any pre-configured scope.", 374 | "type": "string", 375 | "const": "allow-execute" 376 | }, 377 | { 378 | "description": "Denies the execute command without any pre-configured scope.", 379 | "type": "string", 380 | "const": "deny-execute" 381 | }, 382 | { 383 | "description": "Enables the hostname command without any pre-configured scope.", 384 | "type": "string", 385 | "const": "allow-hostname" 386 | }, 387 | { 388 | "description": "Denies the hostname command without any pre-configured scope.", 389 | "type": "string", 390 | "const": "deny-hostname" 391 | }, 392 | { 393 | "description": "Enables the kernel_version command without any pre-configured scope.", 394 | "type": "string", 395 | "const": "allow-kernel-version" 396 | }, 397 | { 398 | "description": "Denies the kernel_version command without any pre-configured scope.", 399 | "type": "string", 400 | "const": "deny-kernel-version" 401 | }, 402 | { 403 | "description": "Enables the load_average command without any pre-configured scope.", 404 | "type": "string", 405 | "const": "allow-load-average" 406 | }, 407 | { 408 | "description": "Denies the load_average command without any pre-configured scope.", 409 | "type": "string", 410 | "const": "deny-load-average" 411 | }, 412 | { 413 | "description": "Enables the memory_info command without any pre-configured scope.", 414 | "type": "string", 415 | "const": "allow-memory-info" 416 | }, 417 | { 418 | "description": "Denies the memory_info command without any pre-configured scope.", 419 | "type": "string", 420 | "const": "deny-memory-info" 421 | }, 422 | { 423 | "description": "Enables the name command without any pre-configured scope.", 424 | "type": "string", 425 | "const": "allow-name" 426 | }, 427 | { 428 | "description": "Denies the name command without any pre-configured scope.", 429 | "type": "string", 430 | "const": "deny-name" 431 | }, 432 | { 433 | "description": "Enables the networks command without any pre-configured scope.", 434 | "type": "string", 435 | "const": "allow-networks" 436 | }, 437 | { 438 | "description": "Denies the networks command without any pre-configured scope.", 439 | "type": "string", 440 | "const": "deny-networks" 441 | }, 442 | { 443 | "description": "Enables the os_version command without any pre-configured scope.", 444 | "type": "string", 445 | "const": "allow-os-version" 446 | }, 447 | { 448 | "description": "Denies the os_version command without any pre-configured scope.", 449 | "type": "string", 450 | "const": "deny-os-version" 451 | }, 452 | { 453 | "description": "Enables the ping command without any pre-configured scope.", 454 | "type": "string", 455 | "const": "allow-ping" 456 | }, 457 | { 458 | "description": "Denies the ping command without any pre-configured scope.", 459 | "type": "string", 460 | "const": "deny-ping" 461 | }, 462 | { 463 | "description": "Enables the processes command without any pre-configured scope.", 464 | "type": "string", 465 | "const": "allow-processes" 466 | }, 467 | { 468 | "description": "Denies the processes command without any pre-configured scope.", 469 | "type": "string", 470 | "const": "deny-processes" 471 | }, 472 | { 473 | "description": "Enables the refresh_all command without any pre-configured scope.", 474 | "type": "string", 475 | "const": "allow-refresh-all" 476 | }, 477 | { 478 | "description": "Denies the refresh_all command without any pre-configured scope.", 479 | "type": "string", 480 | "const": "deny-refresh-all" 481 | }, 482 | { 483 | "description": "Enables the refresh_cpu command without any pre-configured scope.", 484 | "type": "string", 485 | "const": "allow-refresh-cpu" 486 | }, 487 | { 488 | "description": "Denies the refresh_cpu command without any pre-configured scope.", 489 | "type": "string", 490 | "const": "deny-refresh-cpu" 491 | }, 492 | { 493 | "description": "Enables the refresh_memory command without any pre-configured scope.", 494 | "type": "string", 495 | "const": "allow-refresh-memory" 496 | }, 497 | { 498 | "description": "Denies the refresh_memory command without any pre-configured scope.", 499 | "type": "string", 500 | "const": "deny-refresh-memory" 501 | }, 502 | { 503 | "description": "Enables the refresh_processes command without any pre-configured scope.", 504 | "type": "string", 505 | "const": "allow-refresh-processes" 506 | }, 507 | { 508 | "description": "Denies the refresh_processes command without any pre-configured scope.", 509 | "type": "string", 510 | "const": "deny-refresh-processes" 511 | }, 512 | { 513 | "description": "Enables the static_info command without any pre-configured scope.", 514 | "type": "string", 515 | "const": "allow-static-info" 516 | }, 517 | { 518 | "description": "Denies the static_info command without any pre-configured scope.", 519 | "type": "string", 520 | "const": "deny-static-info" 521 | }, 522 | { 523 | "description": "Enables the total_memory command without any pre-configured scope.", 524 | "type": "string", 525 | "const": "allow-total-memory" 526 | }, 527 | { 528 | "description": "Denies the total_memory command without any pre-configured scope.", 529 | "type": "string", 530 | "const": "deny-total-memory" 531 | }, 532 | { 533 | "description": "Enables the total_swap command without any pre-configured scope.", 534 | "type": "string", 535 | "const": "allow-total-swap" 536 | }, 537 | { 538 | "description": "Denies the total_swap command without any pre-configured scope.", 539 | "type": "string", 540 | "const": "deny-total-swap" 541 | }, 542 | { 543 | "description": "Enables the uptime command without any pre-configured scope.", 544 | "type": "string", 545 | "const": "allow-uptime" 546 | }, 547 | { 548 | "description": "Denies the uptime command without any pre-configured scope.", 549 | "type": "string", 550 | "const": "deny-uptime" 551 | }, 552 | { 553 | "description": "Enables the used_memory command without any pre-configured scope.", 554 | "type": "string", 555 | "const": "allow-used-memory" 556 | }, 557 | { 558 | "description": "Denies the used_memory command without any pre-configured scope.", 559 | "type": "string", 560 | "const": "deny-used-memory" 561 | }, 562 | { 563 | "description": "Enables the used_swap command without any pre-configured scope.", 564 | "type": "string", 565 | "const": "allow-used-swap" 566 | }, 567 | { 568 | "description": "Denies the used_swap command without any pre-configured scope.", 569 | "type": "string", 570 | "const": "deny-used-swap" 571 | } 572 | ] 573 | } 574 | } 575 | } -------------------------------------------------------------------------------- /pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '9.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | importers: 8 | 9 | .: 10 | dependencies: 11 | '@tauri-apps/api': 12 | specifier: ^2.2.0 13 | version: 2.2.0 14 | valibot: 15 | specifier: ^1.0.0-beta.10 16 | version: 1.0.0-rc.0(typescript@5.7.3) 17 | devDependencies: 18 | '@rollup/plugin-typescript': 19 | specifier: ^12.1.2 20 | version: 12.1.2(rollup@4.34.7)(tslib@2.8.1)(typescript@5.7.3) 21 | rollup: 22 | specifier: ^4.30.1 23 | version: 4.34.7 24 | tslib: 25 | specifier: ^2.8.1 26 | version: 2.8.1 27 | typedoc: 28 | specifier: ^0.27.6 29 | version: 0.27.7(typescript@5.7.3) 30 | typescript: 31 | specifier: ^5.7.2 32 | version: 5.7.3 33 | 34 | packages: 35 | 36 | '@gerrit0/mini-shiki@1.27.2': 37 | resolution: {integrity: sha512-GeWyHz8ao2gBiUW4OJnQDxXQnFgZQwwQk05t/CVVgNBN7/rK8XZ7xY6YhLVv9tH3VppWWmr9DCl3MwemB/i+Og==} 38 | 39 | '@rollup/plugin-typescript@12.1.2': 40 | resolution: {integrity: sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==} 41 | engines: {node: '>=14.0.0'} 42 | peerDependencies: 43 | rollup: ^2.14.0||^3.0.0||^4.0.0 44 | tslib: '*' 45 | typescript: '>=3.7.0' 46 | peerDependenciesMeta: 47 | rollup: 48 | optional: true 49 | tslib: 50 | optional: true 51 | 52 | '@rollup/pluginutils@5.1.0': 53 | resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} 54 | engines: {node: '>=14.0.0'} 55 | peerDependencies: 56 | rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 57 | peerDependenciesMeta: 58 | rollup: 59 | optional: true 60 | 61 | '@rollup/rollup-android-arm-eabi@4.34.7': 62 | resolution: {integrity: sha512-l6CtzHYo8D2TQ3J7qJNpp3Q1Iye56ssIAtqbM2H8axxCEEwvN7o8Ze9PuIapbxFL3OHrJU2JBX6FIIVnP/rYyw==} 63 | cpu: [arm] 64 | os: [android] 65 | 66 | '@rollup/rollup-android-arm64@4.34.7': 67 | resolution: {integrity: sha512-KvyJpFUueUnSp53zhAa293QBYqwm94TgYTIfXyOTtidhm5V0LbLCJQRGkQClYiX3FXDQGSvPxOTD/6rPStMMDg==} 68 | cpu: [arm64] 69 | os: [android] 70 | 71 | '@rollup/rollup-darwin-arm64@4.34.7': 72 | resolution: {integrity: sha512-jq87CjmgL9YIKvs8ybtIC98s/M3HdbqXhllcy9EdLV0yMg1DpxES2gr65nNy7ObNo/vZ/MrOTxt0bE5LinL6mA==} 73 | cpu: [arm64] 74 | os: [darwin] 75 | 76 | '@rollup/rollup-darwin-x64@4.34.7': 77 | resolution: {integrity: sha512-rSI/m8OxBjsdnMMg0WEetu/w+LhLAcCDEiL66lmMX4R3oaml3eXz3Dxfvrxs1FbzPbJMaItQiksyMfv1hoIxnA==} 78 | cpu: [x64] 79 | os: [darwin] 80 | 81 | '@rollup/rollup-freebsd-arm64@4.34.7': 82 | resolution: {integrity: sha512-oIoJRy3ZrdsXpFuWDtzsOOa/E/RbRWXVokpVrNnkS7npz8GEG++E1gYbzhYxhxHbO2om1T26BZjVmdIoyN2WtA==} 83 | cpu: [arm64] 84 | os: [freebsd] 85 | 86 | '@rollup/rollup-freebsd-x64@4.34.7': 87 | resolution: {integrity: sha512-X++QSLm4NZfZ3VXGVwyHdRf58IBbCu9ammgJxuWZYLX0du6kZvdNqPwrjvDfwmi6wFdvfZ/s6K7ia0E5kI7m8Q==} 88 | cpu: [x64] 89 | os: [freebsd] 90 | 91 | '@rollup/rollup-linux-arm-gnueabihf@4.34.7': 92 | resolution: {integrity: sha512-Z0TzhrsNqukTz3ISzrvyshQpFnFRfLunYiXxlCRvcrb3nvC5rVKI+ZXPFG/Aa4jhQa1gHgH3A0exHaRRN4VmdQ==} 93 | cpu: [arm] 94 | os: [linux] 95 | 96 | '@rollup/rollup-linux-arm-musleabihf@4.34.7': 97 | resolution: {integrity: sha512-nkznpyXekFAbvFBKBy4nNppSgneB1wwG1yx/hujN3wRnhnkrYVugMTCBXED4+Ni6thoWfQuHNYbFjgGH0MBXtw==} 98 | cpu: [arm] 99 | os: [linux] 100 | 101 | '@rollup/rollup-linux-arm64-gnu@4.34.7': 102 | resolution: {integrity: sha512-KCjlUkcKs6PjOcxolqrXglBDcfCuUCTVlX5BgzgoJHw+1rWH1MCkETLkLe5iLLS9dP5gKC7mp3y6x8c1oGBUtA==} 103 | cpu: [arm64] 104 | os: [linux] 105 | 106 | '@rollup/rollup-linux-arm64-musl@4.34.7': 107 | resolution: {integrity: sha512-uFLJFz6+utmpbR313TTx+NpPuAXbPz4BhTQzgaP0tozlLnGnQ6rCo6tLwaSa6b7l6gRErjLicXQ1iPiXzYotjw==} 108 | cpu: [arm64] 109 | os: [linux] 110 | 111 | '@rollup/rollup-linux-loongarch64-gnu@4.34.7': 112 | resolution: {integrity: sha512-ws8pc68UcJJqCpneDFepnwlsMUFoWvPbWXT/XUrJ7rWUL9vLoIN3GAasgG+nCvq8xrE3pIrd+qLX/jotcLy0Qw==} 113 | cpu: [loong64] 114 | os: [linux] 115 | 116 | '@rollup/rollup-linux-powerpc64le-gnu@4.34.7': 117 | resolution: {integrity: sha512-vrDk9JDa/BFkxcS2PbWpr0C/LiiSLxFbNOBgfbW6P8TBe9PPHx9Wqbvx2xgNi1TOAyQHQJ7RZFqBiEohm79r0w==} 118 | cpu: [ppc64] 119 | os: [linux] 120 | 121 | '@rollup/rollup-linux-riscv64-gnu@4.34.7': 122 | resolution: {integrity: sha512-rB+ejFyjtmSo+g/a4eovDD1lHWHVqizN8P0Hm0RElkINpS0XOdpaXloqM4FBkF9ZWEzg6bezymbpLmeMldfLTw==} 123 | cpu: [riscv64] 124 | os: [linux] 125 | 126 | '@rollup/rollup-linux-s390x-gnu@4.34.7': 127 | resolution: {integrity: sha512-nNXNjo4As6dNqRn7OrsnHzwTgtypfRA3u3AKr0B3sOOo+HkedIbn8ZtFnB+4XyKJojIfqDKmbIzO1QydQ8c+Pw==} 128 | cpu: [s390x] 129 | os: [linux] 130 | 131 | '@rollup/rollup-linux-x64-gnu@4.34.7': 132 | resolution: {integrity: sha512-9kPVf9ahnpOMSGlCxXGv980wXD0zRR3wyk8+33/MXQIpQEOpaNe7dEHm5LMfyRZRNt9lMEQuH0jUKj15MkM7QA==} 133 | cpu: [x64] 134 | os: [linux] 135 | 136 | '@rollup/rollup-linux-x64-musl@4.34.7': 137 | resolution: {integrity: sha512-7wJPXRWTTPtTFDFezA8sle/1sdgxDjuMoRXEKtx97ViRxGGkVQYovem+Q8Pr/2HxiHp74SSRG+o6R0Yq0shPwQ==} 138 | cpu: [x64] 139 | os: [linux] 140 | 141 | '@rollup/rollup-win32-arm64-msvc@4.34.7': 142 | resolution: {integrity: sha512-MN7aaBC7mAjsiMEZcsJvwNsQVNZShgES/9SzWp1HC9Yjqb5OpexYnRjF7RmE4itbeesHMYYQiAtUAQaSKs2Rfw==} 143 | cpu: [arm64] 144 | os: [win32] 145 | 146 | '@rollup/rollup-win32-ia32-msvc@4.34.7': 147 | resolution: {integrity: sha512-aeawEKYswsFu1LhDM9RIgToobquzdtSc4jSVqHV8uApz4FVvhFl/mKh92wc8WpFc6aYCothV/03UjY6y7yLgbg==} 148 | cpu: [ia32] 149 | os: [win32] 150 | 151 | '@rollup/rollup-win32-x64-msvc@4.34.7': 152 | resolution: {integrity: sha512-4ZedScpxxIrVO7otcZ8kCX1mZArtH2Wfj3uFCxRJ9NO80gg1XV0U/b2f/MKaGwj2X3QopHfoWiDQ917FRpwY3w==} 153 | cpu: [x64] 154 | os: [win32] 155 | 156 | '@shikijs/engine-oniguruma@1.29.2': 157 | resolution: {integrity: sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==} 158 | 159 | '@shikijs/types@1.29.2': 160 | resolution: {integrity: sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==} 161 | 162 | '@shikijs/vscode-textmate@10.0.1': 163 | resolution: {integrity: sha512-fTIQwLF+Qhuws31iw7Ncl1R3HUDtGwIipiJ9iU+UsDUwMhegFcQKQHd51nZjb7CArq0MvON8rbgCGQYWHUKAdg==} 164 | 165 | '@tauri-apps/api@2.2.0': 166 | resolution: {integrity: sha512-R8epOeZl1eJEl603aUMIGb4RXlhPjpgxbGVEaqY+0G5JG9vzV/clNlzTeqc+NLYXVqXcn8mb4c5b9pJIUDEyAg==} 167 | 168 | '@types/estree@1.0.5': 169 | resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} 170 | 171 | '@types/estree@1.0.6': 172 | resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} 173 | 174 | '@types/hast@3.0.4': 175 | resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} 176 | 177 | '@types/unist@3.0.3': 178 | resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} 179 | 180 | argparse@2.0.1: 181 | resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} 182 | 183 | balanced-match@1.0.2: 184 | resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} 185 | 186 | brace-expansion@2.0.1: 187 | resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} 188 | 189 | entities@4.5.0: 190 | resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} 191 | engines: {node: '>=0.12'} 192 | 193 | estree-walker@2.0.2: 194 | resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} 195 | 196 | fsevents@2.3.3: 197 | resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} 198 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} 199 | os: [darwin] 200 | 201 | function-bind@1.1.2: 202 | resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} 203 | 204 | hasown@2.0.2: 205 | resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} 206 | engines: {node: '>= 0.4'} 207 | 208 | is-core-module@2.13.1: 209 | resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} 210 | 211 | linkify-it@5.0.0: 212 | resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} 213 | 214 | lunr@2.3.9: 215 | resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} 216 | 217 | markdown-it@14.1.0: 218 | resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} 219 | hasBin: true 220 | 221 | mdurl@2.0.0: 222 | resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} 223 | 224 | minimatch@9.0.5: 225 | resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} 226 | engines: {node: '>=16 || 14 >=14.17'} 227 | 228 | path-parse@1.0.7: 229 | resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} 230 | 231 | picomatch@2.3.1: 232 | resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} 233 | engines: {node: '>=8.6'} 234 | 235 | punycode.js@2.3.1: 236 | resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} 237 | engines: {node: '>=6'} 238 | 239 | resolve@1.22.8: 240 | resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} 241 | hasBin: true 242 | 243 | rollup@4.34.7: 244 | resolution: {integrity: sha512-8qhyN0oZ4x0H6wmBgfKxJtxM7qS98YJ0k0kNh5ECVtuchIJ7z9IVVvzpmtQyT10PXKMtBxYr1wQ5Apg8RS8kXQ==} 245 | engines: {node: '>=18.0.0', npm: '>=8.0.0'} 246 | hasBin: true 247 | 248 | supports-preserve-symlinks-flag@1.0.0: 249 | resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} 250 | engines: {node: '>= 0.4'} 251 | 252 | tslib@2.8.1: 253 | resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} 254 | 255 | typedoc@0.27.7: 256 | resolution: {integrity: sha512-K/JaUPX18+61W3VXek1cWC5gwmuLvYTOXJzBvD9W7jFvbPnefRnCHQCEPw7MSNrP/Hj7JJrhZtDDLKdcYm6ucg==} 257 | engines: {node: '>= 18'} 258 | hasBin: true 259 | peerDependencies: 260 | typescript: 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x 261 | 262 | typescript@5.7.3: 263 | resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} 264 | engines: {node: '>=14.17'} 265 | hasBin: true 266 | 267 | uc.micro@2.1.0: 268 | resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} 269 | 270 | valibot@1.0.0-rc.0: 271 | resolution: {integrity: sha512-9ZUrOXOejY/WaIn8p0Z469R1qBAwNJeqq8jzOIDsl1qR8gqtObHQmyHLFli0UCkcGiTco5kH6/KPLWsTWE9b2g==} 272 | peerDependencies: 273 | typescript: '>=5' 274 | peerDependenciesMeta: 275 | typescript: 276 | optional: true 277 | 278 | yaml@2.7.0: 279 | resolution: {integrity: sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==} 280 | engines: {node: '>= 14'} 281 | hasBin: true 282 | 283 | snapshots: 284 | 285 | '@gerrit0/mini-shiki@1.27.2': 286 | dependencies: 287 | '@shikijs/engine-oniguruma': 1.29.2 288 | '@shikijs/types': 1.29.2 289 | '@shikijs/vscode-textmate': 10.0.1 290 | 291 | '@rollup/plugin-typescript@12.1.2(rollup@4.34.7)(tslib@2.8.1)(typescript@5.7.3)': 292 | dependencies: 293 | '@rollup/pluginutils': 5.1.0(rollup@4.34.7) 294 | resolve: 1.22.8 295 | typescript: 5.7.3 296 | optionalDependencies: 297 | rollup: 4.34.7 298 | tslib: 2.8.1 299 | 300 | '@rollup/pluginutils@5.1.0(rollup@4.34.7)': 301 | dependencies: 302 | '@types/estree': 1.0.5 303 | estree-walker: 2.0.2 304 | picomatch: 2.3.1 305 | optionalDependencies: 306 | rollup: 4.34.7 307 | 308 | '@rollup/rollup-android-arm-eabi@4.34.7': 309 | optional: true 310 | 311 | '@rollup/rollup-android-arm64@4.34.7': 312 | optional: true 313 | 314 | '@rollup/rollup-darwin-arm64@4.34.7': 315 | optional: true 316 | 317 | '@rollup/rollup-darwin-x64@4.34.7': 318 | optional: true 319 | 320 | '@rollup/rollup-freebsd-arm64@4.34.7': 321 | optional: true 322 | 323 | '@rollup/rollup-freebsd-x64@4.34.7': 324 | optional: true 325 | 326 | '@rollup/rollup-linux-arm-gnueabihf@4.34.7': 327 | optional: true 328 | 329 | '@rollup/rollup-linux-arm-musleabihf@4.34.7': 330 | optional: true 331 | 332 | '@rollup/rollup-linux-arm64-gnu@4.34.7': 333 | optional: true 334 | 335 | '@rollup/rollup-linux-arm64-musl@4.34.7': 336 | optional: true 337 | 338 | '@rollup/rollup-linux-loongarch64-gnu@4.34.7': 339 | optional: true 340 | 341 | '@rollup/rollup-linux-powerpc64le-gnu@4.34.7': 342 | optional: true 343 | 344 | '@rollup/rollup-linux-riscv64-gnu@4.34.7': 345 | optional: true 346 | 347 | '@rollup/rollup-linux-s390x-gnu@4.34.7': 348 | optional: true 349 | 350 | '@rollup/rollup-linux-x64-gnu@4.34.7': 351 | optional: true 352 | 353 | '@rollup/rollup-linux-x64-musl@4.34.7': 354 | optional: true 355 | 356 | '@rollup/rollup-win32-arm64-msvc@4.34.7': 357 | optional: true 358 | 359 | '@rollup/rollup-win32-ia32-msvc@4.34.7': 360 | optional: true 361 | 362 | '@rollup/rollup-win32-x64-msvc@4.34.7': 363 | optional: true 364 | 365 | '@shikijs/engine-oniguruma@1.29.2': 366 | dependencies: 367 | '@shikijs/types': 1.29.2 368 | '@shikijs/vscode-textmate': 10.0.1 369 | 370 | '@shikijs/types@1.29.2': 371 | dependencies: 372 | '@shikijs/vscode-textmate': 10.0.1 373 | '@types/hast': 3.0.4 374 | 375 | '@shikijs/vscode-textmate@10.0.1': {} 376 | 377 | '@tauri-apps/api@2.2.0': {} 378 | 379 | '@types/estree@1.0.5': {} 380 | 381 | '@types/estree@1.0.6': {} 382 | 383 | '@types/hast@3.0.4': 384 | dependencies: 385 | '@types/unist': 3.0.3 386 | 387 | '@types/unist@3.0.3': {} 388 | 389 | argparse@2.0.1: {} 390 | 391 | balanced-match@1.0.2: {} 392 | 393 | brace-expansion@2.0.1: 394 | dependencies: 395 | balanced-match: 1.0.2 396 | 397 | entities@4.5.0: {} 398 | 399 | estree-walker@2.0.2: {} 400 | 401 | fsevents@2.3.3: 402 | optional: true 403 | 404 | function-bind@1.1.2: {} 405 | 406 | hasown@2.0.2: 407 | dependencies: 408 | function-bind: 1.1.2 409 | 410 | is-core-module@2.13.1: 411 | dependencies: 412 | hasown: 2.0.2 413 | 414 | linkify-it@5.0.0: 415 | dependencies: 416 | uc.micro: 2.1.0 417 | 418 | lunr@2.3.9: {} 419 | 420 | markdown-it@14.1.0: 421 | dependencies: 422 | argparse: 2.0.1 423 | entities: 4.5.0 424 | linkify-it: 5.0.0 425 | mdurl: 2.0.0 426 | punycode.js: 2.3.1 427 | uc.micro: 2.1.0 428 | 429 | mdurl@2.0.0: {} 430 | 431 | minimatch@9.0.5: 432 | dependencies: 433 | brace-expansion: 2.0.1 434 | 435 | path-parse@1.0.7: {} 436 | 437 | picomatch@2.3.1: {} 438 | 439 | punycode.js@2.3.1: {} 440 | 441 | resolve@1.22.8: 442 | dependencies: 443 | is-core-module: 2.13.1 444 | path-parse: 1.0.7 445 | supports-preserve-symlinks-flag: 1.0.0 446 | 447 | rollup@4.34.7: 448 | dependencies: 449 | '@types/estree': 1.0.6 450 | optionalDependencies: 451 | '@rollup/rollup-android-arm-eabi': 4.34.7 452 | '@rollup/rollup-android-arm64': 4.34.7 453 | '@rollup/rollup-darwin-arm64': 4.34.7 454 | '@rollup/rollup-darwin-x64': 4.34.7 455 | '@rollup/rollup-freebsd-arm64': 4.34.7 456 | '@rollup/rollup-freebsd-x64': 4.34.7 457 | '@rollup/rollup-linux-arm-gnueabihf': 4.34.7 458 | '@rollup/rollup-linux-arm-musleabihf': 4.34.7 459 | '@rollup/rollup-linux-arm64-gnu': 4.34.7 460 | '@rollup/rollup-linux-arm64-musl': 4.34.7 461 | '@rollup/rollup-linux-loongarch64-gnu': 4.34.7 462 | '@rollup/rollup-linux-powerpc64le-gnu': 4.34.7 463 | '@rollup/rollup-linux-riscv64-gnu': 4.34.7 464 | '@rollup/rollup-linux-s390x-gnu': 4.34.7 465 | '@rollup/rollup-linux-x64-gnu': 4.34.7 466 | '@rollup/rollup-linux-x64-musl': 4.34.7 467 | '@rollup/rollup-win32-arm64-msvc': 4.34.7 468 | '@rollup/rollup-win32-ia32-msvc': 4.34.7 469 | '@rollup/rollup-win32-x64-msvc': 4.34.7 470 | fsevents: 2.3.3 471 | 472 | supports-preserve-symlinks-flag@1.0.0: {} 473 | 474 | tslib@2.8.1: {} 475 | 476 | typedoc@0.27.7(typescript@5.7.3): 477 | dependencies: 478 | '@gerrit0/mini-shiki': 1.27.2 479 | lunr: 2.3.9 480 | markdown-it: 14.1.0 481 | minimatch: 9.0.5 482 | typescript: 5.7.3 483 | yaml: 2.7.0 484 | 485 | typescript@5.7.3: {} 486 | 487 | uc.micro@2.1.0: {} 488 | 489 | valibot@1.0.0-rc.0(typescript@5.7.3): 490 | optionalDependencies: 491 | typescript: 5.7.3 492 | 493 | yaml@2.7.0: {} 494 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import { readFileSync } from 'fs' 2 | import { join } from 'path' 3 | import { cwd } from 'process' 4 | import typescript from '@rollup/plugin-typescript' 5 | 6 | const pkg = JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf8')) 7 | 8 | export default { 9 | input: 'guest-js/index.ts', 10 | output: [ 11 | { 12 | file: pkg.exports.import, 13 | format: 'esm' 14 | }, 15 | { 16 | file: pkg.exports.require, 17 | format: 'cjs' 18 | } 19 | ], 20 | plugins: [ 21 | typescript() 22 | ], 23 | external: [ 24 | /^@tauri-apps\/api/, 25 | ...Object.keys(pkg.dependencies || {}), 26 | ...Object.keys(pkg.peerDependencies || {}) 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/commands/battery.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::Battery, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn batteries(state: tauri::State<'_, SysInfoState>) -> Result, String> { 5 | let ret = state 6 | .sysinfo 7 | .lock() 8 | .unwrap() 9 | .batteries() 10 | .map_err(|e| e.to_string())?; 11 | Ok(ret) 12 | } 13 | -------------------------------------------------------------------------------- /src/commands/component.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::Component, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn components(state: tauri::State<'_, SysInfoState>) -> Result, String> { 5 | Ok(state.sysinfo.lock().unwrap().components()) 6 | } 7 | -------------------------------------------------------------------------------- /src/commands/cpu.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | model::{Cpu, CpuInfo}, 3 | utils::SysInfoState, 4 | }; 5 | 6 | #[tauri::command] 7 | pub fn cpus(state: tauri::State<'_, SysInfoState>) -> Result, String> { 8 | Ok(state.sysinfo.lock().unwrap().cpus()) 9 | } 10 | 11 | #[tauri::command] 12 | pub fn cpu_count(state: tauri::State<'_, SysInfoState>) -> Result { 13 | Ok(state.sysinfo.lock().unwrap().cpu_count()) 14 | } 15 | 16 | #[tauri::command] 17 | pub fn cpu_info(state: tauri::State<'_, SysInfoState>) -> Result { 18 | let cpus = state.sysinfo.lock().unwrap().cpus(); 19 | let cpu_count = state.sysinfo.lock().unwrap().cpu_count(); 20 | let cpu_info = CpuInfo { cpus, cpu_count }; 21 | Ok(cpu_info) 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/disk.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::Disk, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn disks(state: tauri::State<'_, SysInfoState>) -> Result, String> { 5 | Ok(state.sysinfo.lock().unwrap().disks()) 6 | } 7 | -------------------------------------------------------------------------------- /src/commands/memory.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::MemoryInfo, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn total_memory(state: tauri::State<'_, SysInfoState>) -> Result { 5 | Ok(state.sysinfo.lock().unwrap().total_memory()) 6 | } 7 | 8 | #[tauri::command] 9 | pub fn used_memory(state: tauri::State<'_, SysInfoState>) -> Result { 10 | Ok(state.sysinfo.lock().unwrap().used_memory()) 11 | } 12 | 13 | #[tauri::command] 14 | pub fn total_swap(state: tauri::State<'_, SysInfoState>) -> Result { 15 | Ok(state.sysinfo.lock().unwrap().total_swap()) 16 | } 17 | 18 | #[tauri::command] 19 | pub fn used_swap(state: tauri::State<'_, SysInfoState>) -> Result { 20 | Ok(state.sysinfo.lock().unwrap().used_swap()) 21 | } 22 | 23 | #[tauri::command] 24 | pub fn memory_info(state: tauri::State<'_, SysInfoState>) -> Result { 25 | let total_memory = state.sysinfo.lock().unwrap().total_memory(); 26 | let used_memory = state.sysinfo.lock().unwrap().used_memory(); 27 | let total_swap = state.sysinfo.lock().unwrap().total_swap(); 28 | let used_swap = state.sysinfo.lock().unwrap().used_swap(); 29 | Ok(MemoryInfo { 30 | total_memory, 31 | used_memory, 32 | total_swap, 33 | used_swap, 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /src/commands/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | model::{AllSystemInfo, LoadAverage}, 3 | utils::SysInfoState, 4 | }; 5 | 6 | pub mod battery; 7 | pub mod component; 8 | pub mod cpu; 9 | pub mod disk; 10 | pub mod memory; 11 | pub mod network; 12 | pub mod process; 13 | pub mod refresh; 14 | pub mod static_info; 15 | 16 | #[tauri::command] 17 | pub fn all_sys_info(state: tauri::State<'_, SysInfoState>) -> Result { 18 | let hostname = state.sysinfo.lock().unwrap().hostname(); 19 | let kernel_version = state.sysinfo.lock().unwrap().kernel_version(); 20 | let os_version = state.sysinfo.lock().unwrap().os_version(); 21 | let name = state.sysinfo.lock().unwrap().name(); 22 | let total_memory = state.sysinfo.lock().unwrap().total_memory(); 23 | let used_memory = state.sysinfo.lock().unwrap().used_memory(); 24 | let total_swap = state.sysinfo.lock().unwrap().total_swap(); 25 | let used_swap = state.sysinfo.lock().unwrap().used_swap(); 26 | let cpus = state.sysinfo.lock().unwrap().cpus(); 27 | let cpu_count = state.sysinfo.lock().unwrap().cpu_count(); 28 | let disks = state.sysinfo.lock().unwrap().disks(); 29 | let networks = state.sysinfo.lock().unwrap().networks(); 30 | let components = state.sysinfo.lock().unwrap().components(); 31 | let processes = state.sysinfo.lock().unwrap().processes(); 32 | let batteries = state 33 | .sysinfo 34 | .lock() 35 | .unwrap() 36 | .batteries() 37 | .map_err(|err| err.to_string())?; 38 | Ok(AllSystemInfo { 39 | hostname, 40 | kernel_version, 41 | os_version, 42 | name, 43 | total_memory, 44 | used_memory, 45 | total_swap, 46 | used_swap, 47 | cpus, 48 | cpu_count, 49 | disks, 50 | networks, 51 | components, 52 | processes, 53 | batteries, 54 | }) 55 | } 56 | 57 | #[tauri::command] 58 | pub fn uptime(state: tauri::State<'_, SysInfoState>) -> Result { 59 | Ok(state.sysinfo.lock().unwrap().uptime()) 60 | } 61 | 62 | #[tauri::command] 63 | pub fn load_average(state: tauri::State<'_, SysInfoState>) -> Result { 64 | Ok(state.sysinfo.lock().unwrap().load_average().into()) 65 | } 66 | -------------------------------------------------------------------------------- /src/commands/network.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::Network, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn networks(state: tauri::State<'_, SysInfoState>) -> Result, String> { 5 | Ok(state.sysinfo.lock().unwrap().networks()) 6 | } 7 | -------------------------------------------------------------------------------- /src/commands/process.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::Process, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn processes(state: tauri::State<'_, SysInfoState>) -> Result, String> { 5 | Ok(state.sysinfo.lock().unwrap().processes()) 6 | } 7 | -------------------------------------------------------------------------------- /src/commands/refresh.rs: -------------------------------------------------------------------------------- 1 | use sysinfo::Pid; 2 | 3 | use crate::utils::SysInfoState; 4 | 5 | #[tauri::command] 6 | pub fn refresh_all(state: tauri::State<'_, SysInfoState>) -> Result<(), String> { 7 | state.sysinfo.lock().unwrap().refresh_all(); 8 | Ok(()) 9 | } 10 | 11 | #[tauri::command] 12 | pub fn refresh_memory(state: tauri::State<'_, SysInfoState>) -> Result<(), String> { 13 | state.sysinfo.lock().unwrap().refresh_memory(); 14 | Ok(()) 15 | } 16 | 17 | #[tauri::command] 18 | pub fn refresh_cpu(state: tauri::State<'_, SysInfoState>) -> Result<(), String> { 19 | state.sysinfo.lock().unwrap().refresh_cpu(); 20 | Ok(()) 21 | } 22 | 23 | #[tauri::command] 24 | pub fn refresh_processes(state: tauri::State<'_, SysInfoState>) -> Result<(), String> { 25 | state.sysinfo.lock().unwrap().refresh_processes(); 26 | Ok(()) 27 | } 28 | 29 | #[tauri::command] 30 | pub fn refresh_process(pid: u32, state: tauri::State<'_, SysInfoState>) -> Result<(), String> { 31 | state 32 | .sysinfo 33 | .lock() 34 | .unwrap() 35 | .refresh_process(Pid::from(pid as usize)); 36 | Ok(()) 37 | } 38 | -------------------------------------------------------------------------------- /src/commands/static_info.rs: -------------------------------------------------------------------------------- 1 | use crate::{model::StaticInfo, utils::SysInfoState}; 2 | 3 | #[tauri::command] 4 | pub fn hostname(state: tauri::State<'_, SysInfoState>) -> Result, String> { 5 | Ok(state.sysinfo.lock().unwrap().hostname()) 6 | } 7 | 8 | #[tauri::command] 9 | pub fn name(state: tauri::State<'_, SysInfoState>) -> Result, String> { 10 | Ok(state.sysinfo.lock().unwrap().name()) 11 | } 12 | 13 | #[tauri::command] 14 | pub fn kernel_version(state: tauri::State<'_, SysInfoState>) -> Result, String> { 15 | Ok(state.sysinfo.lock().unwrap().kernel_version()) 16 | } 17 | 18 | #[tauri::command] 19 | pub fn os_version(state: tauri::State<'_, SysInfoState>) -> Result, String> { 20 | Ok(state.sysinfo.lock().unwrap().os_version()) 21 | } 22 | 23 | #[tauri::command] 24 | pub fn static_info(state: tauri::State<'_, SysInfoState>) -> Result { 25 | let hostname = state.sysinfo.lock().unwrap().hostname(); 26 | let kernel_version = state.sysinfo.lock().unwrap().kernel_version(); 27 | let os_version = state.sysinfo.lock().unwrap().os_version(); 28 | let name = state.sysinfo.lock().unwrap().name(); 29 | Ok(StaticInfo { 30 | hostname, 31 | kernel_version, 32 | os_version, 33 | name, 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /src/desktop.rs: -------------------------------------------------------------------------------- 1 | use crate::model::{Battery, Component, Cpu, Disk, Network, Process}; 2 | use serde::de::DeserializeOwned; 3 | use std::sync::Mutex; 4 | use sysinfo::{ 5 | Components, CpuRefreshKind, Disks, LoadAvg, Networks, Pid, ProcessRefreshKind, RefreshKind, 6 | System, 7 | }; 8 | use tauri::{plugin::PluginApi, AppHandle, Runtime}; 9 | 10 | pub fn init( 11 | app: &AppHandle, 12 | _api: PluginApi, 13 | ) -> crate::Result { 14 | Ok(SysInfoState::default()) 15 | } 16 | 17 | pub fn get_sys() -> System { 18 | System::new_all() 19 | } 20 | 21 | pub struct SysInfoState { 22 | pub sysinfo: Mutex, 23 | } 24 | 25 | /// Access to the system-info APIs. 26 | pub struct SysInfo { 27 | pub sys: System, 28 | } 29 | 30 | impl Default for SysInfoState { 31 | fn default() -> SysInfoState { 32 | SysInfoState { 33 | sysinfo: Mutex::new(SysInfo { 34 | sys: System::new_all(), 35 | }), 36 | } 37 | } 38 | } 39 | 40 | /// Impl methods from sysinfo's System struct for convenience 41 | impl SysInfo { 42 | // refresh system info 43 | pub fn refresh_all(&mut self) { 44 | self.sys.refresh_all(); 45 | } 46 | pub fn refresh_memory(&mut self) { 47 | self.sys.refresh_memory(); 48 | } 49 | pub fn refresh_cpu(&mut self) { 50 | self.sys.refresh_cpu(); 51 | } 52 | pub fn refresh_processes(&mut self) { 53 | self.sys.refresh_processes(); 54 | } 55 | pub fn refresh_process(&mut self, pid: Pid) { 56 | self.sys.refresh_process(pid); 57 | } 58 | pub fn refresh_specifics(&mut self, refreshes: RefreshKind) { 59 | self.sys.refresh_specifics(refreshes); 60 | } 61 | pub fn refresh_cpu_specifics(&mut self, refresh_kind: CpuRefreshKind) { 62 | self.sys.refresh_cpu_specifics(refresh_kind); 63 | } 64 | pub fn refresh_processes_specifics(&mut self, refresh_kind: ProcessRefreshKind) { 65 | self.sys.refresh_processes_specifics(refresh_kind); 66 | } 67 | pub fn refresh_process_specifics(&mut self, pid: Pid, refresh_kind: ProcessRefreshKind) { 68 | self.sys.refresh_process_specifics(pid, refresh_kind); 69 | } 70 | 71 | // static info 72 | pub fn hostname(&self) -> Option { 73 | System::host_name() 74 | } 75 | pub fn kernel_version(&self) -> Option { 76 | System::kernel_version() 77 | } 78 | pub fn os_version(&self) -> Option { 79 | System::os_version() 80 | } 81 | pub fn name(&self) -> Option { 82 | System::name() 83 | } 84 | 85 | // memory 86 | pub fn total_memory(&mut self) -> u64 { 87 | self.refresh_memory(); 88 | self.sys.total_memory() 89 | } 90 | pub fn used_memory(&mut self) -> u64 { 91 | self.refresh_memory(); 92 | self.sys.used_memory() 93 | } 94 | pub fn total_swap(&mut self) -> u64 { 95 | self.refresh_memory(); 96 | self.sys.total_swap() 97 | } 98 | pub fn used_swap(&mut self) -> u64 { 99 | self.refresh_memory(); 100 | self.sys.used_swap() 101 | } 102 | 103 | // cpu 104 | pub fn cpus(&self) -> Vec { 105 | self.sys.cpus().iter().map(|cpu| cpu.into()).collect() 106 | } 107 | 108 | pub fn cpu_count(&self) -> usize { 109 | self.sys.cpus().len() 110 | } 111 | 112 | // disks 113 | pub fn disks(&mut self) -> Vec { 114 | let disks = Disks::new_with_refreshed_list(); 115 | disks.iter().map(|disk| disk.into()).collect() 116 | } 117 | 118 | // other 119 | pub fn networks(&self) -> Vec { 120 | let networks = Networks::new_with_refreshed_list(); 121 | networks 122 | .into_iter() 123 | .map(|(name, data)| Network::new(name, data)) 124 | .collect() 125 | } 126 | pub fn components(&self) -> Vec { 127 | let components = Components::new_with_refreshed_list(); 128 | components 129 | .iter() 130 | .map(|component| component.into()) 131 | .collect() 132 | } 133 | pub fn processes(&self) -> Vec { 134 | self.sys 135 | .processes() 136 | .iter() 137 | .map(|(_, process)| process.into()) 138 | .collect() 139 | } 140 | pub fn batteries(&self) -> Result, starship_battery::Error> { 141 | let manager = starship_battery::Manager::new()?; 142 | Ok(manager 143 | .batteries()? 144 | .filter_map(|maybe_battery| match maybe_battery { 145 | Ok(battery) => Some(battery.into()), 146 | Err(_) => None, 147 | }) 148 | .collect()) 149 | } 150 | 151 | pub fn uptime(&self) -> u64 { 152 | System::uptime() 153 | } 154 | 155 | pub fn load_average(&self) -> LoadAvg { 156 | System::load_average() 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/error.rs: -------------------------------------------------------------------------------- 1 | use serde::{ser::Serializer, Serialize}; 2 | 3 | pub type Result = std::result::Result; 4 | 5 | #[derive(Debug, thiserror::Error)] 6 | pub enum Error { 7 | #[error(transparent)] 8 | Io(#[from] std::io::Error), 9 | #[cfg(mobile)] 10 | #[error(transparent)] 11 | PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError), 12 | } 13 | 14 | impl Serialize for Error { 15 | fn serialize(&self, serializer: S) -> std::result::Result 16 | where 17 | S: Serializer, 18 | { 19 | serializer.serialize_str(self.to_string().as_ref()) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | use tauri::{ 2 | plugin::{Builder, TauriPlugin}, 3 | Manager, Runtime, 4 | }; 5 | 6 | use std::{collections::HashMap, sync::Mutex}; 7 | 8 | pub mod commands; 9 | #[cfg(desktop)] 10 | mod desktop; 11 | mod error; 12 | #[cfg(mobile)] 13 | mod mobile; 14 | pub mod model; 15 | pub mod utils; 16 | 17 | pub use error::{Error, Result}; 18 | 19 | pub use utils::SysInfoState; 20 | 21 | #[cfg(desktop)] 22 | use desktop::SysInfo; 23 | #[cfg(mobile)] 24 | use mobile::SysInfo; 25 | 26 | /// Initializes the plugin. 27 | pub fn init() -> TauriPlugin { 28 | Builder::new("system-info") 29 | .invoke_handler(tauri::generate_handler![ 30 | commands::all_sys_info, 31 | commands::uptime, 32 | commands::load_average, 33 | // memory 34 | commands::memory::total_memory, 35 | commands::memory::used_memory, 36 | commands::memory::total_swap, 37 | commands::memory::used_swap, 38 | commands::memory::memory_info, 39 | // static info 40 | commands::static_info::hostname, 41 | commands::static_info::name, 42 | commands::static_info::kernel_version, 43 | commands::static_info::os_version, 44 | commands::static_info::static_info, 45 | // componenets 46 | commands::component::components, 47 | // cpu 48 | commands::cpu::cpus, 49 | commands::cpu::cpu_count, 50 | commands::cpu::cpu_info, 51 | // disk 52 | commands::disk::disks, 53 | // networks 54 | commands::network::networks, 55 | // processes 56 | commands::process::processes, 57 | // refresh 58 | commands::refresh::refresh_all, 59 | commands::refresh::refresh_memory, 60 | commands::refresh::refresh_cpu, 61 | commands::refresh::refresh_processes, 62 | commands::battery::batteries, 63 | ]) 64 | .setup(|app, api| { 65 | #[cfg(mobile)] 66 | let system_info = mobile::init(app, api)?; 67 | #[cfg(desktop)] 68 | // let system_info = desktop::init(app, api)?; 69 | // app.manage(system_info); 70 | app.manage(SysInfoState::default()); 71 | 72 | Ok(()) 73 | }) 74 | .build() 75 | } 76 | -------------------------------------------------------------------------------- /src/mobile.rs: -------------------------------------------------------------------------------- 1 | use serde::de::DeserializeOwned; 2 | use tauri::{ 3 | plugin::{PluginApi, PluginHandle}, 4 | AppHandle, Runtime, 5 | }; 6 | 7 | use crate::models::*; 8 | 9 | #[cfg(target_os = "android")] 10 | const PLUGIN_IDENTIFIER: &str = ""; 11 | 12 | #[cfg(target_os = "ios")] 13 | tauri::ios_plugin_binding!(init_plugin_system - info); 14 | 15 | // initializes the Kotlin or Swift plugin classes 16 | pub fn init( 17 | _app: &AppHandle, 18 | api: PluginApi, 19 | ) -> crate::Result> { 20 | #[cfg(target_os = "android")] 21 | let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "ExamplePlugin")?; 22 | #[cfg(target_os = "ios")] 23 | let handle = api.register_ios_plugin(init_plugin_system - info)?; 24 | Ok(SystemInfo(handle)) 25 | } 26 | 27 | /// Access to the system-info APIs. 28 | pub struct SystemInfo(PluginHandle); 29 | 30 | impl SystemInfo { 31 | pub fn ping(&self, payload: PingRequest) -> crate::Result { 32 | self.0 33 | .run_mobile_plugin("ping", payload) 34 | .map_err(Into::into) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/model/aggregate.rs: -------------------------------------------------------------------------------- 1 | // This file contains System Info Aggregation structs 2 | use crate::model::common::*; 3 | use serde::{Deserialize, Serialize}; 4 | 5 | #[derive(Debug, Serialize, Deserialize)] 6 | pub struct AllSystemInfo { 7 | pub hostname: Option, 8 | pub kernel_version: Option, 9 | pub os_version: Option, 10 | pub name: Option, 11 | pub total_memory: u64, 12 | pub used_memory: u64, 13 | pub total_swap: u64, 14 | pub used_swap: u64, 15 | pub cpus: Vec, 16 | pub cpu_count: usize, 17 | pub disks: Vec, 18 | pub networks: Vec, 19 | pub components: Vec, 20 | pub processes: Vec, 21 | pub batteries: Vec, 22 | } 23 | 24 | #[derive(Debug, Serialize, Deserialize)] 25 | pub struct StaticInfo { 26 | pub hostname: Option, 27 | pub kernel_version: Option, 28 | pub os_version: Option, 29 | pub name: Option, 30 | } 31 | 32 | #[derive(Debug, Serialize, Deserialize)] 33 | pub struct MemoryInfo { 34 | pub total_memory: u64, 35 | pub used_memory: u64, 36 | pub total_swap: u64, 37 | pub used_swap: u64, 38 | } 39 | 40 | #[derive(Debug, Serialize, Deserialize)] 41 | pub struct CpuInfo { 42 | pub cpus: Vec, 43 | pub cpu_count: usize, 44 | } 45 | -------------------------------------------------------------------------------- /src/model/common.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use std::path::PathBuf; 3 | 4 | #[derive(Debug, Serialize, Deserialize)] 5 | pub enum DiskKind { 6 | /// HDD type. 7 | HDD, 8 | /// SSD type. 9 | SSD, 10 | /// Unknown type. 11 | Unknown(isize), 12 | } 13 | impl From for DiskKind { 14 | fn from(value: sysinfo::DiskKind) -> Self { 15 | match value { 16 | sysinfo::DiskKind::HDD => DiskKind::HDD, 17 | sysinfo::DiskKind::SSD => DiskKind::SSD, 18 | sysinfo::DiskKind::Unknown(isize) => DiskKind::Unknown(isize), 19 | } 20 | } 21 | } 22 | 23 | #[derive(Debug, Serialize, Deserialize)] 24 | pub struct MacAddr(pub [u8; 6]); 25 | 26 | impl From for MacAddr { 27 | fn from(value: sysinfo::MacAddr) -> Self { 28 | MacAddr(value.0) 29 | } 30 | } 31 | 32 | #[derive(Debug, Serialize, Deserialize)] 33 | pub enum ProcessStatus { 34 | Idle, 35 | Run, 36 | Sleep, 37 | Stop, 38 | Zombie, 39 | Tracing, 40 | Dead, 41 | Wakekill, 42 | Waking, 43 | Parked, 44 | LockBlocked, 45 | UninterruptibleDiskSleep, 46 | Unknown(u32), 47 | } 48 | 49 | impl From for ProcessStatus { 50 | fn from(ps: sysinfo::ProcessStatus) -> Self { 51 | match ps { 52 | sysinfo::ProcessStatus::Idle => ProcessStatus::Idle, 53 | sysinfo::ProcessStatus::Run => ProcessStatus::Run, 54 | sysinfo::ProcessStatus::Sleep => ProcessStatus::Sleep, 55 | sysinfo::ProcessStatus::Stop => ProcessStatus::Stop, 56 | sysinfo::ProcessStatus::Zombie => ProcessStatus::Zombie, 57 | sysinfo::ProcessStatus::Tracing => ProcessStatus::Tracing, 58 | sysinfo::ProcessStatus::Dead => ProcessStatus::Dead, 59 | sysinfo::ProcessStatus::Wakekill => ProcessStatus::Wakekill, 60 | sysinfo::ProcessStatus::Waking => ProcessStatus::Waking, 61 | sysinfo::ProcessStatus::Parked => ProcessStatus::Parked, 62 | sysinfo::ProcessStatus::LockBlocked => ProcessStatus::LockBlocked, 63 | sysinfo::ProcessStatus::UninterruptibleDiskSleep => { 64 | ProcessStatus::UninterruptibleDiskSleep 65 | } 66 | sysinfo::ProcessStatus::Unknown(u32) => ProcessStatus::Unknown(u32), 67 | } 68 | } 69 | } 70 | 71 | #[derive(Debug, Serialize, Deserialize)] 72 | pub struct DiskUsage { 73 | /// Total number of written bytes. 74 | pub total_written_bytes: u64, 75 | /// Number of written bytes since the last refresh. 76 | pub written_bytes: u64, 77 | /// Total number of read bytes. 78 | pub total_read_bytes: u64, 79 | /// Number of read bytes since the last refresh. 80 | pub read_bytes: u64, 81 | } 82 | 83 | impl From for DiskUsage { 84 | fn from(value: sysinfo::DiskUsage) -> Self { 85 | DiskUsage { 86 | total_written_bytes: value.total_written_bytes, 87 | written_bytes: value.written_bytes, 88 | total_read_bytes: value.total_read_bytes, 89 | read_bytes: value.read_bytes, 90 | } 91 | } 92 | } 93 | 94 | #[derive(Debug, Serialize, Deserialize)] 95 | pub struct Cpu { 96 | name: String, 97 | frequency: u64, 98 | cpu_usage: f32, 99 | vendor_id: String, 100 | brand: String, 101 | } 102 | 103 | impl From<&sysinfo::Cpu> for Cpu { 104 | fn from(cpu: &sysinfo::Cpu) -> Self { 105 | Cpu { 106 | name: cpu.name().to_string(), 107 | frequency: cpu.frequency(), 108 | cpu_usage: cpu.cpu_usage(), 109 | vendor_id: cpu.vendor_id().to_string(), 110 | brand: cpu.brand().to_string(), 111 | } 112 | } 113 | } 114 | 115 | #[derive(Debug, Serialize, Deserialize)] 116 | pub struct Disk { 117 | kind: DiskKind, 118 | name: String, 119 | file_system: String, 120 | mount_point: PathBuf, 121 | total_space: u64, 122 | available_space: u64, 123 | is_removable: bool, 124 | } 125 | 126 | impl From<&sysinfo::Disk> for Disk { 127 | fn from(disk: &sysinfo::Disk) -> Self { 128 | Disk { 129 | kind: disk.kind().into(), 130 | name: disk.name().to_string_lossy().into_owned(), 131 | file_system: disk.file_system().to_string_lossy().into_owned(), 132 | mount_point: disk.mount_point().into(), 133 | total_space: disk.total_space(), 134 | available_space: disk.available_space(), 135 | is_removable: disk.is_removable(), 136 | } 137 | } 138 | } 139 | 140 | #[derive(Debug, Serialize, Deserialize)] 141 | pub struct Network { 142 | interface_name: String, 143 | received: u64, 144 | total_received: u64, 145 | transmitted: u64, 146 | total_transmitted: u64, 147 | packets_received: u64, 148 | total_packets_received: u64, 149 | packets_transmitted: u64, 150 | total_packets_transmitted: u64, 151 | errors_on_received: u64, 152 | total_errors_on_received: u64, 153 | errors_on_transmitted: u64, 154 | total_errors_on_transmitted: u64, 155 | mac_address: MacAddr, 156 | mac_address_str: String, 157 | } 158 | 159 | impl Network { 160 | pub fn new(name: &str, network_data: &sysinfo::NetworkData) -> Self { 161 | Network { 162 | interface_name: name.to_string(), 163 | received: network_data.received(), 164 | total_received: network_data.total_received(), 165 | transmitted: network_data.transmitted(), 166 | total_transmitted: network_data.total_transmitted(), 167 | packets_received: network_data.packets_received(), 168 | total_packets_received: network_data.total_packets_received(), 169 | packets_transmitted: network_data.packets_transmitted(), 170 | total_packets_transmitted: network_data.total_packets_transmitted(), 171 | errors_on_received: network_data.errors_on_received(), 172 | total_errors_on_received: network_data.total_errors_on_received(), 173 | errors_on_transmitted: network_data.errors_on_transmitted(), 174 | total_errors_on_transmitted: network_data.total_errors_on_transmitted(), 175 | mac_address: network_data.mac_address().into(), 176 | mac_address_str: network_data.mac_address().to_string(), 177 | } 178 | } 179 | } 180 | 181 | #[derive(Debug, Serialize, Deserialize)] 182 | pub struct Component { 183 | temperature: f32, 184 | max: f32, 185 | critical: Option, 186 | label: String, 187 | } 188 | 189 | impl From<&sysinfo::Component> for Component { 190 | fn from(component: &sysinfo::Component) -> Self { 191 | Component { 192 | temperature: component.temperature(), 193 | max: component.max(), 194 | critical: component.critical(), 195 | label: component.label().to_string(), 196 | } 197 | } 198 | } 199 | 200 | pub type Uid = String; 201 | pub type Gid = String; 202 | pub type Pid = u32; 203 | 204 | #[derive(Debug, Serialize, Deserialize)] 205 | pub struct Process { 206 | name: String, 207 | cmd: Vec, 208 | exe: Option, 209 | pid: Pid, 210 | environ: Vec, 211 | cwd: Option, 212 | root: Option, 213 | memory: u64, 214 | virtual_memory: u64, 215 | parent: Option, 216 | status: ProcessStatus, 217 | start_time: u64, 218 | run_time: u64, 219 | cpu_usage: f32, 220 | disk_usage: DiskUsage, 221 | user_id: Option, 222 | effective_user_id: Option, 223 | group_id: Option, 224 | effective_group_id: Option, 225 | session_id: Option, 226 | } 227 | 228 | impl From<&sysinfo::Process> for Process { 229 | fn from(proc: &sysinfo::Process) -> Self { 230 | Process { 231 | name: proc.name().to_string(), 232 | cmd: proc.cmd().to_vec(), 233 | exe: proc.exe().map(|exe| exe.into()), 234 | pid: proc.pid().as_u32(), 235 | environ: proc.environ().to_vec(), 236 | cwd: proc.cwd().map(|cwd| cwd.into()), 237 | root: proc.root().map(|root| root.into()), 238 | memory: proc.memory(), 239 | virtual_memory: proc.virtual_memory(), 240 | parent: proc.parent().map(|parent| parent.as_u32()), 241 | status: proc.status().into(), 242 | start_time: proc.start_time(), 243 | run_time: proc.run_time(), 244 | cpu_usage: proc.cpu_usage(), 245 | disk_usage: proc.disk_usage().into(), 246 | user_id: proc.user_id().map(|uid| uid.to_string()), 247 | effective_user_id: proc.effective_user_id().map(|uid| uid.to_string()), 248 | group_id: proc.group_id().map(|gid| gid.to_string()), 249 | effective_group_id: proc.effective_group_id().map(|gid| gid.to_string()), 250 | session_id: proc.session_id().map(|session_id| session_id.as_u32()), 251 | } 252 | } 253 | } 254 | 255 | #[derive(Debug, Serialize, Deserialize)] 256 | pub enum BatteryState { 257 | Unknown, 258 | Charging, 259 | Discharging, 260 | Empty, 261 | Full, 262 | } 263 | 264 | impl From for BatteryState { 265 | fn from(state: starship_battery::State) -> Self { 266 | match state { 267 | starship_battery::State::Unknown => BatteryState::Unknown, 268 | starship_battery::State::Charging => BatteryState::Charging, 269 | starship_battery::State::Discharging => BatteryState::Discharging, 270 | starship_battery::State::Empty => BatteryState::Empty, 271 | starship_battery::State::Full => BatteryState::Full, 272 | } 273 | } 274 | } 275 | 276 | #[derive(Debug, Serialize, Deserialize)] 277 | pub enum Technology { 278 | Unknown, 279 | LithiumIon, 280 | LeadAcid, 281 | LithiumPolymer, 282 | NickelMetalHydride, 283 | NickelCadmium, 284 | NickelZinc, 285 | LithiumIronPhosphate, 286 | RechargeableAlkalineManganese, 287 | } 288 | 289 | impl From for Technology { 290 | fn from(tech: starship_battery::Technology) -> Self { 291 | match tech { 292 | starship_battery::Technology::Unknown => Technology::Unknown, 293 | starship_battery::Technology::LithiumIon => Technology::LithiumIon, 294 | starship_battery::Technology::LeadAcid => Technology::LeadAcid, 295 | starship_battery::Technology::LithiumPolymer => Technology::LithiumPolymer, 296 | starship_battery::Technology::NickelMetalHydride => Technology::NickelMetalHydride, 297 | starship_battery::Technology::NickelCadmium => Technology::NickelCadmium, 298 | starship_battery::Technology::NickelZinc => Technology::NickelZinc, 299 | starship_battery::Technology::LithiumIronPhosphate => Technology::LithiumIronPhosphate, 300 | starship_battery::Technology::RechargeableAlkalineManganese => { 301 | Technology::RechargeableAlkalineManganese 302 | } 303 | _ => Technology::Unknown, 304 | } 305 | } 306 | } 307 | 308 | #[derive(Debug, Serialize, Deserialize)] 309 | pub struct Battery { 310 | state_of_charge: f32, 311 | energy: f32, 312 | energy_full: f32, 313 | energy_full_design: f32, 314 | energy_rate: f32, 315 | voltage: f32, 316 | state_of_health: f32, 317 | state: BatteryState, 318 | technology: Technology, 319 | temperature_kelvin: Option, 320 | temperature_celsius: Option, 321 | temperature_fahrenheit: Option, 322 | cycle_count: Option, 323 | vendor: Option, 324 | model: Option, 325 | serial_number: Option, 326 | time_to_full: Option, 327 | time_to_empty: Option, 328 | } 329 | 330 | impl From for Battery { 331 | fn from(battery: starship_battery::Battery) -> Self { 332 | let temp_kelvin = battery.temperature().map(|temp| temp.value); 333 | let temp_celsius = temp_kelvin.map(|temp| temp - 273.15); 334 | let temp_fahrenheit = temp_celsius.map(|temp| temp * 9.0 / 5.0 + 32.0); 335 | Battery { 336 | state_of_charge: battery.state_of_charge().value, 337 | energy: battery.energy().value, 338 | energy_full: battery.energy_full().value, 339 | energy_full_design: battery.energy_full_design().value, 340 | energy_rate: battery.energy_rate().value, 341 | voltage: battery.voltage().value, 342 | state_of_health: battery.state_of_health().value, 343 | state: battery.state().into(), 344 | technology: battery.technology().into(), 345 | temperature_kelvin: temp_kelvin, 346 | temperature_celsius: temp_celsius, 347 | temperature_fahrenheit: temp_fahrenheit, 348 | cycle_count: battery.cycle_count(), 349 | vendor: battery.vendor().map(|vendor| vendor.to_string()), 350 | model: battery.model().map(|model| model.to_string()), 351 | serial_number: battery 352 | .serial_number() 353 | .map(|serial_number| serial_number.to_string()), 354 | time_to_full: battery.time_to_full().map(|time| time.value), 355 | time_to_empty: battery.time_to_empty().map(|time| time.value), 356 | } 357 | } 358 | } 359 | 360 | #[derive(Debug, Serialize, Deserialize)] 361 | pub struct LoadAverage { 362 | pub one: f64, 363 | pub five: f64, 364 | pub fifteen: f64, 365 | } 366 | 367 | impl From for LoadAverage { 368 | fn from(value: sysinfo::LoadAvg) -> Self { 369 | LoadAverage { 370 | one: value.one, 371 | five: value.five, 372 | fifteen: value.fifteen, 373 | } 374 | } 375 | } 376 | -------------------------------------------------------------------------------- /src/model/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod aggregate; 2 | pub mod common; 3 | 4 | pub use aggregate::*; 5 | pub use common::*; 6 | -------------------------------------------------------------------------------- /src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod sysinfo; 2 | 3 | pub use self::sysinfo::*; 4 | -------------------------------------------------------------------------------- /src/utils/sysinfo.rs: -------------------------------------------------------------------------------- 1 | use crate::model::{Battery, Component, Cpu, Disk, Network, Process}; 2 | use std::sync::Mutex; 3 | use sysinfo::{ 4 | Components, CpuRefreshKind, Disks, LoadAvg, Networks, Pid, ProcessRefreshKind, RefreshKind, 5 | System, 6 | }; 7 | 8 | pub fn get_sys() -> System { 9 | System::new_all() 10 | } 11 | pub struct SysInfoState { 12 | pub sysinfo: Mutex, 13 | } 14 | /// A Mute Wrapper for sysinfo crate's System struct 15 | pub struct SysInfo { 16 | pub sys: System, 17 | } 18 | 19 | impl Default for SysInfoState { 20 | fn default() -> SysInfoState { 21 | SysInfoState { 22 | sysinfo: Mutex::new(SysInfo { 23 | sys: System::new_all(), 24 | }), 25 | } 26 | } 27 | } 28 | 29 | /// Impl methods from sysinfo's System struct for convenience 30 | impl SysInfo { 31 | // refresh system info 32 | pub fn refresh_all(&mut self) { 33 | self.sys.refresh_all(); 34 | } 35 | pub fn refresh_memory(&mut self) { 36 | self.sys.refresh_memory(); 37 | } 38 | pub fn refresh_cpu(&mut self) { 39 | self.sys.refresh_cpu(); 40 | } 41 | pub fn refresh_processes(&mut self) { 42 | self.sys.refresh_processes(); 43 | } 44 | pub fn refresh_process(&mut self, pid: Pid) { 45 | self.sys.refresh_process(pid); 46 | } 47 | pub fn refresh_specifics(&mut self, refreshes: RefreshKind) { 48 | self.sys.refresh_specifics(refreshes); 49 | } 50 | pub fn refresh_cpu_specifics(&mut self, refresh_kind: CpuRefreshKind) { 51 | self.sys.refresh_cpu_specifics(refresh_kind); 52 | } 53 | pub fn refresh_processes_specifics(&mut self, refresh_kind: ProcessRefreshKind) { 54 | self.sys.refresh_processes_specifics(refresh_kind); 55 | } 56 | pub fn refresh_process_specifics(&mut self, pid: Pid, refresh_kind: ProcessRefreshKind) { 57 | self.sys.refresh_process_specifics(pid, refresh_kind); 58 | } 59 | 60 | // static info 61 | pub fn hostname(&self) -> Option { 62 | System::host_name() 63 | } 64 | pub fn kernel_version(&self) -> Option { 65 | System::kernel_version() 66 | } 67 | pub fn os_version(&self) -> Option { 68 | System::os_version() 69 | } 70 | pub fn name(&self) -> Option { 71 | System::name() 72 | } 73 | 74 | // memory 75 | pub fn total_memory(&mut self) -> u64 { 76 | self.refresh_memory(); 77 | self.sys.total_memory() 78 | } 79 | pub fn used_memory(&mut self) -> u64 { 80 | self.refresh_memory(); 81 | self.sys.used_memory() 82 | } 83 | pub fn total_swap(&mut self) -> u64 { 84 | self.refresh_memory(); 85 | self.sys.total_swap() 86 | } 87 | pub fn used_swap(&mut self) -> u64 { 88 | self.refresh_memory(); 89 | self.sys.used_swap() 90 | } 91 | 92 | // cpu 93 | pub fn cpus(&self) -> Vec { 94 | self.sys.cpus().iter().map(|cpu| cpu.into()).collect() 95 | } 96 | 97 | pub fn cpu_count(&self) -> usize { 98 | self.sys.cpus().len() 99 | } 100 | 101 | // disks 102 | pub fn disks(&mut self) -> Vec { 103 | let disks = Disks::new_with_refreshed_list(); 104 | disks.iter().map(|disk| disk.into()).collect() 105 | } 106 | 107 | // other 108 | pub fn networks(&self) -> Vec { 109 | let networks = Networks::new_with_refreshed_list(); 110 | networks 111 | .into_iter() 112 | .map(|(name, data)| Network::new(name, data)) 113 | .collect() 114 | } 115 | pub fn components(&self) -> Vec { 116 | let components = Components::new_with_refreshed_list(); 117 | components 118 | .iter() 119 | .map(|component| component.into()) 120 | .collect() 121 | } 122 | pub fn processes(&self) -> Vec { 123 | self.sys 124 | .processes() 125 | .iter() 126 | .map(|(_, process)| process.into()) 127 | .collect() 128 | } 129 | pub fn batteries(&self) -> Result, starship_battery::Error> { 130 | let manager = starship_battery::Manager::new()?; 131 | Ok(manager 132 | .batteries()? 133 | .filter_map(|maybe_battery| match maybe_battery { 134 | Ok(battery) => Some(battery.into()), 135 | Err(_) => None, 136 | }) 137 | .collect()) 138 | } 139 | 140 | pub fn uptime(&self) -> u64 { 141 | System::uptime() 142 | } 143 | 144 | pub fn load_average(&self) -> LoadAvg { 145 | System::load_average() 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2021", 4 | "module": "esnext", 5 | "moduleResolution": "bundler", 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noUnusedLocals": true, 9 | "noImplicitAny": true, 10 | "noEmit": true, 11 | "declaration": true, 12 | "declarationMap": true, 13 | "outDir": "dist-js", 14 | }, 15 | "include": ["guest-js/*.ts"], 16 | "exclude": ["dist-js", "node_modules"] 17 | } 18 | --------------------------------------------------------------------------------