From 24b2e3ae692ad02108d0f2799c95ce5953388467 Mon Sep 17 00:00:00 2001 From: unexp Date: Fri, 20 Jan 2023 10:27:48 -0300 Subject: [PATCH] What he say --- src/lib/classes/RCCService.js | 4 ++-- src/lua/{user.lua => fullbody.lua} | 0 src/lua/{user_headshot.lua => headshot.lua} | 0 src/routes/index.js | 16 +++++++++++----- 4 files changed, 13 insertions(+), 7 deletions(-) rename src/lua/{user.lua => fullbody.lua} (100%) rename src/lua/{user_headshot.lua => headshot.lua} (100%) diff --git a/src/lib/classes/RCCService.js b/src/lib/classes/RCCService.js index 642047c..a70b2e8 100644 --- a/src/lib/classes/RCCService.js +++ b/src/lib/classes/RCCService.js @@ -18,12 +18,12 @@ class RCCService extends EventEmitter { this.proc = child_process.spawn("wine", ["RCCService.exe", "-Console", "-PlaceId:-1", `-Port`, this.port], options) } this.proc.once("spawn", () => { - logger.info(`Spawning RCCService instance on port ${this.port}`); + logger.info(`Spawned RCCService instance on port ${this.port}`); resolve(this.proc) }) this.proc.once("exit", () => { this.proc = null; - logger.info(`Job has ended, closing RCCService on port ${this.port}`) + logger.info(`An RCCService instance has closed on port ${this.port}`) }) } catch (_) { logger.error(_); diff --git a/src/lua/user.lua b/src/lua/fullbody.lua similarity index 100% rename from src/lua/user.lua rename to src/lua/fullbody.lua diff --git a/src/lua/user_headshot.lua b/src/lua/headshot.lua similarity index 100% rename from src/lua/user_headshot.lua rename to src/lua/headshot.lua diff --git a/src/routes/index.js b/src/routes/index.js index 3224405..2a45b29 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -1,17 +1,20 @@ const waitPort = require("wait-port") +const logger = require(`${__dirname}\\..\\lib\\logger.js`) const { readFileSync, read } = require("fs") const express = require("express") const Job = require("../lib/classes/Job.js") +const { randomUUID } = require("crypto") const app = express.Router() let tempPort = 64990 app.all("*", async (request, response) => { - const job = new Job("KILL JACKD", tempPort) + const job = new Job(randomUUID(), tempPort) await job.Start() const { open } = await waitPort({ host: "127.0.0.1", port: tempPort, timeout: 5000, output: "silent" }) if (!open) { + logger.warn("Job could not be started because port is already taken. Closing job.."); job.Close() return response.json(false) } @@ -19,14 +22,17 @@ app.all("*", async (request, response) => { await job.CreateClient() const result = await job.Open({ name: job.id, - script: readFileSync(__dirname + "/../lua/user_headshot.lua", { encoding: "utf-8" }), + script: readFileSync(__dirname + "/../lua/headshot.lua", { encoding: "utf-8" }), arguments: { LuaValue: [ { type: "LUA_TSTRING", value: job.id }, - { type: "LUA_TSTRING", value: "RenderUserHeadshot" }, + { type: "LUA_TSTRING", value: "Headshot" }, { type: "LUA_TSTRING", value: "PNG" }, - { type: "LUA_TNUMBER", value: "1920" }, - { type: "LUA_TNUMBER", value: "1920" }, + + // change this to 1920x when we finish the arbiter + { type: "LUA_TNUMBER", value: "420" }, + { type: "LUA_TNUMBER", value: "420" }, + { type: "LUA_TSTRING", value: "https://sitetest.unexp.xyz" }, { type: "LUA_TNUMBER", value: "1" }, ],