mirror of
https://github.com/QYG2297248353/IYUUPlus-Windows.git
synced 2025-03-04 11:44:24 +08:00
打包完成
This commit is contained in:
parent
e8aad4690c
commit
16de4f118e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
node_modules/*
|
node_modules/*
|
||||||
|
out/*
|
@ -4,6 +4,11 @@ const { FuseV1Options, FuseVersion } = require('@electron/fuses');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
packagerConfig: {
|
packagerConfig: {
|
||||||
asar: true,
|
asar: true,
|
||||||
|
icon: 'iyuu.png',
|
||||||
|
extraResource: [
|
||||||
|
'run/',
|
||||||
|
'iyuu/'
|
||||||
|
]
|
||||||
},
|
},
|
||||||
rebuildConfig: {},
|
rebuildConfig: {},
|
||||||
makers: [
|
makers: [
|
||||||
|
2
iyuu
2
iyuu
@ -1 +1 @@
|
|||||||
Subproject commit 64e149b2debcf38fe0b8c8d6003cf5e71dedf1e7
|
Subproject commit f7eed461a0d812a3b5c1adb96047a09021d87857
|
13
main.js
13
main.js
@ -1,4 +1,4 @@
|
|||||||
const { app, BrowserWindow, Menu } = require('electron')
|
const { app, BrowserWindow } = require('electron')
|
||||||
const path = require('node:path')
|
const path = require('node:path')
|
||||||
const server = require('./server/server');
|
const server = require('./server/server');
|
||||||
|
|
||||||
@ -18,11 +18,14 @@ const createWindow = () => {
|
|||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
server.startServer()
|
server.startServer()
|
||||||
createWindow()
|
console.log("[About] 新疆萌森软件开发工作室提供技术支持");
|
||||||
|
|
||||||
app.on('activate', () => {
|
setTimeout(() => {
|
||||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
createWindow()
|
||||||
})
|
app.on('activate', () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
|
})
|
||||||
|
}, 5000)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const treeKill = require('tree-kill');
|
const treeKill = require('tree-kill');
|
||||||
|
|
||||||
function getCmdPath() {
|
function getCmdPath(resourcePath) {
|
||||||
const arch = os.arch();
|
const arch = os.arch();
|
||||||
if (arch === 'x64') {
|
if (arch === 'x64') {
|
||||||
return "./run/php-8.3.8-x64/php.exe";
|
return path.join(resourcePath, 'run', 'php-8.3.8-x64', 'php.exe');
|
||||||
} else if (arch === 'ia32') {
|
} else if (arch === 'ia32') {
|
||||||
return "./run/php-8.3.8-x86/php.exe";
|
return path.join(resourcePath, 'run', 'php-8.3.8-x86', 'php.exe');
|
||||||
} else {
|
} else {
|
||||||
console.error("Unsupported architecture:", arch);
|
console.error("Unsupported architecture:", arch);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@ -18,9 +19,14 @@ function getCmdPath() {
|
|||||||
let serverProcess = null;
|
let serverProcess = null;
|
||||||
|
|
||||||
function startServer() {
|
function startServer() {
|
||||||
const cmdPath = getCmdPath();
|
let resourcePath = process.resourcesPath;
|
||||||
const args = ['./iyuu/windows.php'];
|
if (resourcePath.includes('node_modules')) {
|
||||||
const workingDirectory = path.resolve(__dirname, '..');
|
resourcePath = process.cwd();
|
||||||
|
}
|
||||||
|
|
||||||
|
const cmdPath = getCmdPath(resourcePath);
|
||||||
|
const args = [path.join(resourcePath, 'iyuu', 'windows.php')];
|
||||||
|
const workingDirectory = path.resolve(resourcePath);
|
||||||
|
|
||||||
const env = { ...process.env };
|
const env = { ...process.env };
|
||||||
const phpDir = path.dirname(cmdPath);
|
const phpDir = path.dirname(cmdPath);
|
||||||
@ -29,16 +35,17 @@ function startServer() {
|
|||||||
serverProcess = spawn(cmdPath, args, {
|
serverProcess = spawn(cmdPath, args, {
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
stdio: ['inherit', 'pipe', 'inherit'],
|
stdio: ['inherit', 'pipe', 'inherit'],
|
||||||
env: env
|
env: env,
|
||||||
|
windowsHide: true
|
||||||
});
|
});
|
||||||
|
|
||||||
serverProcess.stdout.setEncoding('utf8');
|
serverProcess.stdout.setEncoding('utf8');
|
||||||
|
|
||||||
serverProcess.stdout.on("data", function (data) {
|
serverProcess.stdout.on("data", function (data) {
|
||||||
console.log("启动服务器成功! stdout:" + data);
|
console.log("[IYUU] 服务启动成功");
|
||||||
});
|
});
|
||||||
serverProcess.on("close", function (code) {
|
serverProcess.on("close", function (code) {
|
||||||
console.log("out code:" + code);
|
console.log("[IYUU] 服务退出:" + code);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user