mirror of
https://github.com/gethomepage/homepage.git
synced 2026-10-19 00:41:45 -07:00
Compare commits
2
Commits
a6fcde2222
...
6b4c1e6a5a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b4c1e6a5a | ||
|
|
6bf81a78f3 |
@@ -791,7 +791,7 @@
|
|||||||
"processing": "Processant",
|
"processing": "Processant",
|
||||||
"processed": "Processat",
|
"processed": "Processat",
|
||||||
"time": "Temps",
|
"time": "Temps",
|
||||||
"failed": "Failed"
|
"failed": "Error"
|
||||||
},
|
},
|
||||||
"firefly": {
|
"firefly": {
|
||||||
"networth": "Valor Net",
|
"networth": "Valor Net",
|
||||||
|
|||||||
@@ -791,7 +791,7 @@
|
|||||||
"processing": "Behandler",
|
"processing": "Behandler",
|
||||||
"processed": "Behandlet",
|
"processed": "Behandlet",
|
||||||
"time": "Tid",
|
"time": "Tid",
|
||||||
"failed": "Failed"
|
"failed": "Fejlet"
|
||||||
},
|
},
|
||||||
"firefly": {
|
"firefly": {
|
||||||
"networth": "Nettoformue",
|
"networth": "Nettoformue",
|
||||||
|
|||||||
@@ -871,12 +871,12 @@
|
|||||||
"finished": "Fertig"
|
"finished": "Fertig"
|
||||||
},
|
},
|
||||||
"bookorbit": {
|
"bookorbit": {
|
||||||
"books": "Books",
|
"books": "Bücher",
|
||||||
"authors": "Authors",
|
"authors": "Autoren",
|
||||||
"series": "Series",
|
"series": "Serien",
|
||||||
"storage": "Storage",
|
"storage": "Storage",
|
||||||
"reading": "Reading",
|
"reading": "Reading",
|
||||||
"finished": "Finished"
|
"finished": "Beendet"
|
||||||
},
|
},
|
||||||
"jdownloader": {
|
"jdownloader": {
|
||||||
"downloadCount": "Warteschlange",
|
"downloadCount": "Warteschlange",
|
||||||
@@ -999,11 +999,11 @@
|
|||||||
"message": "Nachricht",
|
"message": "Nachricht",
|
||||||
"tags": "Schlagwörter",
|
"tags": "Schlagwörter",
|
||||||
"none": "Keine",
|
"none": "Keine",
|
||||||
"min": "Min",
|
"min": "Minimal",
|
||||||
"low": "Low",
|
"low": "Niedrig",
|
||||||
"default": "Default",
|
"default": "Standard",
|
||||||
"high": "High",
|
"high": "Hoch",
|
||||||
"urgent": "Urgent"
|
"urgent": "Dringend"
|
||||||
},
|
},
|
||||||
"plantit": {
|
"plantit": {
|
||||||
"events": "Ereignisse",
|
"events": "Ereignisse",
|
||||||
@@ -1117,8 +1117,8 @@
|
|||||||
"beszel": {
|
"beszel": {
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"systems": "Systeme",
|
"systems": "Systeme",
|
||||||
"up": "Up",
|
"up": "Online",
|
||||||
"down": "Down",
|
"down": "Offline",
|
||||||
"paused": "Pausiert",
|
"paused": "Pausiert",
|
||||||
"pending": "Wartend",
|
"pending": "Wartend",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
@@ -1268,10 +1268,10 @@
|
|||||||
"steps": "Schritte"
|
"steps": "Schritte"
|
||||||
},
|
},
|
||||||
"syncthing": {
|
"syncthing": {
|
||||||
"connected": "Connected",
|
"connected": "Verbunden",
|
||||||
"synced": "Synced",
|
"synced": "Synchronisiert",
|
||||||
"errors": "Errors",
|
"errors": "Fehler",
|
||||||
"storage": "Storage"
|
"storage": "Speicher"
|
||||||
},
|
},
|
||||||
"sportarr": {
|
"sportarr": {
|
||||||
"wanted": "Wanted",
|
"wanted": "Wanted",
|
||||||
|
|||||||
@@ -257,14 +257,14 @@
|
|||||||
"seed": "Semillas"
|
"seed": "Semillas"
|
||||||
},
|
},
|
||||||
"qui": {
|
"qui": {
|
||||||
"leech": "Leech",
|
"leech": "Sanguijuela",
|
||||||
"download": "Download",
|
"download": "Descargar",
|
||||||
"seed": "Seed",
|
"seed": "Semilla",
|
||||||
"upload": "Upload",
|
"upload": "Subir",
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
"errored": "Errored",
|
"errored": "Con error",
|
||||||
"ratio": "Ratio",
|
"ratio": "Ratio",
|
||||||
"freeSpace": "Free"
|
"freeSpace": "Libre"
|
||||||
},
|
},
|
||||||
"qnap": {
|
"qnap": {
|
||||||
"cpuUsage": "Uso de la CPU",
|
"cpuUsage": "Uso de la CPU",
|
||||||
@@ -791,7 +791,7 @@
|
|||||||
"processing": "Procesando",
|
"processing": "Procesando",
|
||||||
"processed": "Procesado",
|
"processed": "Procesado",
|
||||||
"time": "Tiempo",
|
"time": "Tiempo",
|
||||||
"failed": "Failed"
|
"failed": "Fallido"
|
||||||
},
|
},
|
||||||
"firefly": {
|
"firefly": {
|
||||||
"networth": "Patrimonio neto",
|
"networth": "Patrimonio neto",
|
||||||
@@ -871,12 +871,12 @@
|
|||||||
"finished": "Finalizado"
|
"finished": "Finalizado"
|
||||||
},
|
},
|
||||||
"bookorbit": {
|
"bookorbit": {
|
||||||
"books": "Books",
|
"books": "Libros",
|
||||||
"authors": "Authors",
|
"authors": "Autores",
|
||||||
"series": "Series",
|
"series": "Series",
|
||||||
"storage": "Storage",
|
"storage": "Almacenamiento",
|
||||||
"reading": "Reading",
|
"reading": "Lectura",
|
||||||
"finished": "Finished"
|
"finished": "Finalizado"
|
||||||
},
|
},
|
||||||
"jdownloader": {
|
"jdownloader": {
|
||||||
"downloadCount": "En cola",
|
"downloadCount": "En cola",
|
||||||
@@ -1279,6 +1279,6 @@
|
|||||||
"leagues": "Ligas"
|
"leagues": "Ligas"
|
||||||
},
|
},
|
||||||
"feed": {
|
"feed": {
|
||||||
"noItems": "No items"
|
"noItems": "No hay elementos"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,14 +257,14 @@
|
|||||||
"seed": "Сид"
|
"seed": "Сид"
|
||||||
},
|
},
|
||||||
"qui": {
|
"qui": {
|
||||||
"leech": "Leech",
|
"leech": "Лич",
|
||||||
"download": "Download",
|
"download": "Скачивание",
|
||||||
"seed": "Seed",
|
"seed": "Сид",
|
||||||
"upload": "Upload",
|
"upload": "Загрузка",
|
||||||
"total": "Total",
|
"total": "Всего",
|
||||||
"errored": "Errored",
|
"errored": "Ошибок",
|
||||||
"ratio": "Ratio",
|
"ratio": "Соотношение",
|
||||||
"freeSpace": "Free"
|
"freeSpace": "Свободно"
|
||||||
},
|
},
|
||||||
"qnap": {
|
"qnap": {
|
||||||
"cpuUsage": "Использование ЦП",
|
"cpuUsage": "Использование ЦП",
|
||||||
@@ -791,7 +791,7 @@
|
|||||||
"processing": "Обрабатывается",
|
"processing": "Обрабатывается",
|
||||||
"processed": "Обработано",
|
"processed": "Обработано",
|
||||||
"time": "Время",
|
"time": "Время",
|
||||||
"failed": "Failed"
|
"failed": "Неудачно"
|
||||||
},
|
},
|
||||||
"firefly": {
|
"firefly": {
|
||||||
"networth": "Общая средства",
|
"networth": "Общая средства",
|
||||||
@@ -871,12 +871,12 @@
|
|||||||
"finished": "Завершено"
|
"finished": "Завершено"
|
||||||
},
|
},
|
||||||
"bookorbit": {
|
"bookorbit": {
|
||||||
"books": "Books",
|
"books": "Книги",
|
||||||
"authors": "Authors",
|
"authors": "Авторы",
|
||||||
"series": "Series",
|
"series": "Серии",
|
||||||
"storage": "Storage",
|
"storage": "Память",
|
||||||
"reading": "Reading",
|
"reading": "Чтение",
|
||||||
"finished": "Finished"
|
"finished": "Завершено"
|
||||||
},
|
},
|
||||||
"jdownloader": {
|
"jdownloader": {
|
||||||
"downloadCount": "Очередь",
|
"downloadCount": "Очередь",
|
||||||
@@ -1279,6 +1279,6 @@
|
|||||||
"leagues": "Лиги"
|
"leagues": "Лиги"
|
||||||
},
|
},
|
||||||
"feed": {
|
"feed": {
|
||||||
"noItems": "No items"
|
"noItems": "Ничего нет"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,11 +69,11 @@ export function substituteEnvironmentVars(str) {
|
|||||||
const cachedVars = getCachedEnvironmentVars();
|
const cachedVars = getCachedEnvironmentVars();
|
||||||
cachedVars.forEach(([key, value]) => {
|
cachedVars.forEach(([key, value]) => {
|
||||||
if (key.startsWith(homepageVarPrefix)) {
|
if (key.startsWith(homepageVarPrefix)) {
|
||||||
result = result.replaceAll(`{{${key}}}`, value);
|
result = result.replaceAll(`{{${key}}}`, () => value);
|
||||||
} else if (key.startsWith(homepageFilePrefix)) {
|
} else if (key.startsWith(homepageFilePrefix)) {
|
||||||
const filename = value;
|
const filename = value;
|
||||||
const fileContents = readFileSync(filename, "utf8");
|
const fileContents = readFileSync(filename, "utf8");
|
||||||
result = result.replaceAll(`{{${key}}}`, fileContents);
|
result = result.replaceAll(`{{${key}}}`, () => fileContents);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { mkdtempSync, writeFileSync } from "node:fs";
|
import { mkdtempSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
@@ -37,6 +37,39 @@ describe("utils/config/config", () => {
|
|||||||
expect(mod.substituteEnvironmentVars("token={{HOMEPAGE_FILE_SECRET}}")).toBe("token=secret");
|
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 () => {
|
it("getSettings reads from HOMEPAGE_CONFIG_DIR and converts layout list to an object", async () => {
|
||||||
const dir = mkdtempSync(path.join(tmpdir(), "homepage-settings-test-"));
|
const dir = mkdtempSync(path.join(tmpdir(), "homepage-settings-test-"));
|
||||||
process.env.HOMEPAGE_CONFIG_DIR = dir;
|
process.env.HOMEPAGE_CONFIG_DIR = dir;
|
||||||
|
|||||||
Reference in New Issue
Block a user