Skip to content

Commit fcd70b7

Browse files
committed
chore: remove dead code and fix stale cli dev doc
1 parent 85e4a0d commit fcd70b7

6 files changed

Lines changed: 4 additions & 64 deletions

File tree

bin/defaults.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,3 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
5656
camera: false,
5757
microphone: false,
5858
};
59-
60-
// Just for cli development
61-
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & { url: string } = {
62-
...DEFAULT_PAKE_OPTIONS,
63-
url: 'https://weekly.tw93.fun/en',
64-
name: 'Weekly',
65-
hideTitleBar: true,
66-
};

bin/utils/name.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,3 @@ export function generateIdentifierSafeName(name: string): string {
4242

4343
return cleaned;
4444
}
45-
46-
export function generateWindowsFilename(name: string): string {
47-
return name
48-
.replace(/[<>:"/\\|?*]/g, '_')
49-
.replace(/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i, '$&_')
50-
.slice(0, 255);
51-
}
52-
53-
export function generateMacOSFilename(name: string): string {
54-
return name.replace(/[:]/g, '_').slice(0, 255);
55-
}

docs/advanced-usage.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,7 @@ pnpm run dev
267267

268268
#### CLI Development
269269

270-
For CLI development with hot reloading, modify the `DEFAULT_DEV_PAKE_OPTIONS` configuration in `bin/defaults.ts`:
271-
272-
```typescript
273-
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & { url: string } = {
274-
...DEFAULT_PAKE_OPTIONS,
275-
url: "https://weekly.tw93.fun/en",
276-
name: "Weekly",
277-
};
278-
```
279-
280-
Then run:
270+
For CLI development with hot reloading, run:
281271

282272
```bash
283273
pnpm run cli:dev

docs/advanced-usage_CN.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,7 @@ pnpm run dev
267267

268268
#### CLI 开发调试
269269

270-
对于需要热重载的 CLI 开发,可修改 `bin/defaults.ts` 中的 `DEFAULT_DEV_PAKE_OPTIONS` 配置:
271-
272-
```typescript
273-
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & { url: string } = {
274-
...DEFAULT_PAKE_OPTIONS,
275-
url: "https://weekly.tw93.fun/en",
276-
name: "Weekly",
277-
};
278-
```
279-
280-
然后运行:
270+
对于需要热重载的 CLI 开发,运行:
281271

282272
```bash
283273
pnpm run cli:dev

src-tauri/src/app/invoke.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,3 @@ pub async fn update_theme_mode(app: AppHandle, mode: String) {
191191
let _ = window.set_theme(Some(theme));
192192
}
193193
}
194-
195-
#[command]
196-
#[allow(unreachable_code)]
197-
pub fn clear_cache_and_restart(app: AppHandle) -> Result<(), String> {
198-
if let Some(window) = app.get_webview_window("pake") {
199-
match window.clear_all_browsing_data() {
200-
Ok(_) => {
201-
// Clear all browsing data successfully
202-
app.restart();
203-
Ok(())
204-
}
205-
Err(e) => {
206-
eprintln!("Failed to clear browsing data: {}", e);
207-
Err(format!("Failed to clear browsing data: {}", e))
208-
}
209-
}
210-
} else {
211-
Err("Main window not found".to_string())
212-
}
213-
}

src-tauri/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const WEBKIT_DISABLE_COMPOSITING_MODE: &str = "WEBKIT_DISABLE_COMPOSITING_MODE";
1919

2020
use app::{
2121
invoke::{
22-
clear_cache_and_restart, clear_dock_badge, download_file, increment_dock_badge,
23-
send_notification, set_dock_badge, set_dock_badge_label, update_theme_mode,
22+
clear_dock_badge, download_file, increment_dock_badge, send_notification,
23+
set_dock_badge, set_dock_badge_label, update_theme_mode,
2424
},
2525
setup::{set_global_shortcut, set_system_tray},
2626
window::{open_additional_window_safe, set_window, MultiWindowState},
@@ -159,7 +159,6 @@ pub fn run_app() {
159159
set_dock_badge_label,
160160
clear_dock_badge,
161161
update_theme_mode,
162-
clear_cache_and_restart,
163162
])
164163
.setup(move |app| {
165164
app.manage(MultiWindowState::new(

0 commit comments

Comments
 (0)