From ffef57e9342b5b3be055cced3ac3170e58d5f7c4 Mon Sep 17 00:00:00 2001 From: lencx Date: Sun, 29 Jan 2023 23:25:23 +0800 Subject: [PATCH 1/8] fix: export buttons do not work (#274) --- src-tauri/src/app/cmd.rs | 18 ++++++++++++++---- src-tauri/src/main.rs | 10 ---------- src-tauri/src/scripts/export.js | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/app/cmd.rs b/src-tauri/src/app/cmd.rs index 9b13282..241b6ba 100644 --- a/src-tauri/src/app/cmd.rs +++ b/src-tauri/src/app/cmd.rs @@ -19,19 +19,29 @@ pub fn fullscreen(app: AppHandle) { } #[command] -pub fn download(_app: AppHandle, name: String, blob: Vec) { +pub fn download(app: AppHandle, name: String, blob: Vec) { + let win = app.app_handle().get_window("core"); let path = utils::app_root().join(PathBuf::from(name)); utils::create_file(&path).unwrap(); fs::write(&path, blob).unwrap(); - utils::open_file(path); + tauri::api::dialog::message( + win.as_ref(), + "Save File", + format!("PATH: {}", path.display()), + ); } #[command] -pub fn save_file(_app: AppHandle, name: String, content: String) { +pub fn save_file(app: AppHandle, name: String, content: String) { + let win = app.app_handle().get_window("core"); let path = utils::app_root().join(PathBuf::from(name)); utils::create_file(&path).unwrap(); fs::write(&path, content).unwrap(); - utils::open_file(path); + tauri::api::dialog::message( + win.as_ref(), + "Save File", + format!("PATH: {}", path.display()), + ); } #[command] diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 919d00c..01c042f 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -46,7 +46,6 @@ async fn main() { } let mut builder = tauri::Builder::default() - // https://github.com/tauri-apps/tauri/pull/2736 .plugin(log.build()) .plugin(tauri_plugin_positioner::init()) .plugin(tauri_plugin_autostart::init( @@ -92,19 +91,10 @@ async fn main() { .on_menu_event(menu::menu_handler) .on_system_tray_event(menu::tray_handler) .on_window_event(|event| { - // https://github.com/tauri-apps/tauri/discussions/2684 if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() { let win = event.window(); if win.label() == "core" { - // TODO: https://github.com/tauri-apps/tauri/issues/3084 - // event.window().hide().unwrap(); - // https://github.com/tauri-apps/tao/pull/517 - #[cfg(target_os = "macos")] event.window().minimize().unwrap(); - - // fix: https://github.com/lencx/ChatGPT/issues/93 - #[cfg(not(target_os = "macos"))] - event.window().hide().unwrap(); } else { win.close().unwrap(); } diff --git a/src-tauri/src/scripts/export.js b/src-tauri/src/scripts/export.js index 0896ca8..16734af 100644 --- a/src-tauri/src/scripts/export.js +++ b/src-tauri/src/scripts/export.js @@ -200,7 +200,7 @@ class Elements { } init() { // this.threadWrapper = document.querySelector(".cdfdFe"); - this.spacer = document.querySelector(".w-full.h-48.flex-shrink-0"); + this.spacer = document.querySelector("[class*='h-48'].w-full.flex-shrink-0"); this.thread = document.querySelector( "[class*='react-scroll-to-bottom']>[class*='react-scroll-to-bottom']>div" ); From 171ac94f77172e3c730659df7c29560bef57fa57 Mon Sep 17 00:00:00 2001 From: lencx Date: Mon, 30 Jan 2023 23:55:43 +0800 Subject: [PATCH 2/8] chore: optim --- AWESOME.md | 26 ------------- UPDATE_LOG.md | 6 +++ chat.model.md | 3 -- src-tauri/src/app/menu.rs | 74 ++++++++++++++++++++++--------------- src-tauri/src/app/setup.rs | 2 + src-tauri/src/app/window.rs | 17 ++++----- src-tauri/src/conf.rs | 2 +- src-tauri/src/main.rs | 1 + src-tauri/src/utils.rs | 38 +++++++++---------- 9 files changed, 81 insertions(+), 88 deletions(-) delete mode 100644 AWESOME.md delete mode 100644 chat.model.md diff --git a/AWESOME.md b/AWESOME.md deleted file mode 100644 index 9f1d3a1..0000000 --- a/AWESOME.md +++ /dev/null @@ -1,26 +0,0 @@ -# Awesome ChatGPT - -- [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) - This repo includes ChatGPT prompt curation to use ChatGPT better. -- [Awesome ChatGPT](https://github.com/humanloop/awesome-chatgpt) - Curated list of awesome tools, demos, docs for ChatGPT and GPT-3 - -## Extension - -`Browser` - -- [ChatGPT Export and Share](https://github.com/liady/ChatGPT-pdf) - A Chrome extension for downloading your ChatGPT history to PNG, PDF or creating a sharable link -- [ChatGPT for Google](https://github.com/wong2/chat-gpt-google-extension) - A browser extension to display ChatGPT response alongside Google Search results -- [ChatGPT Extension](https://github.com/kazuki-sf/ChatGPT_Extension) - ChatGPT Extension is a really simple Chrome Extension (manifest v3) that you can access OpenAI's ChatGPT from anywhere on the web. -- [ChatGPT-Google](https://github.com/ZohaibAhmed/ChatGPT-Google) - Chrome Extension that Integrates ChatGPT (Unofficial) into Google Search - -`VSCode` - -- [ChatGPT Extension for VSCode](https://github.com/mpociot/chatgpt-vscode) - A VSCode extension that allows you to use ChatGPT - -`Bot` - -- [ChatGPT Telegram Bot](https://github.com/altryne/chatGPT-telegram-bot) - This is a very early attempt at having chatGPT work within a telegram bot - -## Tools - -- [commitgpt](https://github.com/RomanHotsiy/commitgpt) - Automatically generate commit messages using ChatGPT -- [ShareGPT](https://sharegpt.com/) - ShareGPT: Share your wildest ChatGPT conversations with one click. diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index affbc85..0f28507 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -1,5 +1,11 @@ # UPDATE LOG +## v0.10.2 + +Fix: + +- PNG and PDF buttons do not work (https://github.com/lencx/ChatGPT/issues/274) + ## v0.10.1 Fix: diff --git a/chat.model.md b/chat.model.md deleted file mode 100644 index 9a80fc8..0000000 --- a/chat.model.md +++ /dev/null @@ -1,3 +0,0 @@ -# ChatGPT Model - -- [Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt-prompts) diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 2b41c47..0e3aac8 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -81,6 +81,7 @@ pub fn init() -> Menu { CustomMenuItem::new("control_center".to_string(), "Control Center") .accelerator("CmdOrCtrl+Shift+P") .into(), + CustomMenuItem::new("app_website".to_string(), "ChatGPT User's Guide").into(), MenuItem::Separator.into(), stay_on_top_menu.into(), #[cfg(target_os = "macos")] @@ -143,7 +144,6 @@ pub fn init() -> Menu { .into(), CustomMenuItem::new("clear_conf".to_string(), "Clear Config").into(), MenuItem::Separator.into(), - CustomMenuItem::new("awesome".to_string(), "Awesome ChatGPT").into(), CustomMenuItem::new("buy_coffee".to_string(), "Buy lencx a coffee").into(), ]), ); @@ -247,7 +247,13 @@ 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), - "awesome" => open(&app, conf::AWESOME_URL.to_string()), + "app_website" => window::cmd::wa_window( + app, + "app_website".into(), + "ChatGPT User's Guide".into(), + conf::APP_WEBSITE.into(), + None, + ), "buy_coffee" => open(&app, conf::BUY_COFFEE.to_string()), "popup_search" => { let app_conf = AppConf::read(); @@ -396,22 +402,29 @@ pub fn menu_handler(event: WindowMenuEvent) { // --- SystemTray Menu pub fn tray_menu() -> SystemTray { if cfg!(target_os = "macos") { - SystemTray::new().with_menu( - SystemTrayMenu::new() - .add_item(CustomMenuItem::new( - "control_center".to_string(), - "Control Center", - )) - .add_native_item(SystemTrayMenuItem::Separator) - .add_item(CustomMenuItem::new( - "show_dock_icon".to_string(), - "Show Dock Icon", - )) + let mut tray_menu = SystemTrayMenu::new() + .add_item(CustomMenuItem::new( + "control_center".to_string(), + "Control Center", + )) + .add_native_item(SystemTrayMenuItem::Separator); + + if AppConf::read().hide_dock_icon { + tray_menu = tray_menu.add_item(CustomMenuItem::new( + "show_dock_icon".to_string(), + "Show Dock Icon", + )); + } else { + tray_menu = tray_menu .add_item(CustomMenuItem::new( "hide_dock_icon".to_string(), "Hide Dock Icon", )) - .add_item(CustomMenuItem::new("show_core".to_string(), "Show ChatGPT")) + .add_item(CustomMenuItem::new("show_core".to_string(), "Show ChatGPT")); + } + + SystemTray::new().with_menu( + tray_menu .add_native_item(SystemTrayMenuItem::Separator) .add_item(CustomMenuItem::new("quit".to_string(), "Quit ChatGPT")), ) @@ -440,17 +453,19 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) { let app_conf = AppConf::read(); if !app_conf.hide_dock_icon { - let core_win = handle.get_window("core").unwrap(); - core_win.minimize().unwrap(); + if let Some(core_win) = handle.get_window("core") { + core_win.minimize().unwrap(); + } } - let tray_win = handle.get_window("tray").unwrap(); - tray_win.move_window(Position::TrayCenter).unwrap(); + if let Some(tray_win) = handle.get_window("tray") { + tray_win.move_window(Position::TrayCenter).unwrap(); - if tray_win.is_visible().unwrap() { - tray_win.hide().unwrap(); - } else { - tray_win.show().unwrap(); + if tray_win.is_visible().unwrap() { + tray_win.hide().unwrap(); + } else { + tray_win.show().unwrap(); + } } } SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() { @@ -472,13 +487,14 @@ pub fn tray_handler(handle: &AppHandle, event: SystemTrayEvent) { } } "show_core" => { - let core_win = app.get_window("core").unwrap(); - let tray_win = app.get_window("tray").unwrap(); - if !core_win.is_visible().unwrap() { - core_win.show().unwrap(); - core_win.set_focus().unwrap(); - tray_win.hide().unwrap(); - } + if let Some(core_win) = app.get_window("core") { + let tray_win = app.get_window("tray").unwrap(); + if !core_win.is_visible().unwrap() { + core_win.show().unwrap(); + core_win.set_focus().unwrap(); + tray_win.hide().unwrap(); + } + }; } "quit" => std::process::exit(0), _ => (), diff --git a/src-tauri/src/app/setup.rs b/src-tauri/src/app/setup.rs index 8ed87cf..6f9a16b 100644 --- a/src-tauri/src/app/setup.rs +++ b/src-tauri/src/app/setup.rs @@ -11,6 +11,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box let handle = app.app_handle(); tauri::async_runtime::spawn(async move { + info!("stepup_tray"); window::tray_window(&handle); }); @@ -56,6 +57,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box } else { &url }; + info!("main_window: {}", link); let mut main_win = WindowBuilder::new(&app, "core", WindowUrl::App(link.into())) .title("ChatGPT") .resizable(true) diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs index b03e805..ee3c398 100644 --- a/src-tauri/src/app/window.rs +++ b/src-tauri/src/app/window.rs @@ -130,7 +130,7 @@ pub mod cmd { } #[command] - pub async fn wa_window( + pub fn wa_window( app: tauri::AppHandle, label: String, title: String, @@ -148,16 +148,13 @@ pub mod cmd { .build() .unwrap(); }); - } else { - if !win.clone().unwrap().is_visible().unwrap() { - win.clone().unwrap().show().unwrap(); + } + if let Some(v) = win { + if !v.is_visible().unwrap() { + v.show().unwrap(); } - win - .clone() - .unwrap() - .eval("window.location.reload()") - .unwrap(); - win.unwrap().set_focus().unwrap(); + v.eval("window.location.reload()").unwrap(); + v.set_focus().unwrap(); } } diff --git a/src-tauri/src/conf.rs b/src-tauri/src/conf.rs index 97bf202..99349d2 100644 --- a/src-tauri/src/conf.rs +++ b/src-tauri/src/conf.rs @@ -8,9 +8,9 @@ use tauri::TitleBarStyle; use crate::utils::{app_root, create_file, exists}; +pub const APP_WEBSITE: &str = "https://lencx.github.io/app/"; pub const ISSUES_URL: &str = "https://github.com/lencx/ChatGPT/issues"; pub const UPDATE_LOG_URL: &str = "https://github.com/lencx/ChatGPT/blob/main/UPDATE_LOG.md"; -pub const AWESOME_URL: &str = "https://github.com/lencx/ChatGPT/blob/main/AWESOME.md"; pub const BUY_COFFEE: &str = "https://www.buymeacoffee.com/lencx"; pub const GITHUB_PROMPTS_CSV_URL: &str = "https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv"; diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 01c042f..74590cc 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,6 +9,7 @@ mod utils; use app::{cmd, fs_extra, gpt, menu, setup, window}; use conf::AppConf; +use log::info; use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_log::{ fern::colors::{Color, ColoredLevelConfig}, diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index bb03d9a..d37f033 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -156,25 +156,25 @@ pub async fn get_data( pub fn run_check_update(app: AppHandle, silent: bool, has_msg: Option) { info!("run_check_update: silent={} has_msg={:?}", silent, has_msg); tauri::async_runtime::spawn(async move { - let result = app.updater().check().await; - let update_resp = result.unwrap(); - if update_resp.is_update_available() { - if silent { - tauri::async_runtime::spawn(async move { - silent_install(app, update_resp).await.unwrap(); - }); - } else { - tauri::async_runtime::spawn(async move { - prompt_for_install(app, update_resp).await.unwrap(); - }); - } - } else if let Some(v) = has_msg { - if v { - tauri::api::dialog::message( - app.app_handle().get_window("core").as_ref(), - "ChatGPT", - "Your ChatGPT is up to date", - ); + if let Ok(update_resp) = app.updater().check().await { + if update_resp.is_update_available() { + if silent { + tauri::async_runtime::spawn(async move { + silent_install(app, update_resp).await.unwrap(); + }); + } else { + tauri::async_runtime::spawn(async move { + prompt_for_install(app, update_resp).await.unwrap(); + }); + } + } else if let Some(v) = has_msg { + if v { + tauri::api::dialog::message( + app.app_handle().get_window("core").as_ref(), + "ChatGPT", + "Your ChatGPT is up to date", + ); + } } } }); From 8eade8e9b9144bd51f4739a9df8ae639e646af59 Mon Sep 17 00:00:00 2001 From: lencx Date: Wed, 1 Feb 2023 00:23:44 +0800 Subject: [PATCH 3/8] chore: optim --- src-tauri/src/app/menu.rs | 5 ++++- src-tauri/src/app/window.rs | 2 ++ src-tauri/src/main.rs | 1 - src-tauri/src/scripts/export.js | 14 +++++++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 0e3aac8..5f4d2c8 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -81,7 +81,6 @@ pub fn init() -> Menu { CustomMenuItem::new("control_center".to_string(), "Control Center") .accelerator("CmdOrCtrl+Shift+P") .into(), - CustomMenuItem::new("app_website".to_string(), "ChatGPT User's Guide").into(), MenuItem::Separator.into(), stay_on_top_menu.into(), #[cfg(target_os = "macos")] @@ -190,6 +189,10 @@ pub fn init() -> Menu { let window_menu = Submenu::new( "Window", Menu::new() + .add_item(CustomMenuItem::new( + "app_website".to_string(), + "ChatGPT User's Guide", + )) .add_item(CustomMenuItem::new("dalle2".to_string(), "DALL·E 2")) .add_native_item(MenuItem::Separator) .add_native_item(MenuItem::Minimize) diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs index ee3c398..bc5ef19 100644 --- a/src-tauri/src/app/window.rs +++ b/src-tauri/src/app/window.rs @@ -145,6 +145,8 @@ pub mod cmd { .initialization_script(&script.unwrap_or_default()) .initialization_script(include_str!("../scripts/core.js")) .title(title) + .inner_size(960.0, 700.0) + .resizable(true) .build() .unwrap(); }); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 74590cc..01c042f 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,7 +9,6 @@ mod utils; use app::{cmd, fs_extra, gpt, menu, setup, window}; use conf::AppConf; -use log::info; use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_log::{ fern::colors::{Color, ColoredLevelConfig}, diff --git a/src-tauri/src/scripts/export.js b/src-tauri/src/scripts/export.js index 16734af..de62516 100644 --- a/src-tauri/src/scripts/export.js +++ b/src-tauri/src/scripts/export.js @@ -20,6 +20,7 @@ async function init() { TryAgainButton = parentNode.querySelector("button"); } addActionsButtons(actionsArea, TryAgainButton, chatConf); + copyBtns(); } else if (shouldRemoveButtons()) { removeButtons(); } @@ -268,10 +269,21 @@ function setIcon(type) { // link: ``, png: ``, pdf: ``, - md: `` + md: ``, + copy: `` }[type]; } +function copyBtns() { + document.querySelectorAll("main >div>div>div>div>div").forEach(i => { + if (!/flex-shrink/i.test(i.getAttribute('class'))) return; + const btn = i.querySelector('button').cloneNode(true); + btn.innerHTML = setIcon('copy'); + i.querySelector('.self-end').appendChild(btn); + }) +} + + if ( document.readyState === "complete" || document.readyState === "interactive" From 272ef1cd37aa5e057a1c0386c7d5353517dcc5a6 Mon Sep 17 00:00:00 2001 From: lencx Date: Wed, 1 Feb 2023 23:48:35 +0800 Subject: [PATCH 4/8] feat: copy to clipboard (#191) --- src-tauri/src/scripts/cmd.js | 4 ++++ src-tauri/src/scripts/core.js | 25 ++++++++++++----------- src-tauri/src/scripts/export.js | 35 +++++++++++++++++++++++++++------ 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src-tauri/src/scripts/cmd.js b/src-tauri/src/scripts/cmd.js index 2b883a7..9a7f727 100644 --- a/src-tauri/src/scripts/cmd.js +++ b/src-tauri/src/scripts/cmd.js @@ -75,6 +75,10 @@ function init() { width: 22px; height: 22px; } + .chatappico.copy { + width: 16px; + height: 16px; + } @media screen and (max-width: 767px) { #download-png-button, #download-pdf-button, #download-html-button { display: none; diff --git a/src-tauri/src/scripts/core.js b/src-tauri/src/scripts/core.js index c683d67..734a277 100644 --- a/src-tauri/src/scripts/core.js +++ b/src-tauri/src/scripts/core.js @@ -36,8 +36,22 @@ async function invoke(cmd, args) { }); } +async function message(message) { + invoke('messageDialog', { + __tauriModule: 'Dialog', + message: { + cmd: 'messageDialog', + message: message.toString(), + title: null, + type: null, + buttonLabel: null + } + }); +} + window.uid = uid; window.invoke = invoke; +window.message = message; window.transformCallback = transformCallback; async function init() { @@ -87,17 +101,6 @@ async function init() { } }); - document.addEventListener('wheel', function(event) { - const deltaX = event.wheelDeltaX; - if (Math.abs(deltaX) >= 50) { - if (deltaX > 0) { - window.history.go(-1); - } else { - window.history.go(1); - } - } - }); - if (window.location.host === 'chat.openai.com') { window.__sync_prompts = async function() { await invoke('sync_prompts', { time: Date.now() }); diff --git a/src-tauri/src/scripts/export.js b/src-tauri/src/scripts/export.js index de62516..8147c22 100644 --- a/src-tauri/src/scripts/export.js +++ b/src-tauri/src/scripts/export.js @@ -275,14 +275,37 @@ function setIcon(type) { } function copyBtns() { - document.querySelectorAll("main >div>div>div>div>div").forEach(i => { - if (!/flex-shrink/i.test(i.getAttribute('class'))) return; - const btn = i.querySelector('button').cloneNode(true); - btn.innerHTML = setIcon('copy'); - i.querySelector('.self-end').appendChild(btn); - }) + Array.from(document.querySelectorAll("main >div>div>div>div>div")) + .forEach(i => { + if (i.querySelector('.chat-item-copy')) return; + if (!i.querySelector('button.rounded-md')) return; + const btn = i.querySelector('button.rounded-md').cloneNode(true); + btn.classList.add('chat-item-copy'); + btn.title = 'Copy to clipboard'; + btn.innerHTML = setIcon('copy'); + i.querySelector('.self-end').appendChild(btn); + btn.onclick = () => { + copyToClipboard(i?.innerText?.trim() || ''); + } + }) } +function copyToClipboard(text) { + if (navigator.clipboard) { + navigator.clipboard.writeText(text); + } else { + var textarea = document.createElement('textarea'); + document.body.appendChild(textarea); + textarea.style.position = 'fixed'; + textarea.style.clip = 'rect(0 0 0 0)'; + textarea.style.top = '10px'; + textarea.value = text; + textarea.select(); + document.execCommand('copy', true); + document.body.removeChild(textarea); + } + message('Copied to clipboard'); +} if ( document.readyState === "complete" || From 8aeca251e68ac80ec87719f0831b85829226b72c Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 2 Feb 2023 00:04:38 +0800 Subject: [PATCH 5/8] fix: shortcuts (#254) --- UPDATE_LOG.md | 4 ++++ src-tauri/src/app/menu.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index 0f28507..03f8e4f 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -6,6 +6,10 @@ Fix: - PNG and PDF buttons do not work (https://github.com/lencx/ChatGPT/issues/274) +Feat: + +- Copy a single record to the clipboard (https://github.com/lencx/ChatGPT/issues/191) + ## v0.10.1 Fix: diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 5f4d2c8..e2040af 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -162,9 +162,9 @@ pub fn init() -> Menu { let view_menu = Submenu::new( "View", Menu::new() - .add_item(CustomMenuItem::new("go_back".to_string(), "Go Back").accelerator("CmdOrCtrl+Left")) + .add_item(CustomMenuItem::new("go_back".to_string(), "Go Back").accelerator("CmdOrCtrl+[")) .add_item( - CustomMenuItem::new("go_forward".to_string(), "Go Forward").accelerator("CmdOrCtrl+Right"), + CustomMenuItem::new("go_forward".to_string(), "Go Forward").accelerator("CmdOrCtrl+]"), ) .add_item( CustomMenuItem::new("scroll_top".to_string(), "Scroll to Top of Screen") From 62924975a65962dc6af81bc4581b7f0cc4b80dca Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 2 Feb 2023 00:39:30 +0800 Subject: [PATCH 6/8] fix: export buttons (#286) --- UPDATE_LOG.md | 4 ++++ src-tauri/src/scripts/export.js | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index 03f8e4f..ccc4cc9 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -5,6 +5,10 @@ Fix: - PNG and PDF buttons do not work (https://github.com/lencx/ChatGPT/issues/274) +- Change the window size and the Send button is obscured by the Export button (https://github.com/lencx/ChatGPT/issues/286) +- Change forward and backward shortcuts (https://github.com/lencx/ChatGPT/issues/254) + - MacOS: `Cmd [`, `Cmd ]` + - Windows and Linux: `Ctrl [`, `Ctrl ]` Feat: diff --git a/src-tauri/src/scripts/export.js b/src-tauri/src/scripts/export.js index 8147c22..08bf45b 100644 --- a/src-tauri/src/scripts/export.js +++ b/src-tauri/src/scripts/export.js @@ -2,11 +2,13 @@ async function init() { const buttonOuterHTMLFallback = ``; - if (window.innerWidth < 767) return; - const chatConf = await invoke('get_app_conf') || {}; + removeButtons(); if (window.buttonsInterval) { clearInterval(window.buttonsInterval); } + if (window.innerWidth < 767) return; + + const chatConf = await invoke('get_app_conf') || {}; window.buttonsInterval = setInterval(() => { const actionsArea = document.querySelector("form>div>div"); if (!actionsArea) { @@ -27,6 +29,8 @@ async function init() { }, 1000); } +window.addEventListener('resize', init); + const Format = { PNG: "png", PDF: "pdf", From a107e2b21ed44d9a349a590bfe36978aa4034c16 Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 2 Feb 2023 00:46:23 +0800 Subject: [PATCH 7/8] release --- README-ZH_CN.md | 12 ++++++------ README.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README-ZH_CN.md b/README-ZH_CN.md index 2a3761d..395fb03 100644 --- a/README-ZH_CN.md +++ b/README-ZH_CN.md @@ -24,7 +24,7 @@ ### Windows -- [ChatGPT_0.10.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64_en-US.msi): +- [ChatGPT_0.10.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64_en-US.msi): - 使用 [winget](https://winstall.app/apps/lencx.ChatGPT): ```bash @@ -35,12 +35,12 @@ winget install --id=lencx.ChatGPT -e --version 0.10.0 ``` -**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.1))** +**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.2))** ### Mac -- [ChatGPT_0.10.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64.dmg) -- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT.app.tar.gz) +- [ChatGPT_0.10.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64.dmg) +- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT.app.tar.gz) - Homebrew \ _[Homebrew 快捷安装](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_ ```sh @@ -56,8 +56,8 @@ ### Linux -- [chat-gpt_0.10.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.deb) -- [chat-gpt_0.10.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它** +- [chat-gpt_0.10.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.deb) +- [chat-gpt_0.10.2_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它** - 使用 [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin): ```bash yay -S chatgpt-desktop-bin diff --git a/README.md b/README.md index 41885c3..4365bce 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ ### Windows -- [ChatGPT_0.10.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64_en-US.msi): Direct download installer +- [ChatGPT_0.10.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64_en-US.msi): Direct download installer - Use [winget](https://winstall.app/apps/lencx.ChatGPT): ```bash @@ -38,12 +38,12 @@ winget install --id=lencx.ChatGPT -e --version 0.10.0 ``` -**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.1))** +**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.2))** ### Mac -- [ChatGPT_0.10.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64.dmg): Direct download installer -- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT.app.tar.gz): Download the `.app` installer +- [ChatGPT_0.10.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT_0.10.2_x64.dmg): Direct download installer +- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/ChatGPT.app.tar.gz): Download the `.app` installer - Homebrew \ Or you can install with _[Homebrew](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_ ```sh @@ -59,8 +59,8 @@ ### Linux -- [chat-gpt_0.10.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility -- [chat-gpt_0.10.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run +- [chat-gpt_0.10.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility +- [chat-gpt_0.10.2_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.2/chat-gpt_0.10.2_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run - Available on [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin) with the package name `chatgpt-desktop-bin`, and you can use your favourite AUR package manager to install it. From 11877a960d943a0a2eeb97ef6a8b68ae215bc672 Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 2 Feb 2023 00:46:33 +0800 Subject: [PATCH 8/8] v0.10.2 --- src-tauri/tauri.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index dd3cfd7..e2b3bdb 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "ChatGPT", - "version": "0.10.1" + "version": "0.10.2" }, "tauri": { "allowlist": {