dev-store #1

Merged
purp1e merged 16 commits from dev-store into master 2025-03-13 00:54:31 +08:00
64 changed files with 2374 additions and 6717 deletions

View File

@@ -7,13 +7,22 @@
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
"project": [
"./tsconfig.json"
]
},
"plugins": ["@typescript-eslint"],
"plugins": [
"@typescript-eslint"
],
"rules": {
"eqeqeq": "error",
"no-else-return": "error",
"no-implicit-coercion": ["error", { "disallowTemplateShorthand": true }],
"no-implicit-coercion": [
"error",
{
"disallowTemplateShorthand": true
}
],
"no-unneeded-ternary": "error",
"no-useless-call": "error",
"no-useless-computed-key": "error",
@@ -23,7 +32,10 @@
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"radix": ["error", "always"],
"radix": [
"error",
"always"
],
"react-hooks/exhaustive-deps": "error",
"@typescript-eslint/no-misused-promises": [
"error",
@@ -31,9 +43,12 @@
"checksVoidReturn": false
}
],
"@typescript-eslint/no-confusing-void-expression":"off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off"
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/no-unsafe-member-access": "warn",
"jsx-a11y/click-events-have-key-events": "off"
}
}
}

View File

@@ -1,28 +0,0 @@
version: 2
updates:
# Enable version updates for Node.js dependencies
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-type: "all"
groups:
all:
patterns:
- "*"
ignore:
- dependency-name: "eslint"
versions: ">= 9"
# Enable version updates for rust
- package-ecosystem: "cargo"
directory: "/src-tauri"
schedule:
interval: "weekly"
allow:
- dependency-type: "all"
groups:
all:
patterns:
- "*"

View File

@@ -1,34 +0,0 @@
# Automatically squashes and merges Dependabot dependency upgrades if tests pass
name: Dependabot Auto-merge
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Fetch Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.3.3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve Dependabot PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto-merge (squash) Dependabot PR
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,46 +0,0 @@
# Installs Node.js dependencies and pnpm, and checks formatting + linting
name: Lint Node.js
on:
push:
branches:
- main
pull_request:
paths-ignore:
- "src-tauri/**"
- "README.md"
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Disable git core.autocrlf on Windows
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout repository code
uses: actions/checkout@v4
- name: Set up pnpm package manager
uses: pnpm/action-setup@v4
with:
version: latest
- name: Set up Node.js v22
uses: actions/setup-node@v3
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies from lockfile
run: pnpm install --frozen-lockfile
- name: Run lint step
run: pnpm lint

View File

@@ -1,55 +0,0 @@
# Installs Rust and checks formatting + linting
name: Lint Rust
on:
push:
branches:
- main
pull_request:
paths-ignore:
- "src/**"
- "package.json"
- "package-lock.json"
- "yarn.lock"
- "pnpm-lock.yaml"
- "README.md"
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Disable git core.autocrlf on Windows
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout repository code
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt install libdbus-1-dev libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- name: Create empty 'out' directory
run: mkdir out
- name: Run rustfmt check
run: cargo fmt --all -- --check
working-directory: src-tauri
- name: Run clippy check and deny warnings
run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: src-tauri

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
public-hoist-pattern[]=*@heroui/*

6
.vscode/tasks.json vendored
View File

@@ -6,7 +6,7 @@
{
"label": "Dev Tauri",
"type": "shell",
"command": "pnpm tauri dev",
"command": "bun tauri dev",
"problemMatcher": [
"$vite"
],
@@ -14,7 +14,7 @@
{
"label": "Build Tauri to nsis installer",
"type": "shell",
"command": "pnpm tauri build -b nsis",
"command": "bun tauri build -b nsis",
"problemMatcher": [
"$vite"
],
@@ -22,7 +22,7 @@
{
"label": "Build Tauri",
"type": "shell",
"command": "pnpm tauri build",
"command": "bun tauri build",
"problemMatcher": [
"$vite"
],

View File

@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
@@ -18,7 +18,7 @@
"formatter": {
"semicolons": "asNeeded",
"lineEnding": "lf",
"trailingComma": "all"
"trailingCommas": "all"
}
}
}

BIN
bun.lockb Executable file

Binary file not shown.

2
next-env.d.ts vendored
View File

@@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -1,11 +1,12 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
unoptimized: true,
},
output: "export",
devIndicators: false
}
module.exports = nextConfig

View File

@@ -7,63 +7,68 @@
"email": "zx8244@qq.com"
},
"scripts": {
"next-start": "cross-env BROWSER=none next dev",
"next-start": "cross-env BROWSER=none next dev --turbo",
"next-build": "next build",
"tauri": "tauri",
"build": "tauri build",
"dev": "tauri dev",
"lint": "next lint && biome check src/",
"fix": "next lint --fix && biome check src/ --write",
"prepare": "husky"
},
"dependencies": {
"@heroui/react": "^2.7.5",
"@icon-park/react": "^1.4.2",
"@reactuses/core": "^5.0.22",
"@tauri-apps/api": "2.0.0-rc.5",
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.2",
"@tauri-apps/plugin-dialog": "2.0.0-rc.1",
"@tauri-apps/plugin-fs": "2.0.0-rc.2",
"@tauri-apps/plugin-global-shortcut": "2.0.0-rc.1",
"@tauri-apps/plugin-http": "2.0.0-rc.2",
"@tauri-apps/plugin-notification": "2.0.0-rc.1",
"@tauri-apps/plugin-os": "2.0.0-rc.1",
"@tauri-apps/plugin-process": "2.0.0-rc.1",
"@tauri-apps/plugin-shell": "2.0.0-rc.1",
"@tauri-apps/plugin-store": "^2.1.0",
"@reactuses/core": "6.0.1",
"@tauri-apps/api": "2.1.0",
"@tauri-apps/plugin-clipboard-manager": "2.0.0",
"@tauri-apps/plugin-dialog": "~2.2.0",
"@tauri-apps/plugin-fs": "2.0.0",
"@tauri-apps/plugin-global-shortcut": "2.0.0",
"@tauri-apps/plugin-http": "2.0.1",
"@tauri-apps/plugin-notification": "2.0.0",
"@tauri-apps/plugin-os": "2.0.0",
"@tauri-apps/plugin-process": "2.0.0",
"@tauri-apps/plugin-shell": "2.0.1",
"@tauri-apps/plugin-store": "^2.2.0",
"@types/throttle-debounce": "^5.0.2",
"jotai": "^2.10.1",
"next": "^14.2.16",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"framer-motion": "^12.5.0",
"jotai": "^2.12.2",
"next": "15.2.0",
"next-themes": "^0.4.6",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tauri-plugin-valtio": "1.1.1",
"throttle-debounce": "^5.0.2",
"zustand": "5.0.0-rc.2"
"zustand": "5.0.1"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@tauri-apps/cli": "2.0.0-rc.16",
"@tauri-apps/cli": "^2.3.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/jest": "^29.5.14",
"@types/node": "^22.8.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"autoprefixer": "^10.4.20",
"@types/node": "^22.13.10",
"@types/react": "19.0.10",
"@types/react-dom": "19.0.4",
"@typescript-eslint/eslint-plugin": "^8.26.1",
"@typescript-eslint/parser": "^8.26.1",
"autoprefixer": "^10.4.21",
"clsx": "^2.1.1",
"cross-env": "^7.0.3",
"cssnano": "^7.0.6",
"eslint": "^8.57.1",
"eslint-config-next": "^14.2.16",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"postcss": "^8.4.47",
"eslint": "9.14.0",
"eslint-config-next": "15.0.3",
"husky": "^9.1.7",
"lint-staged": "^15.4.3",
"postcss": "^8.5.3",
"postcss-import": "^16.1.0",
"postcss-nesting": "^13.0.1",
"tailwind-merge": "^2.5.4",
"tailwindcss": "^3.4.14",
"typescript": "^5.6.3"
"tailwind-merge": "3.0.2",
"tailwindcss": "3.4.17",
"typescript": "^5.8.2"
},
"browserslist": {
"production": [

5109
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

1604
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,26 +12,27 @@ rust-version = "1.66"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "2.0.0-rc", features = [] }
tauri-build = { version = "2.0.3", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-rc", features = [ "macos-private-api",
serde_json = "1.0.140"
serde = { version = "1.0.219", features = ["derive"] }
tauri = { version = "2.3.1", features = [ "macos-private-api",
"tray-icon"
] }
window-vibrancy = "0.5.2"
tauri-plugin-process = "2.0.0-rc"
tauri-plugin-fs = "2.0.0-rc"
tauri-plugin-dialog = "2.0.0-rc"
tauri-plugin-os = "2.0.0-rc"
tauri-plugin-clipboard-manager = "2.0.0-alpha.2"
tauri-plugin-shell = "2.0.0-rc"
tauri-plugin-http = "2.0.0-rc"
tauri-plugin-notification = "2.0.0-rc"
tauri-plugin-store = "2.0.0-rc"
window-vibrancy = "0.6.0"
tauri-plugin-process = "2.2.0"
tauri-plugin-fs = "2.2.0"
tauri-plugin-dialog = "2.2.0"
tauri-plugin-os = "2.2.1"
tauri-plugin-clipboard-manager = "2.2.2"
tauri-plugin-shell = "2.2.0"
tauri-plugin-http = "2.4.0"
tauri-plugin-notification = "2.2.2"
tauri-plugin-valtio = "1.1.1"
tauri-plugin-store = "2.2.0"
[target.'cfg(windows)'.dependencies] # Windows Only
winreg = "0.52.0"
winreg = "0.55.0"
[features]
# by default Tauri runs in production mode
@@ -42,4 +43,4 @@ default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-global-shortcut = "2.0.0-rc"
tauri-plugin-global-shortcut = "2.2.0"

View File

@@ -8,8 +8,9 @@
"windows": ["main"],
"permissions": [
"global-shortcut:default",
"store:default",
"store:allow-set",
"store:allow-get",
"store:allow-get-store",
"store:allow-has",
"store:allow-delete",
"store:allow-clear",

View File

@@ -0,0 +1,10 @@
{
"identifier": "valtio",
"windows": [
"*"
],
"permissions": [
"valtio:default",
"core:event:default"
]
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:allow-set","store:allow-get","store:allow-has","store:allow-delete","store:allow-clear","store:allow-values","store:allow-save","store:allow-load","store:allow-reset","store:allow-entries"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]}}
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:default","store:allow-set","store:allow-get-store","store:allow-has","store:allow-delete","store:allow-clear","store:allow-values","store:allow-save","store:allow-load","store:allow-reset","store:allow-entries"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]},"valtio":{"identifier":"valtio","description":"","local":true,"windows":["*"],"permissions":["valtio:default","core:event:default"]}}

View File

@@ -84,7 +84,7 @@
}
},
"permissions": {
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ```",
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionEntry"
@@ -140,7 +140,7 @@
"identifier": {
"anyOf": [
{
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n",
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n#### Included permissions within this default permission set:\n",
"type": "string",
"const": "fs:default"
},
@@ -984,6 +984,11 @@
"type": "string",
"const": "fs:allow-seek"
},
{
"description": "Enables the size command without any pre-configured scope.",
"type": "string",
"const": "fs:allow-size"
},
{
"description": "Enables the stat command without any pre-configured scope.",
"type": "string",
@@ -1109,6 +1114,11 @@
"type": "string",
"const": "fs:deny-seek"
},
{
"description": "Denies the size command without any pre-configured scope.",
"type": "string",
"const": "fs:deny-size"
},
{
"description": "Denies the stat command without any pre-configured scope.",
"type": "string",
@@ -1581,7 +1591,7 @@
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs. FS scope path pattern.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
{
@@ -1591,7 +1601,7 @@
],
"properties": {
"path": {
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
}
}
@@ -1605,7 +1615,7 @@
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs. FS scope path pattern.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
{
@@ -1615,7 +1625,7 @@
],
"properties": {
"path": {
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
}
}
@@ -2719,6 +2729,11 @@
"type": "string",
"const": "core:webview:allow-reparent"
},
{
"description": "Enables the set_webview_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-set-webview-background-color"
},
{
"description": "Enables the set_webview_focus command without any pre-configured scope.",
"type": "string",
@@ -2799,6 +2814,11 @@
"type": "string",
"const": "core:webview:deny-reparent"
},
{
"description": "Denies the set_webview_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-set-webview-background-color"
},
{
"description": "Denies the set_webview_focus command without any pre-configured scope.",
"type": "string",
@@ -3014,6 +3034,21 @@
"type": "string",
"const": "core:window:allow-set-always-on-top"
},
{
"description": "Enables the set_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-background-color"
},
{
"description": "Enables the set_badge_count command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-badge-count"
},
{
"description": "Enables the set_badge_label command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-badge-label"
},
{
"description": "Enables the set_closable command without any pre-configured scope.",
"type": "string",
@@ -3099,6 +3134,11 @@
"type": "string",
"const": "core:window:allow-set-minimizable"
},
{
"description": "Enables the set_overlay_icon command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-overlay-icon"
},
{
"description": "Enables the set_position command without any pre-configured scope.",
"type": "string",
@@ -3359,6 +3399,21 @@
"type": "string",
"const": "core:window:deny-set-always-on-top"
},
{
"description": "Denies the set_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-background-color"
},
{
"description": "Denies the set_badge_count command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-badge-count"
},
{
"description": "Denies the set_badge_label command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-badge-label"
},
{
"description": "Denies the set_closable command without any pre-configured scope.",
"type": "string",
@@ -3444,6 +3499,11 @@
"type": "string",
"const": "core:window:deny-set-minimizable"
},
{
"description": "Denies the set_overlay_icon command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-overlay-icon"
},
{
"description": "Denies the set_position command without any pre-configured scope.",
"type": "string",
@@ -3595,7 +3655,7 @@
"const": "dialog:deny-save"
},
{
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n",
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n#### Included permissions within this default permission set:\n",
"type": "string",
"const": "fs:default"
},
@@ -4439,6 +4499,11 @@
"type": "string",
"const": "fs:allow-seek"
},
{
"description": "Enables the size command without any pre-configured scope.",
"type": "string",
"const": "fs:allow-size"
},
{
"description": "Enables the stat command without any pre-configured scope.",
"type": "string",
@@ -4564,6 +4629,11 @@
"type": "string",
"const": "fs:deny-seek"
},
{
"description": "Denies the size command without any pre-configured scope.",
"type": "string",
"const": "fs:deny-size"
},
{
"description": "Denies the stat command without any pre-configured scope.",
"type": "string",
@@ -5598,6 +5668,211 @@
"description": "Denies the values command without any pre-configured scope.",
"type": "string",
"const": "store:deny-values"
},
{
"description": "Default permissions for tauri-plugin-valtio.",
"type": "string",
"const": "valtio:default"
},
{
"description": "Enables the clear_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-clear-autosave"
},
{
"description": "Enables the get_default_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-default-save-strategy"
},
{
"description": "Enables the get_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-save-strategy"
},
{
"description": "Enables the get_store_ids command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-ids"
},
{
"description": "Enables the get_store_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-path"
},
{
"description": "Enables the get_store_state command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-state"
},
{
"description": "Enables the get_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-valtio-path"
},
{
"description": "Enables the load command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-load"
},
{
"description": "Enables the patch command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-patch"
},
{
"description": "Enables the save command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save"
},
{
"description": "Enables the save_all command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-all"
},
{
"description": "Enables the save_all_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-all-now"
},
{
"description": "Enables the save_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-now"
},
{
"description": "Enables the save_some command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-some"
},
{
"description": "Enables the save_some_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-some-now"
},
{
"description": "Enables the set_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-autosave"
},
{
"description": "Enables the set_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-save-strategy"
},
{
"description": "Enables the set_store_options command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-store-options"
},
{
"description": "Enables the set_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-valtio-path"
},
{
"description": "Enables the unload command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-unload"
},
{
"description": "Denies the clear_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-clear-autosave"
},
{
"description": "Denies the get_default_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-default-save-strategy"
},
{
"description": "Denies the get_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-save-strategy"
},
{
"description": "Denies the get_store_ids command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-ids"
},
{
"description": "Denies the get_store_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-path"
},
{
"description": "Denies the get_store_state command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-state"
},
{
"description": "Denies the get_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-valtio-path"
},
{
"description": "Denies the load command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-load"
},
{
"description": "Denies the patch command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-patch"
},
{
"description": "Denies the save command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save"
},
{
"description": "Denies the save_all command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-all"
},
{
"description": "Denies the save_all_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-all-now"
},
{
"description": "Denies the save_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-now"
},
{
"description": "Denies the save_some command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-some"
},
{
"description": "Denies the save_some_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-some-now"
},
{
"description": "Denies the set_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-autosave"
},
{
"description": "Denies the set_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-save-strategy"
},
{
"description": "Denies the set_store_options command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-store-options"
},
{
"description": "Denies the set_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-valtio-path"
},
{
"description": "Denies the unload command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-unload"
}
]
},

View File

@@ -84,7 +84,7 @@
}
},
"permissions": {
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ```",
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionEntry"
@@ -5598,6 +5598,211 @@
"description": "Denies the values command without any pre-configured scope.",
"type": "string",
"const": "store:deny-values"
},
{
"description": "Default permissions for tauri-plugin-valtio.",
"type": "string",
"const": "valtio:default"
},
{
"description": "Enables the clear_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-clear-autosave"
},
{
"description": "Enables the get_default_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-default-save-strategy"
},
{
"description": "Enables the get_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-save-strategy"
},
{
"description": "Enables the get_store_ids command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-ids"
},
{
"description": "Enables the get_store_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-path"
},
{
"description": "Enables the get_store_state command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-state"
},
{
"description": "Enables the get_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-valtio-path"
},
{
"description": "Enables the load command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-load"
},
{
"description": "Enables the patch command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-patch"
},
{
"description": "Enables the save command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save"
},
{
"description": "Enables the save_all command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-all"
},
{
"description": "Enables the save_all_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-all-now"
},
{
"description": "Enables the save_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-now"
},
{
"description": "Enables the save_some command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-some"
},
{
"description": "Enables the save_some_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-some-now"
},
{
"description": "Enables the set_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-autosave"
},
{
"description": "Enables the set_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-save-strategy"
},
{
"description": "Enables the set_store_options command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-store-options"
},
{
"description": "Enables the set_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-valtio-path"
},
{
"description": "Enables the unload command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-unload"
},
{
"description": "Denies the clear_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-clear-autosave"
},
{
"description": "Denies the get_default_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-default-save-strategy"
},
{
"description": "Denies the get_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-save-strategy"
},
{
"description": "Denies the get_store_ids command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-ids"
},
{
"description": "Denies the get_store_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-path"
},
{
"description": "Denies the get_store_state command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-state"
},
{
"description": "Denies the get_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-valtio-path"
},
{
"description": "Denies the load command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-load"
},
{
"description": "Denies the patch command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-patch"
},
{
"description": "Denies the save command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save"
},
{
"description": "Denies the save_all command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-all"
},
{
"description": "Denies the save_all_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-all-now"
},
{
"description": "Denies the save_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-now"
},
{
"description": "Denies the save_some command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-some"
},
{
"description": "Denies the save_some_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-some-now"
},
{
"description": "Denies the set_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-autosave"
},
{
"description": "Denies the set_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-save-strategy"
},
{
"description": "Denies the set_store_options command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-store-options"
},
{
"description": "Denies the set_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-valtio-path"
},
{
"description": "Denies the unload command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-unload"
}
]
},

View File

@@ -37,7 +37,7 @@
],
"definitions": {
"Capability": {
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, \"platforms\": [\"macOS\",\"windows\"] } ```",
"description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows fine grained access to the Tauri core, application, or plugin commands. If a window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
"type": "object",
"required": [
"identifier",
@@ -84,7 +84,7 @@
}
},
"permissions": {
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ```",
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
"type": "array",
"items": {
"$ref": "#/definitions/PermissionEntry"
@@ -140,7 +140,7 @@
"identifier": {
"anyOf": [
{
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n",
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n#### Included permissions within this default permission set:\n",
"type": "string",
"const": "fs:default"
},
@@ -984,6 +984,11 @@
"type": "string",
"const": "fs:allow-seek"
},
{
"description": "Enables the size command without any pre-configured scope.",
"type": "string",
"const": "fs:allow-size"
},
{
"description": "Enables the stat command without any pre-configured scope.",
"type": "string",
@@ -1109,6 +1114,11 @@
"type": "string",
"const": "fs:deny-seek"
},
{
"description": "Denies the size command without any pre-configured scope.",
"type": "string",
"const": "fs:deny-size"
},
{
"description": "Denies the stat command without any pre-configured scope.",
"type": "string",
@@ -1581,7 +1591,7 @@
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs. FS scope path pattern.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
{
@@ -1591,7 +1601,7 @@
],
"properties": {
"path": {
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
}
}
@@ -1605,7 +1615,7 @@
"description": "FS scope entry.",
"anyOf": [
{
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs. FS scope path pattern.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
{
@@ -1615,7 +1625,7 @@
],
"properties": {
"path": {
"description": "FS scope path.",
"description": "A path that can be accessed by the webview when using the fs APIs.\n\nThe pattern can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
}
}
@@ -1821,72 +1831,122 @@
"properties": {
"allow": {
"items": {
"title": "Entry",
"description": "A command allowed to be executed by the webview API.",
"type": "object",
"required": [
"args",
"cmd",
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellAllowedArgs"
"title": "ShellScopeEntry",
"description": "Shell scope entry.",
"anyOf": [
{
"type": "object",
"required": [
"cmd",
"name"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
}
]
},
"additionalProperties": false
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
{
"type": "object",
"required": [
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
}
},
"additionalProperties": false
}
}
]
}
},
"deny": {
"items": {
"title": "Entry",
"description": "A command allowed to be executed by the webview API.",
"type": "object",
"required": [
"args",
"cmd",
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellAllowedArgs"
"title": "ShellScopeEntry",
"description": "Shell scope entry.",
"anyOf": [
{
"type": "object",
"required": [
"cmd",
"name"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
}
]
},
"additionalProperties": false
},
"cmd": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
{
"type": "object",
"required": [
"name",
"sidecar"
],
"properties": {
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
{
"$ref": "#/definitions/ShellScopeEntryAllowedArgs"
}
]
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
}
},
"additionalProperties": false
}
}
]
}
}
}
@@ -2039,6 +2099,11 @@
"type": "string",
"const": "core:app:allow-name"
},
{
"description": "Enables the set_app_theme command without any pre-configured scope.",
"type": "string",
"const": "core:app:allow-set-app-theme"
},
{
"description": "Enables the tauri_version command without any pre-configured scope.",
"type": "string",
@@ -2069,6 +2134,11 @@
"type": "string",
"const": "core:app:deny-name"
},
{
"description": "Denies the set_app_theme command without any pre-configured scope.",
"type": "string",
"const": "core:app:deny-set-app-theme"
},
{
"description": "Denies the tauri_version command without any pre-configured scope.",
"type": "string",
@@ -2624,6 +2694,11 @@
"type": "string",
"const": "core:webview:default"
},
{
"description": "Enables the clear_all_browsing_data command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-clear-all-browsing-data"
},
{
"description": "Enables the create_webview command without any pre-configured scope.",
"type": "string",
@@ -2654,6 +2729,11 @@
"type": "string",
"const": "core:webview:allow-reparent"
},
{
"description": "Enables the set_webview_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-set-webview-background-color"
},
{
"description": "Enables the set_webview_focus command without any pre-configured scope.",
"type": "string",
@@ -2679,16 +2759,31 @@
"type": "string",
"const": "core:webview:allow-webview-close"
},
{
"description": "Enables the webview_hide command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-webview-hide"
},
{
"description": "Enables the webview_position command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-webview-position"
},
{
"description": "Enables the webview_show command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-webview-show"
},
{
"description": "Enables the webview_size command without any pre-configured scope.",
"type": "string",
"const": "core:webview:allow-webview-size"
},
{
"description": "Denies the clear_all_browsing_data command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-clear-all-browsing-data"
},
{
"description": "Denies the create_webview command without any pre-configured scope.",
"type": "string",
@@ -2719,6 +2814,11 @@
"type": "string",
"const": "core:webview:deny-reparent"
},
{
"description": "Denies the set_webview_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-set-webview-background-color"
},
{
"description": "Denies the set_webview_focus command without any pre-configured scope.",
"type": "string",
@@ -2744,11 +2844,21 @@
"type": "string",
"const": "core:webview:deny-webview-close"
},
{
"description": "Denies the webview_hide command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-webview-hide"
},
{
"description": "Denies the webview_position command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-webview-position"
},
{
"description": "Denies the webview_show command without any pre-configured scope.",
"type": "string",
"const": "core:webview:deny-webview-show"
},
{
"description": "Denies the webview_size command without any pre-configured scope.",
"type": "string",
@@ -2829,6 +2939,11 @@
"type": "string",
"const": "core:window:allow-is-decorated"
},
{
"description": "Enables the is_enabled command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-is-enabled"
},
{
"description": "Enables the is_focused command without any pre-configured scope.",
"type": "string",
@@ -2919,6 +3034,21 @@
"type": "string",
"const": "core:window:allow-set-always-on-top"
},
{
"description": "Enables the set_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-background-color"
},
{
"description": "Enables the set_badge_count command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-badge-count"
},
{
"description": "Enables the set_badge_label command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-badge-label"
},
{
"description": "Enables the set_closable command without any pre-configured scope.",
"type": "string",
@@ -2959,6 +3089,11 @@
"type": "string",
"const": "core:window:allow-set-effects"
},
{
"description": "Enables the set_enabled command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-enabled"
},
{
"description": "Enables the set_focus command without any pre-configured scope.",
"type": "string",
@@ -2999,6 +3134,11 @@
"type": "string",
"const": "core:window:allow-set-minimizable"
},
{
"description": "Enables the set_overlay_icon command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-overlay-icon"
},
{
"description": "Enables the set_position command without any pre-configured scope.",
"type": "string",
@@ -3034,6 +3174,11 @@
"type": "string",
"const": "core:window:allow-set-skip-taskbar"
},
{
"description": "Enables the set_theme command without any pre-configured scope.",
"type": "string",
"const": "core:window:allow-set-theme"
},
{
"description": "Enables the set_title command without any pre-configured scope.",
"type": "string",
@@ -3159,6 +3304,11 @@
"type": "string",
"const": "core:window:deny-is-decorated"
},
{
"description": "Denies the is_enabled command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-is-enabled"
},
{
"description": "Denies the is_focused command without any pre-configured scope.",
"type": "string",
@@ -3249,6 +3399,21 @@
"type": "string",
"const": "core:window:deny-set-always-on-top"
},
{
"description": "Denies the set_background_color command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-background-color"
},
{
"description": "Denies the set_badge_count command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-badge-count"
},
{
"description": "Denies the set_badge_label command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-badge-label"
},
{
"description": "Denies the set_closable command without any pre-configured scope.",
"type": "string",
@@ -3289,6 +3454,11 @@
"type": "string",
"const": "core:window:deny-set-effects"
},
{
"description": "Denies the set_enabled command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-enabled"
},
{
"description": "Denies the set_focus command without any pre-configured scope.",
"type": "string",
@@ -3329,6 +3499,11 @@
"type": "string",
"const": "core:window:deny-set-minimizable"
},
{
"description": "Denies the set_overlay_icon command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-overlay-icon"
},
{
"description": "Denies the set_position command without any pre-configured scope.",
"type": "string",
@@ -3364,6 +3539,11 @@
"type": "string",
"const": "core:window:deny-set-skip-taskbar"
},
{
"description": "Denies the set_theme command without any pre-configured scope.",
"type": "string",
"const": "core:window:deny-set-theme"
},
{
"description": "Denies the set_title command without any pre-configured scope.",
"type": "string",
@@ -3475,7 +3655,7 @@
"const": "dialog:deny-save"
},
{
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n",
"description": "This set of permissions describes the what kind of\nfile system access the `fs` plugin has enabled or denied by default.\n\n#### Granted Permissions\n\nThis default permission set enables read access to the\napplication specific directories (AppConfig, AppData, AppLocalData, AppCache,\nAppLog) and all files and sub directories created in it.\nThe location of these directories depends on the operating system,\nwhere the application is run.\n\nIn general these directories need to be manually created\nby the application at runtime, before accessing files or folders\nin it is possible.\n\nTherefore, it is also allowed to create all of these folders via\nthe `mkdir` command.\n\n#### Denied Permissions\n\nThis default permission set prevents access to critical components\nof the Tauri application by default.\nOn Windows the webview data folder access is denied.\n\n#### Included permissions within this default permission set:\n",
"type": "string",
"const": "fs:default"
},
@@ -4319,6 +4499,11 @@
"type": "string",
"const": "fs:allow-seek"
},
{
"description": "Enables the size command without any pre-configured scope.",
"type": "string",
"const": "fs:allow-size"
},
{
"description": "Enables the stat command without any pre-configured scope.",
"type": "string",
@@ -4444,6 +4629,11 @@
"type": "string",
"const": "fs:deny-seek"
},
{
"description": "Denies the size command without any pre-configured scope.",
"type": "string",
"const": "fs:deny-size"
},
{
"description": "Denies the stat command without any pre-configured scope.",
"type": "string",
@@ -5359,6 +5549,11 @@
"type": "string",
"const": "store:allow-get"
},
{
"description": "Enables the get_store command without any pre-configured scope.",
"type": "string",
"const": "store:allow-get-store"
},
{
"description": "Enables the has command without any pre-configured scope.",
"type": "string",
@@ -5379,6 +5574,11 @@
"type": "string",
"const": "store:allow-load"
},
{
"description": "Enables the reload command without any pre-configured scope.",
"type": "string",
"const": "store:allow-reload"
},
{
"description": "Enables the reset command without any pre-configured scope.",
"type": "string",
@@ -5419,6 +5619,11 @@
"type": "string",
"const": "store:deny-get"
},
{
"description": "Denies the get_store command without any pre-configured scope.",
"type": "string",
"const": "store:deny-get-store"
},
{
"description": "Denies the has command without any pre-configured scope.",
"type": "string",
@@ -5439,6 +5644,11 @@
"type": "string",
"const": "store:deny-load"
},
{
"description": "Denies the reload command without any pre-configured scope.",
"type": "string",
"const": "store:deny-reload"
},
{
"description": "Denies the reset command without any pre-configured scope.",
"type": "string",
@@ -5458,6 +5668,211 @@
"description": "Denies the values command without any pre-configured scope.",
"type": "string",
"const": "store:deny-values"
},
{
"description": "Default permissions for tauri-plugin-valtio.",
"type": "string",
"const": "valtio:default"
},
{
"description": "Enables the clear_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-clear-autosave"
},
{
"description": "Enables the get_default_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-default-save-strategy"
},
{
"description": "Enables the get_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-save-strategy"
},
{
"description": "Enables the get_store_ids command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-ids"
},
{
"description": "Enables the get_store_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-path"
},
{
"description": "Enables the get_store_state command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-store-state"
},
{
"description": "Enables the get_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-get-valtio-path"
},
{
"description": "Enables the load command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-load"
},
{
"description": "Enables the patch command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-patch"
},
{
"description": "Enables the save command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save"
},
{
"description": "Enables the save_all command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-all"
},
{
"description": "Enables the save_all_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-all-now"
},
{
"description": "Enables the save_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-now"
},
{
"description": "Enables the save_some command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-some"
},
{
"description": "Enables the save_some_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-save-some-now"
},
{
"description": "Enables the set_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-autosave"
},
{
"description": "Enables the set_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-save-strategy"
},
{
"description": "Enables the set_store_options command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-store-options"
},
{
"description": "Enables the set_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-set-valtio-path"
},
{
"description": "Enables the unload command without any pre-configured scope.",
"type": "string",
"const": "valtio:allow-unload"
},
{
"description": "Denies the clear_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-clear-autosave"
},
{
"description": "Denies the get_default_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-default-save-strategy"
},
{
"description": "Denies the get_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-save-strategy"
},
{
"description": "Denies the get_store_ids command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-ids"
},
{
"description": "Denies the get_store_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-path"
},
{
"description": "Denies the get_store_state command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-store-state"
},
{
"description": "Denies the get_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-get-valtio-path"
},
{
"description": "Denies the load command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-load"
},
{
"description": "Denies the patch command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-patch"
},
{
"description": "Denies the save command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save"
},
{
"description": "Denies the save_all command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-all"
},
{
"description": "Denies the save_all_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-all-now"
},
{
"description": "Denies the save_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-now"
},
{
"description": "Denies the save_some command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-some"
},
{
"description": "Denies the save_some_now command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-save-some-now"
},
{
"description": "Denies the set_autosave command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-autosave"
},
{
"description": "Denies the set_save_strategy command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-save-strategy"
},
{
"description": "Denies the set_store_options command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-store-options"
},
{
"description": "Denies the set_valtio_path command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-set-valtio-path"
},
{
"description": "Denies the unload command without any pre-configured scope.",
"type": "string",
"const": "valtio:deny-unload"
}
]
},
@@ -5555,7 +5970,7 @@
}
]
},
"ShellAllowedArg": {
"ShellScopeEntryAllowedArg": {
"description": "A command argument allowed to be executed by the webview API.",
"anyOf": [
{
@@ -5583,18 +5998,18 @@
}
]
},
"ShellAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"ShellScopeEntryAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.",
"description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellAllowedArg"
"$ref": "#/definitions/ShellScopeEntryAllowedArg"
}
}
]

View File

@@ -33,6 +33,7 @@ fn on_button_clicked() -> String {
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_valtio::init())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_http::init())
@@ -45,7 +46,6 @@ fn main() {
.plugin(tauri_plugin_dialog::init())
// .plugin(tauri_plugin_store::Builder::default().build())
// .plugin(tauri_plugin_updater::Builder::new().build())
.invoke_handler(tauri::generate_handler![on_button_clicked])
.setup(|app| {
// Tray
#[cfg(all(desktop))]

View File

@@ -12,6 +12,14 @@ pub fn launch_game(
launch_option: &str,
server: &str,
) -> Result<(), Box<dyn Error>> {
// 判断路径是否存在
if !std::path::Path::new("/etc/hosts").exists() {
return Err(Box::new(std::io::Error::new(
std::io::ErrorKind::NotFound,
"Steam path not found",
)));
}
let mut opt = launch_option.replace("\n", " ");
if server == "perfectworld" {

View File

@@ -1,8 +1,8 @@
{
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"beforeBuildCommand": "pnpm next-build",
"beforeDevCommand": "pnpm next-start",
"beforeBuildCommand": "bun next-build",
"beforeDevCommand": "bun next-start",
"frontendDist": "../out",
"devUrl": "http://localhost:3000"
},

View File

@@ -1,3 +1,3 @@
export default function Page() {
return <div>Console</div>;
return <div>Console</div>
}

View File

@@ -1,3 +1,3 @@
export default function Page() {
return <div>Gear</div>;
return <div>Gear</div>
}

View File

@@ -1,12 +1,12 @@
"use client";
"use client"
import CommonDir from "@/components/cstb/CommonDir";
import FastLaunch from "@/components/cstb/FastLaunch";
import ForceQuit from "@/components/cstb/ForceQuit";
import LaunchOption from "@/components/cstb/LaunchOption";
import Notice from "@/components/cstb/Notice";
import PowerPlan from "@/components/cstb/PowerPlan";
import SmartTransfer from "@/components/cstb/SmartTranser";
import CommonDir from "@/components/cstb/CommonDir"
import FastLaunch from "@/components/cstb/FastLaunch"
import ForceQuit from "@/components/cstb/ForceQuit"
import LaunchOption from "@/components/cstb/LaunchOption"
import Notice from "@/components/cstb/Notice"
import PowerPlan from "@/components/cstb/PowerPlan"
import SmartTransfer from "@/components/cstb/SmartTranser"
const Home = () => {
return (
@@ -25,7 +25,7 @@ const Home = () => {
<FastLaunch />
</div>
</section>
);
};
)
}
export default Home;
export default Home

View File

@@ -1,17 +1,17 @@
"use client"
import Header from "@/components/window/Header";
import Nav from "@/components/window/Nav";
import SideBar from "@/components/window/SideBar";
import clsx from "clsx";
import Header from "@/components/window/Header"
import Nav from "@/components/window/Nav"
import SideBar from "@/components/window/SideBar"
import { cn } from "@heroui/react"
// import { platform } from "@tauri-apps/plugin-os"
export default function BaseLayout({
children,
}: {
children: React.ReactNode;
children: React.ReactNode
}) {
return (
<div className="w-full h-full bg-transparent">
<div className="w-full h-full p-0 m-0 bg-transparent">
{/* bg-[#f1f0f2] */}
<Nav />
@@ -19,8 +19,8 @@ export default function BaseLayout({
<SideBar />
<main
className={clsx(
"flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden"
className={cn(
"flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden",
// platform() === "windows" ? "ml-20" : "ml-[4.25rem]"
)}
>

View File

@@ -1,3 +1,3 @@
export default function Page() {
return <div>Movie</div>;
return <div>Movie</div>
}

View File

@@ -1,8 +1,10 @@
"use client"
import useAppStore from "@/store/app"
import { appStore } from "@/store/app"
import { useSnapshot } from "valtio"
export default function Page() {
const app = useAppStore()
void appStore.start()
const app = useSnapshot(appStore.state)
return (
<div className="flex flex-col items-start gap-3 pt-2 pb-1">

View File

@@ -1,12 +1,26 @@
"use client"
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "@/components/window/Card"
import {
Card,
CardBody,
CardHeader,
CardIcon,
CardTool,
} from "@/components/window/Card"
import { ToolButton } from "@/components/window/ToolButton"
import { SettingConfig, UploadOne, HardDisk, AssemblyLine, Videocamera } from "@icon-park/react"
import clsx from "clsx"
import { cn } from "@heroui/react"
import {
AssemblyLine,
HardDisk,
SettingConfig,
UploadOne,
Videocamera,
} from "@icon-park/react"
import { usePathname, useRouter } from "next/navigation"
// import { platform } from "@tauri-apps/plugin-os"
export default function PreferenceLayout({ children }: { children: React.ReactNode }) {
export default function PreferenceLayout({
children,
}: { children: React.ReactNode }) {
const router = useRouter()
const pathname = usePathname()
@@ -16,21 +30,21 @@ export default function PreferenceLayout({ children }: { children: React.ReactNo
<CardIcon
type="menu"
onClick={() => router.push("/preference/general")}
className={clsx(pathname === "/preference/general" && "bg-white/60")}
className={cn(pathname === "/preference/general" && "bg-black/5")}
>
<SettingConfig />
</CardIcon>
<CardIcon
type="menu"
onClick={() => router.push("/preference/path")}
className={clsx(pathname === "/preference/path" && "bg-white/60")}
className={cn(pathname === "/preference/path" && "bg-black/5")}
>
<AssemblyLine />
</CardIcon>
<CardIcon
type="menu"
onClick={() => router.push("/preference/replay")}
className={clsx(pathname === "/preference/replay" && "bg-white/60")}
className={cn(pathname === "/preference/replay" && "bg-black/5")}
>
<Videocamera />
</CardIcon>

View File

@@ -1,8 +1,10 @@
"use client"
import SteamStore from "@/store/steam"
import { currentUser, steamStore } from "@/store/steam"
import { useSnapshot } from "valtio"
export default function Page() {
const steam = SteamStore()
void steamStore.start()
const steam = useSnapshot(steamStore.state)
return (
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
@@ -10,7 +12,7 @@ export default function Page() {
<p>{steam.csDir}</p>
<p>Steam路径有效{steam.isDirValid ? "是" : "否"}</p>
<p>{steam.isCsDirValid ? "是" : "否"}</p>
<p>Steam账号{steam.currentUser().accountName}</p>
<p>Steam账号{currentUser().accountName}</p>
</div>
)
}

View File

@@ -1,3 +1,3 @@
export default function Page() {
return <div>Tool</div>;
return <div>Tool</div>
}

View File

@@ -1,8 +0,0 @@
import "@/styles/globals.css"
import type { AppProps } from "next/app"
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export default MyApp

View File

@@ -8,10 +8,8 @@ body {
margin: 0;
width: 100%;
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu,
Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
/* background: transparent; */
background: rgba(242, 241, 243, 0.5);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
border-radius: 10px;
}

View File

@@ -1,10 +1,12 @@
export const metadata = {
title: "CS工具箱",
description: "Generated by Next.js",
icons: ["/favicon.ico"],
};
"use client"
// export const metadata = {
// title: "CS工具箱",
// description: "Generated by Next.js",
// icons: ["/favicon.ico"],
// }
import "./globals.css";
import "./globals.css"
import Providers from "./providers"
export default function RootLayout({
children,
@@ -13,7 +15,9 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body>{children}</body>
<body className="bg-[rgba(242, 241, 243, 0.65)] dark:bg-zinc-900">
<Providers>{children}</Providers>
</body>
</html>
)
}

View File

@@ -1,20 +1,46 @@
"use client";
"use client"
import { useRouter } from "next/navigation";
import { open } from "@tauri-apps/plugin-dialog"
import { useRouter } from "next/navigation"
import React from "react"
const Home = () => {
const router = useRouter();
const router = useRouter()
const [file, setFile] = React.useState<string | null>("")
const openFile = async () => {
const filePath = await open({
multiple: true,
directory: false,
})
setFile(filePath?.join("\n") || " ")
}
return (
<main
className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region
>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS </h1>
<button onClick={() => router.push("/home")} className="px-4 py-1 rounded bg-zinc-200">
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">
CS
</h1>
<button
type="button"
onClick={() => router.push("/home")}
className="px-4 py-1 rounded bg-zinc-200"
>
</button>
<button
type="button"
onClick={openFile}
className="px-4 py-1 text-white bg-blue-500 rounded"
>
</button>
<p className="text-center bg-zinc-50">{file}</p>
</main>
)
};
}
export default Home;
export default Home

View File

@@ -1,6 +1,8 @@
import Nav from "@/components/window/Nav"
export default function BaseLayout({ children }: { children: React.ReactNode }) {
export default function BaseLayout({
children,
}: { children: React.ReactNode }) {
return (
<div className="w-full h-full">
<Nav />

View File

@@ -1,25 +1,29 @@
"use client"
import useSteamStore from "@/store/steam"
import { currentUser, setCsDir, setDir, steamStore } from "@/store/steam"
import { useSnapshot } from "valtio"
export default function Page() {
const { dir, setDir, csDir, setCsDir, currentUser } = useSteamStore()
void steamStore.start()
const steam = useSnapshot(steamStore.state)
return (
<div
className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region
>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS工具箱</h1>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">
CS工具箱
</h1>
<p></p>
<div className="flex flex-col w-full gap-6 p-5 border rounded-lg bg-white/40">
<input
className="px-2 py-1 rounded-lg"
value={dir}
value={steam.dir}
onChange={(e) => setDir(e.target.value)}
/>
<input
className="px-2 py-1 rounded-lg"
value={csDir}
value={steam.csDir}
onChange={(e) => setCsDir(e.target.value)}
/>

15
src/app/providers.tsx Normal file
View File

@@ -0,0 +1,15 @@
"use client"
import { HeroUIProvider } from "@heroui/react"
import { ToastProvider } from "@heroui/toast"
import { ThemeProvider as NextThemesProvider } from "next-themes"
export default function Providers({ children }: { children: React.ReactNode }) {
return (
<HeroUIProvider className="h-full bg-transparent">
<NextThemesProvider attribute="class" defaultTheme="light">
<ToastProvider toastOffset={10} placement="top-center" />
{children}
</NextThemesProvider>
</HeroUIProvider>
)
}

View File

@@ -1,27 +1,27 @@
"use client"
import { CardButton } from "@/components/test/CardButton";
import { useGlobalShortcut } from "@/hooks/tauri/shortcuts";
import { invoke } from "@tauri-apps/api/core";
import { useCallback, useState } from "react";
import { CardButton } from "@/components/test/CardButton"
import { useGlobalShortcut } from "@/hooks/tauri/shortcuts"
import { invoke } from "@tauri-apps/api/core"
import { useCallback, useState } from "react"
export default function Page() {
const [buttonDesc, setButtonDesc] = useState<string>(
"Waiting to be clicked. This calls 'on_button_clicked' from Rust."
);
"Waiting to be clicked. This calls 'on_button_clicked' from Rust.",
)
const onButtonClick = () => {
invoke<string>("on_button_clicked")
.then((value) => {
setButtonDesc(value);
setButtonDesc(value)
})
.catch(() => {
setButtonDesc("Failed to invoke Rust command 'on_button_clicked'");
});
};
setButtonDesc("Failed to invoke Rust command 'on_button_clicked'")
})
}
const shortcutHandler = useCallback(() => {
console.log("Ctrl+P was pressed!");
}, []);
useGlobalShortcut("CommandOrControl+P", shortcutHandler);
console.log("Ctrl+P was pressed!")
}, [])
useGlobalShortcut("CommandOrControl+P", shortcutHandler)
return (
<div className="flex flex-col">
@@ -54,5 +54,5 @@ export default function Page() {
</div>
</main>
</div>
);
)
}

View File

@@ -1,17 +1,20 @@
import { FolderFocusOne } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardBody } from "../window/Card";
import { FolderFocusOne } from "@icon-park/react"
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
interface RoundedButtonProps {
children?: React.ReactNode;
children?: React.ReactNode
}
const RoundedButton = ({ children }: RoundedButtonProps) => {
return (
<button className="flex items-center justify-center px-3 py-1 transition rounded-full min-w-fit active:scale-95 hover:bg-black/10 text-zinc-700 bg-black/5">
<button
type="button"
className="flex items-center justify-center px-3 py-1 transition rounded-full min-w-fit active:scale-95 hover:bg-black/10 text-zinc-700 dark:text-zinc-100 bg-black/5"
>
{children}
</button>
);
};
)
}
const CommonDir = () => {
return (
@@ -33,7 +36,7 @@ const CommonDir = () => {
</div>
</CardBody>
</Card>
);
};
)
}
export default CommonDir;
export default CommonDir

View File

@@ -1,8 +1,17 @@
import { TakeOff } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardBody } from "../window/Card";
import { steamStore } from "@/store/steam"
import { toolStore } from "@/store/tool"
import { TakeOff } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core"
import { useSnapshot } from "valtio"
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
// import { addToast } from "@heroui/react"
const FastLaunch = () => {
void toolStore.start()
void steamStore.start()
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
const { dir } = useSnapshot(steamStore.state)
return (
<Card>
<CardHeader>
@@ -13,26 +22,28 @@ const FastLaunch = () => {
<CardBody>
<div className="flex gap-2">
<button
type="button"
onClick={() =>
invoke("launch_game", {
// steamPath: steam.dir + "/steam.exe",
// launchOption: launchOptions.value[launchIndex.value] || "",
steamPath: `${dir}/steam.exe`,
launchOption: launchOptions[launchIndex] || "",
server: "perfectworld",
})
}
className="px-5 font-medium py-1.5 transition bg-red-200 rounded-full"
className="px-5 font-medium py-1.5 transition bg-red-200 dark:bg-red-900/60 rounded-full"
>
</button>
<button
type="button"
onClick={() =>
invoke("launch_game", {
// steamPath: steam.dir + "/steam.exe",
// launchOption: launchOptions.value[launchIndex.value] || "",
steamPath: `${dir}/steam.exe`,
launchOption: launchOptions[launchIndex] || "",
server: "worldwide",
})
}
className="px-5 font-medium py-1.5 transition bg-orange-200 rounded-full"
className="px-5 font-medium py-1.5 transition bg-orange-200 dark:bg-orange-900/60 rounded-full"
>
</button>
@@ -40,6 +51,6 @@ const FastLaunch = () => {
</CardBody>
</Card>
)
};
}
export default FastLaunch;
export default FastLaunch

View File

@@ -1,6 +1,6 @@
import { Power } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardBody } from "../window/Card";
import { invoke } from "@tauri-apps/api/core";
import { Power } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core"
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
const ForceQuit = () => {
return (
@@ -12,12 +12,24 @@ const ForceQuit = () => {
</CardHeader>
<CardBody>
<div className="flex gap-2">
<button onClick={() => invoke("kill_steam")} className="px-5 font-medium py-1.5 transition bg-blue-200 rounded-full">Steam</button>
<button onClick={() => invoke("kill_game")} className="px-5 font-medium py-1.5 transition bg-orange-200 rounded-full">CS2</button>
<button
type="button"
onClick={() => invoke("kill_steam")}
className="px-5 font-medium py-1.5 transition bg-blue-200 dark:bg-blue-900/60 rounded-full"
>
Steam
</button>
<button
type="button"
onClick={() => invoke("kill_game")}
className="px-5 font-medium py-1.5 transition bg-orange-200 dark:bg-orange-900/60 rounded-full"
>
CS2
</button>
</div>
</CardBody>
</Card>
);
};
)
}
export default ForceQuit;
export default ForceQuit

View File

@@ -1,10 +1,12 @@
import { Plus, SettingConfig, Switch } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card";
import { ToolButton } from "../window/ToolButton";
import useToolStore from "@/store/tool";
import { setLaunchIndex, setLaunchOption, toolStore } from "@/store/tool"
import { Plus, SettingConfig, Switch } from "@icon-park/react"
import { useSnapshot } from "valtio"
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
import { ToolButton } from "../window/ToolButton"
const LaunchOption = () => {
const { launchOptions, setLaunchOption, launchIndex, setLaunchIndex } = useToolStore()
void toolStore.start()
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
return (
<Card>
@@ -29,13 +31,15 @@ const LaunchOption = () => {
<CardBody>
<textarea
placeholder="请输入启动选项"
value={launchOptions[launchIndex]}
onChange={(e) => setLaunchOption(e.target.value, launchIndex)}
value={launchOptions[launchIndex] || ""}
onChange={(e) =>
launchIndex !== -1 && setLaunchOption(e.target.value, launchIndex)
}
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
/>
</CardBody>
</Card>
);
};
)
}
export default LaunchOption;
export default LaunchOption

View File

@@ -1,16 +1,19 @@
import { Refresh, VolumeNotice } from "@icon-park/react";
import {
Card,
CardBody,
CardHeader,
CardIcon,
CardTool,
CardBody,
Card,
} from "@/components/window/Card";
import { ToolButton } from "../window/ToolButton";
import useAppStore from "@/store/app";
} from "@/components/window/Card"
import { appStore } from "@/store/app"
import { Refresh, VolumeNotice } from "@icon-park/react"
import { useSnapshot } from "valtio"
import { ToolButton } from "../window/ToolButton"
const Notice = () => {
const app = useAppStore();
void appStore.start()
const app = useSnapshot(appStore.state)
return (
<Card>
<CardHeader>
@@ -24,9 +27,11 @@ const Notice = () => {
</ToolButton>
</CardTool>
</CardHeader>
<CardBody>{app.notice || "不会真的有人要更新CSGO工具箱吧不会吧不会吧 xswl"}</CardBody>
<CardBody>
{app.notice || "不会真的有人要更新CSGO工具箱吧不会吧不会吧 xswl"}
</CardBody>
</Card>
)
};
}
export default Notice;
export default Notice

View File

@@ -1,7 +1,7 @@
import { BatteryCharge, Refresh } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card";
import { ToolButton } from "../window/ToolButton";
import { invoke } from "@tauri-apps/api/core";
import { BatteryCharge, Refresh } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core"
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
import { ToolButton } from "../window/ToolButton"
const PowerPlan = () => {
return (
@@ -19,13 +19,31 @@ const PowerPlan = () => {
</CardHeader>
<CardBody>
<div className="flex p-0.5 bg-black/5 gap-2 rounded-full">
<button onClick={() => invoke("set_power_plan", {index: 1})} className="flex-1 px-2 py-1 transition rounded-full bg-black/5"></button>
<button onClick={() => invoke("set_power_plan", {index: 2})} className="flex-1 px-2 py-1 transition rounded-full"></button>
<button onClick={() => invoke("set_power_plan", {index: 3})} className="flex-1 px-2 py-1 transition rounded-full"></button>
<button
type="button"
onClick={() => invoke("set_power_plan", { index: 1 })}
className="flex-1 px-2 py-1 transition rounded-full bg-black/5"
>
</button>
<button
type="button"
onClick={() => invoke("set_power_plan", { index: 2 })}
className="flex-1 px-2 py-1 transition rounded-full"
>
</button>
<button
type="button"
onClick={() => invoke("set_power_plan", { index: 3 })}
className="flex-1 px-2 py-1 transition rounded-full"
>
</button>
</div>
</CardBody>
</Card>
);
};
)
}
export default PowerPlan;
export default PowerPlan

View File

@@ -1,6 +1,6 @@
import { FolderConversion, FolderPlus } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card";
import { ToolButton } from "../window/ToolButton";
import { FolderConversion, FolderPlus } from "@icon-park/react"
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
import { ToolButton } from "../window/ToolButton"
const SmartTransfer = () => {
return (
@@ -22,7 +22,7 @@ const SmartTransfer = () => {
</div>
</CardBody>
</Card>
);
};
)
}
export default SmartTransfer;
export default SmartTransfer

View File

@@ -1,5 +1,5 @@
import { ReactNode } from "react"
import clsx from "clsx"
import { cn } from "@heroui/react"
import type { ReactNode } from "react"
interface CardProps {
children?: ReactNode
@@ -11,7 +11,7 @@ interface CardProps {
const Card = ({ children }: CardProps) => {
return (
<div
className="dark:from-black/10 dark:to-black/5 dark:border-white/[6%] px-4 pt-3 pb-4 flex flex-col gap-2 border w-full rounded-lg bg-white/40 border-black/[6%]"
className="dark:bg-white/[3%] dark:border-white/[6%] px-3 pt-3 pb-4 flex flex-col gap-2.5 border w-full rounded-lg bg-white/40 border-black/[6%]"
data-tauri-drag-region
>
{children}
@@ -20,23 +20,41 @@ const Card = ({ children }: CardProps) => {
}
const CardHeader = ({ children }: CardProps) => {
return <div className="flex items-center gap-1.5 tracking-wide">{children}</div>
return (
<div className="flex items-center gap-1.5 tracking-wide">{children}</div>
)
}
const CardIcon = ({ children, type, className, ...rest }: CardProps) => {
return (
<div className={clsx("flex gap-1.5 items-center font-semibold", type === "menu" && "transition cursor-pointer hover:bg-white/60 px-2 py-1 rounded-md active:scale-95", className)} {...rest}>
<div
className={cn(
"flex gap-1.5 items-center font-semibold",
type === "menu" &&
"transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95",
className,
)}
{...rest}
>
{children}
</div>
)
}
const CardTool = ({ children }: CardProps) => {
return <div className="flex items-center justify-end flex-grow gap-2">{children}</div>
return (
<div className="flex items-center justify-end flex-grow gap-2">
{children}
</div>
)
}
const CardBody = ({ children }: CardProps) => {
return <div className="w-full h-full text-sm tracking-wide text-zinc-800">{children}</div>
return (
<div className="w-full h-full text-sm tracking-wide text-zinc-800 dark:text-white">
{children}
</div>
)
}
export { Card, CardHeader, CardIcon, CardTool, CardBody }

View File

@@ -8,7 +8,7 @@ const Header = () => {
使CS工具箱 114
</p>
</div>
);
};
)
}
export default Header;
export default Header

View File

@@ -1,11 +1,25 @@
"use client"
import { RocketOne, Minus, Close, Square } from "@icon-park/react"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
import { resetAppStore } from "@/store/app"
import { resetToolStore } from "@/store/tool"
import { addToast } from "@heroui/react"
import {
Close,
Minus,
Moon,
Refresh,
RocketOne,
Square,
SunOne,
} from "@icon-park/react"
import { getCurrentWindow } from "@tauri-apps/api/window"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
import { useTheme } from "next-themes"
// import { platform } from "@tauri-apps/plugin-os"
import { useRouter, usePathname } from "next/navigation"
import { usePathname, useRouter } from "next/navigation"
const Nav = () => {
const { theme, setTheme } = useTheme()
const close = async () => {
// (await window.hideOnClose) ? getCurrent().hide() : exit();
await exit()
@@ -35,35 +49,70 @@ const Nav = () => {
const pathname = usePathname()
return (
<nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
<nav
className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4"
data-tauri-drag-region
>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => pathname !== "/prepare" ? router.push("/prepare") : router.back()}
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => {
resetAppStore()
resetToolStore()
addToast({
title: "重置成功",
color: "success",
// description: "已重置所有设置",
})
}}
>
<Refresh size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() =>
pathname !== "/prepare" ? router.push("/prepare") : router.back()
}
>
<RocketOne size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() =>
theme === "light" ? setTheme("dark") : setTheme("light")
}
>
{theme === "light" ? <SunOne size={16} /> : <Moon size={16} />}
</button>
{/* { platform() === "windows" && ( */}
<>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={minimize}
>
<Minus size={16} />
</button>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={toggleMaximize}
>
<Square size={16} />
</button>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={close}
>
<Close size={16} />
</button>
</>
<>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={minimize}
>
<Minus size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={toggleMaximize}
>
<Square size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={close}
>
<Close size={16} />
</button>
</>
{/* )} */}
</nav>
)

View File

@@ -1,11 +1,19 @@
"use client"
import { ReactNode } from "react"
import clsx from "clsx"
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
import { useRouter, usePathname } from "next/navigation"
import { Button, cn } from "@heroui/react"
import {
Home,
MonitorOne,
Movie,
Setting,
Terminal,
Toolkit,
} from "@icon-park/react"
import { usePathname, useRouter } from "next/navigation"
import type { ReactNode } from "react"
// import { platform } from "@tauri-apps/plugin-os"
import useAppStore from "@/store/app"
import { appStore, setVersion } from "@/store/app"
import { useSnapshot } from "valtio"
interface SideButtonProps {
route: string
@@ -24,19 +32,20 @@ const SideButton = ({
return (
<button
type="button"
onClick={() => router.push(route || "/")}
className={clsx(
className={cn(
className,
"p-2.5 hover:bg-black/5 rounded-lg transition relative",
path.startsWith(route) && "bg-black/5"
path.startsWith(route) && "bg-black/5",
)}
{...rest}
>
{children}
<div
className={clsx(
className={cn(
path.startsWith(route) && "opacity-100",
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2"
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2",
)}
/>
</button>
@@ -48,25 +57,27 @@ const Avatar = () => {
const path = usePathname()
return (
<div
<button
onClick={() => router.push("/users")}
className={clsx(
className={cn(
"w-12 h-12 bg-gray-700 rounded-full shadow-2xl cursor-pointer transition active:scale-95 shadow-purple-800",
path.startsWith("/users") && "shadow-sm"
path.startsWith("/users") && "shadow-sm",
)}
type="button"
>
<img src="favicon.ico" alt="avatar" draggable={false} />
</div>
</button>
)
}
const SideBar = () => {
const { version, setVersion } = useAppStore()
void appStore.start()
const { version } = useSnapshot(appStore.state)
return (
<div
className={clsx(
"absolute left-0 flex flex-col h-full select-none w-20 py-7"
className={cn(
"absolute left-0 flex flex-col h-full select-none w-20 pt-7 pb-5",
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
)}
data-tauri-drag-region
@@ -99,9 +110,19 @@ const SideBar = () => {
</SideButton>
</section>
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
<div
className="mx-auto text-sm text-center text-zinc-500"
data-tauri-drag-region
>
<p></p>
<p onClick={() => setVersion("x.y.z")}>{version}</p>
<Button
variant="light"
size="sm"
className="mt-0.5 text-zinc-600"
onPress={() => setVersion("x.y.z")}
>
{version}
</Button>
</div>
</div>
)

View File

@@ -1,8 +1,17 @@
import { ReactNode } from "react";
import type { ReactNode } from "react"
interface ToolButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children?: ReactNode;
interface ToolButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children?: ReactNode
}
export const ToolButton = ({ children, ...rest }: ToolButtonProps) => {
return <button className="flex gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 rounded-md text-sm leading-none" {...rest}>{children}</button>;
};
return (
<button
type="button"
className="flex gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 rounded-md text-sm leading-none"
{...rest}
>
{children}
</button>
)
}

View File

@@ -1,45 +1,43 @@
import { create } from 'zustand'
import { tauriStore } from '@/utils/persist'
import { createJSONStorage, persist } from 'zustand/middleware'
import { store } from "tauri-plugin-valtio"
import { DEFAULT_STORE_CONFIG } from "."
interface AppState {
version: string
hasUpdate: boolean
inited: boolean
notice: string
useMirror: boolean
// Usage:
// import {appStore} from "@/store/app"
// import { useSnapshot } from "valtio"
// const app = useSnapshot(appStore.state)
// { app.version }
// () => appStore.setVersion("0.0.1")
const defaultValue = {
version: "0.0.1",
hasUpdate: false,
inited: false,
notice: "",
useMirror: true,
}
interface AppAction {
setVersion: (version: string) => void
setHasUpdate: (hasUpdate: boolean) => void
setInited: (hasInit: boolean) => void
setNotice: (notice: string) => void
setUseMirror: (useMirror: boolean) => void
export const appStore = store("app", { ...defaultValue }, DEFAULT_STORE_CONFIG)
export const setVersion = (version: string) => {
appStore.state.version = version
}
export const setHasUpdate = (hasUpdate: boolean) => {
appStore.state.hasUpdate = hasUpdate
}
export const setInited = (inited: boolean) => {
appStore.state.inited = inited
}
export const setNotice = (notice: string) => {
appStore.state.notice = notice
}
export const setUseMirror = (useMirror: boolean) => {
appStore.state.useMirror = useMirror
}
const STORE_NAME = "app"
const { /* store, */ storage } = tauriStore(STORE_NAME)
const useAppStore = create<AppState & AppAction>()(
persist(
(set/* , get */) => ({
version: "0.0.1",
hasUpdate: false,
inited: false,
notice: "Man! What can I say?",
useMirror: true,
setVersion: (version: string) => set(() => ({ version: version })),
setHasUpdate: (hasUpdate: boolean) => set(() => ({ hasUpdate: hasUpdate })),
setInited: (inited: boolean) => set(() => ({ inited: inited })),
setNotice: (notice: string) => set(() => ({ notice: notice })),
setUseMirror: (useMirror: boolean) => set(() => ({ useMirror: useMirror }))
}),
{
name: STORE_NAME, // name of item in the storage (must be unique)
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
},
)
)
export default useAppStore
export const resetAppStore = () => {
setVersion(defaultValue.version)
setHasUpdate(defaultValue.hasUpdate)
setInited(defaultValue.inited)
setNotice(defaultValue.notice)
setUseMirror(defaultValue.useMirror)
}

20
src/store/index.ts Normal file
View File

@@ -0,0 +1,20 @@
// @ts-ignore
import path from "path"
import { appConfigDir } from "@tauri-apps/api/path"
import { setValtioPath } from "tauri-plugin-valtio"
async function init() {
const configDir = await appConfigDir()
const distDir = path.join(configDir, "cstb")
await setValtioPath(distDir)
// console.log('init valtio', distDir);
}
void init()
export const DEFAULT_STORE_CONFIG = {
saveOnChange: true,
saveOnExit: true,
saveStrategy: "debounce" as const,
saveInterval: 3000,
}

View File

@@ -1,60 +1,53 @@
import { SteamUser } from '@/types/steam'
import { tauriStore } from '@/utils/persist'
import { create } from 'zustand'
import { persist, createJSONStorage } from 'zustand/middleware'
import type { SteamUser } from "@/types/steam"
import { store } from "tauri-plugin-valtio"
import { DEFAULT_STORE_CONFIG } from "."
const mock_user: SteamUser = {
steamID64: "76561198052315353",
steamID32: "STEAM_0:0:46157676",
accountName: "wrr",
personaName: "wrr",
recent: 0,
avatar: "",
// "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/0d/0d1d4b9e1a9e8b2b3d4d0a7e1b3d6b1e3f8f4f7.jpg",
}
interface SteamState {
dir: string,
csDir: string,
users: SteamUser[],
isDirValid: boolean,
isCsDirValid: boolean,
}
interface SteamAction {
setDir: (dir: string) => void,
setCsDir: (dir: string) => void,
setUsers: (users: SteamUser[]) => void,
setIsDirValid: (valid: boolean) => void,
setIsCsDirValid: (valid: boolean) => void,
currentUser: () => SteamUser,
}
const STORE_NAME = "steam"
const { /* store, */ storage } = tauriStore(STORE_NAME)
const useSteamStore = create<SteamState & SteamAction>()(
persist(
(set, get) => ({
dir: "C:\\Program Files (x86)\\Steam",
csDir: "",
users: [mock_user] as SteamUser[],
isDirValid: false,
isCsDirValid: false,
setDir: (dir: string) => set(() => ({ dir: dir })),
setCsDir: (dir: string) => set(() => ({ csDir: dir })),
setUsers: (users: SteamUser[]) => set(() => ({ users: users })),
setIsDirValid: (valid: boolean) => set(() => ({ isDirValid: valid })),
setIsCsDirValid: (valid: boolean) => set(() => ({ isCsDirValid: valid })),
currentUser: () => {
return get().users[0] || mock_user
},
}),
const defaultValue = {
dir: "C:\\Program Files (x86)\\Steam",
csDir: "",
users: [
{
name: STORE_NAME, // name of item in the storage (must be unique)
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
}
)
steamID64: "76561198052315353",
steamID32: "STEAM_0:0:46157676",
accountName: "wrr",
personaName: "wrr",
recent: 0,
avatar: "",
},
] as SteamUser[],
isDirValid: false,
isCsDirValid: false,
}
export const steamStore = store(
"steam",
{ ...defaultValue },
DEFAULT_STORE_CONFIG,
)
export default useSteamStore
export const setDir = (dir: string) => {
steamStore.state.dir = dir
}
export const setCsDir = (dir: string) => {
steamStore.state.csDir = dir
}
export const setUsers = (users: SteamUser[]) => {
steamStore.state.users = users
}
export const setIsDirValid = (valid: boolean) => {
steamStore.state.isDirValid = valid
}
export const setIsCsDirValid = (valid: boolean) => {
steamStore.state.isCsDirValid = valid
}
export const currentUser = () => {
return steamStore.state.users[0] || defaultValue.users[0]
}
export const resetSteamStore = () => {
setDir(defaultValue.dir)
setCsDir(defaultValue.csDir)
setUsers(defaultValue.users)
setIsDirValid(defaultValue.isDirValid)
setIsCsDirValid(defaultValue.isCsDirValid)
}

View File

@@ -1,39 +1,44 @@
import { tauriStore } from '@/utils/persist'
import { create } from 'zustand'
import { createJSONStorage, persist } from 'zustand/middleware'
import { store } from "tauri-plugin-valtio"
import { DEFAULT_STORE_CONFIG } from "."
interface ToolState {
launchOptions: string[]
launchIndex: number
powerPlan: number
const defaultValue = {
launchOptions: [
"-novid -high -freq 144 -fullscreen",
"-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder",
"-novid -high -freq 144 -fullscreen -allow_third_party_software",
] as string[],
launchIndex: 0,
powerPlan: 0,
}
interface ToolAction {
setLaunchOption: (option: string, index: number) => void
setLaunchOptions: (options: string[]) => void
setLaunchIndex: (index: number) => void
setPowerPlan: (index: number) => void
}
const STORE_NAME = "tool"
const { /* store, */ storage } = tauriStore(STORE_NAME)
const useToolStore = create<ToolState & ToolAction>()(
persist(
(set/* , get */) => ({
launchOptions: ["-high -refresh 120 -novid -nojoy -tickrate 128 +cl_cmdrate 128 +cl_updaterate 128 +exec auto.cfg +test", "", ""],
launchIndex: 0,
powerPlan: 0,
setLaunchOption: (option: string, index: number) => set((state) => ({ launchOptions: [...state.launchOptions.slice(0, index), option, ...state.launchOptions.slice(index + 1)] })),
setLaunchOptions: (options: string[]) => set(() => ({ launchOptions: options })),
setLaunchIndex: (index: number) => set(() => ({ launchIndex: index })),
setPowerPlan: (index: number) => set(() => ({ powerPlan: index }))
}),
{
name: STORE_NAME, // name of item in the storage (must be unique)
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
}
)
export const toolStore = store(
"tool",
{ ...defaultValue },
DEFAULT_STORE_CONFIG,
)
export default useToolStore
export const setLaunchOption = (option: string, index: number) => {
toolStore.state.launchOptions = [
...toolStore.state.launchOptions.slice(0, index),
option,
...toolStore.state.launchOptions.slice(index + 1),
]
}
export const setLaunchOptions = (options: string[]) => {
toolStore.state.launchOptions = options
}
export const setLaunchIndex = (index: number) => {
toolStore.state.launchIndex = index
}
export const setPowerPlan = (plan: number) => {
toolStore.state.powerPlan = plan
}
export const resetToolStore = () => {
toolStore.state.launchOptions = defaultValue.launchOptions
toolStore.state.launchIndex = defaultValue.launchIndex
toolStore.state.powerPlan = defaultValue.powerPlan
}

View File

@@ -1,4 +1,4 @@
import { AdvancedListItem } from "@/types/common"
import type { AdvancedListItem } from "@/types/common"
export interface File {
dir: string

View File

@@ -1,4 +1,4 @@
import { Owner } from "@/types/cfg"
import type { Owner } from "@/types/cfg"
export interface XBase {
name: string

View File

@@ -1,4 +1,4 @@
import { AdvancedListItem } from "@/types/common"
import type { AdvancedListItem } from "@/types/common"
export interface SteamUser extends AdvancedListItem {
steamID64: string

View File

@@ -1,68 +0,0 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { StateStorage } from 'zustand/middleware'
import { Store } from "@tauri-apps/plugin-store"
import { throttle } from 'throttle-debounce';
// import { useThrottleFn } from '@reactuses/core';
// 节流设置
export const THROTTLE_TIME = 300
export const THROTTLE_TIME_STORE = 5000
export const THROTTLE_LEADING = true
export const THROTTLE_TRAILING = true
// 自定义Store覆盖get, set等方法以适应tauri+zustand
export function tauriStore(name: string) {
const store = new Store(`${name || "store"}.settings.json`)
// 自动保存
const autoSave = throttle(
THROTTLE_TIME_STORE,
async () => {
await store.save()
},
{
noTrailing: !THROTTLE_TRAILING,
noLeading: !THROTTLE_LEADING
}
)
const doSet = throttle(
THROTTLE_TIME,
async (key: string, value: unknown) => {
await store.set(key, value)
},
{
noTrailing: !THROTTLE_TRAILING,
noLeading: !THROTTLE_LEADING
}
)
const set = (key: string, value: unknown) => {
doSet(key, value)
autoSave()
}
const get = (key: string) => {
return store.get(key)
}
// 自定义存储对象
const storage: StateStorage = {
setItem: async (name: string, value: string): Promise<void> => {
await store.set(name, value)
// console.log(name, 'has been set to', value)
},
getItem: async (name: string): Promise<string | null> => {
// console.log(name, 'has been get')
return (await store.get(name)) || null
},
removeItem: async (name: string): Promise<void> => {
// console.log(name, 'has been deleted')
await store.delete(name)
},
}
return { store, get, set, autoSave, storage }
}

View File

@@ -1,7 +1,14 @@
const { heroui } = require("@heroui/react");
module.exports = {
content: ["./src/**/*.{js,jsx,ts,tsx}"],
content: [
"./src/**/*.{js,jsx,ts,tsx}",
"./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}"
],
theme: {
extend: {},
},
plugins: [],
darkMode: "class",
plugins: [heroui()],
}

View File

@@ -12,7 +12,7 @@
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"module": "ESNext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,