This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"pages.attribution.self-hosted": "Self-Hosted-Version von Adventure Land.<br>Original & Lizenz: <a target=\"_blank\" rel=\"noopener\" class=\"cancela eexternal\" style=\"display: inline; color: #33BF6D\" href=\"https://adventure.land\">adventure.land</a><br>Kein Support durch das Originalprojekt."
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Self-host attribution line, copied into /app/languages/en/ at image build.
|
||||
//
|
||||
// The license of Adventure Land requires a crawlable link back to
|
||||
// https://adventure.land and forbids implying that the original project
|
||||
// supports a self-hosted instance. docker/patch-attribution.js points the
|
||||
// login/selection help box at this phrase instead of the upstream
|
||||
// "Email, for anything" line.
|
||||
//
|
||||
// English is also the fallback for every language without its own
|
||||
// attribution.json, so keep the markup identical to docker/attribution/de.json.
|
||||
module.exports = {
|
||||
"pages.attribution.self-hosted":
|
||||
'Self-hosted version of Adventure Land.<br>Original & license: <a target="_blank" rel="noopener" class="cancela eexternal" style="display: inline; color: #33BF6D" href="https://adventure.land">adventure.land</a><br>No support by the original project.',
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env node
|
||||
// Local patch: self-host attribution box (applied at image build time).
|
||||
//
|
||||
// The AdventureLandOnlyUse license requires a crawlable link back to
|
||||
// https://adventure.land, and the original project should not appear to
|
||||
// support a self-hosted instance. The upstream login/character-selection help
|
||||
// box (htmls/contents/account_help.html) shows "Email, for anything:
|
||||
// hello@adventure.land" from a phrase. This patch points that component at
|
||||
// pages.attribution.self-hosted instead, which ships as
|
||||
// docker/attribution/{en.js,de.json}; all other languages fall back to English.
|
||||
//
|
||||
// The script fails loudly when the upstream phrase is gone or the shipped
|
||||
// catalog is incomplete, so a code update cannot silently drop the attribution.
|
||||
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
|
||||
const template = process.argv[2] || "/app/htmls/contents/account_help.html";
|
||||
const app = path.resolve(path.dirname(template), "..", "..");
|
||||
|
||||
const upstream_id = "pages.contents.selection_features.email-for-anything-hello-adventure-land";
|
||||
const phrase_id = "pages.attribution.self-hosted";
|
||||
const license_url = "https://adventure.land";
|
||||
|
||||
function fail(message) {
|
||||
console.error("patch-attribution: " + message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const catalogs = [
|
||||
["en", require(path.join(app, "languages", "en", "attribution.js"))],
|
||||
["de", JSON.parse(fs.readFileSync(path.join(app, "languages", "de", "attribution.json"), "utf8"))],
|
||||
];
|
||||
|
||||
for (const [language, catalog] of catalogs) {
|
||||
const text = catalog[phrase_id];
|
||||
if (typeof text !== "string") fail("missing " + phrase_id + " in languages/" + language + "/attribution");
|
||||
if (!text.includes('href="' + license_url + '"')) {
|
||||
fail("languages/" + language + "/attribution does not link to " + license_url);
|
||||
}
|
||||
}
|
||||
|
||||
const source = fs.readFileSync(template, "utf8");
|
||||
|
||||
if (source.includes('"' + phrase_id + '"')) {
|
||||
console.log("patch-attribution: already applied");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (source.split(upstream_id).length !== 2) {
|
||||
fail("expected exactly one occurrence of " + upstream_id + " in " + template);
|
||||
}
|
||||
|
||||
fs.writeFileSync(template, source.replace(upstream_id, phrase_id));
|
||||
console.log("patch-attribution: applied to " + template);
|
||||
Reference in New Issue
Block a user