chore: config

This commit is contained in:
lencx 2023-04-12 21:15:49 +08:00
parent 9cb4009ec2
commit da1e66bb9f
8 changed files with 60 additions and 15 deletions

View File

@ -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

22
Cargo.lock generated
View File

@ -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",

View File

@ -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" }

View File

@ -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<tauri::Wry>) {
"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(),

View File

@ -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 (

View File

@ -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": {

View File

@ -33,11 +33,11 @@ export default function General() {
<Switch />
</Form.Item>
)}
{platformInfo === 'darwin' && (
{/* {platformInfo === 'darwin' && (
<Form.Item label="Hide Dock Icon" name="hide_dock_icon" valuePropName="checked">
<Switch />
</Form.Item>
)}
)} */}
<Form.Item label="Theme" name="theme">
<Radio.Group>
<Radio value="light">Light</Radio>

View File

@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ESNext",
"target": "ES2015",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,