Compare commits

...

4 Commits
master ... exe

Author SHA1 Message Date
766fbb12b4 [mod] 砍掉安裝檔 2024-08-30 16:00:46 +08:00
f54b9e1848 [mod] 砍掉安裝檔 2024-08-30 16:00:04 +08:00
1152652bf7 [add] exe 2024-08-30 15:57:46 +08:00
3b84cd0511 [add] exe 2024-08-30 15:56:28 +08:00
78 changed files with 38 additions and 5580 deletions

16
.gitignore vendored
View File

@ -1,3 +1,13 @@
/dist /win-unpacked/LICENSE.electron.txt
/node_modules /win-unpacked/LICENSES.chromium.html
/release /win-unpacked/chrome_100_percent.pak
/win-unpacked/chrome_200_percent.pak
/win-unpacked/d3dcompiler_47.dll
/win-unpacked/snapshot_blob.bin
/win-unpacked/vk_swiftshader.dll
/win-unpacked/vk_swiftshader_icd.json
/win-unpacked/vulkan-1.dll
/SDServer Setup 1.0.0.exe
/SDServer Setup 1.0.0.exe.blockmap
/builder-debug.yml
/builder-effective-config.yaml

20
.vscode/launch.json vendored
View File

@ -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
View File

@ -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": []
}
]
}

View File

@ -1,10 +0,0 @@
{
"watch": [
"src"
],
"ext": "ts",
"exec": "npm run build",
"ignore": [
"dist"
]
}

5233
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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": ""
}

9
src/global.d.ts vendored
View File

@ -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;
};
}

View File

@ -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>

View File

@ -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();
});

View File

@ -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))
});

View File

@ -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);
// });

View File

@ -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');

View File

@ -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
win-unpacked/SDServer.exe Normal file

Binary file not shown.

BIN
win-unpacked/ffmpeg.dll Normal file

Binary file not shown.

BIN
win-unpacked/icudtl.dat Normal file

Binary file not shown.

BIN
win-unpacked/libEGL.dll Normal file

Binary file not shown.

BIN
win-unpacked/libGLESv2.dll Normal file

Binary file not shown.

BIN
win-unpacked/locales/af.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/am.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ar.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/bg.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/bn.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ca.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/cs.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/da.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/de.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/el.pak Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
win-unpacked/locales/es.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/et.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/fa.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/fi.pak Normal file

Binary file not shown.

Binary file not shown.

BIN
win-unpacked/locales/fr.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/gu.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/he.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/hi.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/hr.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/hu.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/id.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/it.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ja.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/kn.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ko.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/lt.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/lv.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ml.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/mr.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ms.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/nb.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/nl.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/pl.pak Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
win-unpacked/locales/ro.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ru.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/sk.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/sl.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/sr.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/sv.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/sw.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ta.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/te.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/th.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/tr.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/uk.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/ur.pak Normal file

Binary file not shown.

BIN
win-unpacked/locales/vi.pak Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
win-unpacked/resources.pak Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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]]}
]
}

Binary file not shown.