mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
feat: use eletron to build desktop version for chatgpt-plus
This commit is contained in:
parent
e3d18643b8
commit
545c8fa482
2
desktop/.gitignore
vendored
Normal file
2
desktop/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
BIN
desktop/icons/logo.ico
Executable file
BIN
desktop/icons/logo.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
29
desktop/index.js
Executable file
29
desktop/index.js
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
const { app, BrowserWindow, Menu } = require('electron');
|
||||||
|
|
||||||
|
app.on('ready', () => {
|
||||||
|
|
||||||
|
const loadingWindow = new BrowserWindow({ width: 400, height: 300, frame: false });
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
|
width: 1,
|
||||||
|
height: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 先隐藏主窗口
|
||||||
|
mainWindow.hide()
|
||||||
|
// 加载第三方网站
|
||||||
|
mainWindow.loadURL('https://ai.r9it.com');
|
||||||
|
// 加载 loading.html 文件
|
||||||
|
loadingWindow.loadFile('loading.html');
|
||||||
|
// 隐藏菜单
|
||||||
|
Menu.setApplicationMenu(null);
|
||||||
|
|
||||||
|
// 监听 loading.html 窗口的 'show-main-window' 事件
|
||||||
|
mainWindow.webContents.on('did-finish-load', () => {
|
||||||
|
// 最大化窗口
|
||||||
|
mainWindow.maximize();
|
||||||
|
// 显示主窗口
|
||||||
|
mainWindow.show();
|
||||||
|
// 关闭加载窗口
|
||||||
|
loadingWindow.close();
|
||||||
|
});
|
||||||
|
});
|
31
desktop/loading.html
Executable file
31
desktop/loading.html
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loader {
|
||||||
|
border: 4px solid #f3f3f3;
|
||||||
|
border-top: 4px solid #3498db;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
animation: spin 2s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="loader"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
35
desktop/package.json
Executable file
35
desktop/package.json
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "chatgpt-plus-desktop",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron .",
|
||||||
|
"package": "electron-builder",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "ai.r9it.com",
|
||||||
|
"productName": "ChatGPT-Plus",
|
||||||
|
"directories": {
|
||||||
|
"output": "dist"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"mac": {
|
||||||
|
"target": "dmg"
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"target": "nsis",
|
||||||
|
"icon": "icons/logo.ico"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"author": "geekmaster",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"electron": "^26.1.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user