mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 04:43:36 +00:00
fix: desktop local server failure (#756)
* fix: remote desktop blank screen * fix: desktop local server failure
This commit is contained in:
@@ -6,7 +6,12 @@
|
|||||||
"output": "release"
|
"output": "release"
|
||||||
},
|
},
|
||||||
"asar": true,
|
"asar": true,
|
||||||
"asarUnpack": ["dist/backend/**/*", "node_modules/**/*"],
|
"asarUnpack": [
|
||||||
|
"dist/backend/**/*",
|
||||||
|
"node_modules/**/*",
|
||||||
|
"public/icons/**/*",
|
||||||
|
"public/icon.*"
|
||||||
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"electron/**/*",
|
"electron/**/*",
|
||||||
|
|||||||
+9
-3
@@ -709,15 +709,21 @@ function createTray() {
|
|||||||
try {
|
try {
|
||||||
const { nativeImage } = require("electron");
|
const { nativeImage } = require("electron");
|
||||||
|
|
||||||
|
// Native APIs (Tray, nativeImage) can't load files from inside app.asar —
|
||||||
|
// use the unpacked path so the OS sees a real file.
|
||||||
|
const publicRoot = isDev
|
||||||
|
? path.join(appRoot, "public")
|
||||||
|
: path.join(appRoot.replace("app.asar", "app.asar.unpacked"), "public");
|
||||||
|
|
||||||
let trayIcon;
|
let trayIcon;
|
||||||
if (process.platform === "darwin") {
|
if (process.platform === "darwin") {
|
||||||
const iconPath = path.join(appRoot, "public", "icons", "16x16.png");
|
const iconPath = path.join(publicRoot, "icons", "16x16.png");
|
||||||
trayIcon = nativeImage.createFromPath(iconPath);
|
trayIcon = nativeImage.createFromPath(iconPath);
|
||||||
trayIcon.setTemplateImage(true);
|
trayIcon.setTemplateImage(true);
|
||||||
} else if (process.platform === "win32") {
|
} else if (process.platform === "win32") {
|
||||||
trayIcon = path.join(appRoot, "public", "icon.ico");
|
trayIcon = path.join(publicRoot, "icon.ico");
|
||||||
} else {
|
} else {
|
||||||
trayIcon = path.join(appRoot, "public", "icons", "32x32.png");
|
trayIcon = path.join(publicRoot, "icons", "32x32.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
tray = new Tray(trayIcon);
|
tray = new Tray(trayIcon);
|
||||||
|
|||||||
@@ -61,9 +61,11 @@ const authenticateJWT = authManager.createAuthMiddleware();
|
|||||||
const requireAdmin = authManager.createAdminMiddleware();
|
const requireAdmin = authManager.createAdminMiddleware();
|
||||||
app.use(createCorsMiddleware());
|
app.use(createCorsMiddleware());
|
||||||
|
|
||||||
|
const uploadsDir = path.join(process.env.DATA_DIR || "./db/data", "uploads");
|
||||||
|
|
||||||
const storage = multer.diskStorage({
|
const storage = multer.diskStorage({
|
||||||
destination: (req, file, cb) => {
|
destination: (req, file, cb) => {
|
||||||
cb(null, "uploads/");
|
cb(null, uploadsDir);
|
||||||
},
|
},
|
||||||
filename: (req, file, cb) => {
|
filename: (req, file, cb) => {
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
@@ -2018,7 +2020,6 @@ httpServer.on("error", (err: NodeJS.ErrnoException) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
httpServer.listen(HTTP_PORT, async () => {
|
httpServer.listen(HTTP_PORT, async () => {
|
||||||
const uploadsDir = path.join(process.cwd(), "uploads");
|
|
||||||
if (!fs.existsSync(uploadsDir)) {
|
if (!fs.existsSync(uploadsDir)) {
|
||||||
fs.mkdirSync(uploadsDir, { recursive: true });
|
fs.mkdirSync(uploadsDir, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user