Merge branch 'master' into feature/add-support-for-method-body-and-headers

This commit is contained in:
Bert Verhelst 2021-10-06 21:56:28 +02:00
commit 162ef04c41
37 changed files with 1933 additions and 2038 deletions

34
.github/workflows/auto-test.yml vendored Normal file
View file

@ -0,0 +1,34 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Auto Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 15.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
env:
HEADLESS_TEST: 1
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}

View file

@ -38,6 +38,7 @@ If you are not sure, feel free to create an empty pull request draft first.
- Add a new notification
- Add a chart
- Fix a bug
- Translations
### *️⃣ Requires one more reviewer
@ -150,4 +151,29 @@ The data and socket logic are in `src/mixins/socket.js`.
# Unit Test
Yes, no unit test for now. I know it is very important, but at the same time my spare time is very limited. I want to implement my ideas first. I will go back to this in some points.
It is an end-to-end testing. It is using Jest and Puppeteer.
```
npm run build
npm test
```
By default, the Chromium window will be shown up during the test. Specifying `HEADLESS_TEST=1` for terminal environments.
# Update Dependencies
Install `ncu`
https://github.com/raineorshine/npm-check-updates
```bash
ncu -u -t patch
npm install
```
Since previously updating vite 2.5.10 to 2.6.0 broke the application completely, from now on, it should update patch release version only.
Patch release = the third digit
# Translations
Please read: https://github.com/louislam/uptime-kuma/tree/master/src/languages

View file

@ -19,6 +19,7 @@ if (! newVersion) {
const exists = tagExists(newVersion);
if (! exists) {
// Process package.json
pkg.version = newVersion;
pkg.scripts.setup = pkg.scripts.setup.replaceAll(oldVersion, newVersion);
@ -29,8 +30,11 @@ if (! exists) {
commit(newVersion);
tag(newVersion);
updateWiki(oldVersion, newVersion);
} else {
console.log("version exists")
console.log("version exists");
}
function commit(version) {
@ -38,16 +42,16 @@ function commit(version) {
let res = child_process.spawnSync("git", ["commit", "-m", msg, "-a"]);
let stdout = res.stdout.toString().trim();
console.log(stdout)
console.log(stdout);
if (stdout.includes("no changes added to commit")) {
throw new Error("commit error")
throw new Error("commit error");
}
}
function tag(version) {
let res = child_process.spawnSync("git", ["tag", version]);
console.log(res.stdout.toString().trim())
console.log(res.stdout.toString().trim());
}
function tagExists(version) {
@ -59,3 +63,38 @@ function tagExists(version) {
return res.stdout.toString().trim() === version;
}
function updateWiki(oldVersion, newVersion) {
const wikiDir = "./tmp/wiki";
const howToUpdateFilename = "./tmp/wiki/🆙-How-to-Update.md";
safeDelete(wikiDir);
child_process.spawnSync("git", ["clone", "https://github.com/louislam/uptime-kuma.wiki.git", wikiDir]);
let content = fs.readFileSync(howToUpdateFilename).toString();
content = content.replaceAll(`git checkout ${oldVersion}`, `git checkout ${newVersion}`);
fs.writeFileSync(howToUpdateFilename, content);
child_process.spawnSync("git", ["add", "-A"], {
cwd: wikiDir,
});
child_process.spawnSync("git", ["commit", "-m", `Update to ${newVersion} from ${oldVersion}`], {
cwd: wikiDir,
});
console.log("Pushing to Github");
child_process.spawnSync("git", ["push"], {
cwd: wikiDir,
});
safeDelete(wikiDir);
}
function safeDelete(dir) {
if (fs.existsSync(dir)) {
fs.rmdirSync(dir, {
recursive: true,
});
}
}

View file

@ -1,5 +1,6 @@
module.exports = {
"launch": {
"headless": false
"headless": process.env.HEADLESS_TEST || false,
"userDataDir": "./data/test-chrome-profile",
}
};

3095
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -20,8 +20,8 @@
"start-server": "node server/server.js",
"start-server-dev": "cross-env NODE_ENV=development node server/server.js",
"build": "vite build",
"prepare-test": "npm run build && node server/server.js --port=3002 --data-dir=./data/test/",
"test": "jest",
"test": "node test/prepare-test-server.js && node server/server.js --port=3002 --data-dir=./data/test/ --test",
"jest": "node test/prepare-jest.js && jest",
"tsc": "tsc",
"vite-preview-dist": "vite preview --host",
"build-docker": "npm run build-docker-debian && npm run build-docker-alpine",
@ -53,7 +53,7 @@
"@fortawesome/free-solid-svg-icons": "~5.15.4",
"@fortawesome/vue-fontawesome": "~3.0.0-4",
"@louislam/sqlite3": "~5.0.6",
"@popperjs/core": "~2.10.1",
"@popperjs/core": "~2.10.2",
"args-parser": "~1.3.0",
"axios": "~0.21.4",
"bcryptjs": "~2.4.3",
@ -72,7 +72,7 @@
"notp": "~2.0.3",
"password-hash": "~1.2.2",
"postcss-rtlcss": "~3.4.1",
"postcss-scss": "~4.0.0",
"postcss-scss": "~4.0.1",
"prom-client": "~13.2.0",
"prometheus-api-metrics": "~3.2.0",
"qrcode": "~1.4.4",
@ -87,7 +87,7 @@
"vue-chart-3": "~0.5.8",
"vue-confirm-dialog": "~1.0.2",
"vue-contenteditable": "~3.0.4",
"vue-i18n": "~9.1.7",
"vue-i18n": "~9.1.8",
"vue-image-crop-upload": "~3.0.3",
"vue-multiselect": "~3.0.0-alpha.2",
"vue-qrcode": "~1.0.0",
@ -99,9 +99,9 @@
"@babel/eslint-parser": "~7.15.7",
"@types/bootstrap": "~5.1.6",
"@vitejs/plugin-legacy": "~1.5.3",
"@vitejs/plugin-vue": "~1.9.1",
"@vue/compiler-sfc": "~3.2.16",
"core-js": "~3.18.0",
"@vitejs/plugin-vue": "~1.9.2",
"@vue/compiler-sfc": "~3.2.19",
"core-js": "~3.18.1",
"cross-env": "~7.0.3",
"dns2": "~2.0.1",
"eslint": "~7.32.0",
@ -122,6 +122,7 @@
"__DEV__": true
},
"testRegex": "./test/*.spec.js",
"rootDir": "."
"rootDir": ".",
"testTimeout": 30000
}
}

View file

@ -37,7 +37,7 @@ console.log("Importing this project modules");
debug("Importing Monitor");
const Monitor = require("./model/monitor");
debug("Importing Settings");
const { getSettings, setSettings, setting, initJWTSecret, checkLogin } = require("./util-server");
const { getSettings, setSettings, setting, initJWTSecret, checkLogin, startUnitTest } = require("./util-server");
debug("Importing Notification");
const { Notification } = require("./notification");
@ -64,12 +64,11 @@ const port = parseInt(process.env.PORT || args.port || 3001);
const sslKey = process.env.SSL_KEY || args["ssl-key"] || undefined;
const sslCert = process.env.SSL_CERT || args["ssl-cert"] || undefined;
// Demo Mode?
const demoMode = args["demo"] || false;
if (demoMode) {
console.log("==== Demo Mode ====");
}
/**
* Run unit test after the server is ready
* @type {boolean}
*/
const testMode = !!args["test"] || false;
console.log("Creating express and socket.io instance");
const app = express();
@ -1229,6 +1228,10 @@ exports.entryPage = "dashboard";
}
startMonitors();
checkVersion.startInterval();
if (testMode) {
startUnitTest();
}
});
})();

View file

@ -5,6 +5,7 @@ const { debug } = require("../src/util");
const passwordHash = require("./password-hash");
const dayjs = require("dayjs");
const { Resolver } = require("dns");
const child_process = require("child_process");
/**
* Init or reset JWT secret
@ -292,3 +293,22 @@ exports.checkLogin = (socket) => {
throw new Error("You are not logged in.");
}
};
exports.startUnitTest = async () => {
console.log("Starting unit test...");
const npm = /^win/.test(process.platform) ? "npm.cmd" : "npm";
const child = child_process.spawn(npm, ["run", "jest"]);
child.stdout.on("data", (data) => {
console.log(data.toString());
});
child.stderr.on("data", (data) => {
console.log(data.toString());
});
child.on("close", function (code) {
console.log("Jest exit code: " + code);
process.exit(code);
});
};

View file

@ -60,7 +60,6 @@ export default {
this.$root.login(this.username, this.password, this.token, (res) => {
this.processing = false;
console.log(res);
if (res.tokenRequired) {
this.tokenRequired = true;

View file

@ -3,10 +3,9 @@ import bgBG from "./languages/bg-BG";
import daDK from "./languages/da-DK";
import deDE from "./languages/de-DE";
import en from "./languages/en";
import fa from "./languages/fa";
import esEs from "./languages/es-ES";
import ptBR from "./languages/pt-BR";
import etEE from "./languages/et-EE";
import fa from "./languages/fa";
import frFR from "./languages/fr-FR";
import hu from "./languages/hu";
import itIT from "./languages/it-IT";
@ -14,11 +13,12 @@ import ja from "./languages/ja";
import koKR from "./languages/ko-KR";
import nlNL from "./languages/nl-NL";
import pl from "./languages/pl";
import ptBR from "./languages/pt-BR";
import ruRU from "./languages/ru-RU";
import sr from "./languages/sr";
import srLatn from "./languages/sr-latn";
import trTR from "./languages/tr-TR";
import svSE from "./languages/sv-SE";
import trTR from "./languages/tr-TR";
import zhCN from "./languages/zh-CN";
import zhHK from "./languages/zh-HK";
@ -48,12 +48,13 @@ const languageList = {
};
const rtlLangs = ["fa"];
export const currentLocale = () => localStorage.locale || "en";
export const localeDirection = () => {
return rtlLangs.includes(currentLocale()) ? "rtl" : "ltr"
}
return rtlLangs.includes(currentLocale()) ? "rtl" : "ltr";
};
export const i18n = createI18n({
locale: currentLocale(),
fallbackLocale: "en",

View file

@ -178,4 +178,22 @@ export default {
"Add a monitor": "Добави монитор",
"Edit Status Page": "Редактирай статус страница",
"Go to Dashboard": "Към Таблото",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
"Status Page": "Status Page",
};

View file

@ -170,7 +170,7 @@ export default {
"Avg. Ping": "Gns. Ping",
"Avg. Response": "Gns. Respons",
"Entry Page": "Entry Side",
"statusPageNothing": "Intet her, tilføj venligst en Gruppe eller en Overvåger.",
statusPageNothing: "Intet her, tilføj venligst en Gruppe eller en Overvåger.",
"No Services": "Ingen Tjenester",
"All Systems Operational": "Alle Systemer i Drift",
"Partially Degraded Service": "Delvist Forringet Service",
@ -179,4 +179,22 @@ export default {
"Add a monitor": "Tilføj en Overvåger",
"Edit Status Page": "Rediger Statusside",
"Go to Dashboard": "Gå til Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -178,4 +178,22 @@ export default {
"Add a monitor": "Monitor hinzufügen",
"Edit Status Page": "Bearbeite Statusseite",
"Go to Dashboard": "Gehe zum Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -178,23 +178,24 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"telegram": "Telegram",
"webhook": "Webhook",
"smtp": "Email (SMTP)",
"discord": "Discord",
"teams": "Microsoft Teams",
"signal": "Signal",
"gotify": "Gotify",
"slack": "Slack",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
"pushover": "Pushover",
"pushy": "Pushy",
"octopush": "Octopush",
"lunasea": "LunaSea",
"apprise": "Apprise (Support 50+ Notification services)",
"pushbullet": "Pushbullet",
"line": "Line Messenger",
"mattermost": "Mattermost",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
"Status Page": "Status Page",
Method: "Method",
Body: "Body",
Headers: "Headers",

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -16,7 +16,7 @@ export default {
rrtypeDescription: "Vali kirje tüüp, mida soovid jälgida.",
pauseMonitorMsg: "Kas soovid peatada seire?",
Settings: "Seaded",
"Status Page": "Ülevaade", // hääletuse tulemus, teine: seisundileht, kolmas: Olukord/Olek
"Status Page": "Ülevaade",
Dashboard: "Töölaud",
"New Update": "Uuem tarkvara versioon on saadaval.",
Language: "Keel",
@ -44,7 +44,7 @@ export default {
Edit: "Muuda",
Delete: "Eemalda",
Current: "Hetkeseisund",
Uptime: "Eluiga", // todo: launchpad?
Uptime: "Eluiga",
"Cert Exp.": "Sert. aegumine",
days: "päeva",
day: "päev",
@ -109,7 +109,7 @@ export default {
"Create your admin account": "Admininstraatori konto loomine",
"Repeat Password": "korda salasõna",
respTime: "Reageerimisaeg (ms)",
notAvailableShort: "N/A", // tõlkimata, umbkaudu rahvusvaheline termin peaks sobima piisavalt
notAvailableShort: "N/A",
enableDefaultNotificationDescription: "Kõik järgnevalt lisatud seired kasutavad seda teavitusteenuset. Seiretelt võib teavitusteenuse ühekaupa eemaldada.",
clearEventsMsg: "Kas soovid seire kõik sündmused kustutada?",
clearHeartbeatsMsg: "Kas soovid seire kõik tuksed kustutada?",
@ -122,7 +122,7 @@ export default {
"Clear Data": "Eemalda andmed",
Events: "Sündmused",
Heartbeats: "Tuksed",
"Auto Get": "Hangi automaatselt", // hangi? kõlab liiga otsetõlge
"Auto Get": "Hangi automaatselt",
backupDescription: "Varunda kõik seired ja teavitused JSON faili.",
backupDescription2: "PS: Varukoopia EI sisalda seirete ajalugu ja sündmustikku.",
backupDescription3: "Varukoopiad sisaldavad teavitusteenusete pääsuvõtmeid.",
@ -140,7 +140,7 @@ export default {
"Two Factor Authentication": "Kaksikautentimine",
Active: "kasutusel",
Inactive: "seadistamata",
Token: "kaksikautentimise kood", // needs to compensate for no title
Token: "kaksikautentimise kood",
"Show URI": "Näita URId",
"Clear all statistics": "Tühjenda ajalugu",
importHandleDescription: "'kombineeri' täiendab varukoopiast ja kirjutab üle samanimelised seireid ja teavitusteenused; 'lisa praegustele' jätab olemasolevad puutumata; 'asenda' kustutab ja asendab kõik seired ja teavitusteenused.",
@ -150,14 +150,14 @@ export default {
"Export Backup": "Varukoopia eksportimine",
"Skip existing": "lisa praegustele",
Overwrite: "asenda",
Options: "Mestimisviis", // reusal of key would be chaos
Options: "Mestimisviis",
"Keep both": "kombineeri",
Tags: "Sildid",
"Add New below or Select...": "Leia või lisa all uus…",
"Tag with this name already exist.": "Selle nimega silt on juba olemas.",
"Tag with this value already exist.": "Selle väärtusega silt on juba olemas.",
color: "värvus",
"value (optional)": "väärtus (fakultatiivne)", // milline sõna!
"value (optional)": "väärtus (fakultatiivne)",
Gray: "hall",
Red: "punane",
Orange: "oranž",
@ -167,7 +167,7 @@ export default {
Purple: "lilla",
Pink: "roosa",
"Search...": "Otsi…",
"Avg. Ping": "Keskmine ping", // pikk, aga nagunii kahel real
"Avg. Ping": "Keskmine ping",
"Avg. Response": "Keskmine reaktsiooniaeg",
"Entry Page": "Avaleht",
statusPageNothing: "Kippu ega kõppu; siia saab lisada seireid või -gruppe.",
@ -178,4 +178,22 @@ export default {
"Add Group": "Lisa grupp",
"Edit Status Page": "Muuda lehte",
"Go to Dashboard": "Töölauale",
checkEverySecond: "Check every {0} seconds.",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -187,4 +187,21 @@ export default {
Last: "آخرین",
Info: "اطلاعات",
"Powered By": "نیرو گرفته از",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -170,7 +170,7 @@ export default {
"Avg. Ping": "Ping moyen",
"Avg. Response": "Réponse moyenne",
"Entry Page": "Page d'accueil",
"statusPageNothing": "Rien ici, veuillez ajouter un groupe ou une sonde.",
statusPageNothing: "Rien ici, veuillez ajouter un groupe ou une sonde.",
"No Services": "Aucun service",
"All Systems Operational": "Tous les systèmes sont opérationnels",
"Partially Degraded Service": "Service partiellement dégradé",
@ -179,4 +179,22 @@ export default {
"Add a monitor": "Ajouter une sonde",
"Edit Status Page": "Modifier la page de statut",
"Go to Dashboard": "Accéder au tableau de bord",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -178,4 +178,22 @@ export default {
"Add a monitor": "Figyelő hozzáadása",
"Edit Status Page": "Sátusz oldal szerkesztése",
"Go to Dashboard": "Menj az irányítópulthoz",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
"Status Page": "Status Page",
};

View file

@ -169,7 +169,7 @@ export default {
"Avg. Ping": "Ping medio",
"Avg. Response": "Risposta media",
"Entry Page": "Entry Page",
"statusPageNothing": "Non c'è nulla qui, aggiungere un gruppo oppure un monitoraggio.",
statusPageNothing: "Non c'è nulla qui, aggiungere un gruppo oppure un monitoraggio.",
"No Services": "Nessun Servizio",
"All Systems Operational": "Tutti i sistemi sono operativi",
"Partially Degraded Service": "Servizio parzialmente degradato",
@ -178,4 +178,22 @@ export default {
"Add a monitor": "Aggiungi un monitoraggio",
"Edit Status Page": "Modifica pagina di stato",
"Go to Dashboard": "Vai al Cruscotto",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,6 +179,24 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
Method: "Methode",
Body: "Body",
Headers: "Headers",

View file

@ -169,14 +169,32 @@ export default {
"Search...": "Szukaj...",
"Avg. Ping": "Średni ping",
"Avg. Response": "Średnia odpowiedź",
"Entry Page": "Wejdź na stronę",
"statusPageNothing": "Nic tu nie ma, dodaj monitor lub grupę.",
"Entry Page": "Strona główna",
statusPageNothing: "Nic tu nie ma, dodaj grupę lub monitor.",
"No Services": "Brak usług",
"All Systems Operational": "Wszystkie systemy działają",
"Partially Degraded Service": "Częściowy błąd usługi",
"Degraded Service": "Błąd usługi",
"Add Group": "Dodaj grupę",
"Add a monitor": "Dodaj monitoe",
"Add a monitor": "Dodaj monitor",
"Edit Status Page": "Edytuj stronę statusu",
"Go to Dashboard": "Idź do panelu",
"Status Page": "Strona statusu",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (obsługuje 50+ usług powiadamiania)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,21 @@ export default {
"Add a monitor": "Adicionar um monitor",
"Edit Status Page": "Editar Página de Status",
"Go to Dashboard": "Ir para a dashboard",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -43,7 +43,7 @@ export default {
Delete: "Удалить",
Current: "Текущий",
Uptime: "Аптайм",
"Cert Exp.": "Сертификат просрочен",
"Cert Exp.": "Сертификат истекает",
days: "дней",
day: "день",
"-day": " дней",
@ -180,8 +180,25 @@ export default {
"Edit Status Page": "Редактировать",
"Go to Dashboard": "Панель мониторов",
"Status Page": "Статус сервисов",
"Discard": "Отмена",
Discard: "Отмена",
"Create Incident": "Создать инцидент",
"Switch to Dark Theme": "Тёмная тема",
"Switch to Light Theme": "Светлая тема",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -178,4 +178,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -170,7 +170,7 @@ export default {
"Avg. Ping": "平均Ping",
"Avg. Response": "平均响应",
"Entry Page": "入口页面",
"statusPageNothing": "这里什么也没有,请添加一个分组或一个监控项。",
statusPageNothing: "这里什么也没有,请添加一个分组或一个监控项。",
"No Services": "无服务",
"All Systems Operational": "所有服务运行正常",
"Partially Degraded Service": "部分服务出现故障",
@ -179,4 +179,22 @@ export default {
"Add a monitor": "添加监控项",
"Edit Status Page": "编辑状态页",
"Go to Dashboard": "前往仪表盘",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -179,4 +179,22 @@ export default {
"Add a monitor": "Add a monitor",
"Edit Status Page": "Edit Status Page",
"Go to Dashboard": "Go to Dashboard",
"Status Page": "Status Page",
telegram: "Telegram",
webhook: "Webhook",
smtp: "Email (SMTP)",
discord: "Discord",
teams: "Microsoft Teams",
signal: "Signal",
gotify: "Gotify",
slack: "Slack",
"rocket.chat": "Rocket.chat",
pushover: "Pushover",
pushy: "Pushy",
octopush: "Octopush",
lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet",
line: "Line Messenger",
mattermost: "Mattermost",
};

View file

@ -1,7 +1,7 @@
import "bootstrap";
import { createApp, h } from "vue";
import contenteditable from "vue-contenteditable";
import Toast from "vue-toastification";
import contenteditable from "vue-contenteditable"
import "vue-toastification/dist/index.css";
import App from "./App.vue";
import "./assets/app.scss";
@ -9,10 +9,9 @@ import { i18n } from "./i18n";
import { FontAwesomeIcon } from "./icon.js";
import datetime from "./mixins/datetime";
import mobile from "./mixins/mobile";
import publicMixin from "./mixins/public";
import socket from "./mixins/socket";
import theme from "./mixins/theme";
import publicMixin from "./mixins/public";
import { router } from "./router";
import { appName } from "./util.ts";
@ -27,10 +26,10 @@ const app = createApp({
data() {
return {
appName: appName
}
};
},
render: () => h(App),
})
});
app.use(router);
app.use(i18n);

View file

@ -179,7 +179,7 @@ export default {
});
socket.on("connect", () => {
console.log("connect");
console.log("Connected to the socket server");
this.socket.connectCount++;
this.socket.connected = true;

9
test/prepare-jest.js Normal file
View file

@ -0,0 +1,9 @@
const fs = require("fs");
const path = "./data/test-chrome-profile";
if (fs.existsSync(path)) {
fs.rmdirSync(path, {
recursive: true,
});
}

View file

@ -0,0 +1,9 @@
const fs = require("fs");
const path = "./data/test";
if (fs.existsSync(path)) {
fs.rmdirSync(path, {
recursive: true,
});
}

View file

@ -1,21 +1,236 @@
beforeAll(() => {
// eslint-disable-next-line no-unused-vars
const { Page, Browser } = require("puppeteer");
const { sleep } = require("../src/util");
const axios = require("axios");
/**
* Set back the correct data type for page object
* @type {Page}
*/
page;
/**
* @type {Browser}
*/
browser;
beforeAll(async () => {
await page.setViewport({
width: 1280,
height: 720,
deviceScaleFactor: 1,
});
});
afterAll(() => {
return console.log("Cleanup");
});
describe("Very Simple Test", () => {
const baseURL = "http://127.0.0.1:3002";
describe("Init", () => {
const title = "Uptime Kuma";
beforeAll(async () => {
await page.goto("http://127.0.0.1:3002");
await page.goto(baseURL);
});
it(`should be titled "${title}"`, async () => {
await expect(page.title()).resolves.toMatch(title);
});
// Setup Page
it("Setup", async () => {
// Create an Admin
await page.waitForSelector("#floatingInput");
await page.waitForSelector("#repeat");
await page.click("#floatingInput");
await page.type("#floatingInput", "admin");
await page.type("#floatingPassword", "admin123");
await page.type("#repeat", "admin123");
await page.click(".btn-primary[type=submit]");
await sleep(3000);
// Go to /setup again
await page.goto(baseURL + "/setup");
await sleep(3000);
let pathname = await page.evaluate(() => location.pathname);
expect(pathname).toEqual("/dashboard");
// Go to /
await page.goto(baseURL);
await sleep(3000);
pathname = await page.evaluate(() => location.pathname);
expect(pathname).toEqual("/dashboard");
});
// Settings Page
describe("Settings", () => {
beforeAll(async () => {
await page.goto(baseURL + "/settings");
});
it("Change Language", async () => {
await page.waitForSelector("#language");
await page.select("#language", "zh-HK");
let languageTitle = await page.evaluate(() => document.querySelector("[for=language]").innerText);
expect(languageTitle).toMatch("語言");
await page.select("#language", "en");
languageTitle = await page.evaluate(() => document.querySelector("[for=language]").innerText);
expect(languageTitle).toMatch("Language");
});
it("Change Theme", async () => {
await sleep(1000);
// Dark
await click(page, ".btn[for=btncheck2]");
await page.waitForSelector("div.dark");
await sleep(1000);
// Light
await click(page, ".btn[for=btncheck1]");
await page.waitForSelector("div.light");
});
// TODO: Heartbeat Bar Style
// TODO: Timezone
it("Search Engine Visibility", async () => {
// Default
let res = await axios.get(baseURL + "/robots.txt");
expect(res.data).toMatch("Disallow: /");
// Yes
await click(page, "#searchEngineIndexYes");
await click(page, "form > div > .btn[type=submit]");
await sleep(2000);
res = await axios.get(baseURL + "/robots.txt");
expect(res.data).not.toMatch("Disallow: /");
// No
await click(page, "#searchEngineIndexNo");
await click(page, "form > div > .btn[type=submit]");
await sleep(2000);
res = await axios.get(baseURL + "/robots.txt");
expect(res.data).toMatch("Disallow: /");
});
it("Entry Page", async () => {
const newPage = await browser.newPage();
// Default
await newPage.goto(baseURL);
await sleep(3000);
let pathname = await newPage.evaluate(() => location.pathname);
expect(pathname).toEqual("/dashboard");
// Status Page
await click(page, "#entryPageNo");
await click(page, "form > div > .btn[type=submit]");
await sleep(2000);
await newPage.goto(baseURL);
await sleep(3000);
pathname = await newPage.evaluate(() => location.pathname);
expect(pathname).toEqual("/status");
// Back to Dashboard
await click(page, "#entryPageYes");
await click(page, "form > div > .btn[type=submit]");
await sleep(2000);
await newPage.goto(baseURL);
await sleep(3000);
pathname = await newPage.evaluate(() => location.pathname);
expect(pathname).toEqual("/dashboard");
await newPage.close();
});
it("Change Password (wrong current password)", async () => {
await page.type("#current-password", "wrong_passw$$d");
await page.type("#new-password", "new_password123");
await page.type("#repeat-new-password", "new_password123");
await click(page, "form > div > .btn[type=submit]", 1);
await sleep(3000);
await click(page, ".btn-danger.btn.me-1");
await sleep(2000);
await login("admin", "new_password123");
await sleep(2000);
let elementCount = await page.evaluate(() => document.querySelectorAll("#floatingPassword").length);
expect(elementCount).toEqual(1);
await login("admin", "admin123");
await sleep(3000);
});
it("Change Password (wrong repeat)", async () => {
await page.type("#current-password", "admin123");
await page.type("#new-password", "new_password123");
await page.type("#repeat-new-password", "new_password1234567898797898");
await click(page, "form > div > .btn[type=submit]", 1);
await sleep(3000);
await click(page, ".btn-danger.btn.me-1");
await sleep(2000);
await login("admin", "new_password123");
await sleep(2000);
let elementCount = await page.evaluate(() => document.querySelectorAll("#floatingPassword").length);
expect(elementCount).toEqual(1);
await login("admin", "admin123");
await sleep(3000);
});
// TODO: 2FA
// TODO: Export Backup
// TODO: Import Backup
// TODO: Disable Auth
// TODO: Clear Stats
});
/*
* TODO
* Create Monitor - All type
* Edit Monitor
* Delete Monitor
*
* Create Notification (token problem, maybe hard to test)
*
*/
describe("Status Page", () => {
const title = "Uptime Kuma";
beforeAll(async () => {
await page.goto(baseURL + "/status");
});
it(`should be titled "${title}"`, async () => {
await expect(page.title()).resolves.toMatch(title);
});
});
});
async function login(username, password) {
await input(page, "#floatingInput", username);
await input(page, "#floatingPassword", password);
await page.click(".btn-primary[type=submit]");
}
async function click(page, selector, elementIndex = 0) {
return await page.evaluate((s, i) => {
return document.querySelectorAll(s)[i].click();
}, selector, elementIndex);
}
async function input(page, selector, text) {
const element = await page.$(selector);
await element.click({ clickCount: 3 });
await page.keyboard.press("Backspace");
await page.type(selector, text);
}