This commit is contained in:
parent
24b2e3ae69
commit
2aa69bb240
|
|
@ -2,8 +2,6 @@ const logger = require("./lib/logger.js")
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
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"))
|
||||||
app.use("/game/execute", require("./routes/game/execute.js"))
|
app.use("/game/execute", require("./routes/game/execute.js"))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +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`)
|
const logger = require("../../lib/logger.js")
|
||||||
|
|
||||||
class RCCService extends EventEmitter {
|
class RCCService extends EventEmitter {
|
||||||
constructor(port, path = process.env.RCCSERVICE_PATH) {
|
constructor(port, path = process.env.RCCSERVICE_PATH) {
|
||||||
|
|
@ -12,21 +12,21 @@ class RCCService extends EventEmitter {
|
||||||
Start(options = { cwd: this.path }) {
|
Start(options = { cwd: this.path }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
if(process.platform == "win32") {
|
if (process.platform == "win32") {
|
||||||
this.proc = child_process.spawn("RCCService.exe", ["-Console", "-PlaceId:-1", `-Port`, this.port], options)
|
this.proc = child_process.spawn("RCCService.exe", ["-Console", "-PlaceId:-1", `-Port`, this.port], options)
|
||||||
} else {
|
} else {
|
||||||
this.proc = child_process.spawn("wine", ["RCCService.exe", "-Console", "-PlaceId:-1", `-Port`, this.port], options)
|
this.proc = child_process.spawn("wine", ["RCCService.exe", "-Console", "-PlaceId:-1", `-Port`, this.port], options)
|
||||||
}
|
}
|
||||||
this.proc.once("spawn", () => {
|
this.proc.once("spawn", () => {
|
||||||
logger.info(`Spawned RCCService instance on port ${this.port}`);
|
logger.info(`Spawned RCCService instance on port ${this.port}`)
|
||||||
resolve(this.proc)
|
resolve(this.proc)
|
||||||
})
|
})
|
||||||
this.proc.once("exit", () => {
|
this.proc.once("exit", () => {
|
||||||
this.proc = null;
|
this.proc = null
|
||||||
logger.info(`An RCCService instance has closed on port ${this.port}`)
|
logger.info(`An RCCService instance has closed on port ${this.port}`)
|
||||||
})
|
})
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
logger.error(_);
|
logger.error(_)
|
||||||
reject(_)
|
reject(_)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
app.all("*", (request, response) => response.status(404).end())
|
app.all("*", (request, response) => response.status(404).json({ status: 404 }))
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
app.all("*", (request, response) => response.status(404).end())
|
app.all("*", (request, response) => response.status(404).json({ status: 404 }))
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
app.all("*", (request, response) => response.status(404).end())
|
app.all("*", (request, response) => response.status(404).json({ status: 404 }))
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,8 @@
|
||||||
const waitPort = require("wait-port")
|
|
||||||
const logger = require(`${__dirname}\\..\\lib\\logger.js`)
|
|
||||||
const { readFileSync, read } = require("fs")
|
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const Job = require("../lib/classes/Job.js")
|
|
||||||
const { randomUUID } = require("crypto")
|
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
let tempPort = 64990
|
app.get("/", (request, response) => response.status(200).json())
|
||||||
|
|
||||||
app.all("*", async (request, response) => {
|
app.all("*", (request, response) => response.status(404).json({ status: 404 }))
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
await job.CreateClient()
|
|
||||||
const result = await job.Open({
|
|
||||||
name: job.id,
|
|
||||||
script: readFileSync(__dirname + "/../lua/headshot.lua", { encoding: "utf-8" }),
|
|
||||||
arguments: {
|
|
||||||
LuaValue: [
|
|
||||||
{ type: "LUA_TSTRING", value: job.id },
|
|
||||||
{ type: "LUA_TSTRING", value: "Headshot" },
|
|
||||||
{ type: "LUA_TSTRING", value: "PNG" },
|
|
||||||
|
|
||||||
// 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" },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
await job.Stop()
|
|
||||||
|
|
||||||
return response.end(Buffer.from(result[0].OpenJobExResult.LuaValue[0].value, "base64"))
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,46 @@
|
||||||
|
const waitPort = require("wait-port")
|
||||||
|
const { readFileSync } = require("fs")
|
||||||
|
const { randomUUID } = require("crypto")
|
||||||
|
const logger = require("../../lib/logger.js")
|
||||||
|
const Job = require("../../lib/classes/Job.js")
|
||||||
|
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
app.all("*", (request, response) => response.status(404).end())
|
app.get("/", async (request, response) => {
|
||||||
|
let tempPort = 64990
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
await job.CreateClient()
|
||||||
|
const result = await job.Open({
|
||||||
|
name: job.id,
|
||||||
|
script: readFileSync(__dirname + "/../lua/xml.lua", { encoding: "utf-8" }),
|
||||||
|
arguments: {
|
||||||
|
LuaValue: [
|
||||||
|
{ type: "LUA_TSTRING", value: job.id },
|
||||||
|
{ type: "LUA_TSTRING", value: "XML" },
|
||||||
|
{ type: "LUA_TSTRING", value: "PNG" },
|
||||||
|
|
||||||
|
// change this to 1920x when we finish the arbiter
|
||||||
|
{ type: "LUA_TNUMBER", value: "420" },
|
||||||
|
{ type: "LUA_TNUMBER", value: "420" },
|
||||||
|
|
||||||
|
{ type: "LUA_TSTRING", value: "https://economy.ittblox.gay" },
|
||||||
|
{ type: "LUA_TNUMBER", value: "2555" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await job.Stop()
|
||||||
|
return response.end(Buffer.from(result[0].OpenJobExResult.LuaValue[0].value, "base64"))
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,46 @@
|
||||||
|
const waitPort = require("wait-port")
|
||||||
|
const { readFileSync } = require("fs")
|
||||||
|
const { randomUUID } = require("crypto")
|
||||||
|
const logger = require("../../lib/logger.js")
|
||||||
|
const Job = require("../../lib/classes/Job.js")
|
||||||
|
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
app.all("*", (request, response) => response.status(404).end())
|
app.get("/", async (request, response) => {
|
||||||
|
let tempPort = 64990
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
await job.CreateClient()
|
||||||
|
const result = await job.Open({
|
||||||
|
name: job.id,
|
||||||
|
script: readFileSync(__dirname + "/../lua/headshot.lua", { encoding: "utf-8" }),
|
||||||
|
arguments: {
|
||||||
|
LuaValue: [
|
||||||
|
{ type: "LUA_TSTRING", value: job.id },
|
||||||
|
{ type: "LUA_TSTRING", value: "Headshot" },
|
||||||
|
{ type: "LUA_TSTRING", value: "PNG" },
|
||||||
|
|
||||||
|
// change this to 1920x when we finish the arbiter
|
||||||
|
{ type: "LUA_TNUMBER", value: "420" },
|
||||||
|
{ type: "LUA_TNUMBER", value: "420" },
|
||||||
|
|
||||||
|
{ type: "LUA_TSTRING", value: "https://economy.ittblox.gay" },
|
||||||
|
{ type: "LUA_TNUMBER", value: "1" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
await job.Stop()
|
||||||
|
return response.end(Buffer.from(result[0].OpenJobExResult.LuaValue[0].value, "base64"))
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const express = require("express")
|
const express = require("express")
|
||||||
const app = express.Router()
|
const app = express.Router()
|
||||||
|
|
||||||
app.all("*", (request, response) => response.status(404).end())
|
app.all("*", (request, response) => response.status(404).json({ status: 404 }))
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
set RCCSERVICE_PATH=D:\\Projects\\Roblox\\Source\\UploadBits\\Win32-Release-RCCService\\
|
||||||
|
npm run dev
|
||||||
Loading…
Reference in New Issue