diff --git a/src/index.ts b/src/index.ts index 8bc1983..2a59325 100644 --- a/src/index.ts +++ b/src/index.ts @@ -127,14 +127,16 @@ app.get("/start", async (req, res) => { type, buildName, ownerIp, + hostname: sessionServer.hostname, + localIP: sessionServer.localIP, }); } return res.json({ stream: result.id }); } catch (error) { - if (error instanceof Error) { - return res.json({ error: error.message }); - } + console.log("error", error); + continue; + // return res.json({ error: (error as Error).message }); } } @@ -202,6 +204,17 @@ app.get("/session_servers", async (req, res) => { } }); +app.get("/launch_logs", async (req, res) => { + try { + const result = await LaunchLog.find().limit(200); + res.json(result); + } catch (error) { + if (error instanceof Error) { + res.json({ error: error.message }); + } + } +}); + app.listen(port, () => { console.log(`Server is listening on port ${port}`); }); @@ -227,9 +240,7 @@ async function checkActiveSessions() { console.log("Result:", result); } catch (error) { - if (error instanceof Error) { - console.log({ error }); - } + console.log({ error }); } } } diff --git a/src/models/LaunchLog.ts b/src/models/LaunchLog.ts index 73899a2..addde94 100644 --- a/src/models/LaunchLog.ts +++ b/src/models/LaunchLog.ts @@ -22,6 +22,14 @@ const launchLogSchema = new Schema( type: String, required: true, }, + hostname: { + type: String, + required: true, + }, + localIP: { + type: String, + required: true, + }, }, { timestamps: true,