Merge branch 'louislam:master' into master

This commit is contained in:
Ivan Bratović 2021-12-02 06:19:28 +01:00 committed by GitHub
commit 365d23214c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 314 additions and 136 deletions

View file

@ -67,7 +67,7 @@ Browse to http://localhost:3001 after starting.
### Advanced Installation
If you need more options or need to browse via a reserve proxy, please read:
If you need more options or need to browse via a reverse proxy, please read:
https://github.com/louislam/uptime-kuma/wiki/%F0%9F%94%A7-How-to-Install

View file

@ -7,7 +7,7 @@
"url": "https://github.com/louislam/uptime-kuma.git"
},
"engines": {
"node": "14.*"
"node": "14.* >=16.*"
},
"scripts": {
"install-legacy": "npm install --legacy-peer-deps",
@ -130,4 +130,4 @@
"typescript": "~4.4.4",
"vite": "~2.6.14"
}
}
}

View file

@ -7,12 +7,12 @@ class Pushover extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
let pushoverlink = "https://api.pushover.net/1/messages.json"
let pushoverlink = "https://api.pushover.net/1/messages.json";
try {
if (heartbeatJSON == null) {
let data = {
"message": "<b>Uptime Kuma Pushover testing successful.</b>",
"message": msg,
"user": notification.pushoveruserkey,
"token": notification.pushoverapptoken,
"sound": notification.pushoversounds,
@ -21,8 +21,8 @@ class Pushover extends NotificationProvider {
"retry": "30",
"expire": "3600",
"html": 1,
}
await axios.post(pushoverlink, data)
};
await axios.post(pushoverlink, data);
return okMsg;
}
@ -36,11 +36,11 @@ class Pushover extends NotificationProvider {
"retry": "30",
"expire": "3600",
"html": 1,
}
await axios.post(pushoverlink, data)
};
await axios.post(pushoverlink, data);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error)
this.throwGeneralAxiosError(error);
}
}

View file

@ -0,0 +1,44 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class SerwerSMS extends NotificationProvider {
name = "serwersms";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
try {
let config = {
headers: {
"Content-Type": "application/json",
}
};
let data = {
"username": notification.serwersmsUsername,
"password": notification.serwersmsPassword,
"phone": notification.serwersmsPhoneNumber,
"text": msg.replace(/[^\x00-\x7F]/g, ""),
"sender": notification.serwersmsSenderName,
};
let resp = await axios.post("https://api2.serwersms.pl/messages/send_sms", data, config);
if (!resp.data.success) {
if (resp.data.error) {
let error = `SerwerSMS.pl API returned error code ${resp.data.error.code} (${resp.data.error.type}) with error message: ${resp.data.error.message}`;
this.throwGeneralAxiosError(error);
} else {
let error = "SerwerSMS.pl API returned an unexpected response";
this.throwGeneralAxiosError(error);
}
}
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = SerwerSMS;

View file

@ -23,6 +23,7 @@ const Feishu = require("./notification-providers/feishu");
const AliyunSms = require("./notification-providers/aliyun-sms");
const DingDing = require("./notification-providers/dingding");
const Bark = require("./notification-providers/bark");
const SerwerSMS = require("./notification-providers/serwersms");
class Notification {
@ -58,6 +59,7 @@ class Notification {
new Telegram(),
new Webhook(),
new Bark(),
new SerwerSMS(),
];
for (let item of list) {

View file

@ -3,7 +3,7 @@
<label for="clicksendsms-login" class="form-label">API Username</label>
<div class="form-text">
{{ $t("apiCredentials") }}
<a href="http://dashboard.clicksend.com/account/subaccounts" target="_blank">here</a>
<a href="http://dashboard.clicksend.com/account/subaccounts" target="_blank">{{ $t("here") }}</a>
</div>
<input id="clicksendsms-login" v-model="$parent.notification.clicksendsmsLogin" type="text" class="form-control" required>
<label for="clicksendsms-key" class="form-label">API Key</label>

View file

@ -10,7 +10,7 @@
</div>
<div class="mb-3">
<label for="secure" class="form-label">Secure</label>
<label for="secure" class="form-label">{{ $t("Security") }}</label>
<select id="secure" v-model="$parent.notification.smtpSecure" class="form-select">
<option :value="false">{{ $t("secureOptionNone") }}</option>
<option :value="true">{{ $t("secureOptionTLS") }}</option>

View file

@ -0,0 +1,28 @@
<template>
<div class="mb-3">
<label for="serwersms-username" class="form-label">{{ $t('serwersmsAPIUser') }}</label>
<input id="serwersms-username" v-model="$parent.notification.serwersmsUsername" type="text" class="form-control" required>
</div>
<div class="mb-3">
<label for="serwersms-key" class="form-label">{{ $t('serwersmsAPIPassword') }}</label>
<HiddenInput id="serwersms-key" v-model="$parent.notification.serwersmsPassword" :required="true" autocomplete="one-time-code"></HiddenInput>
</div>
<div class="mb-3">
<label for="serwersms-phone-number" class="form-label">{{ $t("serwersmsPhoneNumber") }}</label>
<input id="serwersms-phone-number" v-model="$parent.notification.serwersmsPhoneNumber" type="text" class="form-control" required>
</div>
<div class="mb-3">
<label for="serwersms-sender-name" class="form-label">{{ $t("serwersmsSenderName") }}</label>
<input id="serwersms-sender-name" v-model="$parent.notification.serwersmsSenderName" type="text" minlength="3" maxlength="11" class="form-control">
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -22,6 +22,7 @@ import Matrix from "./Matrix.vue";
import AliyunSMS from "./AliyunSms.vue";
import DingDing from "./DingDing.vue";
import Bark from "./Bark.vue";
import SerwerSMS from "./SerwerSMS.vue";
/**
* Manage all notification form.
@ -52,7 +53,8 @@ const NotificationFormList = {
"mattermost": Mattermost,
"matrix": Matrix,
"DingDing": DingDing,
"Bark": Bark
"Bark": Bark,
"serwersms": SerwerSMS,
}
export default NotificationFormList

View file

@ -4,7 +4,7 @@
<label for="language" class="form-label">
{{ $t("Language") }}
</label>
<select id="language" v-model="$i18n.locale" class="form-select">
<select id="language" v-model="$root.language" class="form-select">
<option
v-for="(lang, i) in $i18n.availableLocales"
:key="`Lang${i}`"
@ -116,14 +116,8 @@
</template>
<script>
import { setPageLocale } from "../../util-frontend";
export default {
watch: {
"$i18n.locale"() {
localStorage.locale = this.$i18n.locale;
setPageLocale();
},
},
};
</script>

View file

@ -122,6 +122,7 @@
<HiddenInput
id="steamAPIKey"
v-model="settings.steamAPIKey"
autocomplete="one-time-code"
/>
<div class="form-text">
{{ $t("steamApiKeyDescription") }}

View file

@ -1,62 +1,45 @@
import { createI18n } from "vue-i18n/index";
import daDK from "./languages/da-DK";
import deDE from "./languages/de-DE";
import en from "./languages/en";
import esEs from "./languages/es-ES";
import etEE from "./languages/et-EE";
import fa from "./languages/fa";
import frFR from "./languages/fr-FR";
import hu from "./languages/hu";
import hrHR from "./languages/hr-HR";
import itIT from "./languages/it-IT";
import idID from "./languages/id-ID";
import ja from "./languages/ja";
import koKR from "./languages/ko-KR";
import nlNL from "./languages/nl-NL";
import nbNO from "./languages/nb-NO";
import pl from "./languages/pl";
import ptBR from "./languages/pt-BR";
import bgBG from "./languages/bg-BG";
import ruRU from "./languages/ru-RU";
import sr from "./languages/sr";
import srLatn from "./languages/sr-latn";
import svSE from "./languages/sv-SE";
import trTR from "./languages/tr-TR";
import vi from "./languages/vi";
import zhCN from "./languages/zh-CN";
import zhHK from "./languages/zh-HK";
import zhTW from "./languages/zh-TW";
const languageList = {
en,
"zh-HK": zhHK,
"bg-BG": bgBG,
"de-DE": deDE,
"nl-NL": nlNL,
"nb-NO": nbNO,
"es-ES": esEs,
"fa": fa,
"pt-BR": ptBR,
"fr-FR": frFR,
"hu": hu,
"hr-HR": hrHR,
"it-IT": itIT,
"id-ID" : idID,
"ja": ja,
"da-DK": daDK,
"sr": sr,
"sr-latn": srLatn,
"sv-SE": svSE,
"tr-TR": trTR,
"ko-KR": koKR,
"ru-RU": ruRU,
"zh-CN": zhCN,
"pl": pl,
"et-EE": etEE,
"vi": vi,
"zh-TW": zhTW
"zh-HK": "繁體中文 (香港)",
"bg-BG": "Български",
"de-DE": "Deutsch (Deutschland)",
"nl-NL": "Nederlands",
"nb-NO": "Norsk",
"es-ES": "Español",
"fa": "Farsi",
"pt-BR": "Português (Brasileiro)",
"fr-FR": "Français (France)",
"hu": "Magyar",
"hr-HR": "Hrvatski",
"it-IT": "Italiano (Italian)",
"id-ID": "Bahasa Indonesia (Indonesian)",
"ja": "日本語",
"da-DK": "Danish (Danmark)",
"sr": "Српски",
"sr-latn": "Srpski",
"sv-SE": "Svenska",
"tr-TR": "Türkçe",
"ko-KR": "한국어",
"ru-RU": "Русский",
"zh-CN": "简体中文",
"pl": "Polski",
"et-EE": "eesti",
"vi": "Vietnamese",
"zh-TW": "繁體中文 (台灣)"
};
let messages = {
en,
};
for (let lang in languageList) {
messages[lang] = {
languageName: languageList[lang]
};
}
const rtlLangs = ["fa"];
export const currentLocale = () => localStorage.locale
@ -73,5 +56,5 @@ export const i18n = createI18n({
fallbackLocale: "en",
silentFallbackWarn: true,
silentTranslationWarn: true,
messages: languageList,
messages: messages,
});

View file

@ -5,10 +5,7 @@
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/components/settings/Security.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. Add it into `languageList` constant.
7. Make a [pull request](https://github.com/louislam/uptime-kuma/pulls) when you have done.
One of good examples:
https://github.com/louislam/uptime-kuma/pull/316/files
If you do not have programming skills, let me know in [Issues section](https://github.com/louislam/uptime-kuma/issues). I will assist you. 😏

View file

@ -89,7 +89,7 @@ export default {
Timezone: "Часова зона",
"Search Engine Visibility": "Видимост за търсачки",
"Allow indexing": "Разреши индексиране",
"Discourage search engines from indexing site": "Обезкуражи индексирането на сайта от търсачките",
"Discourage search engines from indexing site": "Не позволявай на търсачките да индексират този сайт",
"Change Password": "Промени парола",
"Current Password": "Текуща парола",
"New Password": "Нова парола",
@ -307,4 +307,5 @@ export default {
PasswordsDoNotMatch: "Паролите не съвпадат.",
"Current User": "Текущ потребител",
recent: "Скорошни",
shrinkDatabaseDescription: "Инициира \"VACUUM\" за \"SQLite\" база данни. Ако Вашата база данни е създадена след версия 1.10.0, \"AUTO_VACUUM\" функцията е активна и това действие не нужно.",
};

View file

@ -307,5 +307,48 @@ export default {
steamApiKeyDescription: "For monitoring a Steam Game Server you need a Steam Web-API key. You can register your API key here: ",
"Current User": "Current User",
recent: "Recent",
Done: "Done",
Info: "Info",
Security: "Security",
"Steam API Key": "Steam API Key",
"Shrink Database": "Shrink Database",
"Pick a RR-Type...": "Pick a RR-Type...",
"Pick Accepted Status Codes...": "Pick Accepted Status Codes...",
Default: "Default",
"HTTP Options": "HTTP Options",
"Create Incident": "Create Incident",
Title: "Title",
Content: "Content",
Style: "Style",
info: "info",
warning: "warning",
danger: "danger",
primary: "primary",
light: "light",
dark: "dark",
Post: "Post",
"Please input title and content": "Please input title and content",
Created: "Created",
"Last Updated": "Last Updated",
Unpin: "Unpin",
"Switch to Light Theme": "Switch to Light Theme",
"Switch to Dark Theme": "Switch to Dark Theme",
"Show Tags": "Show Tags",
"Hide Tags": "Hide Tags",
Description: "Description",
"No monitors available.": "No monitors available.",
"Add one": "Add one",
"No Monitors": "No Monitors",
"Add one": "Add one",
"Untitled Group": "Untitled Group",
Services: "Services",
Discard: "Discard",
Cancel: "Cancel",
"Powered by": "Powered by",
shrinkDatabaseDescription: "Trigger database VACUUM for SQLite. If your database is created after 1.10.0, AUTO_VACUUM is already enabled and this action is not needed.",
serwersms: "SerwerSMS.pl",
serwersmsAPIUser: "API Username (incl. webapi_ prefix)",
serwersmsAPIPassword: "API Password",
serwersmsPhoneNumber: "Phone number",
serwersmsSenderName: "SMS Sender Name (registered via customer portal)",
};

View file

@ -308,4 +308,43 @@ export default {
steamApiKeyDescription: "Za praćenje Steam poslužitelja za igru, potrebno je imati Steam Web-API ključ. Možete registrirati vlastiti ključ ovdje: ",
"Current User": "Trenutni korisnik",
recent: "Nedavno",
Done: "Gotovo",
Info: "Informacije",
Security: "Sigurnost",
"Shrink Database": "Smanji bazu podataka",
"Pick a RR-Type...": "Odaberite vrstu DNS zapisa od navedenih...",
"Pick Accepted Status Codes...": "Odaberite HTTP statusne kodove koji će biti prihvaćeni...",
"Steam API Key": "Steam API ključ",
Default: "Zadano",
"HTTP Options": "HTTP Postavke",
"Create Incident": "Novi izvještaj o incidentu",
Title: "Naslov",
Content: "Sadržaj",
Style: "Stil",
info: "informacija",
warning: "upozorenje",
danger: "opasnost",
primary: "primarno",
light: "svijetlo",
dark: "tamno",
Post: "Objavi",
Created: "Stvoreno",
"Last Updated": "Uređeno",
"Please input title and content": "Naslov i sadržaj ne mogu biti prazni",
Unpin: "Ukloni",
"Switch to Light Theme": "Prebaci na svijetli način",
"Switch to Dark Theme": "Prebaci na tamni način",
"Show Tags": "Pokaži oznake",
"Hide Tags": "Sakrij oznake",
Description: "Opis",
"No monitors available.": "Nema dostupnih monitora.",
"Add one": "Add one",
"No Monitors": "Bez monitora",
"Add one": "Stvori jednog",
"Untitled Group": "Bezimena grupa",
Services: "Usluge",
Discard: "Odbaci",
Cancel: "Otkaži",
"Powered by": "Pokreće",
Saved: "Spremljeno",
};

View file

@ -2,26 +2,26 @@ export default {
languageName: "Magyar",
checkEverySecond: "Ellenőrzés {0} másodpercenként",
retryCheckEverySecond: "Újrapróbál {0} másodpercenként.",
retriesDescription: "Maximális próbálkozás mielőtt a szolgáltatás leállt jelőlést kap és értesítés kerül kiküldésre",
ignoreTLSError: "TLS/SSL hibák figyelnen kívül hagyása HTTPS weboldalaknál",
retriesDescription: "Maximális próbálkozás mielőtt a szolgáltatás 'Leállt' jelölést kap és értesítés kerül kiküldésre",
ignoreTLSError: "TLS/SSL hibák figyelmen kívül hagyása HTTPS weboldalaknál",
upsideDownModeDescription: "Az állapot megfordítása. Ha a szolgáltatás elérhető, akkor lesz leállt állapotú.",
maxRedirectDescription: "Az átirányítások maximális száma. állítsa 0-ra az átirányítás tiltásához.",
acceptedStatusCodesDescription: "Válassza ki az állapot kódokat amelyek sikeres válasznak fognak számítani.",
passwordNotMatchMsg: "A megismételt jelszó nem egyezik.",
notificationDescription: "Kérem, rendeljen egy értesítést a figyeléshez, hogy működjön.",
keywordDescription: "Kulcsszó keresése a html-ben vagy a JSON válaszban. (kis-nagybetű érzékeny)",
keywordDescription: "Kulcsszó keresése a HTML-ben vagy a JSON válaszban. (kis-nagybetű érzékeny)",
pauseDashboardHome: "Szünetel",
deleteMonitorMsg: "Biztos, hogy törölni akarja ezt a figyelőt?",
deleteNotificationMsg: "Biztos, hogy törölni akarja ezt az értesítést az összes figyelőnél?",
resoverserverDescription: "A Cloudflare az alapértelmezett szerver, bármikor meg tudja változtatni a resolver server-t.",
rrtypeDescription: "Válassza ki az RR-Típust a figyelőhöz",
rrtypeDescription: "Válassza ki az RR-típust a figyelőhöz",
pauseMonitorMsg: "Biztos, hogy szüneteltetni akarja?",
enableDefaultNotificationDescription: "Minden új figyelőhöz ez az értesítés engedélyezett lesz alapértelmezetten. Kikapcsolhatja az értesítést külön minden figyelőnél.",
clearEventsMsg: "Biztos, hogy törölni akar miden eseményt ennél a figyelnél?",
clearHeartbeatsMsg: "Biztos, hogy törölni akar minden heartbeat-et ennél a figyelőnél?",
confirmClearStatisticsMsg: "Biztos, hogy törölni akat MINDEN statisztikát?",
clearHeartbeatsMsg: "Biztos, hogy törölni akar minden életjelet ennél a figyelőnél?",
confirmClearStatisticsMsg: "Biztos, hogy törölni akar MINDEN statisztikát?",
importHandleDescription: "Válassza a 'Meglévő kihagyását', ha ki szeretné hagyni az azonos nevő figyelőket vagy értesítésket. A 'Felülírás' törölni fog minden meglévő figyelőt és értesítést.",
confirmImportMsg: "Biztos, hogy importálja a mentést? Győzödjön meg róla, hogy jól választotta ki az importálás opciót.",
confirmImportMsg: "Biztos, hogy importálja a mentést? Győződjön meg róla, hogy jól választotta ki az importálás opciót.",
twoFAVerifyLabel: "Kérem, adja meg a token-t, hogy a 2FA működését ellenőrizzük",
tokenValidSettingsMsg: "A token érvényes! El tudja menteni a 2FA beállításait.",
confirmEnableTwoFAMsg: "Biztosan engedélyezi a 2FA-t?",
@ -68,9 +68,9 @@ export default {
URL: "URL",
Hostname: "Hostnév",
Port: "Port",
"Heartbeat Interval": "Heartbeat időköz",
"Heartbeat Interval": "Életjel időköz",
Retries: "Újrapróbálkozás",
"Heartbeat Retry Interval": "Heartbeat újrapróbálkozások időköze",
"Heartbeat Retry Interval": "Életjel újrapróbálkozások időköze",
Advanced: "Haladó",
"Upside Down Mode": "Fordított mód",
"Max. Redirects": "Max. átirányítás",
@ -82,8 +82,8 @@ export default {
Light: "Világos",
Dark: "Sötét",
Auto: "Auto",
"Theme - Heartbeat Bar": "Téma - Heartbeat Bar",
Normal: "Normal",
"Theme - Heartbeat Bar": "Téma - Életjel sáv",
Normal: "Normál",
Bottom: "Nyomógomb",
None: "Nincs",
Timezone: "Időzóna",
@ -97,9 +97,9 @@ export default {
"Update Password": "Jelszó módosítása",
"Disable Auth": "Hitelesítés tiltása",
"Enable Auth": "Hitelesítés engedélyezése",
Logout: "Kijelenetkezés",
Logout: "Kijelentkezés",
Leave: "Elhagy",
"I understand, please disable": "Megértettem, kérem tilsa le",
"I understand, please disable": "Megértettem, kérem tiltsa le",
Confirm: "Megerősítés",
Yes: "Igen",
No: "Nem",
@ -129,8 +129,8 @@ export default {
Create: "Létrehozás",
"Clear Data": "Adatok törlése",
Events: "Események",
Heartbeats: "Heartbeats",
"Auto Get": "Auto Get",
Heartbeats: "Életjelek",
"Auto Get": "Auto lekérd.",
backupDescription: "Ki tudja menteni az összes figyelőt és értesítést egy JSON fájlba.",
backupDescription2: "Ui.: Történeti és esemény adatokat nem tartalmaz.",
backupDescription3: "Érzékeny adatok, pl. szolgáltatás kulcsok is vannak az export fájlban. Figyelmesen őrizze!",
@ -144,17 +144,17 @@ export default {
"Verify Token": "Token ellenőrzése",
"Setup 2FA": "2FA beállítása",
"Enable 2FA": "2FA engedélyezése",
"Disable 2FA": "2FA toltása",
"Disable 2FA": "2FA tiltása",
"2FA Settings": "2FA beállítások",
"Two Factor Authentication": "Two Factor Authentication",
"Two Factor Authentication": "Kétfaktoros hitelesítés",
Active: "Aktív",
Inactive: "Inaktív",
Token: "Token",
"Show URI": "URI megmutatása",
Tags: "Cimkék",
Tags: "Címkék",
"Add New below or Select...": "Adjon hozzá lentre vagy válasszon...",
"Tag with this name already exist.": "Ilyen nevű cimke már létezik.",
"Tag with this value already exist.": "Ilyen értékű cimke már létezik.",
"Tag with this name already exist.": "Ilyen nevű címke már létezik.",
"Tag with this value already exist.": "Ilyen értékű címke már létezik.",
color: "szín",
"value (optional)": "érték (opcionális)",
Gray: "Szürke",
@ -169,15 +169,15 @@ export default {
"Avg. Ping": "Átl. ping",
"Avg. Response": "Átl. válasz",
"Entry Page": "Nyitólap",
statusPageNothing: "Semmi nincs itt, kérem, adjon hozzá egy figyelőt.",
statusPageNothing: "Semmi nincs itt. Adjon hozzá egy vagy több figyelőt.",
"No Services": "Nincs szolgáltatás",
"All Systems Operational": "Minden rendszer működik",
"Partially Degraded Service": "Részlegesen leállt szolgáltatás",
"Degraded Service": "Leállt szolgáltatás",
"Add Group": "Csoport hozzáadása",
"Add a monitor": "Figyelő hozzáadása",
"Edit Status Page": "Sátusz oldal szerkesztése",
"Go to Dashboard": "Menj az irányítópulthoz",
"Edit Status Page": "Státusz oldal szerkesztése",
"Go to Dashboard": "Irányítópulthoz",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
@ -192,9 +192,9 @@ export default {
octopush: "Octopush",
promosms: "PromoSMS",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
apprise: "Apprise (50+ értesítési szolgáltatás)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
"Status Page": "Status Page",
"Status Page": "Státusz oldal",
};

View file

@ -307,4 +307,9 @@ export default {
recent: "Ostatnie",
clicksendsms: "ClickSend SMS",
apiCredentials: "Poświadczenia API",
serwersms: "SerwerSMS.pl",
serwersmsAPIUser: "Nazwa użytkownika API (z prefiksem webapi_)",
serwersmsAPIPassword: "Hasło API",
serwersmsPhoneNumber: "Numer telefonu",
serwersmsSenderName: "Nazwa nadawcy (zatwierdzona w panelu klienta)",
};

View file

@ -12,6 +12,7 @@ import mobile from "./mixins/mobile";
import publicMixin from "./mixins/public";
import socket from "./mixins/socket";
import theme from "./mixins/theme";
import lang from "./mixins/lang";
import { router } from "./router";
import { appName } from "./util.ts";
@ -22,6 +23,7 @@ const app = createApp({
mobile,
datetime,
publicMixin,
lang,
],
data() {
return {

33
src/mixins/lang.js Normal file
View file

@ -0,0 +1,33 @@
import { currentLocale } from "../i18n";
import { setPageLocale } from "../util-frontend";
const langModules = import.meta.glob("../languages/*.js");
export default {
data() {
return {
language: currentLocale(),
};
},
async created() {
if (this.language !== "en") {
await this.changeLang(this.language);
}
},
watch: {
async language(lang) {
await this.changeLang(lang);
},
},
methods: {
async changeLang(lang) {
let message = (await langModules["../languages/" + lang + ".js"]()).default;
this.$i18n.setLocaleMessage(lang, message);
this.$i18n.locale = lang;
localStorage.locale = lang;
setPageLocale();
}
}
};

View file

@ -103,7 +103,7 @@
:close-on-select="true"
:clear-on-select="false"
:preserve-search="false"
placeholder="Pick a RR-Type..."
:placeholder="$t('Pick a RR-Type...')"
:preselect-first="false"
:max-height="500"
:taggable="false"
@ -177,7 +177,7 @@
:close-on-select="false"
:clear-on-select="false"
:preserve-search="true"
placeholder="Pick Accepted Status Codes..."
:placeholder="$t('Pick Accepted Status Codes...')"
:preselect-first="false"
:max-height="600"
:taggable="true"
@ -215,7 +215,7 @@
<a href="#" @click="$refs.notificationDialog.show(notification.id)">{{ $t("Edit") }}</a>
</label>
<span v-if="notification.isDefault == true" class="badge bg-primary ms-2">Default</span>
<span v-if="notification.isDefault == true" class="badge bg-primary ms-2">{{ $t("Default") }}</span>
</div>
<button class="btn btn-primary me-2" type="button" @click="$refs.notificationDialog.show()">
@ -353,17 +353,17 @@ export default {
},
bodyPlaceholder() {
return `Example:
return this.$t("Example:", [`
{
"key": "value"
}`;
}`]);
},
headersPlaceholder() {
return `Example:
return this.$t("Example:", [`
{
"HeaderName": "HeaderValue"
}`;
}`]);
}
},

View file

@ -44,8 +44,20 @@ export default {
settings: {},
settingsLoaded: false,
};
},
subMenus: {
computed: {
currentPage() {
let pathEnd = useRoute().path.split("/").at(-1);
if (pathEnd == "settings" || pathEnd == null) {
return "general";
}
return pathEnd;
},
subMenus() {
return {
general: {
title: this.$t("General"),
},
@ -67,17 +79,7 @@ export default {
about: {
title: this.$t("About"),
},
},
};
},
computed: {
currentPage() {
let pathEnd = useRoute().path.split("/").at(-1);
if (pathEnd == "settings" || pathEnd == null) {
return "general";
}
return pathEnd;
};
},
},

View file

@ -101,9 +101,9 @@
<!-- Incident Date -->
<div class="date mt-3">
Created: {{ $root.datetime(incident.createdDate) }} ({{ dateFromNow(incident.createdDate) }})<br />
{{ $t("Created") }}: {{ $root.datetime(incident.createdDate) }} ({{ dateFromNow(incident.createdDate) }})<br />
<span v-if="incident.lastUpdatedDate">
Last Updated: {{ $root.datetime(incident.lastUpdatedDate) }} ({{ dateFromNow(incident.lastUpdatedDate) }})
{{ $t("Last Updated") }}: {{ $root.datetime(incident.lastUpdatedDate) }} ({{ dateFromNow(incident.lastUpdatedDate) }})
</span>
</div>
@ -125,15 +125,15 @@
<div v-if="editIncidentMode" class="dropdown d-inline-block me-2">
<button id="dropdownMenuButton1" class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Style: {{ incident.style }}
{{ $t("Style") }}: {{ $t(incident.style) }}
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<li><a class="dropdown-item" href="#" @click="incident.style = 'info'">info</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'warning'">warning</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'danger'">danger</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'primary'">primary</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'light'">light</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'dark'">dark</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'info'">{{ $t("info") }}</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'warning'">{{ $t("warning") }}</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'danger'">{{ $t("danger") }}</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'primary'">{{ $t("primary") }}</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'light'">{{ $t("light") }}</a></li>
<li><a class="dropdown-item" href="#" @click="incident.style = 'dark'">{{ $t("dark") }}</a></li>
</ul>
</div>
@ -468,10 +468,10 @@ export default {
},
addGroup() {
let groupName = "Untitled Group";
let groupName = this.$t("Untitled Group");
if (this.$root.publicGroupList.length === 0) {
groupName = "Services";
groupName = this.$t("Services");
}
this.$root.publicGroupList.unshift({
@ -536,7 +536,7 @@ export default {
postIncident() {
if (this.incident.title == "" || this.incident.content == "") {
toast.error("Please input title and content.");
toast.error(this.$t("Please input title and content"));
return;
}

View file

@ -83,6 +83,7 @@ describe("Init", () => {
});
// Settings Page
/*
describe("Settings", () => {
beforeEach(async () => {
await page.goto(baseURL + "/settings");
@ -261,6 +262,7 @@ describe("Init", () => {
// }, { timeout: 3000 });
// });
});
*/
/*
* TODO