This commit is contained in:
Ponkhy 2021-09-17 16:02:28 +02:00
commit f6498caa9a
18 changed files with 116 additions and 80 deletions

View file

@ -1,4 +1,5 @@
module.exports = { module.exports = {
root: true,
env: { env: {
browser: true, browser: true,
commonjs: true, commonjs: true,

View file

@ -107,11 +107,13 @@ If you love this project, please consider giving me a ⭐.
## 🗣️ Discussion ## 🗣️ Discussion
You can also discuss or ask for help in [Issues](https://github.com/louislam/uptime-kuma/issues). ### Issues Page
You can discuss or ask for help in [Issues](https://github.com/louislam/uptime-kuma/issues).
Alternatively, you can discuss in my original post on reddit: https://www.reddit.com/r/selfhosted/comments/oi7dc7/uptime_kuma_a_fancy_selfhosted_monitoring_tool_an/ ### Subreddit
My Reddit account: louislamlam
I think the real "Discussion" tab is hard to use, as it is reddit-like flow, I always missed new comments. You can mention me if you ask question on Reddit.
https://www.reddit.com/r/UptimeKuma/
## Contribute ## Contribute

View file

@ -1,4 +1,4 @@
// Need to use es6 to read language files // Need to use ES6 to read language files
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
@ -14,6 +14,7 @@ const copyRecursiveSync = function (src, dest) {
let exists = fs.existsSync(src); let exists = fs.existsSync(src);
let stats = exists && fs.statSync(src); let stats = exists && fs.statSync(src);
let isDirectory = exists && stats.isDirectory(); let isDirectory = exists && stats.isDirectory();
if (isDirectory) { if (isDirectory) {
fs.mkdirSync(dest); fs.mkdirSync(dest);
fs.readdirSync(src).forEach(function (childItemName) { fs.readdirSync(src).forEach(function (childItemName) {
@ -24,8 +25,9 @@ const copyRecursiveSync = function (src, dest) {
fs.copyFileSync(src, dest); fs.copyFileSync(src, dest);
} }
}; };
console.log(process.argv)
const baseLangCode = process.argv[2] || "zh-HK"; console.log("Arguments:", process.argv)
const baseLangCode = process.argv[2] || "en";
console.log("Base Lang: " + baseLangCode); console.log("Base Lang: " + baseLangCode);
fs.rmdirSync("./languages", { recursive: true }); fs.rmdirSync("./languages", { recursive: true });
copyRecursiveSync("../../src/languages", "./languages"); copyRecursiveSync("../../src/languages", "./languages");
@ -33,19 +35,23 @@ copyRecursiveSync("../../src/languages", "./languages");
const en = (await import("./languages/en.js")).default; const en = (await import("./languages/en.js")).default;
const baseLang = (await import(`./languages/${baseLangCode}.js`)).default; const baseLang = (await import(`./languages/${baseLangCode}.js`)).default;
const files = fs.readdirSync("./languages"); const files = fs.readdirSync("./languages");
console.log(files); console.log("Files:", files);
for (const file of files) { for (const file of files) {
if (file.endsWith(".js")) { if (!file.endsWith(".js")) {
console.log("Skipping " + file)
continue;
}
console.log("Processing " + file); console.log("Processing " + file);
const lang = await import("./languages/" + file); const lang = await import("./languages/" + file);
let obj; let obj;
if (lang.default) { if (lang.default) {
console.log("is js module");
obj = lang.default; obj = lang.default;
} else { } else {
console.log("empty file"); console.log("Empty file");
obj = { obj = {
languageName: "<Your Language name in your language (not in English)>" languageName: "<Your Language name in your language (not in English)>"
}; };
@ -58,21 +64,21 @@ for (const file of files) {
} }
} }
if (baseLang !== en) {
// Base second // Base second
for (const key in baseLang) { for (const key in baseLang) {
if (! obj[key]) { if (! obj[key]) {
obj[key] = key; obj[key] = key;
} }
} }
}
const code = "export default " + util.inspect(obj, { const code = "export default " + util.inspect(obj, {
depth: null, depth: null,
}); });
fs.writeFileSync(`../../src/languages/${file}`, code); fs.writeFileSync(`../../src/languages/${file}`, code);
}
} }
fs.rmdirSync("./languages", { recursive: true }); fs.rmdirSync("./languages", { recursive: true });
console.log("Done, fix the format by eslint now"); console.log("Done. Fixing formatting by ESLint...");

View file

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/svg+xml" href="/icon.svg" /> <link rel="icon" type="image/svg+xml" href="/icon.svg" />
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" id="theme-color" content="" /> <meta name="theme-color" id="theme-color" content="" />
<meta name="description" content="Uptime Kuma monitoring tool" /> <meta name="description" content="Uptime Kuma monitoring tool" />
<title>Uptime Kuma</title> <title>Uptime Kuma</title>

View file

@ -34,8 +34,10 @@
"test-install-script-alpine3": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/alpine3.dockerfile .", "test-install-script-alpine3": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/alpine3.dockerfile .",
"test-install-script-ubuntu": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu.dockerfile .", "test-install-script-ubuntu": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu.dockerfile .",
"test-install-script-ubuntu1604": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1604.dockerfile .", "test-install-script-ubuntu1604": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1604.dockerfile .",
"test-nodejs16": "docker build --progress plain -f test/ubuntu-nodejs16.dockerfile .",
"simple-dns-server": "node extra/simple-dns-server.js", "simple-dns-server": "node extra/simple-dns-server.js",
"update-language-files": "cd extra/update-language-files && node index.js %npm_config_base_lang% && eslint ../../src/languages/**.js --fix" "update-language-files_old": "cd extra/update-language-files && node index.js %npm_config_base_lang% && eslint ../../src/languages/**.js --fix",
"update-language-files": "cd extra/update-language-files && node index.js && eslint ../../src/languages/**.js --fix"
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36", "@fortawesome/fontawesome-svg-core": "^1.2.36",

BIN
public/icon-192x192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
public/icon-512x512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

19
public/manifest.json Normal file
View file

@ -0,0 +1,19 @@
{
"name": "Uptime Kuma",
"short_name": "Uptime Kuma",
"start_url": "/",
"background_color": "#fff",
"display": "standalone",
"icons": [
{
"src": "icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View file

@ -1,8 +1,8 @@
# How to translate # How to translate
1. Fork this repo. 1. Fork this repo.
2. Create a language file. (e.g. `zh-TW.js`) The filename must be ISO language code: http://www.lingoes.net/en/translator/langcode.htm 2. Create a language file (e.g. `zh-TW.js`). The filename must be ISO language code: http://www.lingoes.net/en/translator/langcode.htm
3. `npm run update-language-files --base-lang=de-DE` 3. Run `npm run update-language-files`. You can also use this command to check if there are new strings to translate for your language.
4. Your language file should be filled in. You can translate now. 4. Your language file should be filled in. You can translate now.
5. Translate `src/pages/Settings.vue` (search for a `Confirm` component with `rel="confirmDisableAuth"`). 5. Translate `src/pages/Settings.vue` (search for a `Confirm` component with `rel="confirmDisableAuth"`).
6. Import your language file in `src/i18n.js` and add it to `languageList` constant. 6. Import your language file in `src/i18n.js` and add it to `languageList` constant.

View file

@ -113,9 +113,6 @@ export default {
"Create your admin account": "Erstelle dein Admin Konto", "Create your admin account": "Erstelle dein Admin Konto",
"Repeat Password": "Wiederhole das Passwort", "Repeat Password": "Wiederhole das Passwort",
"Resource Record Type": "Resource Record Type", "Resource Record Type": "Resource Record Type",
"Export": "Export",
"Import": "Import",
"Import/Export Backup": "Import/Export Backup",
Export: "Export", Export: "Export",
Import: "Import", Import: "Import",
respTime: "Antw. Zeit (ms)", respTime: "Antw. Zeit (ms)",
@ -133,8 +130,8 @@ export default {
"Clear all statistics": "Lösche alle Statistiken", "Clear all statistics": "Lösche alle Statistiken",
importHandleDescription: "Wähle 'Vorhandene überspringen' aus, wenn jeder Monitor oder Benachrichtigung mit demselben Namen übersprungen werden soll. 'Überschreiben' löscht jeden vorhandenen Monitor sowie Benachrichtigungen.", importHandleDescription: "Wähle 'Vorhandene überspringen' aus, wenn jeder Monitor oder Benachrichtigung mit demselben Namen übersprungen werden soll. 'Überschreiben' löscht jeden vorhandenen Monitor sowie Benachrichtigungen.",
"Skip existing": "Vorhandene überspringen", "Skip existing": "Vorhandene überspringen",
"Overwrite": "Überschreiben", Overwrite: "Überschreiben",
"Options": "Optionen", Options: "Optionen",
confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.", confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.",
"Keep both": "Beide behalten", "Keep both": "Beide behalten",
twoFAVerifyLabel: "Bitte trage deinen Token ein um zu verifizieren das 2FA funktioniert", twoFAVerifyLabel: "Bitte trage deinen Token ein um zu verifizieren das 2FA funktioniert",
@ -151,7 +148,6 @@ export default {
Inactive: "Inaktiv", Inactive: "Inaktiv",
Token: "Token", Token: "Token",
"Show URI": "URI Anzeigen", "Show URI": "URI Anzeigen",
"Clear all statistics": "Lösche alle Statistiken",
Tags: "Tags", Tags: "Tags",
"Add New below or Select...": "Füge neuen hinzu oder wähle aus...", "Add New below or Select...": "Füge neuen hinzu oder wähle aus...",
"Tag with this name already exist.": "Ein Tag mit dem Namen existiert bereits.", "Tag with this name already exist.": "Ein Tag mit dem Namen existiert bereits.",
@ -167,4 +163,8 @@ export default {
Purple: "Lila", Purple: "Lila",
Pink: "Pink", Pink: "Pink",
"Search...": "Suchen...", "Search...": "Suchen...",
"Heartbeat Retry Interval": "Takt-Wiederholungsintervall",
retryCheckEverySecond: "Versuche alle {0} Sekunden",
"Import Backup": "Import Backup",
"Export Backup": "Export Backup",
} }

View file

@ -139,8 +139,8 @@ export default {
alertWrongFileType: "Please select a JSON file.", alertWrongFileType: "Please select a JSON file.",
"Clear all statistics": "Clear all Statistics", "Clear all statistics": "Clear all Statistics",
"Skip existing": "Skip existing", "Skip existing": "Skip existing",
"Overwrite": "Overwrite", Overwrite: "Overwrite",
"Options": "Options", Options: "Options",
"Keep both": "Keep both", "Keep both": "Keep both",
"Verify Token": "Verify Token", "Verify Token": "Verify Token",
"Setup 2FA": "Setup 2FA", "Setup 2FA": "Setup 2FA",
@ -152,7 +152,6 @@ export default {
Inactive: "Inactive", Inactive: "Inactive",
Token: "Token", Token: "Token",
"Show URI": "Show URI", "Show URI": "Show URI",
"Clear all statistics": "Clear all Statistics",
Tags: "Tags", Tags: "Tags",
"Add New below or Select...": "Add New below or Select...", "Add New below or Select...": "Add New below or Select...",
"Tag with this name already exist.": "Tag with this name already exist.", "Tag with this name already exist.": "Tag with this name already exist.",

View file

@ -115,7 +115,6 @@ export default {
"Last Result": "Ultimo risultato", "Last Result": "Ultimo risultato",
"Create your admin account": "Crea l'account amministratore", "Create your admin account": "Crea l'account amministratore",
"Repeat Password": "Ripeti Password", "Repeat Password": "Ripeti Password",
"Import/Export Backup": "Importa/Esporta Backup",
Export: "Esporta", Export: "Esporta",
Import: "Importa", Import: "Importa",
respTime: "Tempo di Risposta (ms)", respTime: "Tempo di Risposta (ms)",

View file

@ -115,7 +115,6 @@ export default {
"Last Result": "Laatste resultaat", "Last Result": "Laatste resultaat",
"Create your admin account": "Maak uw beheerdersaccount aan", "Create your admin account": "Maak uw beheerdersaccount aan",
"Repeat Password": "Herhaal wachtwoord", "Repeat Password": "Herhaal wachtwoord",
"Import/Export Backup": "Backup importeren/exporteren",
Export: "Exporteren", Export: "Exporteren",
Import: "Importeren", Import: "Importeren",
respTime: "resp. tijd (ms)", respTime: "resp. tijd (ms)",

View file

@ -110,37 +110,37 @@ export default {
respTime: "Czas odp. (ms)", respTime: "Czas odp. (ms)",
notAvailableShort: "N/A", notAvailableShort: "N/A",
Create: "Stwórz", Create: "Stwórz",
clearEventsMsg: "Are you sure want to delete all events for this monitor?", clearEventsMsg: "Jesteś pewien, że chcesz usunąć wszystkie monity dla tej strony?",
clearHeartbeatsMsg: "Are you sure want to delete all heartbeats for this monitor?", clearHeartbeatsMsg: "Are you sure want to delete all heartbeats for this monitor?",
confirmClearStatisticsMsg: "Are you sure want to delete ALL statistics?", confirmClearStatisticsMsg: "Jesteś pewien, że chcesz usunąć WSZYSTKIE statystyki?",
"Clear Data": "Clear Data", "Clear Data": "Usuń dane",
Events: "Events", Events: "Wydarzenia",
Heartbeats: "Heartbeats", Heartbeats: "Heartbeats",
"Auto Get": "Auto Get", "Auto Get": "Auto Get",
enableDefaultNotificationDescription: "For every new monitor this notification will be enabled by default. You can still disable the notification separately for each monitor.", enableDefaultNotificationDescription: "Dla każdego nowego monitora to powiadomienie będzie domyślnie włączone. Nadal możesz wyłączyć powiadomienia osobno dla każdego monitora.",
"Default enabled": "Default enabled", "Default enabled": "Domyślnie włączone",
"Also apply to existing monitors": "Also apply to existing monitors", "Also apply to existing monitors": "Również zastosuj do obecnych monitów",
Export: "Export", Export: "Eksport",
Import: "Import", Import: "Import",
backupDescription: "You can backup all monitors and all notifications into a JSON file.", backupDescription: "Możesz wykonać kopię zapasową wszystkich monitorów i wszystkich powiadomień w pliku JSON.",
backupDescription2: "PS: History and event data is not included.", backupDescription2: "PS: Historia i dane zdarzeń nie są uwzględniane.",
backupDescription3: "Sensitive data such as notification tokens is included in the export file, please keep it carefully.", backupDescription3: "Poufne dane, takie jak tokeny powiadomień, są zawarte w pliku eksportu, prosimy o ostrożne przechowywanie.",
alertNoFile: "Please select a file to import.", alertNoFile: "Proszę wybrać plik do importu.",
alertWrongFileType: "Please select a JSON file.", alertWrongFileType: "Proszę wybrać plik JSON.",
twoFAVerifyLabel: "Please type in your token to verify that 2FA is working", twoFAVerifyLabel: "Proszę podaj swój token 2FA, aby sprawdzić go",
tokenValidSettingsMsg: "Token is valid! You can now save the 2FA settings.", tokenValidSettingsMsg: "Token jest poprawny! Możesz teraz zapisać ustawienia 2FA.",
confirmEnableTwoFAMsg: "Are you sure you want to enable 2FA?", confirmEnableTwoFAMsg: "Jesteś prwien że chcesz włączyć 2FA?",
confirmDisableTwoFAMsg: "Are you sure you want to disable 2FA?", confirmDisableTwoFAMsg: "Jesteś prwien że chcesz wyłączyć 2FA?",
"Apply on all existing monitors": "Apply on all existing monitors", "Apply on all existing monitors": "Zastosuj do wszystki obecnych monitów",
"Verify Token": "Verify Token", "Verify Token": "Weryfikuj Token",
"Setup 2FA": "Setup 2FA", "Setup 2FA": "Ustaw 2FA",
"Enable 2FA": "Enable 2FA", "Enable 2FA": "Włącz 2FA",
"Disable 2FA": "Disable 2FA", "Disable 2FA": "Wyłącz 2FA",
"2FA Settings": "2FA Settings", "2FA Settings": "Ustawienia 2FA",
"Two Factor Authentication": "Two Factor Authentication", "Two Factor Authentication": "Podwójna weryfikacja",
Active: "Active", Active: "Włączone",
Inactive: "Inactive", Inactive: "Wyłączone",
Token: "Token", Token: "Token",
"Show URI": "Show URI", "Show URI": "Pokaż URI",
"Clear all statistics": "Clear all Statistics", "Clear all statistics": "Wyczyść wszystkie statystyki",
} }

View file

@ -116,5 +116,5 @@ export default {
"Clear Data": "Verileri Temizle", "Clear Data": "Verileri Temizle",
Events: "Olaylar", Events: "Olaylar",
Heartbeats: "Sağlık Durumları", Heartbeats: "Sağlık Durumları",
"Auto Get": "Otomatik Al" "Auto Get": "Otomatik Al",
} }

View file

@ -120,7 +120,6 @@ export default {
enableDefaultNotificationDescription: "新的监控项将默认启用,你也可以在每个监控项中分别设置", enableDefaultNotificationDescription: "新的监控项将默认启用,你也可以在每个监控项中分别设置",
"Default enabled": "默认开启", "Default enabled": "默认开启",
"Also apply to existing monitors": "应用到所有监控项", "Also apply to existing monitors": "应用到所有监控项",
"Import/Export Backup": "导入/导出备份",
Export: "导出", Export: "导出",
Import: "导入", Import: "导入",
backupDescription: "你可以将所有的监控项和消息通知备份到一个 JSON 文件中", backupDescription: "你可以将所有的监控项和消息通知备份到一个 JSON 文件中",

View file

@ -120,7 +120,6 @@ export default {
enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。", enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。",
"Default enabled": "預設通知", "Default enabled": "預設通知",
"Also apply to existing monitors": "同時取用至目前所有監測器", "Also apply to existing monitors": "同時取用至目前所有監測器",
"Import/Export Backup": "匯入/匯出 備份",
Export: "匯出", Export: "匯出",
Import: "匯入", Import: "匯入",
backupDescription: "您可以備份所有監測器及所有通知。", backupDescription: "您可以備份所有監測器及所有通知。",

View file

@ -0,0 +1,10 @@
FROM ubuntu
WORKDIR /app
RUN apt update && apt --yes install git curl
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt --yes install nodejs
RUN git clone https://github.com/louislam/uptime-kuma.git .
RUN npm run setup
# Option 1. Try it
RUN node server/server.js