mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
- the client (1.3.0) sends one-way hashes of the device's ids at sign-in; the server keys them again with a secret of its own (data/device-key) and keeps them per account (lib/devices.js). a sign-in without them is refused with 426 (AJ_REQUIRE_DEVICE=0 lets it in), so 1.2 clients cannot sign in. - hardware bans: every device an account used in the last 90 days. any id but a network card blocks sign-in, sign-up and the game, on any account. a network card match, ids that look altered, or a device shared with a banned player raise hardware alerts instead. - both panels: hardware ban and lift, the account's hardware ids, search by hardware id, other accounts by device or address, a timeline (bans, staff actions, reports, alerts), and hardware bans and alerts in the bans tab. - jam-a-grams and wall posts go into the chat log, the filtered ones marked not sent. chat search filters by kind, by what the filter stopped, and from a time back; each player's page lists their jam-a-grams and wall posts, sent and received. - account search runs on the server and ranks exact names first, then names starting with the search; the admin panel no longer downloads every account. hidden tabs only refresh the waiting counts in the title. masterpieces can be searched by maker, approved ones too. reports can show the reported player's chat at the time. links follow the open tab and player. - admin actions on accounts go into the moderator log. - privacy policy covers hardware hashes and the new logs.
317 lines
18 KiB
JavaScript
317 lines
18 KiB
JavaScript
"use strict";
|
|
|
|
const path = require("path");
|
|
|
|
const env = process.env;
|
|
const LOOPBACK_NAMES = ["127.0.0.1", "::1", "localhost"];
|
|
const bindAddress = env.AJ_BIND || "127.0.0.1";
|
|
const httpPort = Number(env.AJ_HTTP_PORT || 8080);
|
|
const gamePort = Number(env.AJ_GAME_PORT || 9339);
|
|
// with a certificate both ports speak TLS. the launcher follows suit when its
|
|
// own config.js uses an https:// address.
|
|
const tls = env.AJ_TLS_CERT && env.AJ_TLS_KEY ? {certFile: env.AJ_TLS_CERT, keyFile: env.AJ_TLS_KEY} : null;
|
|
// AJ_PUBLIC_URL: the address players reach this server at
|
|
// ("https://play.burrow.moe", with a port if it is not the usual one). it
|
|
// is the one switch for a server strangers can reach, whether this process
|
|
// listens on a public address itself or sits behind a reverse proxy or a
|
|
// tunnel: with it set the server knows it is public, tells the game that
|
|
// address, marks its cookies Secure when it is an https:// one, and trusts
|
|
// no request for coming from this machine (behind a proxy they all do).
|
|
const publicUrl = env.AJ_PUBLIC_URL ? new URL(env.AJ_PUBLIC_URL) : null;
|
|
const host = env.AJ_HOST || (publicUrl ? publicUrl.hostname : "127.0.0.1");
|
|
// AJ_SITE_URL: where the web pages are (the home page, sign-up, the account
|
|
// page, the moderator panel, the terms), when that is another name than the
|
|
// game server's ("https://burrow.moe" beside AJ_PUBLIC_URL's
|
|
// "https://play.burrow.moe"). the server answers to both; a web page asked
|
|
// for under the game server's name is sent on to this one.
|
|
const siteUrl = env.AJ_SITE_URL ? new URL(env.AJ_SITE_URL) : null;
|
|
// reachable from other machines? several defaults get stricter when it is.
|
|
const isPublic = Boolean(publicUrl) || !LOOPBACK_NAMES.includes(bindAddress) || !LOOPBACK_NAMES.includes(env.AJ_GAME_BIND || bindAddress);
|
|
// AJ_TRUSTED_PROXY=1: a reverse proxy on this machine is the only thing that
|
|
// reaches the web port, and the visitor's address is the last one in the
|
|
// X-Forwarded-For header it sets. without it every visitor behind a proxy
|
|
// has the proxy's address, and the per-address limits see one address.
|
|
const trustedProxy = env.AJ_TRUSTED_PROXY === "1";
|
|
// the game port can listen wider than the web port: a proxy (cloudflare, say)
|
|
// carries web pages but not the game's own protocol
|
|
const gameBindAddress = env.AJ_GAME_BIND || bindAddress;
|
|
const baseUrl = publicUrl ? `${publicUrl.origin}/` : `${tls ? "https" : "http"}://${host}:${httpPort}/`;
|
|
// settings that contradict each other are refused at start (server.js)
|
|
// rather than left to be found out.
|
|
const problems = [];
|
|
if (publicUrl && env.AJ_TRUST_LOCAL === "1") {
|
|
problems.push("AJ_PUBLIC_URL and AJ_TRUST_LOCAL=1 cannot both be set: behind a proxy every request looks local");
|
|
}
|
|
if (trustedProxy && !LOOPBACK_NAMES.includes(bindAddress)) {
|
|
problems.push("AJ_TRUSTED_PROXY=1 needs AJ_BIND to be 127.0.0.1: anyone who reaches the port directly could name any address as theirs");
|
|
}
|
|
if ((publicUrl || !LOOPBACK_NAMES.includes(bindAddress)) && env.AJ_REGISTER === "1") {
|
|
problems.push("AJ_REGISTER=1 cannot be used on a public server: an account made that way has agreed to nothing");
|
|
}
|
|
if (Boolean(env.AJ_TURNSTILE_SITE_KEY) !== Boolean(env.AJ_TURNSTILE_SECRET)) {
|
|
problems.push("AJ_TURNSTILE_SITE_KEY and AJ_TURNSTILE_SECRET go together: set both or neither");
|
|
}
|
|
if (siteUrl && (!publicUrl || !/^https?:$/.test(siteUrl.protocol))) {
|
|
problems.push("AJ_SITE_URL needs AJ_PUBLIC_URL, and must be an http:// or https:// address");
|
|
}
|
|
if (publicUrl && !/^https?:$/.test(publicUrl.protocol)) {
|
|
problems.push("AJ_PUBLIC_URL must be an http:// or https:// address");
|
|
}
|
|
|
|
module.exports = {
|
|
// address the client is told to use. the patched ajclient.swf always opens
|
|
// its game socket to 127.0.0.1, so only change this together with the SWF.
|
|
host,
|
|
bindAddress,
|
|
gameBindAddress,
|
|
isPublic,
|
|
publicUrl,
|
|
trustedProxy,
|
|
problems,
|
|
tls,
|
|
// behind a trusted proxy the proxy encrypts the web port; the certificate is the game port's
|
|
webTls: trustedProxy ? null : tls,
|
|
// requests from this machine may use the item finder for any account and
|
|
// list accounts. never with AJ_PUBLIC_URL set; AJ_TRUST_LOCAL=0 turns it
|
|
// off otherwise. (A request that came through a proxy is never taken for
|
|
// local, whatever is set: lib/limits.js.)
|
|
trustLocalRequests: !publicUrl && env.AJ_TRUST_LOCAL !== "0",
|
|
httpPort,
|
|
gamePort,
|
|
baseUrl,
|
|
// the web pages' address: baseUrl unless AJ_SITE_URL names another
|
|
siteUrl: siteUrl ? `${siteUrl.origin}/` : baseUrl,
|
|
// cookies are only sent back over an encrypted connection when players
|
|
// have one, whoever does the encrypting.
|
|
secureCookies: baseUrl.startsWith("https:"),
|
|
// the admin panel answers this machine alone on a public server (reach it
|
|
// through an SSH tunnel), plus the addresses listed in AJ_ADMIN_ALLOW,
|
|
// separated by commas. on a local server it answers whoever can reach it.
|
|
adminAllow: (env.AJ_ADMIN_ALLOW || "").split(",").map(address => address.trim()).filter(Boolean),
|
|
|
|
// cloudflare turnstile (lib/captcha.js): a captcha wherever a password is
|
|
// tried or an account is made, with both set. off without them.
|
|
turnstile: env.AJ_TURNSTILE_SITE_KEY && env.AJ_TURNSTILE_SECRET
|
|
? {siteKey: env.AJ_TURNSTILE_SITE_KEY, secret: env.AJ_TURNSTILE_SECRET} : null,
|
|
|
|
// asset mirror: anything not served locally is fetched once from here and
|
|
// cached in cacheDir. set AJ_OFFLINE=1 to serve from the cache only.
|
|
upstreamContent: env.AJ_UPSTREAM || "https://ajcontent.akamaized.net/",
|
|
offline: env.AJ_OFFLINE === "1",
|
|
// the client's device ids (lib/devices.js): a sign-in without them (a
|
|
// client from before 1.3.0, the official launcher, or one that left them
|
|
// out) is refused. AJ_REQUIRE_DEVICE=0 lets them in, unknown.
|
|
requireDevice: env.AJ_REQUIRE_DEVICE !== "0",
|
|
deployVersion: env.AJ_DEPLOY_VERSION || "1830",
|
|
// older builds the CDN still serves, asked in turn for a room file the
|
|
// current build has dropped. 1828 is the last with the Summer Carnival.
|
|
olderBuilds: ["1828"],
|
|
// the client adds this to every asset address, so raising it makes every
|
|
// client fetch everything afresh. raise it whenever the server starts
|
|
// serving an asset differently (4: item defs with all eyes for all animals;
|
|
// 5: re-dated item packs, the room pack, HUD artwork with the 2014 name tag;
|
|
// 6: the party pack; 14 and 15: more rows in the Theme list; 16: clothing
|
|
// for every animal, and last-seen times on player cards; 17 and 18: the
|
|
// banned label on player cards).
|
|
// 19 to 25: the comforts of 2026-10-11, see HANDOFF.md.
|
|
// 39: chat drawn as text and never as markup, the chat filter, and the
|
|
// game no longer open to SWFs from other addresses.
|
|
// 40: the chat filter's window laid out again.
|
|
// 41: the game's text says "Burrow" where it said Animal Jam.
|
|
// 48: the item giver (the item finder renamed) with previews and hex colours;
|
|
// 49 and 50: its link to a colour picker.
|
|
buildVersion: env.AJ_BUILD_VERSION || "57",
|
|
// what the official CDN is asked for; not ours to change.
|
|
upstreamBuildVersion: "3",
|
|
|
|
// the patched game client and the font file its assets import, both in
|
|
// swf/ (ajclient.before-finder.swf there is the base the client is rebuilt
|
|
// from, see the README).
|
|
clientSwf: env.AJ_CLIENT_SWF || path.join(__dirname, "swf", "ajclient.swf"),
|
|
sharedFontsSwf: path.join(__dirname, "swf", "sharedFonts.swf"),
|
|
// the HUD artwork (assets/HUDAssets.swf on the CDN), served from here
|
|
// because it is changed: see "Rebuild" in the README.
|
|
hudAssetsSwf: path.join(__dirname, "swf", "HUDAssets.swf"),
|
|
dataDir: env.AJ_DATA_DIR || path.join(__dirname, "data"),
|
|
cacheDir: path.join(__dirname, "cache"),
|
|
// updates for installed clients, served at /client/ (the client's
|
|
// tools/make-update.js writes them here; they are in the repository)
|
|
clientUpdatesDir: env.AJ_CLIENT_UPDATES_DIR || path.join(__dirname, "client-updates"),
|
|
// the client's installers, listed at /download. not in the repository:
|
|
// copied here by hand after a build (the client's BUILDING.md).
|
|
downloadsDir: env.AJ_DOWNLOADS_DIR || path.join(env.AJ_DATA_DIR || path.join(__dirname, "data"), "downloads"),
|
|
publicDir: path.join(__dirname, "public"),
|
|
|
|
// accounts are made through the client's Create Account screens or the
|
|
// /register page. set AJ_REGISTER=1 to also create one whenever an unknown
|
|
// username logs in (handy for throwaway test accounts).
|
|
registerOnLogin: env.AJ_REGISTER === "1",
|
|
|
|
// the terms of service and the privacy policy (public/terms.html,
|
|
// public/privacy.html). A sign-up records the version agreed to: change
|
|
// it when either text changes in a way that matters. the values under it
|
|
// are written into both pages. the emails and the host's country are
|
|
// placeholders until set; the operator is, at the owner's word, said to
|
|
// be in the EU without a name or a country.
|
|
termsVersion: "2026-10-17",
|
|
legalEmail: env.AJ_LEGAL_EMAIL || "[email protected]",
|
|
adminEmail: env.AJ_ADMIN_EMAIL || "[email protected]",
|
|
operator: env.AJ_OPERATOR || "an individual based in the European Union",
|
|
hostedIn: env.AJ_HOSTED_IN || "[country of the hosting provider]",
|
|
|
|
// links on the home page; an empty download reads "Soon"
|
|
downloadUrl: env.AJ_DOWNLOAD_URL || "",
|
|
githubUrl: env.AJ_GITHUB_URL || "",
|
|
discordUrl: env.AJ_DISCORD_URL || "",
|
|
|
|
// 2+ is a member. 4 and 5 unlock the client's developer debug overlays.
|
|
// no account type gives powers over other players; running the server is
|
|
// done from the admin panel at /admin (lib/panel.js).
|
|
defaultAccountType: 2,
|
|
// looks of the lands players can pick with the Theme list. the official CDN
|
|
// keeps past builds (35 of them, November 2022 to today), each with that
|
|
// month's version of every land, so a theme is first of all the build to
|
|
// take room files from. `rooms` then names rooms shown as another room
|
|
// file: the room list still carries seasonal copies of some lands that the
|
|
// official game stopped using years ago, and those are older than any
|
|
// build. `label` is for people; the list the game shows is in
|
|
// swf-src/MySettings.as, in the same order.
|
|
//
|
|
// the first eight are the latest year's seasons. the rest is every other
|
|
// season and year there is (DISCOVERIES.md, "Older designs of the lands",
|
|
// says what was looked through and how each was dated): one row for each
|
|
// season of each year the builds cover, then one for each year's worth
|
|
// of leftover seasonal room files. most differ from today's version of
|
|
// their season by a handful of decorations; the ones that show more:
|
|
// - 1636 and 1637: the Township's painting before it was redone in 2023
|
|
// and Club Geoz was built.
|
|
// - 1691 and earlier: the Flag Shop in Sarepia, before it became the
|
|
// Hall of Animals.
|
|
// - friendship2018: the Township on its winter 2017 painting with the
|
|
// old arcade front, and Mt. shiveer before the bridge to Balloosh.
|
|
// - freedom2021: Freedom Day's fireworks, which today's July build no
|
|
// longer has.
|
|
themes: {
|
|
halloween: {label: "Halloween", build: 1830},
|
|
fall: {label: "Fall", build: 1829},
|
|
jamaalidays: {label: "Jamaalidays", build: 1810},
|
|
winter: {label: "Winter", build: 1811},
|
|
friendship: {label: "Friendship", build: 1815},
|
|
lucky: {label: "Lucky Day", build: 1817},
|
|
spring: {label: "Spring", build: 1820},
|
|
summer: {label: "Summer", build: 1828},
|
|
halloween2025: {label: "Halloween 2025", build: 1803},
|
|
fall2025: {label: "Fall 2025", build: 1807},
|
|
summer2025: {label: "Summer 2025", build: 1731},
|
|
lucky2025: {label: "Lucky Day 2025", build: 1711},
|
|
summer2024: {label: "Summer 2024", build: 1691},
|
|
spring2024: {label: "Spring 2024", build: 1678},
|
|
lucky2024: {label: "Lucky Day 2024", build: 1676},
|
|
jamaalidays2022: {label: "Jamaalidays 2022", build: 1637},
|
|
fall2022: {label: "Fall 2022", build: 1636},
|
|
freedom2021: {label: "Freedom Day 2021", build: 1824, rooms: {"sarepia.room_main": "sarepia.room_main_freedom"}},
|
|
jamaalidays2020: {label: "Jamaalidays 2020", build: 1810, rooms: {"sarepia.room_main": "sarepia.room_main_jamaalidays"}},
|
|
spring2020: {label: "Spring 2020", build: 1820, rooms: {"canyon_path.room_main": "canyon_path.room_main_main"}},
|
|
jamaalidays2018: {
|
|
label: "Jamaalidays 2018",
|
|
build: 1810,
|
|
rooms: {
|
|
"lost_temple_of_zios.room_main": "lost_temple_of_zios.room_main_jamaalidays",
|
|
"balloosh.room_main": "balloosh.room_main_jamaalidays",
|
|
},
|
|
},
|
|
summer2018: {label: "Summer 2018", build: 1828, rooms: {"sarepia.room_main": "sarepia.room_main_summer"}},
|
|
lucky2018: {label: "Lucky Day 2018", build: 1817, rooms: {"mountains_of_shivveer.room_main": "mountains_of_shivveer.room_main_lucky"}},
|
|
friendship2018: {
|
|
label: "Friendship 2018",
|
|
build: 1815,
|
|
rooms: {
|
|
"jamaa_township.room_main": "jamaa_township.room_main_friendship",
|
|
"mountains_of_shivveer.room_main": "mountains_of_shivveer.room_main_friendship",
|
|
"crystal_sands.room_main": "crystal_sands.room_main_friendship",
|
|
"lost_temple_of_zios.room_main": "lost_temple_of_zios.room_main_friendship",
|
|
},
|
|
},
|
|
// the Phantom Vortex rooms as saved in 2011 and 2013: no shop, no fog.
|
|
halloween2013: {
|
|
label: "Halloween 2013",
|
|
build: 1830,
|
|
rooms: Object.fromEntries([1, 2, 3, 4, 5].map(n => [`holidays_and_celebrations.room_jamaa_halloween${n}`, `rholidays_and_celebrations.room_jamaa_halloween${n}`])),
|
|
},
|
|
},
|
|
// rooms shown as another version of themselves in some months (1-12).
|
|
// both are versions the official game put up for a while and no door
|
|
// leads to today; when it did so is not recorded, so the months are ours:
|
|
// the Canyons Pathway with the plushie scavenger hunt's stand in spring,
|
|
// and the Conservation Museum with its "Antlers and Tusks" exhibit in
|
|
// place of the savannah one every other month.
|
|
roomSwaps: [
|
|
{room: "canyon_path.room_main", shown: "canyon_path.room_main_main", months: [3, 4]},
|
|
{room: "appondale.room_museum", shown: "appondale.room_museum_ant", months: [2, 4, 6, 8, 10, 12]},
|
|
],
|
|
startupRoom: "jamaa_township.room_main",
|
|
shards: [{id: 1, name: "Aldan"}],
|
|
maxUsersPerRoom: 80,
|
|
// everything in every shop for nothing (AJ_FREE_SHOPS=1). off unless
|
|
// asked for: what the game's shops make of a price of 0 has not been seen.
|
|
freeShops: env.AJ_FREE_SHOPS === "1",
|
|
// smooth movement in the client (AJClient.smoothOn in the SWF) for players
|
|
// who never chose: on, or with AJ_SMOOTH=0 off for everyone who has not
|
|
// chosen "Graphics: Smooth" themselves. the way back if it misbehaves.
|
|
smooth: env.AJ_SMOOTH !== "0",
|
|
partyMinutes: 120,
|
|
// row of the den-room defPack every player's den uses (1 = the small free den).
|
|
denDefId: 1,
|
|
// every currency of every account is raised to at least this at each login,
|
|
// so nobody runs dry while testing.
|
|
minimumCurrency: 10000000,
|
|
|
|
// limits on what strangers can do. requests from the server's own machine
|
|
// are exempt from the per-address ones (see trustLocalRequests).
|
|
registrationsPerHour: 5, // per address
|
|
failedLoginsPerTenMinutes: 10, // per address, and 3x this per account
|
|
errorReportsPerMinute: 30, // per address
|
|
maxConnectionsPerAddress: 10, // game sockets
|
|
// the asset mirror (lib/cdn.js): files asked for that are not in the
|
|
// cache yet, per address; how long the official CDN is waited for; and
|
|
// how big the cache may grow (files are still fetched and served past
|
|
// that, only not kept).
|
|
cacheMissesPerTenMinutes: 1500, // a first visit with an empty cache fetches several hundred files
|
|
upstreamTimeoutMs: 20000,
|
|
maxCacheBytes: Number(env.AJ_MAX_CACHE_MB || 8192) * 1024 * 1024,
|
|
maxConnections: 2000,
|
|
maxHttpConnections: 2000, // open at once, in all
|
|
maxHttpConnectionsPerAddress: 40, // the game opens a good many at once while it loads
|
|
httpSocketTimeoutMs: 60000, // a connection nothing moves on is closed
|
|
tlsHandshakeTimeoutMs: 10000,
|
|
maxMessagesPerTenSeconds: 400, // per game socket; walking sends a few a second
|
|
loginTimeoutMs: 30000, // a game socket must log in within this
|
|
idleTimeoutMs: 15 * 60000, // the client sends a keep-alive far more often
|
|
tokenLifetimeDays: 30, // login tokens kept by the launcher's "remember me"
|
|
maxChatLength: 300,
|
|
// days typed chat and whispers are kept for the moderator panel's chat
|
|
// history (lib/chatlog.js); 0 keeps none.
|
|
chatLogDays: env.AJ_CHAT_LOG_DAYS === undefined ? 30 : Math.max(0, Number(env.AJ_CHAT_LOG_DAYS) || 0),
|
|
chatLinesPerWindow: 5, // typed chat lines one player may send ...
|
|
chatWindowMs: 3000, // ... in this long
|
|
maxBytesPerTenSeconds: 512 * 1024, // per game socket; saving a full den is about 40 KB
|
|
// custom colours (lib/colours.js). every one ever made is sent to every
|
|
// player at every login and is never taken out again, so there is an end
|
|
// to how many one account may add in a day and to the table as a whole.
|
|
customColoursPerDay: 30,
|
|
maxCustomColours: 20000,
|
|
|
|
// may a client pick, when it logs in, how the game should treat the
|
|
// account for that session: member or not, guide, moderator, membership
|
|
// days left (the custom client's "advanced" settings)? it changes what that
|
|
// player's own game shows and the badge others see, never what the server
|
|
// lets them do. on by default only for a local server;
|
|
// AJ_LOGIN_CHOICES=1 / 0 forces it.
|
|
loginChoices: env.AJ_LOGIN_CHOICES === undefined ? !isPublic : env.AJ_LOGIN_CHOICES === "1",
|
|
|
|
// log every game packet in both directions (login tokens are masked), plus
|
|
// the client's media-load traces. on by default only for a local server;
|
|
// AJ_QUIET=1 / AJ_QUIET=0 forces it off / on.
|
|
logPackets: env.AJ_QUIET === undefined ? !isPublic : env.AJ_QUIET !== "1",
|
|
};
|