[add] exe
This commit is contained in:
parent
0271674764
commit
3b84cd0511
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
/dist
|
||||
/node_modules
|
||||
/release
|
20
.vscode/launch.json
vendored
20
.vscode/launch.json
vendored
@ -1,20 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Main Process",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
"windows": {
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd"
|
||||
},
|
||||
"args": ["."],
|
||||
"outputCapture": "std",
|
||||
"sourceMaps": true,
|
||||
"restart": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
20
.vscode/tasks.json
vendored
20
.vscode/tasks.json
vendored
@ -1,20 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "npm: build",
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": ["run", "build"],
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "npm: start",
|
||||
"type": "shell",
|
||||
"command": "npm",
|
||||
"args": ["start"],
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
BIN
SDServer.exe
Normal file
BIN
SDServer.exe
Normal file
Binary file not shown.
BIN
ffmpeg.dll
Normal file
BIN
ffmpeg.dll
Normal file
Binary file not shown.
BIN
icudtl.dat
Normal file
BIN
icudtl.dat
Normal file
Binary file not shown.
BIN
libEGL.dll
Normal file
BIN
libEGL.dll
Normal file
Binary file not shown.
BIN
libGLESv2.dll
Normal file
BIN
libGLESv2.dll
Normal file
Binary file not shown.
BIN
locales/af.pak
Normal file
BIN
locales/af.pak
Normal file
Binary file not shown.
BIN
locales/am.pak
Normal file
BIN
locales/am.pak
Normal file
Binary file not shown.
BIN
locales/ar.pak
Normal file
BIN
locales/ar.pak
Normal file
Binary file not shown.
BIN
locales/bg.pak
Normal file
BIN
locales/bg.pak
Normal file
Binary file not shown.
BIN
locales/bn.pak
Normal file
BIN
locales/bn.pak
Normal file
Binary file not shown.
BIN
locales/ca.pak
Normal file
BIN
locales/ca.pak
Normal file
Binary file not shown.
BIN
locales/cs.pak
Normal file
BIN
locales/cs.pak
Normal file
Binary file not shown.
BIN
locales/da.pak
Normal file
BIN
locales/da.pak
Normal file
Binary file not shown.
BIN
locales/de.pak
Normal file
BIN
locales/de.pak
Normal file
Binary file not shown.
BIN
locales/el.pak
Normal file
BIN
locales/el.pak
Normal file
Binary file not shown.
BIN
locales/en-GB.pak
Normal file
BIN
locales/en-GB.pak
Normal file
Binary file not shown.
BIN
locales/en-US.pak
Normal file
BIN
locales/en-US.pak
Normal file
Binary file not shown.
BIN
locales/es-419.pak
Normal file
BIN
locales/es-419.pak
Normal file
Binary file not shown.
BIN
locales/es.pak
Normal file
BIN
locales/es.pak
Normal file
Binary file not shown.
BIN
locales/et.pak
Normal file
BIN
locales/et.pak
Normal file
Binary file not shown.
BIN
locales/fa.pak
Normal file
BIN
locales/fa.pak
Normal file
Binary file not shown.
BIN
locales/fi.pak
Normal file
BIN
locales/fi.pak
Normal file
Binary file not shown.
BIN
locales/fil.pak
Normal file
BIN
locales/fil.pak
Normal file
Binary file not shown.
BIN
locales/fr.pak
Normal file
BIN
locales/fr.pak
Normal file
Binary file not shown.
BIN
locales/gu.pak
Normal file
BIN
locales/gu.pak
Normal file
Binary file not shown.
BIN
locales/he.pak
Normal file
BIN
locales/he.pak
Normal file
Binary file not shown.
BIN
locales/hi.pak
Normal file
BIN
locales/hi.pak
Normal file
Binary file not shown.
BIN
locales/hr.pak
Normal file
BIN
locales/hr.pak
Normal file
Binary file not shown.
BIN
locales/hu.pak
Normal file
BIN
locales/hu.pak
Normal file
Binary file not shown.
BIN
locales/id.pak
Normal file
BIN
locales/id.pak
Normal file
Binary file not shown.
BIN
locales/it.pak
Normal file
BIN
locales/it.pak
Normal file
Binary file not shown.
BIN
locales/ja.pak
Normal file
BIN
locales/ja.pak
Normal file
Binary file not shown.
BIN
locales/kn.pak
Normal file
BIN
locales/kn.pak
Normal file
Binary file not shown.
BIN
locales/ko.pak
Normal file
BIN
locales/ko.pak
Normal file
Binary file not shown.
BIN
locales/lt.pak
Normal file
BIN
locales/lt.pak
Normal file
Binary file not shown.
BIN
locales/lv.pak
Normal file
BIN
locales/lv.pak
Normal file
Binary file not shown.
BIN
locales/ml.pak
Normal file
BIN
locales/ml.pak
Normal file
Binary file not shown.
BIN
locales/mr.pak
Normal file
BIN
locales/mr.pak
Normal file
Binary file not shown.
BIN
locales/ms.pak
Normal file
BIN
locales/ms.pak
Normal file
Binary file not shown.
BIN
locales/nb.pak
Normal file
BIN
locales/nb.pak
Normal file
Binary file not shown.
BIN
locales/nl.pak
Normal file
BIN
locales/nl.pak
Normal file
Binary file not shown.
BIN
locales/pl.pak
Normal file
BIN
locales/pl.pak
Normal file
Binary file not shown.
BIN
locales/pt-BR.pak
Normal file
BIN
locales/pt-BR.pak
Normal file
Binary file not shown.
BIN
locales/pt-PT.pak
Normal file
BIN
locales/pt-PT.pak
Normal file
Binary file not shown.
BIN
locales/ro.pak
Normal file
BIN
locales/ro.pak
Normal file
Binary file not shown.
BIN
locales/ru.pak
Normal file
BIN
locales/ru.pak
Normal file
Binary file not shown.
BIN
locales/sk.pak
Normal file
BIN
locales/sk.pak
Normal file
Binary file not shown.
BIN
locales/sl.pak
Normal file
BIN
locales/sl.pak
Normal file
Binary file not shown.
BIN
locales/sr.pak
Normal file
BIN
locales/sr.pak
Normal file
Binary file not shown.
BIN
locales/sv.pak
Normal file
BIN
locales/sv.pak
Normal file
Binary file not shown.
BIN
locales/sw.pak
Normal file
BIN
locales/sw.pak
Normal file
Binary file not shown.
BIN
locales/ta.pak
Normal file
BIN
locales/ta.pak
Normal file
Binary file not shown.
BIN
locales/te.pak
Normal file
BIN
locales/te.pak
Normal file
Binary file not shown.
BIN
locales/th.pak
Normal file
BIN
locales/th.pak
Normal file
Binary file not shown.
BIN
locales/tr.pak
Normal file
BIN
locales/tr.pak
Normal file
Binary file not shown.
BIN
locales/uk.pak
Normal file
BIN
locales/uk.pak
Normal file
Binary file not shown.
BIN
locales/ur.pak
Normal file
BIN
locales/ur.pak
Normal file
Binary file not shown.
BIN
locales/vi.pak
Normal file
BIN
locales/vi.pak
Normal file
Binary file not shown.
BIN
locales/zh-CN.pak
Normal file
BIN
locales/zh-CN.pak
Normal file
Binary file not shown.
BIN
locales/zh-TW.pak
Normal file
BIN
locales/zh-TW.pak
Normal file
Binary file not shown.
10
nodemon.json
10
nodemon.json
@ -1,10 +0,0 @@
|
||||
{
|
||||
"watch": [
|
||||
"src"
|
||||
],
|
||||
"ext": "ts",
|
||||
"exec": "npm run build",
|
||||
"ignore": [
|
||||
"dist"
|
||||
]
|
||||
}
|
5233
package-lock.json
generated
5233
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
51
package.json
51
package.json
@ -1,51 +0,0 @@
|
||||
{
|
||||
"name": "sdserver",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"build": "tsc && copyfiles -u 1 src/index.html dist/",
|
||||
"pack": "electron-packager . SDServer --platform=win32 --arch=x64 --out=dist/",
|
||||
"buildexe": "npx electron-builder",
|
||||
"watch": "nodemon"
|
||||
},
|
||||
"build": {
|
||||
"appId": "SDServer",
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
"node_modules/**/*",
|
||||
"package.json"
|
||||
],
|
||||
"directories": {
|
||||
"output": "release"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": "^8.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/electron": "^1.6.10",
|
||||
"@types/node": "^22.5.0",
|
||||
"@types/ws": "^8.5.12",
|
||||
"copyfiles": "^2.4.1",
|
||||
"electron": "^32.0.1",
|
||||
"electron-builder": "^24.7.0",
|
||||
"electron-packager": "^17.1.2",
|
||||
"nodemon": "^3.1.4",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.5.4"
|
||||
},
|
||||
"bin": "dist/server.js",
|
||||
"pkg": {
|
||||
"assets": [
|
||||
"public/**/*"
|
||||
],
|
||||
"outputPath": "executables",
|
||||
"targets": [
|
||||
"node18-win-x64"
|
||||
]
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": ""
|
||||
}
|
BIN
resources.pak
Normal file
BIN
resources.pak
Normal file
Binary file not shown.
BIN
resources/app.asar
Normal file
BIN
resources/app.asar
Normal file
Binary file not shown.
BIN
resources/elevate.exe
Normal file
BIN
resources/elevate.exe
Normal file
Binary file not shown.
25
resources/shared/jsons/slot1.json
Normal file
25
resources/shared/jsons/slot1.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"slotData": [
|
||||
{"slot":[11,4,8,9,5,2,13,10,7,9,10,6,6,12,4],"line":[[[5,11,12],161,200]]},
|
||||
{"slot":[9,6,2,5,4,14,10,9,13,10,4,5,5,2,2]},
|
||||
{"slot":[4,3,3,3,9,10,14,14,9,4,7,8,8,5,10],"free":[[1,2,3],3],"scatter":[[[1,2,3],300]]},
|
||||
{"slot":[1,2,4,5,6,7,3,3,3,8,9,10,11,12,13],"free":[[6,7,8],10],"scatter":[[[6,7,8],300]]}
|
||||
],
|
||||
"slotFreeData": [
|
||||
{"slot":[9,9,10,13,4,5,4,3,4,11,10,14,14,14,5]},
|
||||
{"slot":[12,6,8,12,11,7,12,11,5,5,11,5,3,10,9]},
|
||||
{"slot":[4,6,11,13,8,12,12,3,4,10,7,5,14,14,4]},
|
||||
{"slot":[12,11,9,14,6,7,2,3,8,8,11,10,10,7,14]},
|
||||
{"slot":[9,14,13,4,11,4,7,6,14,6,12,13,9,12,12]},
|
||||
{"slot":[10,3,12,13,5,6,4,8,4,9,13,14,11,14,4]},
|
||||
{"slot":[11,13,9,8,5,8,5,5,13,9,14,9,12,4,7]},
|
||||
{"slot":[10,14,13,9,8,6,6,6,4,13,13,12,9,14,4],"line":[[[5,6,7],122,300]]},
|
||||
{"slot":[13,9,5,14,4,9,4,12,12,11,4,14,8,7,6],"line":[[[10,6],195,300],[[10,6],213,300]]},
|
||||
{"slot":[5,9,9,3,11,10,4,5,12,5,4,14,12,5,9],"line":[[[10,6],195,300],[[10,6],213,300]]},
|
||||
{"slot":[2,8,13,2,10,9,12,5,11,4,5,2,12,5,8],"line":[[[0,6,12],49,150],[[0,11,2],61,150],[[0,11,7,13],70,3000],[[0,11,12],79,150],[[10,11,7,13],234,3000]]},
|
||||
{"slot":[5,12,13,3,4,10,2,5,8,8,2,9,12,10,9],"line":[[[10,1,12],183,150],[[10,6,2],195,150],[[10,6,12],213,150]]},
|
||||
{"slot":[14,4,10,3,11,5,14,3,12,6,10,6,14,5,12],"line":[[[0,6,12],49,750]],"scatter":[[[3,7],300]]},
|
||||
{"slot":[6,3,12,4,8,14,10,3,7,9,10,4,10,6,7],"line":[[[10,6,12],213,75]],"scatter":[[[1,7],300]]},
|
||||
{"slot":[9,12,3,7,2,6,13,11,3,11,13,3,8,6,6],"free":[[2,8,11],10],"scatter":[[[2,8,11],900]]}
|
||||
]
|
||||
}
|
9
src/global.d.ts
vendored
9
src/global.d.ts
vendored
@ -1,9 +0,0 @@
|
||||
// src/global.d.ts
|
||||
interface Window {
|
||||
electron: {
|
||||
startWebSocket: (port: number) => void;
|
||||
stopWebSocket: () => void;
|
||||
openDevTools: () => void;
|
||||
onWebSocketStatus: (callback: (message: string) => void) => void;
|
||||
};
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-TW">
|
||||
|
||||
<head>
|
||||
<title>WebSocket Control</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>SD Server Control</h1>
|
||||
|
||||
<label for="port">Port:</label>
|
||||
<input type="number" id="port" value="8080">
|
||||
<button id="startBtn">Start WebSocket Server</button>
|
||||
<button id="stopBtn">Stop WebSocket Server</button>
|
||||
<button id="devToolsBtn">Open DevTools</button>
|
||||
|
||||
<p id="status">Status: Waiting for actions...</p>
|
||||
<script src="renderer.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
96
src/main.ts
96
src/main.ts
@ -1,96 +0,0 @@
|
||||
// src/main.ts
|
||||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
import * as path from 'path';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
let server: WebSocketServer | null = null;
|
||||
let port = 8080; // 默认端口
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
// contextIsolation: false, // 使渲染進程能夠使用 Node.js
|
||||
// nodeIntegration: true, // 使渲染進程可以使用 Node.js 模組
|
||||
},
|
||||
});
|
||||
|
||||
win.loadFile(path.join(__dirname, 'index.html'));
|
||||
win.webContents.openDevTools();
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
let mainWindow: BrowserWindow | null = null;
|
||||
|
||||
app.whenReady().then(() => {
|
||||
mainWindow = createWindow();
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
// 启动 WebSocket 服务器
|
||||
ipcMain.on('start-websocket', (event, portNumber: number) => {
|
||||
if (server) {
|
||||
server.close();
|
||||
}
|
||||
|
||||
port = portNumber || 8080;
|
||||
|
||||
server = new WebSocketServer({ port: port });
|
||||
|
||||
server.on('connection', (socket) => {
|
||||
console.log(`WebSocket server started on port ${port}`);
|
||||
socket.send('Welcome to the WebSocket server');
|
||||
|
||||
socket.on('message', (message: string) => {
|
||||
console.log(`Received message: ${message}`);
|
||||
socket.send(`Server received your message: ${message}`);
|
||||
});
|
||||
|
||||
socket.on('close', () => {
|
||||
console.log('Client disconnected');
|
||||
});
|
||||
});
|
||||
|
||||
event.reply('websocket-status', `WebSocket server started on port ${port} 88`);
|
||||
});
|
||||
|
||||
// 关闭 WebSocket 服务器
|
||||
ipcMain.on('stop-websocket', (event) => {
|
||||
if (server) {
|
||||
server.clients.forEach(client => {
|
||||
if (client.readyState === 1) {
|
||||
client.close();
|
||||
}
|
||||
});
|
||||
server.close((err) => {
|
||||
if (err) {
|
||||
event.reply('websocket-status', 'Failed to stop WebSocket server');
|
||||
} else {
|
||||
event.reply('websocket-status', 'WebSocket server stopped');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
event.reply('websocket-status', 'No WebSocket server is running');
|
||||
}
|
||||
});
|
||||
|
||||
// 打开开发者工具
|
||||
ipcMain.on('open-devtools', () => {
|
||||
mainWindow.webContents.openDevTools();
|
||||
});
|
@ -1,9 +0,0 @@
|
||||
// src/preload.ts
|
||||
import { contextBridge, ipcRenderer } from 'electron';
|
||||
|
||||
contextBridge.exposeInMainWorld('electron', {
|
||||
startWebSocket: (port: number) => ipcRenderer.send('start-websocket', port),
|
||||
stopWebSocket: () => ipcRenderer.send('stop-websocket'),
|
||||
openDevTools: () => ipcRenderer.send('open-devtools'),
|
||||
onWebSocketStatus: (callback: (message: string) => void) => ipcRenderer.on('websocket-status', (event, message) => callback(message))
|
||||
});
|
@ -1,51 +0,0 @@
|
||||
document.getElementById('startBtn')?.addEventListener('click', () => {
|
||||
// console.log('Start WebSocket button clicked');
|
||||
const portElement = document.getElementById('port') as HTMLInputElement;
|
||||
const port = parseInt(portElement.value, 10);
|
||||
window.electron.startWebSocket(port);
|
||||
});
|
||||
|
||||
document.getElementById('stopBtn')?.addEventListener('click', () => {
|
||||
// console.log('Stop WebSocket button clicked');
|
||||
window.electron.stopWebSocket();
|
||||
});
|
||||
|
||||
document.getElementById('devToolsBtn')?.addEventListener('click', () => {
|
||||
// console.log('Open DevTools button clicked');
|
||||
window.electron.openDevTools();
|
||||
});
|
||||
|
||||
window.electron.onWebSocketStatus((message: string) => {
|
||||
console.log(`WebSocket status: ${message}`);
|
||||
const statusElement = document.getElementById('status');
|
||||
if (statusElement) {
|
||||
statusElement.innerText = `Status: ${message}`;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// document.getElementById('startBtn')?.addEventListener('click', () => {
|
||||
// // console.log('Start WebSocket button clicked');
|
||||
// const portElement = document.getElementById('port') as HTMLInputElement;
|
||||
// const port = parseInt(portElement.value, 10);
|
||||
// ipcRenderer.send('start-websocket', port);
|
||||
// });
|
||||
|
||||
// document.getElementById('stopBtn')?.addEventListener('click', () => {
|
||||
// // console.log('Stop WebSocket button clicked');
|
||||
// ipcRenderer.send('stop-websocket');
|
||||
// });
|
||||
|
||||
// document.getElementById('devToolsBtn')?.addEventListener('click', () => {
|
||||
// // console.log('Open DevTools button clicked');
|
||||
// ipcRenderer.send('open-devtools');
|
||||
// });
|
||||
|
||||
// function onWebSocketStatus(callback: (message: string) => void) {
|
||||
// ipcRenderer.on('websocket-status', (event, message) => callback(message));
|
||||
// }
|
||||
|
||||
// // 監聽 WebSocket 狀態
|
||||
// onWebSocketStatus((message) => {
|
||||
// console.log('WebSocket status:', message);
|
||||
// });
|
@ -1,25 +0,0 @@
|
||||
import WebSocket, { WebSocketServer } from 'ws';
|
||||
|
||||
const server = new WebSocketServer({ port: 8080 });
|
||||
|
||||
server.on('connection', (socket: WebSocket) => {
|
||||
console.log('客户端已连接');
|
||||
|
||||
// 发送消息到客户端
|
||||
socket.send('欢迎连接到WebSocket服务器');
|
||||
|
||||
// 接收来自客户端的消息
|
||||
socket.on('message', (message: string) => {
|
||||
console.log(`收到客户端消息: ${message}`);
|
||||
|
||||
// 回应消息
|
||||
socket.send(`服务器收到你的消息: ${message}`);
|
||||
});
|
||||
|
||||
// 处理客户端断开连接
|
||||
socket.on('close', () => {
|
||||
console.log('客户端已断开连接');
|
||||
});
|
||||
});
|
||||
|
||||
console.log('WebSocket服务器运行在 ws://localhost:8080');
|
@ -1,20 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020", // 设置 ECMAScript 版本
|
||||
"module": "CommonJS", // 使用 CommonJS 模块系统
|
||||
"sourceMap": true,
|
||||
"strict": false, // 启用严格模式
|
||||
"esModuleInterop": true, // 启用 ES 模块的兼容性
|
||||
"skipLibCheck": true, // 跳过库的类型检查
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
},
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
},
|
||||
"include": ["src/**/*"] // 包含 src 目录下的所有文件
|
||||
}
|
||||
|
BIN
v8_context_snapshot.bin
Normal file
BIN
v8_context_snapshot.bin
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user