From 698be6671c0fe1c5b5c46c6fe9209191420b202e Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 15 Jun 2023 23:20:14 +0800 Subject: [PATCH] feat: enable drag area for tauri apps --- app/components/chat.tsx | 2 +- app/components/settings.tsx | 2 +- app/components/sidebar.tsx | 6 ++++-- app/locales/index.ts | 1 - app/styles/markdown.scss | 2 +- next.config.mjs | 3 +++ package.json | 1 - src-tauri/Cargo.lock | 34 ++++++++++++++++++++++++++++++++++ src-tauri/Cargo.toml | 6 +++--- src-tauri/tauri.conf.json | 30 ++++++++++++++++++++++++++---- 10 files changed, 73 insertions(+), 14 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 38daa3cde0d..50358f7fbba 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -728,7 +728,7 @@ export function Chat() { return (
-
+
-
+
{Locale.Settings.Title} diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx index 63614ffae54..a43daedefb0 100644 --- a/app/components/sidebar.tsx +++ b/app/components/sidebar.tsx @@ -118,8 +118,10 @@ export function SideBar(props: { className?: string }) { shouldNarrow && styles["narrow-sidebar"] }`} > -
-
ChatGPT Next
+
+
+ ChatGPT Next +
Build your own AI assistant.
diff --git a/app/locales/index.ts b/app/locales/index.ts index 22c417da581..267a4c83aa0 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -69,7 +69,6 @@ function getLanguage() { try { return navigator.language.toLowerCase(); } catch { - console.log("[Lang] failed to detect user lang."); return DEFAULT_LANG; } } diff --git a/app/styles/markdown.scss b/app/styles/markdown.scss index 107c1b80d13..0a6b3bc5605 100644 --- a/app/styles/markdown.scss +++ b/app/styles/markdown.scss @@ -1116,4 +1116,4 @@ .markdown-body ::-webkit-calendar-picker-indicator { filter: invert(50%); -} \ No newline at end of file +} diff --git a/next.config.mjs b/next.config.mjs index 540fc027505..a0cc4fafc53 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -12,6 +12,9 @@ const nextConfig = { return config; }, output: mode, + images: { + unoptimized: mode === "export", + }, }; if (mode !== "export") { diff --git a/package.json b/package.json index 35a98e08599..99cef5f7c4e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", "sass": "^1.59.2", - "sharp": "^0.32.1", "spark-md5": "^3.0.2", "use-debounce": "^9.0.3", "zustand": "^4.3.6" diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 7583bf59063..4d77172a0d0 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1636,6 +1636,16 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +[[package]] +name = "open" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" +dependencies = [ + "pathdiff", + "windows-sys 0.42.0", +] + [[package]] name = "overload" version = "0.1.1" @@ -1690,6 +1700,12 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" version = "2.2.0" @@ -2537,9 +2553,11 @@ dependencies = [ "ignore", "objc", "once_cell", + "open", "percent-encoding", "rand 0.8.5", "raw-window-handle", + "regex", "semver", "serde", "serde_json", @@ -2593,6 +2611,7 @@ dependencies = [ "png", "proc-macro2", "quote", + "regex", "semver", "serde", "serde_json", @@ -3256,6 +3275,21 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-sys" version = "0.45.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 504ee6a23e3..a94714b081b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "chatgpt-next-web" version = "0.1.0" -description = "A Tauri App" +description = "A cross platform app for LLM ChatBot." authors = ["Yidadaa"] -license = "anti-996" +license = "mit" repository = "" default-run = "chatgpt-next-web" edition = "2021" @@ -17,7 +17,7 @@ tauri-build = { version = "1.3.0", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.3.0", features = [] } +tauri = { version = "1.3.0", features = ["clipboard-all", "shell-open", "window-close", "window-hide", "window-maximize", "window-minimize", "window-set-icon", "window-set-ignore-cursor-events", "window-set-resizable", "window-show", "window-start-dragging", "window-unmaximize", "window-unminimize"] } [features] # this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled. diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index fe34f807502..b97b6c6c747 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,16 +8,37 @@ }, "package": { "productName": "chatgpt-next-web", - "version": "2.8.1" + "version": "2.8.2" }, "tauri": { "allowlist": { - "all": false + "all": false, + "shell": { + "all": false, + "open": true + }, + "clipboard": { + "all": true + }, + "window": { + "all": false, + "close": true, + "hide": true, + "maximize": true, + "minimize": true, + "setIcon": true, + "setIgnoreCursorEvents": true, + "setResizable": true, + "show": true, + "startDragging": true, + "unmaximize": true, + "unminimize": true + } }, "bundle": { "active": true, "category": "DeveloperTool", - "copyright": "", + "copyright": "2023, Zhang Yifei All Rights Reserved.", "deb": { "depends": [] }, @@ -59,7 +80,8 @@ "height": 600, "resizable": true, "title": "ChatGPT Next Web", - "width": 960 + "width": 960, + "titleBarStyle": "Overlay" } ] }