Compare commits

..
1 Commits
Author SHA1 Message Date
Crowdin Bot a6fcde2222 New Crowdin translations by GitHub Action
Lint / Linting Checks (push) Canceled after 0s
Tests / vitest (1) (push) Canceled after 0s
Tests / vitest (2) (push) Canceled after 0s
Tests / vitest (3) (push) Canceled after 0s
Tests / vitest (4) (push) Canceled after 0s
2026-10-13 12:32:56 +00:00
3 changed files with 4 additions and 37 deletions
+1 -1
View File
@@ -791,7 +791,7 @@
"processing": "Behandler",
"processed": "Behandlet",
"time": "Tid",
"failed": "Fejlet"
"failed": "Failed"
},
"firefly": {
"networth": "Nettoformue",
+2 -2
View File
@@ -69,11 +69,11 @@ export function substituteEnvironmentVars(str) {
const cachedVars = getCachedEnvironmentVars();
cachedVars.forEach(([key, value]) => {
if (key.startsWith(homepageVarPrefix)) {
result = result.replaceAll(`{{${key}}}`, () => value);
result = result.replaceAll(`{{${key}}}`, value);
} else if (key.startsWith(homepageFilePrefix)) {
const filename = value;
const fileContents = readFileSync(filename, "utf8");
result = result.replaceAll(`{{${key}}}`, () => fileContents);
result = result.replaceAll(`{{${key}}}`, fileContents);
}
});
}
+1 -34
View File
@@ -1,4 +1,4 @@
import { mkdtempSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
import { mkdtempSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
@@ -37,39 +37,6 @@ describe("utils/config/config", () => {
expect(mod.substituteEnvironmentVars("token={{HOMEPAGE_FILE_SECRET}}")).toBe("token=secret");
});
it.each(["pa$$word", "pa$&word", "pa$`word", "pa$'word", "pa$1word"])(
"substituteEnvironmentVars preserves literal environment value %j in every occurrence",
async (secret) => {
process.env.HOMEPAGE_VAR_SECRET = secret;
const mod = await import("./config");
expect(
mod.substituteEnvironmentVars("before {{HOMEPAGE_VAR_SECRET}} between {{HOMEPAGE_VAR_SECRET}} after"),
).toBe(`before ${secret} between ${secret} after`);
},
);
it.each(["pa$$word", "pa$&word", "pa$`word", "pa$'word", "pa$1word"])(
"substituteEnvironmentVars preserves literal secret file contents %j in every occurrence",
async (secret) => {
const dir = mkdtempSync(path.join(tmpdir(), "homepage-config-test-"));
const secretPath = path.join(dir, "secret.txt");
writeFileSync(secretPath, secret, "utf8");
try {
process.env.HOMEPAGE_FILE_SECRET = secretPath;
const mod = await import("./config");
expect(
mod.substituteEnvironmentVars("before {{HOMEPAGE_FILE_SECRET}} between {{HOMEPAGE_FILE_SECRET}} after"),
).toBe(`before ${secret} between ${secret} after`);
} finally {
unlinkSync(secretPath);
rmdirSync(dir);
}
},
);
it("getSettings reads from HOMEPAGE_CONFIG_DIR and converts layout list to an object", async () => {
const dir = mkdtempSync(path.join(tmpdir(), "homepage-settings-test-"));
process.env.HOMEPAGE_CONFIG_DIR = dir;