Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiencing a bug using Lune #280

Closed
devtyp opened this issue Dec 3, 2024 · 6 comments
Closed

Experiencing a bug using Lune #280

devtyp opened this issue Dec 3, 2024 · 6 comments
Labels
bug Something isn't working needs information / investigation Issue is missing information to be able to be solved roblox Issues pertaining to the built-in Roblox library

Comments

@devtyp
Copy link

devtyp commented Dec 3, 2024

Code:

--asset_updater.lua
local roblox = require("@lune/roblox")
local net = require("@lune/net")
local fs = require("@lune/fs")
local task = require("@lune/task")

local cookie = roblox.getAuthCookie()
assert(cookie ~= nil, "Failed to get roblox auth cookie")

function fetchPlace(placeId)
	local response = net.request({
		url = `https://assetdelivery.roblox.com/v2/assetId/{placeId}`,
		headers = {
			Cookie = cookie,
		},
	})
	local responseTable = net.jsonDecode(response.body)

	response = net.request({
		url = responseTable.locations[1].location,
	})

	return roblox.deserializePlace(response.body)
end

function saveAsModel(instance, path)
	local bin = roblox.serializeModel({ instance })
	fs.writeFile(path, bin)
end

function getPath(current, dir)
	local segments = dir:split(".")
	for _, v in pairs(segments) do
		current = current[v]
	end

	return current
end

local idToLocation = {
	["6505422288"] = { -- ScriptingGame
		["Workspace.Terrain"] = "Assets/ScriptingGame/Terrain.rbxm",
		["Workspace.Map"] = "Assets/ScriptingGame/Map.rbxm",
		["Workspace.__SCRIPTABLE"] = "Assets/ScriptingGame/Scriptable.rbxm",

		["StarterGui.Firestone"] = "Assets/FirestoneUIs.rbxm",
		["ReplicatedStorage.Remotes"] = "Assets/Remotes.rbxm",
		["StarterPlayer.StarterPlayerScripts.NewProximity"] = "Assets/ProximitySystem.rbxm",
		["ReplicatedFirst.CustomLoading"] = "Assets/CustomLoading.rbxm",
	},
	["18617058228"] = { -- SC-Assets
		["ServerStorage.Vehicles"] = "Assets/Vehicles.rbxm",
		["ServerScriptService.Vehicle Module"] = "Assets/VehicleModule.rbxm",
		["ServerScriptService.WeaponsSystem"] = "Assets/ServerWeaponsSystem.rbxm",
		["ServerScriptService.SocialInteractions"] = "Assets/SocialInteractions.rbxm",

		-- ["ReplicatedStorage.Vehicle Module RS"] = "Assets/ReplicatedVehicleModule.rbxm",
		["ReplicatedStorage.ELS"] = "Assets/ELS.rbxm",
		["ReplicatedStorage.WeaponsSystem"] = "Assets/ReplicatedWeaponsSystem.rbxm",
		["ReplicatedStorage.Tools"] = "Assets/Tools.rbxm",
		["ReplicatedStorage.Placeables"] = "Assets/Placeables.rbxm",
		["ReplicatedStorage.Objects"] = "Assets/Objects.rbxm",

		-- ["Teams"] = "Assets/Teams.rbxm",
		["StarterPack"] = "Assets/StarterPack.rbxm",
		["StarterPlayer.StarterPlayerScripts.WeaponsSystem"] = "Assets/ClientWeaponSystem.rbxm",
		["Chat"] = "Assets/Chat.rbxm",
	},
	["7735529531"] = { -- DevHere
		["Workspace.Terrain"] = "Assets/FullMap/Terrain.rbxm",
		["Workspace.Map"] = "Assets/FullMap/Map.rbxm",
		["Workspace.__SCRIPTABLE"] = "Assets/FullMap/Scriptable.rbxm",
	},
}

pcall(function()
	fs.removeFile(".bin/Map.rbxm")
end)
pcall(function()
	fs.removeFile(".bin/Scriptable.rbxm")
end)
pcall(function()
	fs.removeFile(".bin/Terrain.rbxm")
end)

for id, data in idToLocation do
	task.spawn(function()
		local map = fetchPlace(id)
		warn(`Loaded {id}`)

		for loc, output in data do
			local asset = getPath(map, loc)
			saveAsModel(asset, output)
			print(`Saved {loc}`)
		end
	end)
end

Whenever I run "just update" on Mac I receive an error message:

lune run asset_updater.luau
[string "asset_updater"]:7: Failed to get roblox auth cookie
[Stack Begin]
        Script '[C]' - function 'assert'
        Script 'asset_updater', Line 7
[Stack End]

error: Recipe `update` failed on line 12 with exit code 1

My colleagues on Windows experience no such issues. Any ideas to fix?
Thanks

@devtyp
Copy link
Author

devtyp commented Dec 3, 2024

(just run runs lune run asset_updater.luau)

@CompeyDev
Copy link
Contributor

The cookie can be nil when there is no logged in Roblox Studio installation at the expected (default) install location.

You can either fix your Studio installation, or set the ROBLOSECURITY environment variable for the lune run command to give it the cookie directly.

@devtyp
Copy link
Author

devtyp commented Dec 5, 2024

I'd rather fix this directly. What is the default install location on a Mac?

@CompeyDev
Copy link
Contributor

Not sure, but it should work as long as you're using the official Roblox Studio installer. Try a reinstall.

@filiptibell filiptibell added bug Something isn't working roblox Issues pertaining to the built-in Roblox library needs information / investigation Issue is missing information to be able to be solved labels Dec 18, 2024
@filiptibell
Copy link
Collaborator

I have also had intermittent issues with finding the auth cookie on mac... not sure what the cause could be, but would be great to get this fixed if someone has spare time to spend on investigating.

@devtyp
Copy link
Author

devtyp commented Dec 22, 2024

I tried uninstalling and reinstalling twice and it seems to have fixed the issue. Thanks

@devtyp devtyp closed this as completed Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs information / investigation Issue is missing information to be able to be solved roblox Issues pertaining to the built-in Roblox library
Projects
None yet
Development

No branches or pull requests

3 participants