[Manual MIRROR] dmapi manual update port (#11138)

This commit is contained in:
Kashargul
2025-07-03 23:30:00 +02:00
committed by GitHub
parent 7d7ef755ee
commit c71ab6c9bd
48 changed files with 1101 additions and 629 deletions

View File

@@ -37,6 +37,11 @@ function Get-Bun {
$BunTag = " (baseline)"
}
if (Test-Path $BunTargetDir -PathType Container) {
Write-Output "Bun target directory exists but bun.exe is missing. Re-downloading."
Remove-Item $BunTargetDir -Recurse -Force
}
$BunSource = "https://github.com/oven-sh/bun/releases/download/bun-v$BunVersion/$BunRelease.zip"
Write-Output "Downloading Bun v$BunVersion$BunTag"

View File

@@ -9,7 +9,7 @@ This build script is the recommended way to compile the game, including not only
a) Double-click `BUILD.bat` in the repository root to build (will wait for a key press before it closes).
b) Double-click `tools/build/build.bat` to build (will exit as soon as it finishes building).
- Linux:
a) Run `tools/build/build` from the repository root.
a) Run `tools/build/build.sh` from the repository root.
The script will skip build steps whose inputs have not changed since the last run.
@@ -18,7 +18,7 @@ The script will skip build steps whose inputs have not changed since the last ru
You can get a list of all targets that you can build by running the following command:
```
tools/build/build --help
tools/build/build.sh --help
```
## Dependencies

2
tools/registration/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules/
config.json

View File

@@ -0,0 +1,6 @@
{
"port": 6969,
"token": "your-token-goes-here",
"guildId": "your-guild-snowflake-goes-here",
"roleId": "your-role-snowflake-goes-here"
}

View File

@@ -0,0 +1,72 @@
const http = require("node:http");
const { Client, GatewayIntentBits } = require("discord.js");
const { port, token, guildId, roleId } = require("./config.json");
async function main() {
const client = new Client({ intents: [] });
await client.login(token);
const guild = await client.guilds.fetch(guildId);
if (!guild) {
console.error("ERROR in config, unable to resolve guild " + guildId);
return;
}
const role = await guild.roles.fetch(roleId);
if (!role) {
console.error("ERROR in config, invalid role ID ", roleId);
return;
}
const server = http.createServer({}, (req, res) => {
const url = req.url;
if (!url) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ data: "error parsing URL" }))
return;
}
let urlObj;
try {
urlObj = new URL(`http://localhost${url}`);
} catch (err) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ data: "error parsing URL: " + err }))
return;
}
if (!urlObj.search) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ data: "error parsing URL" }))
return;
}
const params = urlObj.searchParams;
const member_id = params.get("member");
if (!member_id) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ data: "error parsing URL" }))
return;
}
let memberIdRaw;
try {
memberIdRaw = JSON.parse(member_id);
} catch(err) {
res.writeHead(400, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ data: "error parsing URL: " + err }))
return;
}
guild.members.addRole({ user: memberIdRaw, role, reason: "SS13 Registration" })
console.log("Successfully registered ", memberIdRaw);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ data: "success" }))
});
server.listen(port);
console.log("Server running on port", port);
}
main();

View File

@@ -0,0 +1,14 @@
{
"name": "registration",
"version": "1.0.0",
"description": "Small discord.js bot to handle adding member roles on discord registration",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "tigercat2000",
"license": "MIT",
"dependencies": {
"discord.js": "^14.21.0"
}
}

View File

@@ -6,22 +6,31 @@ has_git="$(command -v git)"
has_curl="$(command -v curl)"
has_cargo="$(command -v ~/.cargo/bin/cargo)"
has_sudo="$(command -v sudo)"
# FIXME: yt-dlp
has_ytdlp="$(command -v yt-dlp)"
has_pip3="$(command -v pip3)"
has_unzip="$(command -v unzip)"
set -e
set -x
# apt packages, libssl needed by rust-g but not included in TGS barebones install
if ! ( [ -x "$has_git" ] && [ -x "$has_curl" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] ); then
echo "Installing apt dependencies..."
if ! ( [ -x "$has_git" ] && [ -x "$has_curl" ] && [ -x "$has_pip3" ] && [ -x "$has_unzip" ] && [ -f "/usr/lib/i386-linux-gnu/libssl.so" ] ); then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!! HEY YOU THERE, READING THE TGS LOGS READ THIS!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "We are about to try installing native dependencies, we will use 'sudo' if possible for this, but it may fail because the tgstation-server user doesn't have passwordless sudo."
echo "WE DO NOT RECOMMEND GRANTING PASSWORDLESS SUDO!!! Instead, install all the dependencies yourself with the following command:"
echo ".................................................................................................................................................."
echo "sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl libclang-dev g++-multilib python3 python3-pip unzip"
echo ".................................................................................................................................................."
echo "Attempting to install apt dependencies..."
if ! [ -x "$has_sudo" ]; then
dpkg --add-architecture i386
apt-get update
apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl
apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl libclang-dev g++-multilib python3 python3-pip unzip
else
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl
sudo apt-get install -y lib32z1 git pkg-config libssl-dev:i386 libssl-dev zlib1g-dev:i386 curl libclang-dev g++-multilib python3 python3-pip unzip
fi
fi
@@ -31,3 +40,13 @@ if ! [ -x "$has_cargo" ]; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
. ~/.profile
fi
# install or update yt-dlp when not present, or if it is present with pip3,
# which we assume was used to install it
if ! [ -x "$has_ytdlp" ]; then
echo "Installing yt-dlp with pip3..."
pip3 install yt-dlp --break-system-packages
else
echo "Ensuring yt-dlp is up-to-date with pip3..."
pip3 install yt-dlp -U --break-system-packages
fi

View File

@@ -1,15 +1,6 @@
@echo off
cd /D "%~dp0"
set TG_BOOTSTRAP_CACHE=%cd%
IF NOT %1 == "" (
rem TGS4+: we are passed the game directory on the command line
cd %1
) ELSE IF EXIST "..\Game\B\tgstation.dmb" (
rem TGS3: Game/B/tgstation.dmb exists, so build in Game/A
cd ..\Game\A
) ELSE (
rem TGS3: Otherwise build in Game/B
cd ..\Game\B
)
cd %1
set CBT_BUILD_MODE=TGS
tools\build\build

View File

@@ -32,7 +32,28 @@ env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --ignore-rust-version --re
mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g.so"
cd ..
#
cd "$original_dir"
# update dreamluau
if [ ! -d "dreamluau" ]; then
echo "Cloning dreamluau..."
git clone https://github.com/tgstation/dreamluau
cd dreamluau
~/.cargo/bin/rustup target add i686-unknown-linux-gnu
else
echo "Fetching dreamlaua..."
cd dreamluau
git fetch
~/.cargo/bin/rustup target add i686-unknown-linux-gnu
fi
echo "Deploying Dreamlaua..."
git checkout "$DREAMLUAU_VERSION"
env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --ignore-rust-version --release --target=i686-unknown-linux-gnu
mv target/i686-unknown-linux-gnu/release/libdreamluau.so "$1/libdreamluau.so"
cd ..
# compile tgui
echo "Compiling tgui..."
cd "$1"
env TG_BOOTSTRAP_CACHE="$original_dir" TG_BOOTSTRAP_NODE_LINUX=1 CBT_BUILD_MODE="TGS" tools/bootstrap/node tools/build/build.js
env TG_BOOTSTRAP_CACHE="$original_dir" CBT_BUILD_MODE="TGS" tools/bootstrap/javascript.sh tools/build/build.js

View File

@@ -1,4 +1,4 @@
// Simple app meant to test chompstation's TGS integration given a fresh TGS install with the default account
// Simple app meant to test tgstation's TGS integration given a fresh TGS install with the default account
//
// Args: Repository Owner/Name, TGS instance path, TGS API port, Pushed commit hash (For .tgs.yml access), GitHub Token, (OPTIONAL) PR Number
@@ -176,7 +176,7 @@ try
new InstanceCreateRequest
{
ConfigurationType = ConfigurationType.HostWrite,
Name = "chompstation",
Name = "tgstation",
Path = instancePath
},
default);

View File

@@ -7,5 +7,5 @@ This is a simple app that does a few things
- Connects to a TGS instance via command line parameters.
- Uses the .tgs.yml information to automatically set up a TGS instance.
- Runs a TGS deploy/launch and validates that they succeeded.
Look for its invocation in the GitHub workflows
Look for its invocation in the GitHub workflows