mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
chore: build
This commit is contained in:
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: '${{ steps.get_version.outputs.VERSION }}'
|
||||
release_name: 'WA+ ${{ steps.get_version.outputs.VERSION }}'
|
||||
release_name: 'ChatGPT ${{ steps.get_version.outputs.VERSION }}'
|
||||
body: 'See the assets to download this version and install.'
|
||||
|
||||
build-tauri:
|
||||
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,7 +1,9 @@
|
||||
.DS_Store
|
||||
*.lock
|
||||
|
||||
package-lock.json
|
||||
node_modules/
|
||||
target/
|
||||
yarn.lock
|
||||
|
||||
target/
|
||||
Cargo.lock
|
||||
yarn.lock
|
||||
25
README.md
25
README.md
@@ -1,2 +1,23 @@
|
||||
# ChatGPT
|
||||
ChatGPT Desktop Application
|
||||
<p align="center">
|
||||
<img width="180" src="./logo.png" alt="ChatGPT">
|
||||
<h1 align="center">ChatGPT</h1>
|
||||
</p>
|
||||
|
||||
> ChatGPT Desktop Application
|
||||
|
||||
## Features
|
||||
|
||||
- multi-platform: `macOS` `Linux` `Windows`
|
||||
- inject script
|
||||
- auto updater
|
||||
- hotkey
|
||||
|
||||
## Preview
|
||||
|
||||
<img width="600" src="./assets/install.png" alt="install">
|
||||
<img width="600" src="./assets/chat.png" alt="chat">
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] export chat history
|
||||
- [ ] ...
|
||||
|
||||
5
UPDATE_LOG.md
Normal file
5
UPDATE_LOG.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# UPDATE LOG
|
||||
|
||||
## v0.1.0
|
||||
|
||||
initialization
|
||||
BIN
assets/chat.png
Normal file
BIN
assets/chat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 754 KiB |
BIN
assets/install.png
Normal file
BIN
assets/install.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 218 KiB |
13
package.json
13
package.json
@@ -1,8 +1,6 @@
|
||||
{
|
||||
"name": "chatgpt",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "yarn tauri dev",
|
||||
"build": "yarn tauri build",
|
||||
@@ -11,8 +9,17 @@
|
||||
"tr": "tr",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "lencx <cxin1314@gmail.com>",
|
||||
"keywords": ["chatgpt", "app", "desktop", "tauri", "macos", "linux", "windows"],
|
||||
"homepage": "https://github.com/lencx/ChatGPT",
|
||||
"bugs": "https://github.com/lencx/ChatGPT/issues",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lencx/ChatGPT"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.1",
|
||||
"@tauri-release/cli": "^0.2.0"
|
||||
"@tauri-release/cli": "^0.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ rust-version = "1.57"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = {version = "1.2", features = [] }
|
||||
tauri-build = {version = "1.2.1", features = [] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = {version = "1.2", features = ["api-all", "system-tray"] }
|
||||
tauri = { version = "1.2.1", features = ["api-all", "devtools", "system-tray", "updater"] }
|
||||
anyhow = "1.0.66"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -1,5 +1,41 @@
|
||||
// *** Core Script ***
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const uid = () => window.crypto.getRandomValues(new Uint32Array(1))[0];
|
||||
function transformCallback(callback = () => {}, once = false) {
|
||||
const identifier = uid();
|
||||
const prop = `_${identifier}`;
|
||||
Object.defineProperty(window, prop, {
|
||||
value: (result) => {
|
||||
if (once) {
|
||||
Reflect.deleteProperty(window, prop);
|
||||
}
|
||||
return callback(result)
|
||||
},
|
||||
writable: false,
|
||||
configurable: true,
|
||||
})
|
||||
return identifier;
|
||||
}
|
||||
async function invoke(cmd, args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!window.__TAURI_POST_MESSAGE__) reject('__TAURI_POST_MESSAGE__ does not exist!');
|
||||
const callback = transformCallback((e) => {
|
||||
resolve(e);
|
||||
Reflect.deleteProperty(window, `_${error}`);
|
||||
}, true)
|
||||
const error = transformCallback((e) => {
|
||||
reject(e);
|
||||
Reflect.deleteProperty(window, `_${callback}`);
|
||||
}, true)
|
||||
window.__TAURI_POST_MESSAGE__({
|
||||
cmd,
|
||||
callback,
|
||||
error,
|
||||
...args
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -7,9 +43,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
topDom.id = "chatgpt-app-window-top";
|
||||
document.body.appendChild(topDom);
|
||||
|
||||
topDom.addEventListener("mousedown", () => __TAURI_INVOKE__("drag_window"));
|
||||
topDom.addEventListener("touchstart", () => __TAURI_INVOKE__("drag_window"));
|
||||
topDom.addEventListener("dblclick", () => __TAURI_INVOKE__("fullscreen"));
|
||||
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");
|
||||
|
||||
@@ -13,7 +13,7 @@ fn main() {
|
||||
let context = tauri::generate_context!();
|
||||
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![cmd::drag_window, cmd::fullscreen,])
|
||||
.invoke_handler(tauri::generate_handler![cmd::drag_window, cmd::fullscreen])
|
||||
.setup(setup::init)
|
||||
.menu(menu::init(&context))
|
||||
.system_tray(SystemTray::new())
|
||||
|
||||
@@ -10,18 +10,6 @@ pub fn get_tauri_conf() -> Option<Config> {
|
||||
Some(config)
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug)]
|
||||
pub struct WaJson {
|
||||
pub url: String,
|
||||
pub resizable: bool,
|
||||
pub theme: tauri::Theme,
|
||||
pub mode: String,
|
||||
pub title: String,
|
||||
pub always_on_top: bool,
|
||||
pub hidden_title: bool,
|
||||
pub hide_title_bar: bool,
|
||||
}
|
||||
|
||||
pub fn exists(path: &Path) -> bool {
|
||||
Path::new(path).exists()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "ChatGPT",
|
||||
"version": "../package.json"
|
||||
"version": "0.0.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "ChatGPT",
|
||||
"category": "DeveloperTool",
|
||||
"copyright": "",
|
||||
"deb": {
|
||||
"depends": []
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"url": "https://weread.qq.com",
|
||||
"resizable": true,
|
||||
"theme": "Light",
|
||||
"mode": "PC",
|
||||
"title": "WA",
|
||||
"always_on_top": false,
|
||||
"hidden_title": true,
|
||||
"hide_title_bar": true
|
||||
}
|
||||
Reference in New Issue
Block a user