diff --git a/.eslintrc.js b/.eslintrc.js index 398d64c84..21fb56088 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,5 @@ module.exports = { + root: true, env: { browser: true, commonjs: true, diff --git a/README.md b/README.md index bbb9b0024..ffcac83b1 100644 --- a/README.md +++ b/README.md @@ -107,11 +107,13 @@ If you love this project, please consider giving me a ⭐. ## 🗣️ 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/ - -I think the real "Discussion" tab is hard to use, as it is reddit-like flow, I always missed new comments. +### Subreddit +My Reddit account: louislamlam +You can mention me if you ask question on Reddit. +https://www.reddit.com/r/UptimeKuma/ ## Contribute diff --git a/extra/update-language-files/index.js b/extra/update-language-files/index.js index ee7c0b5ea..a90f9f363 100644 --- a/extra/update-language-files/index.js +++ b/extra/update-language-files/index.js @@ -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 path from "path"; @@ -14,6 +14,7 @@ const copyRecursiveSync = function (src, dest) { let exists = fs.existsSync(src); let stats = exists && fs.statSync(src); let isDirectory = exists && stats.isDirectory(); + if (isDirectory) { fs.mkdirSync(dest); fs.readdirSync(src).forEach(function (childItemName) { @@ -24,8 +25,9 @@ const copyRecursiveSync = function (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); fs.rmdirSync("./languages", { recursive: true }); copyRecursiveSync("../../src/languages", "./languages"); @@ -33,46 +35,50 @@ copyRecursiveSync("../../src/languages", "./languages"); const en = (await import("./languages/en.js")).default; const baseLang = (await import(`./languages/${baseLangCode}.js`)).default; const files = fs.readdirSync("./languages"); -console.log(files); +console.log("Files:", files); + for (const file of files) { - if (file.endsWith(".js")) { - console.log("Processing " + file); - const lang = await import("./languages/" + file); + if (!file.endsWith(".js")) { + console.log("Skipping " + file) + continue; + } - let obj; + console.log("Processing " + file); + const lang = await import("./languages/" + file); - if (lang.default) { - console.log("is js module"); - obj = lang.default; - } else { - console.log("empty file"); - obj = { - languageName: "" - }; - } - - // En first - for (const key in en) { - if (! obj[key]) { - obj[key] = en[key]; - } + let obj; + + if (lang.default) { + obj = lang.default; + } else { + console.log("Empty file"); + obj = { + languageName: "" + }; + } + + // En first + for (const key in en) { + if (! obj[key]) { + obj[key] = en[key]; } + } + if (baseLang !== en) { // Base second for (const key in baseLang) { if (! obj[key]) { obj[key] = key; } } - - const code = "export default " + util.inspect(obj, { - depth: null, - }); - - fs.writeFileSync(`../../src/languages/${file}`, code); - } + + const code = "export default " + util.inspect(obj, { + depth: null, + }); + + fs.writeFileSync(`../../src/languages/${file}`, code); } fs.rmdirSync("./languages", { recursive: true }); -console.log("Done, fix the format by eslint now"); +console.log("Done. Fixing formatting by ESLint..."); diff --git a/index.html b/index.html index 61d0f42b0..cd5da9360 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@ + Uptime Kuma diff --git a/package.json b/package.json index 8d9c88fc1..0f7a71575 100644 --- a/package.json +++ b/package.json @@ -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-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-nodejs16": "docker build --progress plain -f test/ubuntu-nodejs16.dockerfile .", "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": { "@fortawesome/fontawesome-svg-core": "^1.2.36", diff --git a/public/icon-192x192.png b/public/icon-192x192.png new file mode 100644 index 000000000..89d60d72b Binary files /dev/null and b/public/icon-192x192.png differ diff --git a/public/icon-512x512.png b/public/icon-512x512.png new file mode 100644 index 000000000..cd3ab7718 Binary files /dev/null and b/public/icon-512x512.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 000000000..38e1d17da --- /dev/null +++ b/public/manifest.json @@ -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" + } + ] +} diff --git a/src/languages/README.md b/src/languages/README.md index d27e0e7eb..6ba7d95eb 100644 --- a/src/languages/README.md +++ b/src/languages/README.md @@ -1,8 +1,8 @@ # How to translate 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 -3. `npm run update-language-files --base-lang=de-DE` +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. 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. 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. diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js index 008dbbc5f..b5b0bc3bd 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -113,9 +113,6 @@ export default { "Create your admin account": "Erstelle dein Admin Konto", "Repeat Password": "Wiederhole das Passwort", "Resource Record Type": "Resource Record Type", - "Export": "Export", - "Import": "Import", - "Import/Export Backup": "Import/Export Backup", Export: "Export", Import: "Import", respTime: "Antw. Zeit (ms)", @@ -133,8 +130,8 @@ export default { "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.", "Skip existing": "Vorhandene überspringen", - "Overwrite": "Überschreiben", - "Options": "Optionen", + Overwrite: "Überschreiben", + Options: "Optionen", confirmImportMsg: "Möchtest du das Backup wirklich importieren? Bitte stelle sicher, dass die richtige Import Option ausgewählt ist.", "Keep both": "Beide behalten", twoFAVerifyLabel: "Bitte trage deinen Token ein um zu verifizieren das 2FA funktioniert", @@ -151,7 +148,6 @@ export default { Inactive: "Inaktiv", Token: "Token", "Show URI": "URI Anzeigen", - "Clear all statistics": "Lösche alle Statistiken", Tags: "Tags", "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.", @@ -167,4 +163,8 @@ export default { Purple: "Lila", Pink: "Pink", "Search...": "Suchen...", + "Heartbeat Retry Interval": "Takt-Wiederholungsintervall", + retryCheckEverySecond: "Versuche alle {0} Sekunden", + "Import Backup": "Import Backup", + "Export Backup": "Export Backup", } diff --git a/src/languages/en.js b/src/languages/en.js index 025f002f0..1971f6f6d 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -139,8 +139,8 @@ export default { alertWrongFileType: "Please select a JSON file.", "Clear all statistics": "Clear all Statistics", "Skip existing": "Skip existing", - "Overwrite": "Overwrite", - "Options": "Options", + Overwrite: "Overwrite", + Options: "Options", "Keep both": "Keep both", "Verify Token": "Verify Token", "Setup 2FA": "Setup 2FA", @@ -152,7 +152,6 @@ export default { Inactive: "Inactive", Token: "Token", "Show URI": "Show URI", - "Clear all statistics": "Clear all Statistics", Tags: "Tags", "Add New below or Select...": "Add New below or Select...", "Tag with this name already exist.": "Tag with this name already exist.", diff --git a/src/languages/it-IT.js b/src/languages/it-IT.js index 6362f0143..bbd2d3ad1 100644 --- a/src/languages/it-IT.js +++ b/src/languages/it-IT.js @@ -115,7 +115,6 @@ export default { "Last Result": "Ultimo risultato", "Create your admin account": "Crea l'account amministratore", "Repeat Password": "Ripeti Password", - "Import/Export Backup": "Importa/Esporta Backup", Export: "Esporta", Import: "Importa", respTime: "Tempo di Risposta (ms)", diff --git a/src/languages/nl-NL.js b/src/languages/nl-NL.js index 00dc41501..546e6dbd4 100644 --- a/src/languages/nl-NL.js +++ b/src/languages/nl-NL.js @@ -115,7 +115,6 @@ export default { "Last Result": "Laatste resultaat", "Create your admin account": "Maak uw beheerdersaccount aan", "Repeat Password": "Herhaal wachtwoord", - "Import/Export Backup": "Backup importeren/exporteren", Export: "Exporteren", Import: "Importeren", respTime: "resp. tijd (ms)", diff --git a/src/languages/pl.js b/src/languages/pl.js index e76c2f30c..e6936a1c7 100644 --- a/src/languages/pl.js +++ b/src/languages/pl.js @@ -110,37 +110,37 @@ export default { respTime: "Czas odp. (ms)", notAvailableShort: "N/A", 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?", - confirmClearStatisticsMsg: "Are you sure want to delete ALL statistics?", - "Clear Data": "Clear Data", - Events: "Events", + confirmClearStatisticsMsg: "Jesteś pewien, że chcesz usunąć WSZYSTKIE statystyki?", + "Clear Data": "Usuń dane", + Events: "Wydarzenia", Heartbeats: "Heartbeats", "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.", - "Default enabled": "Default enabled", - "Also apply to existing monitors": "Also apply to existing monitors", - Export: "Export", + 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": "Domyślnie włączone", + "Also apply to existing monitors": "Również zastosuj do obecnych monitów", + Export: "Eksport", Import: "Import", - backupDescription: "You can backup all monitors and all notifications into a JSON file.", - backupDescription2: "PS: History and event data is not included.", - backupDescription3: "Sensitive data such as notification tokens is included in the export file, please keep it carefully.", - alertNoFile: "Please select a file to import.", - alertWrongFileType: "Please select a JSON file.", - twoFAVerifyLabel: "Please type in your token to verify that 2FA is working", - tokenValidSettingsMsg: "Token is valid! You can now save the 2FA settings.", - confirmEnableTwoFAMsg: "Are you sure you want to enable 2FA?", - confirmDisableTwoFAMsg: "Are you sure you want to disable 2FA?", - "Apply on all existing monitors": "Apply on all existing monitors", - "Verify Token": "Verify Token", - "Setup 2FA": "Setup 2FA", - "Enable 2FA": "Enable 2FA", - "Disable 2FA": "Disable 2FA", - "2FA Settings": "2FA Settings", - "Two Factor Authentication": "Two Factor Authentication", - Active: "Active", - Inactive: "Inactive", + backupDescription: "Możesz wykonać kopię zapasową wszystkich monitorów i wszystkich powiadomień w pliku JSON.", + backupDescription2: "PS: Historia i dane zdarzeń nie są uwzględniane.", + backupDescription3: "Poufne dane, takie jak tokeny powiadomień, są zawarte w pliku eksportu, prosimy o ostrożne przechowywanie.", + alertNoFile: "Proszę wybrać plik do importu.", + alertWrongFileType: "Proszę wybrać plik JSON.", + twoFAVerifyLabel: "Proszę podaj swój token 2FA, aby sprawdzić go", + tokenValidSettingsMsg: "Token jest poprawny! Możesz teraz zapisać ustawienia 2FA.", + confirmEnableTwoFAMsg: "Jesteś prwien że chcesz włączyć 2FA?", + confirmDisableTwoFAMsg: "Jesteś prwien że chcesz wyłączyć 2FA?", + "Apply on all existing monitors": "Zastosuj do wszystki obecnych monitów", + "Verify Token": "Weryfikuj Token", + "Setup 2FA": "Ustaw 2FA", + "Enable 2FA": "Włącz 2FA", + "Disable 2FA": "Wyłącz 2FA", + "2FA Settings": "Ustawienia 2FA", + "Two Factor Authentication": "Podwójna weryfikacja", + Active: "Włączone", + Inactive: "Wyłączone", Token: "Token", - "Show URI": "Show URI", - "Clear all statistics": "Clear all Statistics", + "Show URI": "Pokaż URI", + "Clear all statistics": "Wyczyść wszystkie statystyki", } diff --git a/src/languages/tr-TR.js b/src/languages/tr-TR.js index e05af23e3..b62e289fc 100644 --- a/src/languages/tr-TR.js +++ b/src/languages/tr-TR.js @@ -116,5 +116,5 @@ export default { "Clear Data": "Verileri Temizle", Events: "Olaylar", Heartbeats: "Sağlık Durumları", - "Auto Get": "Otomatik Al" + "Auto Get": "Otomatik Al", } diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js index f3e55fc8c..c09a824da 100644 --- a/src/languages/zh-CN.js +++ b/src/languages/zh-CN.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "新的监控项将默认启用,你也可以在每个监控项中分别设置", "Default enabled": "默认开启", "Also apply to existing monitors": "应用到所有监控项", - "Import/Export Backup": "导入/导出备份", Export: "导出", Import: "导入", backupDescription: "你可以将所有的监控项和消息通知备份到一个 JSON 文件中", diff --git a/src/languages/zh-HK.js b/src/languages/zh-HK.js index 50959ca87..1a4ae5a6c 100644 --- a/src/languages/zh-HK.js +++ b/src/languages/zh-HK.js @@ -120,7 +120,6 @@ export default { enableDefaultNotificationDescription: "新增監測器時這個通知會預設啟用,當然每個監測器亦可分別控制開關。", "Default enabled": "預設通知", "Also apply to existing monitors": "同時取用至目前所有監測器", - "Import/Export Backup": "匯入/匯出 備份", Export: "匯出", Import: "匯入", backupDescription: "您可以備份所有監測器及所有通知。", diff --git a/test/ubuntu-nodejs16.dockerfile b/test/ubuntu-nodejs16.dockerfile new file mode 100644 index 000000000..a2dd2ec86 --- /dev/null +++ b/test/ubuntu-nodejs16.dockerfile @@ -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