Skip to content

Commit

Permalink
feat: Update plugin versions and add new permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
pacholoamit committed Oct 9, 2024
1 parent 1be3528 commit 70d3cbe
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@tauri-apps/api": "^2.0.2",
"@tauri-apps/plugin-fs": "^2.0.0",
"@tauri-apps/plugin-log": "^2.0.0",
"@tauri-apps/plugin-os": "^2.0.0",
"@tauri-apps/plugin-os": "~2",
"@tauri-apps/plugin-process": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0",
"@tauri-apps/plugin-updater": "^2.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ base64 = "0.22.1"
# surrealdb = { version = "1.5.2", features = ["kv-speedb"] }
anyhow = "1.0.86"
tauri-plugin-decorum = "1.1.1"
tauri-plugin-os = "2"

[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-os = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-log = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/capabilities/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"os:default",
"os:allow-arch",
"os:allow-hostname",
"os:allow-exe-extension",
"os:allow-family",
"os:allow-os-type",
"os:allow-platform",
"os:allow-version",
"core:window:allow-start-dragging",
"autostart:allow-enable",
"autostart:allow-disable",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/gen/schemas/capabilities.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","os:allow-platform","core:window:allow-start-dragging","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled","updater:allow-check","updater:default","log:allow-log","log:default","shell:allow-spawn","core:menu:allow-new","core:menu:allow-popup","core:window:allow-close","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-is-maximized","core:window:allow-start-dragging","core:window:allow-toggle-maximize","decorum:allow-show-snap-overlay",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"}]},"fs:read-all","fs:read-files","fs:read-meta"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}}
{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","os:default","os:allow-arch","os:allow-hostname","os:allow-exe-extension","os:allow-family","os:allow-os-type","os:allow-platform","os:allow-version","core:window:allow-start-dragging","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled","updater:allow-check","updater:default","log:allow-log","log:default","shell:allow-spawn","core:menu:allow-new","core:menu:allow-popup","core:window:allow-close","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-is-maximized","core:window:allow-start-dragging","core:window:allow-toggle-maximize","decorum:allow-show-snap-overlay",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"}]},"fs:read-all","fs:read-files","fs:read-meta"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}}
20 changes: 4 additions & 16 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::time::Duration;

fn build_and_run_app(app: AppState) {
tauri::Builder::default()
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_updater::Builder::new().build())
.setup(|app| {
let handle = app.handle().clone();
Expand All @@ -45,21 +46,6 @@ fn build_and_run_app(app: AppState) {
}
});

// CONFIGURE WINDOW
// if cfg!(target_os = "macos") {
// #[cfg(target_os = "macos")]
// use mac::window::setup_mac_window;

// #[cfg(target_os = "macos")]
// setup_mac_window(app);
// } else if cfg!(target_os = "windows") {
// #[cfg(target_os = "windows")]
// use win::window::setup_win_window;

// #[cfg(target_os = "windows")]
// setup_win_window(app);
// }

// Create a custom titlebar for main window
// On Windows this hides decoration and creates custom window controls
// On macOS it needs hiddenTitle: true and titleBarStyle: overlay
Expand All @@ -68,7 +54,9 @@ fn build_and_run_app(app: AppState) {

// Some macOS-specific helpers
#[cfg(target_os = "macos")]
main_window.set_traffic_lights_inset(12.0, 16.0).unwrap();
{
main_window.set_traffic_lights_inset(12.0, 32.0).unwrap();
}

// BUILD TRAY - TODO MOVE TO DIFFERENT FILE

Expand Down
7 changes: 7 additions & 0 deletions src/global-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export {};

declare global {
interface Window {
__TAURI__: any;
}
}
4 changes: 3 additions & 1 deletion src/providers/platform.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import useIsFirstRun from '@/hooks/useIsFirstRun';
import { streams } from '@/lib';
import store from '@/lib/store';
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import { Platform, platform as obtainPlatform } from '@tauri-apps/plugin-os';
import { Platform } from '@tauri-apps/plugin-os';

const { platform: obtainPlatform } = window.__TAURI__.os;

interface PlatformProviderProps {
children: React.ReactNode;
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,7 @@ __metadata:
languageName: node
linkType: hard

"@tauri-apps/plugin-os@npm:^2.0.0":
"@tauri-apps/plugin-os@npm:~2":
version: 2.0.0
resolution: "@tauri-apps/plugin-os@npm:2.0.0"
dependencies:
Expand Down Expand Up @@ -6797,7 +6797,7 @@ __metadata:
"@tauri-apps/cli": 2.0.2
"@tauri-apps/plugin-fs": ^2.0.0
"@tauri-apps/plugin-log": ^2.0.0
"@tauri-apps/plugin-os": ^2.0.0
"@tauri-apps/plugin-os": ~2
"@tauri-apps/plugin-process": ^2.0.0
"@tauri-apps/plugin-shell": ^2.0.0
"@tauri-apps/plugin-updater": ^2.0.0
Expand Down

0 comments on commit 70d3cbe

Please sign in to comment.