Compare commits

...

8 Commits

Author SHA1 Message Date
lencx
fec14cd6a4 v0.1.3 2022-12-07 22:12:17 +08:00
lencx
50e46f4064 fix: build error 2022-12-07 22:12:05 +08:00
lencx
dd51ffbf1d v0.1.3 2022-12-07 22:04:12 +08:00
lencx
7a682d0177 v0.1.2 2022-12-07 21:43:55 +08:00
lencx
4239775127 fix: build error 2022-12-07 21:43:32 +08:00
lencx
89cea44f8b readme 2022-12-07 21:06:51 +08:00
lencx
ee4b14daf1 v0.1.1 2022-12-07 21:01:12 +08:00
lencx
08ea541130 fix: build error 2022-12-07 21:00:19 +08:00
6 changed files with 54 additions and 13 deletions

View File

@@ -75,7 +75,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install app dependencies and build it
run: yarn && yarn build
run: yarn
- uses: tauri-apps/tauri-action@v0.3
env:

View File

@@ -5,12 +5,16 @@
> ChatGPT Desktop Application
[🚀 Download ChatGPT](https://github.com/lencx/ChatGPT/releases)
## Features
- multi-platform: `macOS` `Linux` `Windows`
- inject script
- auto updater
- hotkey
- app menu
- system tray
- shortcut
## Preview

View File

@@ -1,5 +1,17 @@
# UPDATE LOG
## v0.1.3
fix: only mac supports `TitleBarStyle`
## v0.1.2
initialization
## v0.1.1
initialization
## v0.1.0
initialization

View File

@@ -1,10 +1,14 @@
use crate::utils;
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, TitleBarStyle};
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App};
#[cfg(target_os = "macos")]
use tauri::TitleBarStyle;
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
let conf = utils::get_tauri_conf().unwrap();
let url = conf.build.dev_path.to_string();
#[cfg(target_os = "macos")]
WindowBuilder::new(app, "core", WindowUrl::App(url.into()))
.resizable(true)
.fullscreen(false)
@@ -16,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")
.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(())
}

View File

@@ -36,16 +36,26 @@ document.addEventListener('DOMContentLoaded', async () => {
});
}
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);
async function platform() {
return invoke('platform', {
__tauriModule: 'Os',
message: { cmd: 'platform' }
});
}
topDom.addEventListener("mousedown", () => invoke("drag_window"));
topDom.addEventListener("touchstart", () => invoke("drag_window"));
topDom.addEventListener("dblclick", () => invoke("fullscreen"));
const _platform = await platform();
if (/darwin/.test(_platform)) {
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) => {
const origin = e.target.closest("a");

View File

@@ -7,7 +7,7 @@
},
"package": {
"productName": "ChatGPT",
"version": "0.1.0"
"version": "0.1.3"
},
"tauri": {
"allowlist": {