fix: resolve build errors in session-stability branch
1. Vite config: make HTTPS conditional on SSL cert/key files existing (pre-existing issue, broke builds when certs not present) 2. Drone reconnect handler: use socket.io Manager-level 'reconnect' event (this.socket.io.on) instead of Socket-level event, and add explicit type annotation for attemptNumber parameter
This commit is contained in:
parent
009863cf2b
commit
9418d95e35
@ -14,10 +14,17 @@ export default defineConfig({
|
||||
server: {
|
||||
port: 5174,
|
||||
host: '0.0.0.0',
|
||||
https: {
|
||||
key: fs.readFileSync(path.join(rootDir, 'ssl', 'code-dev.g4dge7.com.key')),
|
||||
cert: fs.readFileSync(path.join(rootDir, 'ssl', 'code-dev.g4dge7.com.crt')),
|
||||
},
|
||||
https: (() => {
|
||||
const keyPath = path.join(rootDir, 'ssl', 'code-dev.g4dge7.com.key');
|
||||
const certPath = path.join(rootDir, 'ssl', 'code-dev.g4dge7.com.crt');
|
||||
if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
|
||||
return {
|
||||
key: fs.readFileSync(keyPath),
|
||||
cert: fs.readFileSync(certPath),
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
})(),
|
||||
hmr: {
|
||||
host: 'code-dev.g4dge7.com',
|
||||
port: 5174,
|
||||
|
||||
@ -268,8 +268,10 @@ class GadgetDrone extends GadgetProcess {
|
||||
/*
|
||||
* Handle socket reconnect: re-emit current drone status so the
|
||||
* platform knows the drone is still alive and available.
|
||||
* NOTE: "reconnect" is a Manager-level event in Socket.IO v4,
|
||||
* not a Socket-level event, so we listen on socket.io.
|
||||
*/
|
||||
this.socket.on("reconnect", (attemptNumber) => {
|
||||
this.socket.io.on("reconnect", (attemptNumber: number) => {
|
||||
this.log.info("socket reconnected to platform", { attemptNumber });
|
||||
if (this.sessionLock) {
|
||||
this.socket?.emit("status", "session lock active (reconnected)");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user