Compare commits

..

57 Commits

Author SHA1 Message Date
cirroskais 483662950c Add LICENSE 2023-11-19 15:38:50 -05:00
cirroskais cd4c0a20a6
Add mesh render endpoint 2023-09-13 18:49:45 -04:00
cirroskais cd8d56e767
Add Stan patches 2023-09-02 18:15:48 -04:00
cirroskais a915bd775c
I must sleep 2023-08-28 00:35:32 -04:00
cirroskais 7c5cc4b27b
Switch to Tadah-style asset rendering 2023-08-27 06:03:58 -04:00
cirroskais 234b6d7e53
Fix typo 2023-08-27 06:00:53 -04:00
cirroskais efb16c2bb6
make more changes 2023-08-27 04:35:40 -04:00
cirroskais 72e40b3083
Merge crapblox and tadah 2023-08-27 03:49:00 -04:00
I-Have-An-Issue 82599e3df8
KILL JACKD 2023-03-19 16:40:22 -04:00
I-Have-An-Issue d4cb7eebb1
ec 2023-03-04 20:39:30 -05:00
I-Have-An-Issue 87ecc1faba
GameJobs JobId should be their PlaceId 2023-03-03 21:56:12 -05:00
I-Have-An-Issue fbd6c7a3f7
Remove error logger 2023-03-03 21:41:15 -05:00
I-Have-An-Issue f4e6b4a0fb
Enable ClientTicket 2023-03-03 21:39:51 -05:00
I-Have-An-Issue 46b05a211f
Fix bug where games wouldnt be named by their placeid 2023-02-21 18:21:20 -05:00
I-Have-An-Issue 115a44d76f
Remove redundant checking 2023-02-21 18:02:59 -05:00
I-Have-An-Issue e92ac41318
Fix gameservers for real this time 2023-02-21 17:49:42 -05:00
I-Have-An-Issue bce1dfcf90
??/ 2023-02-21 17:43:10 -05:00
I-Have-An-Issue 4793dcac66
??/ 2023-02-21 17:37:31 -05:00
I-Have-An-Issue 55af57ac91
??/ 2023-02-21 17:35:54 -05:00
I-Have-An-Issue bf6636e7c8
/render/clothing 2023-02-21 17:18:38 -05:00
I-Have-An-Issue 1d01d17b0c
?? 2023-02-20 16:25:48 -05:00
I-Have-An-Issue 32a2748d17
Better game management 2023-02-20 05:39:42 -05:00
I-Have-An-Issue 88135b551b
W 2023-02-20 05:17:27 -05:00
I-Have-An-Issue 512ef31ffc
Merge branch 'master' into tadah 2023-02-20 05:16:19 -05:00
I-Have-An-Issue 0ac8928024
Games should be queried by ids, not 'tokens' 2023-02-20 05:06:30 -05:00
I-Have-An-Issue 884406416f
Merge branch 'master' into tadah 2023-02-20 04:52:52 -05:00
I-Have-An-Issue b366c31385
Update LUA 2023-02-20 04:52:01 -05:00
I-Have-An-Issue a1097414d7
Pass ARBITER_TOKEN into games 2023-02-20 04:26:45 -05:00
I-Have-An-Issue 5ebbee0e0d
Merge branch 'master' into tadah 2023-02-20 04:25:58 -05:00
I-Have-An-Issue f557766c24
Update gameserver.lua 2023-02-20 04:23:36 -05:00
I-Have-An-Issue 08fdef42ce
It would be nice if git stopped merging changes that I dont want it to 2023-02-19 16:33:10 -05:00
I-Have-An-Issue aaaa44761e
w 2023-02-19 03:11:05 -05:00
I-Have-An-Issue 29bd85e426
Merge branch 'master' into tadah 2023-02-19 03:10:31 -05:00
stan a3aeb3c2ef fix leakage 2023-02-18 23:53:46 -06:00
stan 9c640be545 add something calone too lazy to add 2023-02-18 23:27:35 -06:00
stan 06900ea5c0 .env accesskey 2023-02-18 23:26:59 -06:00
I-Have-An-Issue 79259ae8c3
Merge branch 'master' into tadah 2023-02-17 23:45:31 -05:00
I-Have-An-Issue fa3025faab
Merge branch 'master' into crapblox 2023-02-17 23:45:23 -05:00
I-Have-An-Issue 1e50d656d5
Oh boy 2023-02-17 23:29:33 -05:00
I-Have-An-Issue 60cb8ccd18
Merge branch 'master' into tadah 2023-02-17 22:55:03 -05:00
I-Have-An-Issue ab761f5801
Merge branch 'master' into crapblox 2023-02-17 21:13:16 -05:00
I-Have-An-Issue bcf4b16da9
Rotate job ids on job 2023-02-17 21:13:08 -05:00
I-Have-An-Issue 9542096bc6
Merge branch 'master' into crapblox 2023-02-17 21:05:56 -05:00
I-Have-An-Issue 4b869132de
Merge branch 'master' into tadah 2023-02-17 20:56:22 -05:00
I-Have-An-Issue 6a2130f17e
Merge branch 'master' into crapblox 2023-02-17 20:55:54 -05:00
I-Have-An-Issue 154318b0bb
Fix render sizes 2023-02-16 22:09:09 -05:00
I-Have-An-Issue 4ce7c14604
More stuff 2023-02-16 22:07:52 -05:00
I-Have-An-Issue 5e897f89c9
Merge branch 'master' into crapblox 2023-02-16 22:00:16 -05:00
I-Have-An-Issue 3fbf304fab
Merge branch 'master' into tadah 2023-02-13 20:17:01 -05:00
I-Have-An-Issue 4d056e9f81
Merge branch 'master' into crapblox 2023-02-13 20:16:56 -05:00
I-Have-An-Issue d835487616
abc 2023-02-12 23:42:17 -05:00
I-Have-An-Issue 4298f85632
Merge branch 'master' into crapblox 2023-02-12 22:26:48 -05:00
I-Have-An-Issue 75eacef99f
Idk 2023-02-12 21:53:23 -05:00
I-Have-An-Issue 3204aede8a
Merge branch 'master' into crapblox 2023-02-12 20:28:03 -05:00
I-Have-An-Issue ec2eba6493
Merge branch 'master' into tadah 2023-02-12 20:26:38 -05:00
I-Have-An-Issue e985ae7b0b
Hii 2023-02-12 19:27:18 -05:00
I-Have-An-Issue 63990cb43b
Fix endpoints 2023-02-12 19:07:06 -05:00
15 changed files with 273 additions and 53 deletions

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2023 cirroskais Copyright (c) 2023 [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,16 +1,16 @@
PORT= PORT=
RCCSERVICE= RCCSERVICE=
BASE_URL=https://sitetest.unexp.xyz BASE_URL=https://kapish.fun
ARBITER_TOKEN= ARBITER_TOKEN=
ARBITER_KEY= ARBITER_KEY=
RENDER_USER_WIDTH=720 RENDER_USER_WIDTH=420
RENDER_USER_HEIGHT=720 RENDER_USER_HEIGHT=420
RENDER_ASSET_WIDTH=720 RENDER_ASSET_WIDTH=420
RENDER_ASSET_HEIGHT=720 RENDER_ASSET_HEIGHT=420
RENDER_PLACE_WIDTH=854 RENDER_PLACE_WIDTH=768
RENDER_PLACE_HEIGHT=480 RENDER_PLACE_HEIGHT=432

View File

@ -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/game", require("./routes/render/game.js"))
app.use("/render/texture", require("./routes/render/texture.js")) app.use("/render/texture", require("./routes/render/texture.js"))
app.use("/render/user", require("./routes/render/user.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")) app.use("*", require("./routes/index.js"))

View File

@ -3,16 +3,17 @@ const { readFile } = require("fs/promises")
const Job = require("./Job.js") const Job = require("./Job.js")
const logger = require("../logger.js") const logger = require("../logger.js")
const randport = require("../randport.js")
class GameJob extends Job { class GameJob extends Job {
constructor() { constructor() {
super({ expirationInSeconds: 360 }) super({ expirationInSeconds: 360 })
} }
StartGame(id) { StartGame(id, port, creatorId) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
this.placeId = id this.placeId = id
this.port = port
this.id = id
const started = await this.Start() const started = await this.Start()
if (!started) throw new Error("RCCService failed to 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}`) logger.info(`[${this.id}] GameJob started for ${id}`)
const port = await randport.udp()
this.OpenJobEx({ this.OpenJobEx({
name: this.id, name: this.id,
script: await readFile(__dirname + "/../../lua/gameserver.lua", { encoding: "utf-8" }), 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: id },
{ type: "LUA_TNUMBER", value: port }, { type: "LUA_TNUMBER", value: port },
{ type: "LUA_TSTRING", value: process.env.ARBITER_TOKEN },
{ type: "LUA_TNUMBER", value: creatorId },
], ],
}, },
}).catch((e) => reject(e)) }).catch((e) => reject(e))
resolve(port) resolve()
}) })
} }

View File

@ -1,5 +1,6 @@
const { readFile } = require("fs/promises") const { readFile } = require("fs/promises")
const chalk = require("chalk") const chalk = require("chalk")
const axios = require("axios")
const Job = require("./Job.js") const Job = require("./Job.js")
const logger = require("../logger.js") const logger = require("../logger.js")
@ -161,7 +162,7 @@ class RenderJob extends Job {
{ type: "LUA_TSTRING", value: process.env.BASE_URL }, { type: "LUA_TSTRING", value: process.env.BASE_URL },
{ type: "LUA_TNUMBER", value: id }, { type: "LUA_TNUMBER", value: id },
{ type: "LUA_TSTRING", value: process.env.ARBITER_TOKEN }, { type: "LUA_TSTRING", value: "test" },
], ],
}, },
}).catch((e) => false) }).catch((e) => false)
@ -213,6 +214,91 @@ class RenderJob extends Job {
if (!result) return false if (!result) return false
return result[0]?.OpenJobExResult?.LuaValue[0]?.value 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 module.exports = RenderJob

View File

@ -8,7 +8,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
game:GetService("ScriptContext").ScriptsDisabled = true game:GetService("ScriptContext").ScriptsDisabled = true
local Player = game.Players:CreateLocalPlayer(0) 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) Player:LoadCharacter(false)
game:GetService("RunService"):Run() game:GetService("RunService"):Run()

24
src/lua/clothing.lua Normal file
View File

@ -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

View File

@ -1,12 +1,15 @@
local jobId, type, baseUrl, placeId, port = ... local jobId, type, baseUrl, placeId, port, key, creatorId = ...
------------------- UTILITY FUNCTIONS -------------------------- ------------------- UTILITY FUNCTIONS --------------------------
function waitForChild(parent, childName) function waitForChild(parent, childName)
while true do while true do
local child = parent:findFirstChild(childName) local child = parent:findFirstChild(childName)
if child then return child end if child then
parent.ChildAdded:wait() return child
end end
parent.ChildAdded:wait()
end
end end
-----------------------------------END UTILITY FUNCTIONS ------------------------- -----------------------------------END UTILITY FUNCTIONS -------------------------
@ -24,53 +27,83 @@ pcall(function() settings().Diagnostics:LegacyScriptMode() end)
-----------------------------------START GAME SHARED SCRIPT------------------------------ -----------------------------------START GAME SHARED SCRIPT------------------------------
local scriptContext = game:GetService("ScriptContext") local assetId = placeId
pcall(function() scriptContext:AddStarterScript(37801172) end)
scriptContext.ScriptsDisabled = true
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("ChangeHistoryService"):SetEnabled(false)
game:GetService("HttpService").HttpEnabled = true
local ns = game:GetService("NetworkServer") local ns = game:GetService("NetworkServer")
if baseUrl ~= nil then if baseUrl ~= nil then
pcall(function() game:GetService("Players"):SetAbuseReportUrl(baseUrl .. "/AbuseReport/InGameChatHandler.ashx") end) pcall(function() game:GetService("Players"):SetAbuseReportUrl(baseUrl .. "/AbuseReport/InGameChatHandler.ashx") end)
pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(baseUrl .. "/Asset/") end) pcall(function() game:GetService("ScriptInformationProvider"):SetAssetUrl(baseUrl .. "/Asset/") end)
pcall(function() game:GetService("ContentProvider"):SetBaseUrl(baseUrl .. "/") 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"):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("BadgeService"):SetIsBadgeLegalUrl("")
game:GetService("InsertService"):SetBaseSetsUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?nsets=10&type=base") 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"):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"):SetCollectionUrl(baseUrl .. "/Game/Tools/InsertAsset.ashx?sid=%d")
game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/Asset/?id=%d") game:GetService("InsertService"):SetAssetUrl(baseUrl .. "/Asset/?id=%d")
game:GetService("InsertService"):SetAssetVersionUrl(baseUrl .. "/Asset/?assetversionid=%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() loadfile(baseUrl .. "/Game/LoadPlaceInfo.ashx?PlaceId=" .. placeId)() end)
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end) -- pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
game:GetService('Players'):SetSysStatsUrl('https://kapish.fun/Game/report-stats')
end end
pcall(function() game:GetService("NetworkServer"):SetIsPlayerAuthenticationRequired(true) end)
settings().Diagnostics.LuaRamLimit = 0 settings().Diagnostics.LuaRamLimit = 0
game:GetService("Players").PlayerAdded:connect(function(player) game:GetService("Players").PlayerAdded:connect(function(player)
print("Player " .. player.userId .. " added") --print("Player " .. player.userId .. " added")
end) end)
game:GetService("Players").PlayerRemoving:connect(function(player) game:GetService("Players").PlayerRemoving:connect(function(player)
print("Player " .. player.userId .. " leaving") --print("Player " .. player.userId .. " leaving")
end) end)
if placeId ~= nil and baseUrl ~= nil then if placeId~=nil and baseUrl~=nil then
wait() wait()
game:Load(baseUrl .. "/asset/?id=" .. placeId) game:Load("https://kapish.fun/asset/?id=" .. placeId .. "&placelol=true")
end end
ns:Start(port) -- Now start the connection
scriptContext:SetTimeout(10)
scriptContext.ScriptsDisabled = false
------------------------------END START GAME SHARED SCRIPT--------------------------
game:GetService("RunService"):Run() 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)

View File

@ -9,7 +9,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
game:GetService("ScriptContext").ScriptsDisabled = true game:GetService("ScriptContext").ScriptsDisabled = true
local Player = game.Players:CreateLocalPlayer(0) 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) Player:LoadCharacter(false)
game:GetService("RunService"):Run() game:GetService("RunService"):Run()

23
src/lua/mesh.lua Normal file
View File

@ -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

View File

@ -11,7 +11,7 @@ game:GetService("ContentProvider"):SetBaseUrl(baseUrl)
game:GetService("ScriptContext").ScriptsDisabled = true game:GetService("ScriptContext").ScriptsDisabled = true
game:GetService("StarterGui").ShowDevelopmentGui = false 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("ScriptContext").ScriptsDisabled = true
game:GetService("StarterGui").ShowDevelopmentGui = false game:GetService("StarterGui").ShowDevelopmentGui = false

View File

@ -11,7 +11,7 @@ app.post("/:id", async (request, response) => {
if (!game) return response.status(404).json({ error: "Game is not running" }) if (!game) return response.status(404).json({ error: "Game is not running" })
const { script } = request.body const { script } = request.body
const jobResponse = await game.Execute(randomUUID(), script) const jobResponse = await game.Execute(randomUUID(), script).catch((_) => _)
return response.json({ response: jobResponse }) return response.json({ response: jobResponse })
}) })

View File

@ -8,7 +8,7 @@ app.get("/:id", async (request, response) => {
if (game) return response.status(400).json({ error: "Game is running" }) if (game) return response.status(400).json({ error: "Game is running" })
const job = new GameJob() 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) global.games.set(request.params.id, job)
job.proc.once("exit", () => { job.proc.once("exit", () => {

View File

@ -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

26
src/routes/render/mesh.js Normal file
View File

@ -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