mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fec14cd6a4 | ||
|
|
50e46f4064 | ||
|
|
dd51ffbf1d | ||
|
|
7a682d0177 | ||
|
|
4239775127 | ||
|
|
89cea44f8b |
@@ -12,7 +12,9 @@
|
|||||||
- multi-platform: `macOS` `Linux` `Windows`
|
- multi-platform: `macOS` `Linux` `Windows`
|
||||||
- inject script
|
- inject script
|
||||||
- auto updater
|
- auto updater
|
||||||
- hotkey
|
- app menu
|
||||||
|
- system tray
|
||||||
|
- shortcut
|
||||||
|
|
||||||
## Preview
|
## Preview
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
# UPDATE LOG
|
# UPDATE LOG
|
||||||
|
|
||||||
|
## v0.1.3
|
||||||
|
|
||||||
|
fix: only mac supports `TitleBarStyle`
|
||||||
|
|
||||||
|
## v0.1.2
|
||||||
|
|
||||||
|
initialization
|
||||||
|
|
||||||
## v0.1.1
|
## v0.1.1
|
||||||
|
|
||||||
- initialization
|
initialization
|
||||||
|
|
||||||
## v0.1.0
|
## v0.1.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
use crate::utils;
|
use crate::utils;
|
||||||
use tauri::{
|
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App};
|
||||||
utils::{config::WindowUrl, TitleBarStyle},
|
|
||||||
window::WindowBuilder,
|
#[cfg(target_os = "macos")]
|
||||||
App,
|
use tauri::TitleBarStyle;
|
||||||
};
|
|
||||||
|
|
||||||
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||||
let conf = utils::get_tauri_conf().unwrap();
|
let conf = utils::get_tauri_conf().unwrap();
|
||||||
let url = conf.build.dev_path.to_string();
|
let url = conf.build.dev_path.to_string();
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
WindowBuilder::new(app, "core", WindowUrl::App(url.into()))
|
WindowBuilder::new(app, "core", WindowUrl::App(url.into()))
|
||||||
.resizable(true)
|
.resizable(true)
|
||||||
.fullscreen(false)
|
.fullscreen(false)
|
||||||
@@ -20,5 +20,16 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
|||||||
.user_agent("5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")
|
.user_agent("5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
WindowBuilder::new(app, "core", WindowUrl::App(url.into()))
|
||||||
|
.resizable(true)
|
||||||
|
.fullscreen(false)
|
||||||
|
.initialization_script(include_str!("../core.js"))
|
||||||
|
.initialization_script(&utils::user_script())
|
||||||
|
.inner_size(800.0, 600.0)
|
||||||
|
.title("ChatGPT")
|
||||||
|
.user_agent("5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")
|
||||||
|
.build()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,16 +36,26 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const topStyleDom = document.createElement("style");
|
async function platform() {
|
||||||
topStyleDom.innerHTML = `#chatgpt-app-window-top{position:fixed;top:0;z-index:999999999;width:100%;height:24px;background:transparent;cursor:grab;cursor:-webkit-grab;user-select:none;-webkit-user-select:none;}#chatgpt-app-window-top:active {cursor:grabbing;cursor:-webkit-grabbing;}`;
|
return invoke('platform', {
|
||||||
document.head.appendChild(topStyleDom);
|
__tauriModule: 'Os',
|
||||||
const topDom = document.createElement("div");
|
message: { cmd: 'platform' }
|
||||||
topDom.id = "chatgpt-app-window-top";
|
});
|
||||||
document.body.appendChild(topDom);
|
}
|
||||||
|
|
||||||
topDom.addEventListener("mousedown", () => invoke("drag_window"));
|
const _platform = await platform();
|
||||||
topDom.addEventListener("touchstart", () => invoke("drag_window"));
|
if (/darwin/.test(_platform)) {
|
||||||
topDom.addEventListener("dblclick", () => invoke("fullscreen"));
|
const topStyleDom = document.createElement("style");
|
||||||
|
topStyleDom.innerHTML = `#chatgpt-app-window-top{position:fixed;top:0;z-index:999999999;width:100%;height:24px;background:transparent;cursor:grab;cursor:-webkit-grab;user-select:none;-webkit-user-select:none;}#chatgpt-app-window-top:active {cursor:grabbing;cursor:-webkit-grabbing;}`;
|
||||||
|
document.head.appendChild(topStyleDom);
|
||||||
|
const topDom = document.createElement("div");
|
||||||
|
topDom.id = "chatgpt-app-window-top";
|
||||||
|
document.body.appendChild(topDom);
|
||||||
|
|
||||||
|
topDom.addEventListener("mousedown", () => invoke("drag_window"));
|
||||||
|
topDom.addEventListener("touchstart", () => invoke("drag_window"));
|
||||||
|
topDom.addEventListener("dblclick", () => invoke("fullscreen"));
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener("click", (e) => {
|
document.addEventListener("click", (e) => {
|
||||||
const origin = e.target.closest("a");
|
const origin = e.target.closest("a");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "ChatGPT",
|
"productName": "ChatGPT",
|
||||||
"version": "0.1.1"
|
"version": "0.1.3"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|||||||
Reference in New Issue
Block a user