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 express = require("express")
const app = 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/start", require("./routes/game/start.js"))
app.use("/game/stop", require("./routes/game/stop.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.use("*", require("./routes/index.js"))
app.listen(process.env.PORT || 5173, () => { 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) => { process.on("uncaughtException", (err) => {
console.log(err) logger.error(err)
}) })

View File

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

View File

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

View File

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