migrate to tauri 2.0

This commit is contained in:
Vomitblood 2024-10-22 22:10:01 +08:00
parent 9036e5f189
commit b1da210a9f
17 changed files with 18156 additions and 1166 deletions

BIN
bun.lockb

Binary file not shown.

6696
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,18 +17,23 @@
"@mui/icons-material": "^5.16.6",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5.16.6",
"@tauri-apps/api": "^1.6.0",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-dialog": "^2.0.1",
"@tauri-apps/plugin-fs": "^2.0.1",
"@tauri-apps/plugin-notification": "^2.0.0",
"@tauri-apps/plugin-process": "^2.0.0",
"jotai": "^2.9.1",
"lodash": "^4.17.21",
"next": "14.2.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"smol-toml": "^1.3.0",
"tauri": "^0.15.0",
"zustand": "^4.5.4"
},
"devDependencies": {
"@tauri-apps/cli": "^2.0.4",
"@types/lodash": "^4.17.7",
"@tauri-apps/cli": "^1.6.0",
"@types/node": "^20.14.14",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",

2530
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,15 +12,19 @@ rust-version = "1.60"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.5.3", features = [] }
tauri-build = { version = "2", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.7.0", features = [ "protocol-all", "fs-all", "path-all", "window-all", "process-all", "notification-all", "dialog-all"] }
tauri = { version = "2", features = ["protocol-asset"] }
image = "0.25.2"
webp = "0.3.0"
gif = "0.13.1"
tauri-plugin-notification = "2"
tauri-plugin-process = "2"
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.

View file

@ -0,0 +1,77 @@
{
"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",
{
"identifier": "fs:scope",
"allow": [
"**",
"**/*",
"/**/*",
"$CONFIG/stort/",
"$CONFIG/stort/**",
"$HOME/.local/share/stort/*",
"$HOME/.local/share/stort/**"
]
},
"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",
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-message",
"dialog:allow-ask",
"dialog:allow-confirm",
"notification:default",
"process:allow-restart",
"process:allow-exit",
"notification:default",
"process:default",
"dialog:default",
"fs:default"
]
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"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",{"identifier":"fs:scope","allow":["**","**/*","/**/*","$CONFIG/stort/","$CONFIG/stort/**","$HOME/.local/share/stort/*","$HOME/.local/share/stort/**"]},"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","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","notification:default","process:allow-restart","process:allow-exit","notification:default","process:default","dialog:default","fs:default"]}}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,80 +1,42 @@
{
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
"build": {
"beforeBuildCommand": "bun run build",
"beforeDevCommand": "bun run dev",
"devPath": "http://localhost:3000",
"distDir": "../out"
"beforeBuildCommand": "npm run build",
"beforeDevCommand": "npm run dev",
"frontendDist": "../out",
"devUrl": "http://localhost:3000"
},
"package": {
"productName": "stort",
"version": "0.1.0"
},
"tauri": {
"allowlist": {
"dialog": {
"all": true
},
"fs": {
"all": true,
"scope": [
"**",
"**/*",
"/**/*",
"$CONFIG/stort/",
"$CONFIG/stort/**",
"$HOME/.local/share/stort/*",
"$HOME/.local/share/stort/**"
]
},
"notification": {
"all": true
},
"path": {
"all": true
},
"process": {
"all": true
},
"protocol": {
"all": true,
"asset": true,
"assetScope": [
"$APPDATA/*",
"$APPDATA/**"
]
},
"window": {
"all": true
}
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"shortDescription": "Launcher for Steam Deck",
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"targets": [
"appimage",
"deb"
],
"longDescription": "Launcher for Steam Deck",
"resources": [],
"linux": {
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "stort",
"longDescription": "Launcher for Steam Deck",
"resources": [],
"shortDescription": "Launcher for Steam Deck",
"targets": [
"appimage",
"deb"
]
},
"security": {
"csp": null
},
}
}
},
"productName": "stort",
"mainBinaryName": "stort",
"version": "0.1.0",
"identifier": "stort",
"plugins": {},
"app": {
"windows": [
{
"decorations": false,
@ -84,6 +46,16 @@
"title": "Stort",
"width": 800
}
]
],
"security": {
"assetProtocol": {
"scope": [
"$APPDATA/*",
"$APPDATA/**"
],
"enable": true
},
"csp": null
}
}
}

View file

@ -1,5 +1,5 @@
import { Box, Button, useTheme } from "@mui/material";
import { convertFileSrc } from "@tauri-apps/api/tauri";
import { convertFileSrc } from "@tauri-apps/api/core";
import { useEffect, useState } from "react";
import { useSettings } from "../../contexts/SettingsContext";
import { FooterBar } from "../FooterBar/FooterBar";

View file

@ -1,8 +1,8 @@
import { DeleteOutline, FileOpenOutlined } from "@mui/icons-material";
import { Box, Button, CircularProgress, LinearProgress, Stack, TextField, Typography } from "@mui/material";
import { open } from "@tauri-apps/api/dialog";
import { readBinaryFile } from "@tauri-apps/api/fs";
import { invoke } from "@tauri-apps/api/tauri";
import { open } from "@tauri-apps/plugin-dialog";
import { readBinaryFile } from "@tauri-apps/plugin-fs";
import { invoke } from "@tauri-apps/api/core";
import { useAtom } from "jotai";
import Image from "next/image";
import { FC, useEffect, useState } from "react";

View file

@ -1,6 +1,6 @@
import { Close, CloseFullscreen, Fullscreen, FullscreenExit, Minimize, WebAssetOutlined } from "@mui/icons-material";
import { Box, IconButton, Stack, useTheme } from "@mui/material";
import { WebviewWindow } from "@tauri-apps/api/window";
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
import { useEffect, useState } from "react";
import { useSettings } from "../../contexts/SettingsContext";

View file

@ -1,4 +1,4 @@
import { createDir } from "@tauri-apps/api/fs";
import { createDir } from "@tauri-apps/plugin-fs";
export const testing = async () => {
await createDir("/home/vomitblood/.config/stort/");

View file

@ -1,4 +1,4 @@
import { readTextFile, writeTextFile } from "@tauri-apps/api/fs";
import { readTextFile, writeTextFile } from "@tauri-apps/plugin-fs";
export const readJsonFile = async <T>(path: string): Promise<T | null> => {
try {

View file

@ -1,4 +1,4 @@
import { readTextFile, writeTextFile } from "@tauri-apps/api/fs";
import { readTextFile, writeTextFile } from "@tauri-apps/plugin-fs";
import { parse, stringify } from "smol-toml";
export const readTomlFile = async <T>(path: string): Promise<T | null> => {