Billions must commit

This commit is contained in:
unexp 2023-01-20 08:40:44 -03:00
parent 27675a3634
commit da3436db19
No known key found for this signature in database
GPG Key ID: BF66F09641C584C8
4 changed files with 22 additions and 14 deletions

View File

@ -2,7 +2,7 @@ const logger = require("./lib/logger.js")
const express = require("express")
const app = express()
process.env.RCCSERVICE_PATH = "/tmp/Release"
process.env.RCCSERVICE_PATH = "D:\\Projects\\Roblox\\Source\\UploadBits\\Win32-Release-RCCService\\"
app.use("/game/start", require("./routes/game/start.js"))
app.use("/game/stop", require("./routes/game/stop.js"))
@ -15,9 +15,9 @@ app.use("/render/game", require("./routes/render/game.js"))
app.use("*", require("./routes/index.js"))
app.listen(process.env.PORT || 5173, () => {
logger.info(`Listening on http://127.0.0.1:${process.env.PORT || 5173}/`)
logger.boot(`Listening on http://127.0.0.1:${process.env.PORT || 5173}/`)
})
process.on("uncaughtException", (err) => {
console.log(err)
logger.error(err)
})

View File

@ -1,5 +1,6 @@
const EventEmitter = require("events")
const child_process = require("child_process")
const logger = require(`${__dirname}\\..\\logger.js`)
class RCCService extends EventEmitter {
constructor(path = process.env.RCCSERVICE_PATH) {
@ -10,19 +11,24 @@ class RCCService extends EventEmitter {
start(port, options = { cwd: this.path }) {
return new Promise((resolve, reject) => {
try {
this.proc = child_process.spawn("wine", ["RCCService.exe", "-console", "-placeid:-1", `-port`, port], options)
this.proc.once("spawn", resolve(this.proc))
this.proc = child_process.spawn("RCCService.exe", ["-Console", "-PlaceId:-1", `-Port`, port], options)
this.proc.once("spawn", () => {
logger.info(`Spawning RCCService instance on port ${port}`);
resolve(this.proc)
})
this.proc.once("exit", () => {
this.proc = null
this.proc = null;
logger.info(`Job has ended, closing RCCService on port ${port}`)
})
} catch (_) {
logger.error(_);
reject(_)
}
})
}
stop(signal = "SIGTERM") {
if (!this.proc) throw new Error("Process is not running")
if (!this.proc) { logger.error("RCCService process is not running"); throw new Error("Process is not running") }
return this.proc.kill(signal)
}
}

View File

@ -1,10 +1,12 @@
const chalk = require("chalk")
const logger = {
info: (_) => console.log(chalk.blue("[info]"), _),
success: (_) => console.log(chalk.green("[success]"), _),
warn: (_) => console.log(chalk.yellow("[warn]"), _),
error: (_) => console.log(chalk.red("[error]"), _),
// Omg just like tadah :D (Tadahjak face)
boot: (_) => console.log(chalk.greenBright("[BOOT]"), _),
info: (_) => console.log(chalk.blue("[INFO]"), _),
success: (_) => console.log(chalk.green("[SUCCESS]"), _),
warn: (_) => console.log(chalk.yellow("[WARN]"), _),
error: (_) => console.log(chalk.red("[ERROR]"), _),
}
module.exports = logger

View File

@ -10,7 +10,7 @@ app.all("*", async (request, response) => {
const proc = await rcc.start(64989)
if (proc.exitCode !== null) return response.json(false)
await wait(1000)
await wait(5000)
const jobId = "RenderTest"
const client = await soap.createClientAsync(__dirname + "/../lib/RCCService.wsdl", {}, "http://127.0.0.1:64989/")
@ -23,7 +23,7 @@ app.all("*", async (request, response) => {
},
script: {
name: jobId,
script: readFileSync(__dirname + "/../lua/user_headshot.lua", { encoding: "utf-8" }),
script: readFileSync(__dirname + "/../lua/user.lua", { encoding: "utf-8" }),
arguments: {
LuaValue: [
{
@ -48,7 +48,7 @@ app.all("*", async (request, response) => {
},
{
type: "LUA_TSTRING",
value: "https://economy.ittblox.gay",
value: "https://sitetest.unexp.xyz",
},
{
type: "LUA_TNUMBER",