mirror of
https://github.com/lencx/ChatGPT.git
synced 2026-02-06 09:37:05 +00:00
feat: add go to config (#24)
This commit is contained in:
parent
bb44cdd5b7
commit
918d53c9b9
@ -60,11 +60,12 @@ cask "popcorn-time", args: { "no-quarantine": true }
|
||||
|
||||
- **Preferences**
|
||||
- `Theme` - `Light`, `Dark` (Only macOS and Windows are supported).
|
||||
- `Always On Top`: Window is always on top of other windows.
|
||||
- `Always on Top`: Window is always on top of other windows.
|
||||
- `Titlebar`: Only supports macOS.
|
||||
- `User Agent` ([#17](https://github.com/lencx/ChatGPT/issues/17)): Customize `user agent` to prevent security detection interception. Default is empty string.
|
||||
- `Inject Script`: User scripts that can modify web pages.
|
||||
- `Switch Origin` ([#14](https://github.com/lencx/ChatGPT/issues/14)): Modify website address, the default is `https://chat.openai.com`. Please ensure that the mirror address is consistent with the UI of the original URL, otherwise the export function will fail.
|
||||
- `Go to Config`: Open the configuration file directory (`path: ~/.chatgpt/*`).
|
||||
- `Clear Config`: Clear all chatgpt configuration files (`path: ~/.chatgpt/*`), dangerous operation, please backup data.
|
||||
- `Restart ChatGPT`: After editing the injection script file, you can restart the application through this menu item to make the script take effect.
|
||||
- `Awesome ChatGPT`: Related resources recommended.
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
# UPDATE LOG
|
||||
|
||||
## v0.2.2
|
||||
|
||||
feat:
|
||||
- menu: go to config
|
||||
|
||||
## v0.2.1
|
||||
|
||||
feat: menu optimization
|
||||
|
||||
@ -26,7 +26,7 @@ pub fn init(context: &Context<EmbeddedAssets>) -> Menu {
|
||||
.add_native_item(MenuItem::Quit),
|
||||
);
|
||||
|
||||
let always_on_top = CustomMenuItem::new("always_on_top".to_string(), "Always On Top")
|
||||
let always_on_top = CustomMenuItem::new("always_on_top".to_string(), "Always on Top")
|
||||
.accelerator("CmdOrCtrl+T");
|
||||
let titlebar =
|
||||
CustomMenuItem::new("titlebar".to_string(), "Titlebar").accelerator("CmdOrCtrl+B");
|
||||
@ -79,15 +79,18 @@ pub fn init(context: &Context<EmbeddedAssets>) -> Menu {
|
||||
.accelerator("CmdOrCtrl+J")
|
||||
.into(),
|
||||
MenuItem::Separator.into(),
|
||||
CustomMenuItem::new("go_conf".to_string(), "Go to Config")
|
||||
.accelerator("CmdOrCtrl+Shift+G")
|
||||
.into(),
|
||||
CustomMenuItem::new("clear_conf".to_string(), "Clear Config")
|
||||
.accelerator("CmdOrCtrl+D")
|
||||
.accelerator("CmdOrCtrl+Shift+D")
|
||||
.into(),
|
||||
CustomMenuItem::new("restart".to_string(), "Restart ChatGPT")
|
||||
.accelerator("CmdOrCtrl+Shift+R")
|
||||
.into(),
|
||||
MenuItem::Separator.into(),
|
||||
CustomMenuItem::new("awesome".to_string(), "Awesome ChatGPT")
|
||||
.accelerator("CmdOrCtrl+Z")
|
||||
.accelerator("CmdOrCtrl+Shift+A")
|
||||
.into(),
|
||||
]),
|
||||
);
|
||||
@ -164,6 +167,7 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
||||
// Preferences
|
||||
"restart" => tauri::api::process::restart(&app.env()),
|
||||
"inject_script" => open(&app, script_path),
|
||||
"go_conf" => utils::open_file(utils::chat_root()),
|
||||
"clear_conf" => utils::clear_conf(&app),
|
||||
"switch_origin" => window::origin_window(&app),
|
||||
"user_agent" => window::ua_window(&app),
|
||||
|
||||
20
src-tauri/src/assets/export.js
vendored
20
src-tauri/src/assets/export.js
vendored
@ -1,5 +1,5 @@
|
||||
// *** Core Script - Export ***
|
||||
// @ref: https://github.com/liady/ChatGPT-pdf/blob/main/src/content_script.js
|
||||
// @ref: https://github.com/liady/ChatGPT-pdf
|
||||
|
||||
async function init() {
|
||||
const chatConf = await invoke('get_chat_conf') || {};
|
||||
@ -78,22 +78,9 @@ function downloadThread({ as = Format.PNG } = {}) {
|
||||
const pixelRatio = window.devicePixelRatio;
|
||||
const minRatio = as === Format.PDF ? 2 : 2.5;
|
||||
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
|
||||
|
||||
html2canvas(elements.thread, {
|
||||
letterRendering: true,
|
||||
onclone: function (cloneDoc) {
|
||||
//Make small fix of position to all the text containers
|
||||
let listOfTexts = cloneDoc.getElementsByClassName("min-h-[20px]");
|
||||
Array.from(listOfTexts).forEach((text) => {
|
||||
text.style.position = "relative";
|
||||
text.style.top = "-8px";
|
||||
});
|
||||
|
||||
//Delete copy button from code blocks
|
||||
let listOfCopyBtns = cloneDoc.querySelectorAll("button.flex");
|
||||
Array.from(listOfCopyBtns).forEach(
|
||||
(btn) => (btn.style.visibility = "hidden")
|
||||
);
|
||||
},
|
||||
}).then(async function (canvas) {
|
||||
elements.restoreLocation();
|
||||
window.devicePixelRatio = pixelRatio;
|
||||
@ -166,6 +153,8 @@ class Elements {
|
||||
img.setAttribute("srcset_old", srcset);
|
||||
img.setAttribute("srcset", "");
|
||||
});
|
||||
//Fix to the text shifting down when generating the canvas
|
||||
document.body.style.lineHeight = "0.5";
|
||||
}
|
||||
restoreLocation() {
|
||||
this.hiddens.forEach((el) => {
|
||||
@ -182,6 +171,7 @@ class Elements {
|
||||
img.setAttribute("srcset", srcset);
|
||||
img.setAttribute("srcset_old", "");
|
||||
});
|
||||
document.body.style.lineHeight = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user