diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c494c5..700e533 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,10 +54,6 @@ jobs: with: key: ${{ matrix.target }} - - name: Install xattr (macos only) - if: matrix.os == 'macos-latest' - run: pip install xattr - - name: Install dependencies (ubuntu only) if: matrix.os == 'ubuntu-latest' run: | @@ -110,11 +106,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install xattr - run: | - sudo apt-get update - sudo apt-get install -y xattr - - name: Query version number run: echo "version=${GITHUB_REF:11}" >> $GITHUB_ENV diff --git a/Cargo.lock b/Cargo.lock index 638ead8..b946402 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2140,6 +2140,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "os_pipe" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a53dbb20faf34b16087a931834cba2d7a73cc74af2b7ef345a4c8324e2409a12" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "overload" version = "0.1.1" @@ -2959,6 +2969,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shared_child" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "siphasher" version = "0.3.10" @@ -3250,6 +3270,7 @@ dependencies = [ "once_cell", "open", "os_info", + "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", @@ -3260,6 +3281,7 @@ dependencies = [ "serde_json", "serde_repr", "serialize-to-javascript", + "shared_child", "state", "tar", "tauri-macros", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0bbaa90..b0d0ced 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -26,7 +26,7 @@ wry = "0.24.1" dark-light = "1.0.0" serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.23.0", features = ["macros"] } -tauri = { version = "1.2.4", features = ["devtools", "fs-create-dir", "fs-exists", "fs-read-dir", "fs-read-file", "fs-remove-dir", "fs-remove-file", "fs-write-file", "global-shortcut", "global-shortcut-all", "os-all", "path-all", "process-all", "shell-open-api", "system-tray", "updater"] } +tauri = { version = "1.2.4", features = ["devtools", "fs-create-dir", "fs-exists", "fs-read-dir", "fs-read-file", "fs-remove-dir", "fs-remove-file", "fs-write-file", "global-shortcut", "global-shortcut-all", "os-all", "path-all", "process-all", "shell-all", "shell-open-api", "system-tray", "updater"] } tauri-plugin-positioner = { git = "https://github.com/lencx/tauri-plugins-workspace", features = ["system-tray"] } tauri-plugin-log = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev", features = ["colored"] } tauri-plugin-autostart = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev" } diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 34410d9..76caac2 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -72,6 +72,12 @@ pub fn init() -> Menu { } else { system_tray }; + let hide_dock_icon = CustomMenuItem::new("hide_dock_icon", "Hide Dock Icon"); + let hide_dock_icon_menu = if app_conf.tray { + hide_dock_icon + } else { + hide_dock_icon.disabled() + }; let auto_update = app_conf.get_auto_update(); let preferences_menu = Submenu::new( @@ -85,7 +91,7 @@ pub fn init() -> Menu { #[cfg(target_os = "macos")] titlebar_menu.into(), #[cfg(target_os = "macos")] - CustomMenuItem::new("hide_dock_icon", "Hide Dock Icon").into(), + hide_dock_icon_menu.into(), system_tray_menu.into(), CustomMenuItem::new("inject_script", "Inject Script") .accelerator("CmdOrCtrl+J") @@ -134,6 +140,7 @@ pub fn init() -> Menu { popup_search_menu.into(), CustomMenuItem::new("sync_prompts", "Sync Prompts").into(), MenuItem::Separator.into(), + CustomMenuItem::new("clear_cache", "Clear Cache").into(), CustomMenuItem::new("go_conf", "Go to Config") .accelerator("CmdOrCtrl+Shift+G") .into(), @@ -236,6 +243,20 @@ pub fn menu_handler(event: WindowMenuEvent) { "inject_script" => open(&app, &script_path), "go_conf" => utils::open_file(utils::app_root()), "clear_conf" => utils::clear_conf(&app), + "clear_cache" => { + let main_win = app.get_window("core"); + let tray_win = app.get_window("tray"); + if let Some(main) = main_win { + main + .eval("window.__clearCache && window.__clearCache()") + .unwrap(); + } + if let Some(tray) = tray_win { + tray + .eval("window.__clearCache && window.__clearCache()") + .unwrap(); + } + } "app_website" => window::cmd::wa_window( app, "app_website".into(), diff --git a/src-tauri/src/scripts/core.js b/src-tauri/src/scripts/core.js index 2a3bc47..e4ba302 100644 --- a/src-tauri/src/scripts/core.js +++ b/src-tauri/src/scripts/core.js @@ -176,6 +176,13 @@ function coreZoom() { window.__zoomIn = zoomIn; window.__zoomOut = zoomOut; window.__zoom0 = zoom0; + + window.__clearCache = () => { + window.localStorage.clear(); + window.sessionStorage.clear(); + window.applicationCache && window.applicationCache.update(); + window.location.reload(); + } } if ( diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b59ed9d..c0e0919 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -15,6 +15,9 @@ "globalShortcut": { "all": true }, + "shell": { + "all": true + }, "fs": { "all": false, "readFile": true, @@ -25,7 +28,8 @@ "removeFile": true, "removeDir": true, "scope": [ - "$HOME/.chatgpt/**" + "$HOME/.chatgpt/**", + "$DOWNLOAD/**" ] }, "path": { diff --git a/src/view/settings/General.tsx b/src/view/settings/General.tsx index 12ff1eb..59e335c 100644 --- a/src/view/settings/General.tsx +++ b/src/view/settings/General.tsx @@ -33,11 +33,11 @@ export default function General() { )} - {platformInfo === 'darwin' && ( + {/* {platformInfo === 'darwin' && ( - )} + )} */} Light diff --git a/tsconfig.json b/tsconfig.json index 9505215..77f74ab 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ESNext", + "target": "ES2015", "useDefineForClassFields": true, "lib": ["DOM", "DOM.Iterable", "ESNext"], "allowJs": false,