Skip to content

Commit

Permalink
migrate tauri to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
k2d222 committed Oct 20, 2024
1 parent 8392a1f commit 32923a4
Show file tree
Hide file tree
Showing 11 changed files with 11,337 additions and 746 deletions.
1,970 changes: 1,282 additions & 688 deletions desktop/Cargo.lock

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ 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.4.0", features = [] }
tauri-build = { version = "2", features = [] }

[dependencies]
twwe-server = { path = "../server", features = ["bridge_out"] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.4.0", features = ["shell-open", "fs-all"] }
twwe-server = { path = "../server", features = ["bridge_out"] }
tokio = "1.32.0"
platform-dirs = "0.3.0"
env_logger = "0.10.2"
tauri = { version = "2", features = [] }
tauri-plugin-fs = "2"
tauri-plugin-shell = "2"

[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
Expand Down
2 changes: 1 addition & 1 deletion desktop/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build()
}
23 changes: 23 additions & 0 deletions desktop/capabilities/migrated.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"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",
"shell:allow-open",
"fs:default",
"shell:default"
]
}
1 change: 1 addition & 0 deletions desktop/gen/schemas/acl-manifests.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions desktop/gen/schemas/capabilities.json
Original file line number Diff line number Diff line change
@@ -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","shell:allow-open","fs:default","shell:default"]}}
4,986 changes: 4,986 additions & 0 deletions desktop/gen/schemas/desktop-schema.json

Large diffs are not rendered by default.

4,986 changes: 4,986 additions & 0 deletions desktop/gen/schemas/linux-schema.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ async fn server_main() {
maps_dirs: vec![],
static_dir: None,
rpp_path: None,
max_maps: 10000,
max_map_size: 100 * 1024, // 100MiB
max_connections: 100,
max_http_bursts: 100,
http_ratelimit_delay: 500,
};
let server = Arc::new(twwe_server::create_server(&cli).expect("failed to create the server"));

Expand All @@ -60,10 +65,12 @@ async fn server_main() {
}

fn main() {
twwe_server::init_logger();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
std::thread::spawn(server_main);

let app = tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_fs::init())
.setup(|_app| Ok(()))
.build(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down
94 changes: 42 additions & 52 deletions desktop/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,49 @@
"build": {
"beforeBuildCommand": "npm --prefix client run build",
"beforeDevCommand": "npm --prefix client run dev",
"devPath": "http://localhost:5173",
"distDir": "../client/dist"
"frontendDist": "../client/dist",
"devUrl": "http://localhost:5173"
},
"package": {
"productName": "Twwe",
"version": "0.1.1"
},
"tauri": {
"allowlist": {
"all": false,
"fs": {
"all": true
},
"shell": {
"open": true
}
"bundle": {
"active": true,
"category": "Game",
"copyright": "Mathis Brossier <[email protected]>",
"targets": "all",
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
],
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
},
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"bundle": {
"active": true,
"category": "Game",
"copyright": "Mathis Brossier <[email protected]>",
"resources": [],
"shortDescription": "",
"linux": {
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "fr.thissma.tw",
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"resources": [],
"shortDescription": "",
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"security": {
"csp": null
},
"updater": {
"active": false
},
}
},
"productName": "Twwe",
"mainBinaryName": "Twwe",
"version": "0.1.1",
"identifier": "fr.thissma.tw",
"plugins": {},
"app": {
"windows": [
{
"fullscreen": false,
Expand All @@ -66,6 +53,9 @@
"title": "Teeworlds Web Editor",
"width": 800
}
]
],
"security": {
"csp": null
}
}
}
2 changes: 1 addition & 1 deletion server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 32923a4

Please sign in to comment.