Compare commits
57 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
483662950c | |
|
|
cd4c0a20a6 | |
|
|
cd8d56e767 | |
|
|
a915bd775c | |
|
|
7c5cc4b27b | |
|
|
234b6d7e53 | |
|
|
efb16c2bb6 | |
|
|
72e40b3083 | |
|
|
82599e3df8 | |
|
|
d4cb7eebb1 | |
|
|
87ecc1faba | |
|
|
fbd6c7a3f7 | |
|
|
f4e6b4a0fb | |
|
|
46b05a211f | |
|
|
115a44d76f | |
|
|
e92ac41318 | |
|
|
bce1dfcf90 | |
|
|
4793dcac66 | |
|
|
55af57ac91 | |
|
|
bf6636e7c8 | |
|
|
1d01d17b0c | |
|
|
32a2748d17 | |
|
|
88135b551b | |
|
|
512ef31ffc | |
|
|
0ac8928024 | |
|
|
884406416f | |
|
|
b366c31385 | |
|
|
a1097414d7 | |
|
|
5ebbee0e0d | |
|
|
f557766c24 | |
|
|
08fdef42ce | |
|
|
aaaa44761e | |
|
|
29bd85e426 | |
|
|
a3aeb3c2ef | |
|
|
9c640be545 | |
|
|
06900ea5c0 | |
|
|
79259ae8c3 | |
|
|
fa3025faab | |
|
|
1e50d656d5 | |
|
|
60cb8ccd18 | |
|
|
ab761f5801 | |
|
|
bcf4b16da9 | |
|
|
9542096bc6 | |
|
|
4b869132de | |
|
|
6a2130f17e | |
|
|
154318b0bb | |
|
|
4ce7c14604 | |
|
|
5e897f89c9 | |
|
|
3fbf304fab | |
|
|
4d056e9f81 | |
|
|
d835487616 | |
|
|
4298f85632 | |
|
|
75eacef99f | |
|
|
3204aede8a | |
|
|
ec2eba6493 | |
|
|
e985ae7b0b | |
|
|
63990cb43b |
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 [fullname]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
14
example.env
14
example.env
|
|
@ -1,16 +1,16 @@
|
|||
PORT=
|
||||
RCCSERVICE=
|
||||
|
||||
BASE_URL=https://sitetest.unexp.xyz
|
||||
BASE_URL=https://kapish.fun
|
||||
|
||||
ARBITER_TOKEN=
|
||||
ARBITER_KEY=
|
||||
|
||||
RENDER_USER_WIDTH=720
|
||||
RENDER_USER_HEIGHT=720
|
||||
RENDER_USER_WIDTH=420
|
||||
RENDER_USER_HEIGHT=420
|
||||
|
||||
RENDER_ASSET_WIDTH=720
|
||||
RENDER_ASSET_HEIGHT=720
|
||||
RENDER_ASSET_WIDTH=420
|
||||
RENDER_ASSET_HEIGHT=420
|
||||
|
||||
RENDER_PLACE_WIDTH=854
|
||||
RENDER_PLACE_HEIGHT=480
|
||||
RENDER_PLACE_WIDTH=768
|
||||
RENDER_PLACE_HEIGHT=432
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ app.use("/render/asset", require("./routes/render/asset.js"))
|
|||
app.use("/render/game", require("./routes/render/game.js"))
|
||||
app.use("/render/texture", require("./routes/render/texture.js"))
|
||||
app.use("/render/user", require("./routes/render/user.js"))
|
||||
app.use("/render/texture", require("./routes/render/texture.js"))
|
||||
app.use("/render/clothing", require("./routes/render/clothing.js"))
|
||||
app.use("/render/mesh", require("./routes/render/mesh.js"))
|
||||
|
||||
app.use("*", require("./routes/index.js"))
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,17 @@ const { readFile } = require("fs/promises")
|
|||
|
||||
const Job = require("./Job.js")
|
||||
const logger = require("../logger.js")
|
||||
const randport = require("../randport.js")
|
||||
|
||||
class GameJob extends Job {
|
||||
constructor() {
|
||||
super({ expirationInSeconds: 360 })
|
||||
}
|
||||
|
||||
StartGame(id) {
|
||||
StartGame(id, port, creatorId) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.placeId = id
|
||||
this.port = port
|
||||
this.id = id
|
||||
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
|
|
@ -20,8 +21,6 @@ class GameJob extends Job {
|
|||
|
||||
logger.info(`[${this.id}] GameJob started for ${id}`)
|
||||
|
||||
const port = await randport.udp()
|
||||
|
||||
this.OpenJobEx({
|
||||
name: this.id,
|
||||
script: await readFile(__dirname + "/../../lua/gameserver.lua", { encoding: "utf-8" }),
|
||||
|
|
@ -34,11 +33,13 @@ class GameJob extends Job {
|
|||
|
||||
{ type: "LUA_TNUMBER", value: id },
|
||||
{ type: "LUA_TNUMBER", value: port },
|
||||
{ type: "LUA_TSTRING", value: process.env.ARBITER_TOKEN },
|
||||
{ type: "LUA_TNUMBER", value: creatorId },
|
||||
],
|
||||
},
|
||||
}).catch((e) => reject(e))
|
||||
|
||||
resolve(port)
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
const { readFile } = require("fs/promises")
|
||||
const chalk = require("chalk")
|
||||
const axios = require("axios")
|
||||
|
||||
const Job = require("./Job.js")
|
||||
const logger = require("../logger.js")
|
||||
|
|
@ -161,7 +162,7 @@ class RenderJob extends Job {
|
|||
|
||||
{ type: "LUA_TSTRING", value: process.env.BASE_URL },
|
||||
{ type: "LUA_TNUMBER", value: id },
|
||||
{ type: "LUA_TSTRING", value: process.env.ARBITER_TOKEN },
|
||||
{ type: "LUA_TSTRING", value: "test" },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false)
|
||||
|
|
@ -213,6 +214,91 @@ class RenderJob extends Job {
|
|||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
|
||||
async RenderClothing(id, three_d = false) {
|
||||
this.id = randomUUID()
|
||||
|
||||
const running = this.started
|
||||
if (!running) {
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
}
|
||||
|
||||
if (!this.client) await this.CreateClient()
|
||||
|
||||
if (three_d) logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} 3D Asset RenderJob started for ${id}`)
|
||||
else logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} Asset RenderJob started for ${id}`)
|
||||
|
||||
const result = await this.OpenJobEx({
|
||||
name: this.id,
|
||||
script: await readFile(__dirname + "/../../lua/clothing.lua", { encoding: "utf-8" }),
|
||||
arguments: {
|
||||
LuaValue: [
|
||||
{ type: "LUA_TSTRING", value: this.id },
|
||||
|
||||
{ type: "LUA_TSTRING", value: "Clothing" },
|
||||
{ type: "LUA_TSTRING", value: three_d ? "OBJ" : "PNG" },
|
||||
|
||||
{ type: "LUA_TNUMBER", value: process.env.RENDER_ASSET_WIDTH },
|
||||
{ type: "LUA_TNUMBER", value: process.env.RENDER_ASSET_HEIGHT },
|
||||
|
||||
{ type: "LUA_TSTRING", value: process.env.BASE_URL },
|
||||
{ type: "LUA_TNUMBER", value: id },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false)
|
||||
|
||||
if (three_d) logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} 3D Asset RenderJob finished for ${id}`)
|
||||
else logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} Asset RenderJob finished for ${id}`)
|
||||
|
||||
this.Stop()
|
||||
|
||||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
|
||||
async RenderMesh(id, three_d = false) {
|
||||
this.id = randomUUID()
|
||||
|
||||
const running = this.started
|
||||
if (!running) {
|
||||
const started = await this.Start()
|
||||
if (!started) throw new Error("RCCService failed to start")
|
||||
}
|
||||
|
||||
if (!this.client) await this.CreateClient()
|
||||
|
||||
if (three_d) logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} 3D Mesh RenderJob started for ${id}`)
|
||||
else logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} Mesh RenderJob started for ${id}`)
|
||||
|
||||
const result = await this.OpenJobEx({
|
||||
name: this.id,
|
||||
script: await readFile(__dirname + "/../../lua/mesh.lua", { encoding: "utf-8" }),
|
||||
arguments: {
|
||||
LuaValue: [
|
||||
{ type: "LUA_TSTRING", value: this.id },
|
||||
|
||||
{ type: "LUA_TSTRING", value: "Mesh" },
|
||||
{ type: "LUA_TSTRING", value: three_d ? "OBJ" : "PNG" },
|
||||
|
||||
{ type: "LUA_TNUMBER", value: process.env.RENDER_ASSET_WIDTH },
|
||||
{ type: "LUA_TNUMBER", value: process.env.RENDER_ASSET_HEIGHT },
|
||||
|
||||
{ type: "LUA_TSTRING", value: process.env.BASE_URL },
|
||||
{ type: "LUA_TNUMBER", value: id },
|
||||
{ type: "LUA_TBOOLEAN", value: "true" },
|
||||
],
|
||||
},
|
||||
}).catch((e) => false)
|
||||
|
||||
if (three_d) logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} 3D Mesh RenderJob finished for ${id}`)
|
||||
else logger.info(`${chalk.gray(`${chalk.gray(`[${this.id}]`)}`)} Mesh RenderJob finished for ${id}`)
|
||||
|
||||
this.Stop()
|
||||
|
||||
if (!result) return false
|
||||
return result[0]?.OpenJobExResult?.LuaValue[0]?.value
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RenderJob
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
|
|||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local Player = game.Players:CreateLocalPlayer(0)
|
||||
Player.CharacterAppearance = ("%s/Character?id=%d"):format(baseUrl, assetId)
|
||||
Player.CharacterAppearance = ("%s/Asset/CharacterFetch.ashx?userId=%d"):format(baseUrl, assetId)
|
||||
Player:LoadCharacter(false)
|
||||
|
||||
game:GetService("RunService"):Run()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
local jobId, type, format, x, y, baseUrl, assetId = ...
|
||||
|
||||
print(("[%s] Started RenderJob for type '%s' with assetId %d"):format(jobId, type, assetId))
|
||||
|
||||
game:GetService("ScriptInformationProvider"):SetAssetUrl(baseUrl .. "/asset/")
|
||||
game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/asset/?id=%d")
|
||||
game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
|
||||
game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local Player = game.Players:CreateLocalPlayer(0)
|
||||
Player.CharacterAppearance = ("%s/thumbnail/clothingcharapp/%d"):format(baseUrl, assetId)
|
||||
Player:LoadCharacter(false)
|
||||
|
||||
game:GetService("RunService"):Run()
|
||||
|
||||
Player.Character.Animate.Disabled = true
|
||||
Player.Character.Torso.Anchored = true
|
||||
|
||||
print(("[%s] Rendering ..."):format(jobId))
|
||||
local result = game:GetService("ThumbnailGenerator"):Click(format, x, y, true)
|
||||
print(("[%s] Done!"):format(jobId))
|
||||
|
||||
return result
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
local jobId, type, baseUrl, placeId, port = ...
|
||||
local jobId, type, baseUrl, placeId, port, key, creatorId = ...
|
||||
|
||||
------------------- UTILITY FUNCTIONS --------------------------
|
||||
|
||||
function waitForChild(parent, childName)
|
||||
while true do
|
||||
local child = parent:findFirstChild(childName)
|
||||
if child then return child end
|
||||
if child then
|
||||
return child
|
||||
end
|
||||
parent.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
|
|
@ -24,12 +27,14 @@ pcall(function() settings().Diagnostics:LegacyScriptMode() end)
|
|||
|
||||
-----------------------------------START GAME SHARED SCRIPT------------------------------
|
||||
|
||||
local scriptContext = game:GetService("ScriptContext")
|
||||
pcall(function() scriptContext:AddStarterScript(37801172) end)
|
||||
scriptContext.ScriptsDisabled = true
|
||||
local assetId = placeId
|
||||
|
||||
game:SetPlaceID(placeId, false)
|
||||
local scriptContext = game:GetService('ScriptContext')
|
||||
pcall(function() scriptContext:AddStarterScript(37801172) end)
|
||||
|
||||
game:SetPlaceID(assetId, false)
|
||||
game:GetService("ChangeHistoryService"):SetEnabled(false)
|
||||
game:GetService("HttpService").HttpEnabled = true
|
||||
|
||||
local ns = game:GetService("NetworkServer")
|
||||
|
||||
|
|
@ -37,39 +42,68 @@ if baseUrl ~= nil then
|
|||
pcall(function() game:GetService("Players"):SetAbuseReportUrl(baseUrl .. "/AbuseReport/InGameChatHandler.ashx") end)
|
||||
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(baseUrl .. "/Asset/") end)
|
||||
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl .. "/") end)
|
||||
pcall(function() game:GetService("Players"):SetChatFilterUrl(baseUrl .. "/Game/ChatFilter.ashx") end)
|
||||
|
||||
game:GetService("BadgeService"):SetPlaceId(placeId)
|
||||
|
||||
game:GetService("BadgeService"):SetAwardBadgeUrl(baseUrl .. "/assets/award-badge?userId=%d&badgeId=%d&placeId=%d")
|
||||
game:GetService("BadgeService"):SetHasBadgeUrl(baseUrl .. "/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d")
|
||||
game:GetService("BadgeService"):SetIsBadgeDisabledUrl(baseUrl .. "/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d")
|
||||
game:GetService("BadgeService"):SetIsBadgeLegalUrl("")
|
||||
game:GetService("InsertService"):SetBaseSetsUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base")
|
||||
game:GetService("InsertService"):SetUserSetsUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?nsets=20&type=user&userid=%d")
|
||||
game:GetService("InsertService"):SetCollectionUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?sid=%d")
|
||||
game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/Asset/?id=%d")
|
||||
game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
|
||||
|
||||
pcall(function() game:SetCreatorID(creatorId, Enum.CreatorType.User) end)
|
||||
pcall(function() loadfile(baseUrl .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
|
||||
-- pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
|
||||
game:GetService('Players'):SetSysStatsUrl('https://kapish.fun/Game/report-stats')
|
||||
end
|
||||
|
||||
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
|
||||
|
||||
settings().Diagnostics.LuaRamLimit = 0
|
||||
|
||||
game:GetService("Players").PlayerAdded:connect(function(player)
|
||||
print("Player " .. player.userId .. " added")
|
||||
--print("Player " .. player.userId .. " added")
|
||||
end)
|
||||
|
||||
game:GetService("Players").PlayerRemoving:connect(function(player)
|
||||
print("Player " .. player.userId .. " leaving")
|
||||
--print("Player " .. player.userId .. " leaving")
|
||||
end)
|
||||
|
||||
if placeId~=nil and baseUrl~=nil then
|
||||
wait()
|
||||
game:Load(baseUrl .. "/asset/?id=" .. placeId)
|
||||
game:Load("https://kapish.fun/asset/?id=" .. placeId .. "&placelol=true")
|
||||
end
|
||||
|
||||
ns:Start(port)
|
||||
|
||||
scriptContext:SetTimeout(10)
|
||||
scriptContext.ScriptsDisabled = false
|
||||
|
||||
------------------------------END START GAME SHARED SCRIPT--------------------------
|
||||
-- Now start the connection
|
||||
|
||||
game:GetService("RunService"):Run()
|
||||
spawn(function()
|
||||
while wait(5) do
|
||||
local playerIds = ""
|
||||
local players = game.Players:GetChildren()
|
||||
for i, player in pairs(players) do
|
||||
if player.ClassName == "Player" then
|
||||
if i ~= #players then
|
||||
playerIds = playerIds .. player.userId .. ","
|
||||
else
|
||||
playerIds = playerIds .. player.userId
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pcall(function() game:HttpGet('http://kapish.fun/server/ping/' .. placeId .. '?players=' .. playerIds) end)
|
||||
end
|
||||
end)
|
||||
|
||||
spawn(function()
|
||||
while wait(60) do
|
||||
if #game.Players:GetPlayers() == 0 then
|
||||
pcall(function() game:HttpGet("https://kapish.fun/dielol/" .. placeId) end)
|
||||
else
|
||||
pcall(function() game:HttpGet("https://kapish.fun/renewlol/" .. placeId) end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
|
|||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local Player = game.Players:CreateLocalPlayer(0)
|
||||
Player.CharacterAppearance = ("%s/Character?id=%d"):format(baseUrl, assetId)
|
||||
Player.CharacterAppearance = ("%s/Asset/CharacterFetch.ashx?userId=%d"):format(baseUrl, assetId)
|
||||
Player:LoadCharacter(false)
|
||||
|
||||
game:GetService("RunService"):Run()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
local jobId, type, format, x, y, baseUrl, assetId = ...
|
||||
|
||||
print(("[%s] Started RenderJob for type '%s' with assetId %d ..."):format(jobId, type, assetId))
|
||||
|
||||
game:GetService("ScriptInformationProvider"):SetAssetUrl(baseUrl .. "/asset/")
|
||||
game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/asset/?id=%d")
|
||||
game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%d")
|
||||
game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
|
||||
local meshPart = Instance.new("Part", workspace)
|
||||
meshPart.Anchored = true
|
||||
meshPart.Size = Vector3.new(1.5, 1.5, 1.5)
|
||||
|
||||
local mesh = Instance.new("SpecialMesh", meshPart)
|
||||
mesh.MeshType = "FileMesh"
|
||||
mesh.MeshId = ("%s/asset?id=%d"):format(baseUrl, assetId)
|
||||
|
||||
print(("[%s] Rendering ..."):format(jobId))
|
||||
local result = game:GetService("ThumbnailGenerator"):Click(format, x, y, true)
|
||||
print(("[%s] Done!"):format(jobId))
|
||||
|
||||
return result
|
||||
|
|
@ -11,7 +11,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
|
|||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
game:GetService("StarterGui").ShowDevelopmentGui = false
|
||||
|
||||
game:Load(("%s/asset/?id=%d"):format(baseUrl, assetId))
|
||||
game:Load(("%s/asset/?id=%d&placelol=true"):format(baseUrl, assetId))
|
||||
|
||||
game:GetService("ScriptContext").ScriptsDisabled = true
|
||||
game:GetService("StarterGui").ShowDevelopmentGui = false
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ app.post("/:id", async (request, response) => {
|
|||
if (!game) return response.status(404).json({ error: "Game is not running" })
|
||||
|
||||
const { script } = request.body
|
||||
const jobResponse = await game.Execute(randomUUID(), script)
|
||||
const jobResponse = await game.Execute(randomUUID(), script).catch((_) => _)
|
||||
|
||||
return response.json({ response: jobResponse })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ app.get("/:id", async (request, response) => {
|
|||
if (game) return response.status(400).json({ error: "Game is running" })
|
||||
|
||||
const job = new GameJob()
|
||||
const result = await job.StartGame(request.params.id).catch((_) => _)
|
||||
const result = await job.StartGame(request.params.id, request.query.port).catch((_) => _)
|
||||
|
||||
global.games.set(request.params.id, job)
|
||||
job.proc.once("exit", () => {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
const express = require("express")
|
||||
const app = express.Router()
|
||||
|
||||
const RenderJob = require("../../lib/classes/RenderJob.js")
|
||||
|
||||
app.get("/:id", async (request, response) => {
|
||||
const { params, query } = request
|
||||
const job = new RenderJob()
|
||||
|
||||
const asset = await job.RenderClothing(params.id).catch((_) => _)
|
||||
if (asset?.message) return response.status(500).json({ error: asset.message })
|
||||
|
||||
return response.end(asset)
|
||||
})
|
||||
|
||||
app.get("/:id/3d", async (request, response) => {
|
||||
const { params, query } = request
|
||||
const job = new RenderJob()
|
||||
|
||||
const three_d = await job.RenderClothing(params.id, true).catch((_) => _)
|
||||
if (three_d?.message) return response.status(500).json({ error: three_d.message })
|
||||
|
||||
return response.json(JSON.parse(three_d))
|
||||
})
|
||||
|
||||
module.exports = app
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
const express = require("express")
|
||||
const app = express.Router()
|
||||
|
||||
const RenderJob = require("../../lib/classes/RenderJob.js")
|
||||
|
||||
app.get("/:id", async (request, response) => {
|
||||
const { params, query } = request
|
||||
const job = new RenderJob()
|
||||
|
||||
const asset = await job.RenderMesh(params.id).catch((_) => _)
|
||||
if (asset?.message) return response.status(500).json({ error: asset.message })
|
||||
|
||||
return response.end(asset)
|
||||
})
|
||||
|
||||
app.get("/:id/3d", async (request, response) => {
|
||||
const { params, query } = request
|
||||
const job = new RenderJob()
|
||||
|
||||
const three_d = await job.RenderMesh(params.id, true).catch((_) => _)
|
||||
if (three_d?.message) return response.status(500).json({ error: three_d.message })
|
||||
|
||||
return response.json(JSON.parse(three_d))
|
||||
})
|
||||
|
||||
module.exports = app
|
||||
Loading…
Reference in New Issue