diff --git a/README.md b/README.md
index 4757133..3246cc4 100644
--- a/README.md
+++ b/README.md
@@ -151,6 +151,7 @@
| ⌘ + L | Ctrl + L | Copy Current Page URL |
| ⌘ + ⇧ + H | Ctrl + Shift + H | Go to Home Page |
| ⌘ + ⌥ + I | Ctrl + Shift + I | Toggle Developer Tools (Debug Only) |
+| ⌘ + ⇧ + ⌫ | Ctrl + Shift + Del | Clear Cache & Restart |
In addition, double-click the title bar to switch to full-screen mode. For Mac users, you can also use the gesture to go to the previous or next page and drag the title bar to move the window. The new menu also offers options for navigation, zoom, and window controls.
diff --git a/README_CN.md b/README_CN.md
index 5f9245c..2b9fc2b 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -152,6 +152,7 @@
| ⌘ + L | Ctrl + L | 复制当前页面网址 |
| ⌘ + ⇧ + H | Ctrl + Shift + H | 回到首页 |
| ⌘ + ⌥ + I | Ctrl + Shift + I | 开启调试 (仅开发版) |
+| ⌘ + ⇧ + ⌫ | Ctrl + Shift + Del | 清除缓存并重启 |
此外还支持双击头部全屏切换,拖拽头部移动窗口,Mac 用户支持手势返回和前进,新菜单也提供了导航、缩放和窗口控制等选项。
diff --git a/README_JP.md b/README_JP.md
index de1f525..7da74d9 100644
--- a/README_JP.md
+++ b/README_JP.md
@@ -150,6 +150,7 @@
| ⌘ + L | Ctrl + L | 現在のURLをコピー |
| ⌘ + ⇧ + H | Ctrl + Shift + H | ホームページに戻る |
| ⌘ + ⌥ + I | Ctrl + Shift + I | 開発者ツール (デバッグのみ) |
+| ⌘ + ⇧ + ⌫ | Ctrl + Shift + Del | キャッシュをクリアして再起動 |
さらに、タイトルバーをダブルクリックして全画面モードに切り替えることができます。Mac ユーザーは、ジェスチャーを使用して前のページまたは次のページに移動することもできます。新しいメニューには、ナビゲーション、ズーム、ウィンドウ制御などのオプションも用意されています。
diff --git a/package.json b/package.json
index 9c5677d..5a6e3b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "pake-cli",
- "version": "3.5.3",
+ "version": "3.6.0",
"description": "🤱🏻 Turn any webpage into a desktop app with one command. 🤱🏻 一键打包网页生成轻量桌面应用。",
"engines": {
"node": ">=18.0.0"
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 7c0c8df..79d703c 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -2588,7 +2588,7 @@ dependencies = [
[[package]]
name = "pake"
-version = "3.5.4"
+version = "3.6.0"
dependencies = [
"serde",
"serde_json",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index fbe88cf..0e27017 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pake"
-version = "3.5.4"
+version = "3.6.0"
description = "🤱🏻 Turn any webpage into a desktop app with Rust."
authors = ["Tw93"]
license = "MIT"
diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rs
index c643698..f5c8f4a 100644
--- a/src-tauri/src/app/invoke.rs
+++ b/src-tauri/src/app/invoke.rs
@@ -116,7 +116,7 @@ pub fn send_notification(app: AppHandle, params: NotificationParams) -> Result<(
}
#[command]
-pub fn update_theme_mode(app: AppHandle, mode: String) {
+pub async fn update_theme_mode(app: AppHandle, mode: String) {
let window = app.get_webview_window("pake").unwrap();
#[cfg(target_os = "macos")]
{
@@ -128,3 +128,23 @@ pub fn update_theme_mode(app: AppHandle, mode: String) {
let _ = window.set_theme(Some(theme));
}
}
+
+#[command]
+#[allow(unreachable_code)]
+pub fn clear_cache_and_restart(app: AppHandle) -> Result<(), String> {
+ if let Some(window) = app.get_webview_window("pake") {
+ match window.clear_all_browsing_data() {
+ Ok(_) => {
+ // Clear all browsing data successfully
+ app.restart();
+ Ok(())
+ }
+ Err(e) => {
+ eprintln!("Failed to clear browsing data: {}", e);
+ Err(format!("Failed to clear browsing data: {}", e))
+ }
+ }
+ } else {
+ Err("Main window not found".to_string())
+ }
+}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 0e5dd53..6782b28 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -13,7 +13,10 @@ use tauri::menu::{AboutMetadata, Menu, MenuItem, PredefinedMenuItem, Submenu};
use tauri_plugin_opener::OpenerExt; // Add this
use app::{
- invoke::{download_file, download_file_by_binary, send_notification, update_theme_mode},
+ invoke::{
+ clear_cache_and_restart, download_file, download_file_by_binary, send_notification,
+ update_theme_mode,
+ },
setup::{set_global_shortcut, set_system_tray},
window::set_window,
};
@@ -65,6 +68,7 @@ pub fn run_app() {
download_file_by_binary,
send_notification,
update_theme_mode,
+ clear_cache_and_restart,
])
.setup(move |app| {
// --- Menu Construction Start ---
@@ -91,6 +95,15 @@ pub fn run_app() {
// File Menu
let file_menu = Submenu::new(app, "File", true)?;
file_menu.append(&PredefinedMenuItem::close_window(app, None)?)?;
+ file_menu.append(&PredefinedMenuItem::separator(app)?)?;
+ file_menu.append(&MenuItem::with_id(
+ app,
+ "clear_cache_restart",
+ "Clear Cache & Restart",
+ true,
+ Some("CmdOrCtrl+Shift+Backspace"),
+ )?)?;
+
// Edit Menu
let edit_menu = Submenu::new(app, "Edit", true)?;
@@ -277,6 +290,13 @@ pub fn run_app() {
window.eval("navigator.clipboard.writeText(window.location.href)");
}
}
+ "clear_cache_restart" => {
+ if let Some(window) = app_handle.get_webview_window("pake") {
+ if let Ok(_) = window.clear_all_browsing_data() {
+ app_handle.restart();
+ }
+ }
+ }
"always_on_top" => {
if let Some(window) = app_handle.get_webview_window("pake") {
let is_on_top = window.is_always_on_top().unwrap_or(false);