mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
feat: add go to config (#24)
This commit is contained in:
@@ -60,11 +60,12 @@ cask "popcorn-time", args: { "no-quarantine": true }
|
|||||||
|
|
||||||
- **Preferences**
|
- **Preferences**
|
||||||
- `Theme` - `Light`, `Dark` (Only macOS and Windows are supported).
|
- `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.
|
- `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.
|
- `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.
|
- `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.
|
- `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.
|
- `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.
|
- `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.
|
- `Awesome ChatGPT`: Related resources recommended.
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# UPDATE LOG
|
# UPDATE LOG
|
||||||
|
|
||||||
|
## v0.2.2
|
||||||
|
|
||||||
|
feat:
|
||||||
|
- menu: go to config
|
||||||
|
|
||||||
## v0.2.1
|
## v0.2.1
|
||||||
|
|
||||||
feat: menu optimization
|
feat: menu optimization
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub fn init(context: &Context<EmbeddedAssets>) -> Menu {
|
|||||||
.add_native_item(MenuItem::Quit),
|
.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");
|
.accelerator("CmdOrCtrl+T");
|
||||||
let titlebar =
|
let titlebar =
|
||||||
CustomMenuItem::new("titlebar".to_string(), "Titlebar").accelerator("CmdOrCtrl+B");
|
CustomMenuItem::new("titlebar".to_string(), "Titlebar").accelerator("CmdOrCtrl+B");
|
||||||
@@ -79,15 +79,18 @@ pub fn init(context: &Context<EmbeddedAssets>) -> Menu {
|
|||||||
.accelerator("CmdOrCtrl+J")
|
.accelerator("CmdOrCtrl+J")
|
||||||
.into(),
|
.into(),
|
||||||
MenuItem::Separator.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")
|
CustomMenuItem::new("clear_conf".to_string(), "Clear Config")
|
||||||
.accelerator("CmdOrCtrl+D")
|
.accelerator("CmdOrCtrl+Shift+D")
|
||||||
.into(),
|
.into(),
|
||||||
CustomMenuItem::new("restart".to_string(), "Restart ChatGPT")
|
CustomMenuItem::new("restart".to_string(), "Restart ChatGPT")
|
||||||
.accelerator("CmdOrCtrl+Shift+R")
|
.accelerator("CmdOrCtrl+Shift+R")
|
||||||
.into(),
|
.into(),
|
||||||
MenuItem::Separator.into(),
|
MenuItem::Separator.into(),
|
||||||
CustomMenuItem::new("awesome".to_string(), "Awesome ChatGPT")
|
CustomMenuItem::new("awesome".to_string(), "Awesome ChatGPT")
|
||||||
.accelerator("CmdOrCtrl+Z")
|
.accelerator("CmdOrCtrl+Shift+A")
|
||||||
.into(),
|
.into(),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
@@ -164,6 +167,7 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
|||||||
// Preferences
|
// Preferences
|
||||||
"restart" => tauri::api::process::restart(&app.env()),
|
"restart" => tauri::api::process::restart(&app.env()),
|
||||||
"inject_script" => open(&app, script_path),
|
"inject_script" => open(&app, script_path),
|
||||||
|
"go_conf" => utils::open_file(utils::chat_root()),
|
||||||
"clear_conf" => utils::clear_conf(&app),
|
"clear_conf" => utils::clear_conf(&app),
|
||||||
"switch_origin" => window::origin_window(&app),
|
"switch_origin" => window::origin_window(&app),
|
||||||
"user_agent" => window::ua_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 ***
|
// *** 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() {
|
async function init() {
|
||||||
const chatConf = await invoke('get_chat_conf') || {};
|
const chatConf = await invoke('get_chat_conf') || {};
|
||||||
@@ -78,22 +78,9 @@ function downloadThread({ as = Format.PNG } = {}) {
|
|||||||
const pixelRatio = window.devicePixelRatio;
|
const pixelRatio = window.devicePixelRatio;
|
||||||
const minRatio = as === Format.PDF ? 2 : 2.5;
|
const minRatio = as === Format.PDF ? 2 : 2.5;
|
||||||
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
|
window.devicePixelRatio = Math.max(pixelRatio, minRatio);
|
||||||
|
|
||||||
html2canvas(elements.thread, {
|
html2canvas(elements.thread, {
|
||||||
letterRendering: true,
|
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) {
|
}).then(async function (canvas) {
|
||||||
elements.restoreLocation();
|
elements.restoreLocation();
|
||||||
window.devicePixelRatio = pixelRatio;
|
window.devicePixelRatio = pixelRatio;
|
||||||
@@ -166,6 +153,8 @@ class Elements {
|
|||||||
img.setAttribute("srcset_old", srcset);
|
img.setAttribute("srcset_old", srcset);
|
||||||
img.setAttribute("srcset", "");
|
img.setAttribute("srcset", "");
|
||||||
});
|
});
|
||||||
|
//Fix to the text shifting down when generating the canvas
|
||||||
|
document.body.style.lineHeight = "0.5";
|
||||||
}
|
}
|
||||||
restoreLocation() {
|
restoreLocation() {
|
||||||
this.hiddens.forEach((el) => {
|
this.hiddens.forEach((el) => {
|
||||||
@@ -182,6 +171,7 @@ class Elements {
|
|||||||
img.setAttribute("srcset", srcset);
|
img.setAttribute("srcset", srcset);
|
||||||
img.setAttribute("srcset_old", "");
|
img.setAttribute("srcset_old", "");
|
||||||
});
|
});
|
||||||
|
document.body.style.lineHeight = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user