mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Add syncback scripts
This commit is contained in:
parent
63f849e735
commit
81f72681c6
2 changed files with 57 additions and 0 deletions
30
syncback.ps1
Normal file
30
syncback.ps1
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#Requires -Version 5.1
|
||||||
|
|
||||||
|
$ProjectRbxl = "Project.rbxl"
|
||||||
|
$ProjectJsonFile = "default.project.json"
|
||||||
|
|
||||||
|
# Load .env file
|
||||||
|
Get-Content ".env" | ForEach-Object {
|
||||||
|
if ($_ -match "^\s*([^#][^=]+)=(.*)$") {
|
||||||
|
Set-Variable -Name $Matches[1].Trim() -Value $Matches[2].Trim() -Scope Script
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ProjectJson = Get-Content $ProjectJsonFile | ConvertFrom-Json
|
||||||
|
$PlaceId = $ProjectJson.servePlaceIds[0]
|
||||||
|
Write-Host "PlaceId: $PlaceId"
|
||||||
|
|
||||||
|
# Download rbxl from Roblox
|
||||||
|
$Url = "https://assetdelivery.roblox.com/v1/asset/?id=$PlaceId"
|
||||||
|
$Session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
|
||||||
|
$Cookie = New-Object System.Net.Cookie(".ROBLOSECURITY", $ROBLOSECURITY, "/", ".roblox.com")
|
||||||
|
$Session.Cookies.Add($Cookie)
|
||||||
|
|
||||||
|
Write-Host "Downloading $Url..."
|
||||||
|
Invoke-WebRequest -Uri $Url -WebSession $Session -OutFile $ProjectRbxl
|
||||||
|
|
||||||
|
if ($args.Count -eq 0) {
|
||||||
|
rojo syncback --non-interactive --input $ProjectRbxl $ProjectJsonFile
|
||||||
|
} else {
|
||||||
|
rojo syncback @args --input $ProjectRbxl $ProjectJsonFile
|
||||||
|
}
|
||||||
27
syncback.sh
Normal file
27
syncback.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
ProjectRbxl="Project.rbxl"
|
||||||
|
ProjectJsonFile="default.project.json"
|
||||||
|
|
||||||
|
# Load .env file (auto-export all variables)
|
||||||
|
if [ -f ".env" ]; then
|
||||||
|
set -a
|
||||||
|
. ./.env
|
||||||
|
set +a
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract PlaceId from project json (first number after servePlaceIds line)
|
||||||
|
PlaceId=$(grep -A1 'servePlaceIds' "$ProjectJsonFile" | grep -o '[0-9]\+')
|
||||||
|
echo "PlaceId: $PlaceId"
|
||||||
|
|
||||||
|
# Download rbxl from Roblox
|
||||||
|
Url="https://assetdelivery.roblox.com/v1/asset/?id=$PlaceId"
|
||||||
|
echo "Downloading $Url..."
|
||||||
|
curl -fSL --compressed -o "$ProjectRbxl" -H "Cookie: .ROBLOSECURITY=${ROBLOSECURITY}" "$Url"
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
rojo syncback --non-interactive --input "$ProjectRbxl" "$ProjectJsonFile"
|
||||||
|
else
|
||||||
|
rojo syncback "$@" --input "$ProjectRbxl" "$ProjectJsonFile"
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue