From 6875ecdfbfe528fc6841bf731024bb84f838f653 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Mon, 2 Oct 2023 21:39:17 +0000 Subject: [PATCH 1/3] Fix warnings (#3826) --- server/model/monitor.js | 4 ++-- server/routers/api-router.js | 2 -- server/routers/status-page-router.js | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 284a5ccc9..216283e16 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -2,7 +2,7 @@ const https = require("https"); const dayjs = require("dayjs"); const axios = require("axios"); const { Prometheus } = require("../prometheus"); -const { log, UP, DOWN, PENDING, MAINTENANCE, flipStatus, TimeLogger, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND, +const { log, UP, DOWN, PENDING, MAINTENANCE, flipStatus, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND, SQL_DATETIME_FORMAT } = require("../../src/util"); const { tcping, ping, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, mqttAsync, setSetting, httpNtlm, radius, grpcQuery, @@ -1067,7 +1067,7 @@ class Monitor extends BeanModel { /** * Example: http: or https: - * @returns {(null|string)} + * @returns {(null|string)} URL's protocol */ getURLProtocol() { const url = this.getUrl(); diff --git a/server/routers/api-router.js b/server/routers/api-router.js index d480ed6ed..d1445d30c 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -283,8 +283,6 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request, requestedDuration = "24h"; } - const sqlHourOffset = Database.sqlHourOffset(); - // Check if monitor is public const uptimeCalculator = await UptimeCalculator.getUptimeCalculator(requestedMonitorId); diff --git a/server/routers/status-page-router.js b/server/routers/status-page-router.js index f8c347050..86d2af9a9 100644 --- a/server/routers/status-page-router.js +++ b/server/routers/status-page-router.js @@ -4,7 +4,6 @@ const { UptimeKumaServer } = require("../uptime-kuma-server"); const StatusPage = require("../model/status_page"); const { allowDevAllOrigin, sendHttpError } = require("../util-server"); const { R } = require("redbean-node"); -const Monitor = require("../model/monitor"); const { badgeConstants } = require("../config"); const { makeBadge } = require("badge-maker"); const { UptimeCalculator } = require("../uptime-calculator"); From d5a3f7e38557692f4f17a834f967a3f7cbdeaccc Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Mon, 2 Oct 2023 23:47:04 +0200 Subject: [PATCH 2/3] Add LABEL to Docker image (#3802) This label can be used to fetch more information about this image. For example Renovate uses this label to get the changelog of a specific version: https://docs.renovatebot.com/modules/datasource/docker/ --- docker/dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/dockerfile b/docker/dockerfile index 719cba5c5..1993c1045 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -30,6 +30,8 @@ FROM $BASE_IMAGE AS release USER node WORKDIR /app +LABEL org.opencontainers.image.source="https://github.com/louislam/uptime-kuma" + ENV UPTIME_KUMA_IS_CONTAINER=1 # Copy app files from build layer From 04b8681cfbe637f6aae5a2de9216371bfcdecd51 Mon Sep 17 00:00:00 2001 From: Adam Stachowicz Date: Mon, 2 Oct 2023 21:48:21 +0000 Subject: [PATCH 3/3] Fix few markdownlint warnings (#3825) --- .devcontainer/README.md | 2 +- .github/ISSUE_TEMPLATE/security.md | 2 - .github/PULL_REQUEST_TEMPLATE.md | 2 +- CONTRIBUTING.md | 44 ++++++++++--------- README.md | 44 ++++++++++--------- db/knex_migrations/README.md | 5 ++- .../push-examples/typescript-fetch/README.md | 2 +- src/lang/README.md | 6 ++- test/backend-test/README.md | 5 +-- 9 files changed, 57 insertions(+), 55 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 4a34b2115..81b8b0fa0 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -6,7 +6,7 @@ You can modifiy Uptime Kuma in your browser without setting up a local developme 1. Click `Code` -> `Create codespace on master` 2. Wait a few minutes until you see there are two exposed ports -3. Go to the `3000` url, see if it is working +3. Go to the `3000` url, see if it is working ![image](https://github.com/louislam/uptime-kuma/assets/1336778/909b2eb4-4c5e-44e4-ac26-6d20ed856e7f) diff --git a/.github/ISSUE_TEMPLATE/security.md b/.github/ISSUE_TEMPLATE/security.md index 26450ed3a..708670e85 100644 --- a/.github/ISSUE_TEMPLATE/security.md +++ b/.github/ISSUE_TEMPLATE/security.md @@ -12,8 +12,6 @@ labels: DO NOT PROVIDE ANY DETAILS HERE. Please privately report to https://github.com/louislam/uptime-kuma/security/advisories/new. - Why need this issue? It is because GitHub Advisory do not send a notification to @louislam, it is a workaround to do so. Your GitHub Advisory URL: - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 87e7f5ff7..6a217143d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,7 @@ ⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules: https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma -Tick the checkbox if you understand [x]: +Tick the checkbox if you understand [x]: - [ ] I have read and understand the pull request rules. # Description diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index af3fff0e4..f253cff04 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,24 +34,27 @@ Yes or no, it depends on what you will try to do. Since I don't want to waste yo Here are some references: -### ✅ Usually accepted: +### ✅ Usually accepted + - Bug fix - Security fix - Adding notification providers - Adding new language files (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)) - Adding new language keys: `$t("...")` -### ⚠️ Discussion required: +### ⚠️ Discussion required + - Large pull requests - New features -### ❌ Won't be merged: +### ❌ Won't be merged + - A dedicated PR for translating existing languages (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)) - Do not pass the auto-test - Any breaking changes - Duplicated pull requests - Buggy -- UI/UX is not close to Uptime Kuma +- UI/UX is not close to Uptime Kuma - Modifications or deletions of existing logic without a valid reason. - Adding functions that is completely out of scope - Converting existing code into other programming languages @@ -65,7 +68,6 @@ I will assign your pull request to a [milestone](https://github.com/louislam/upt Also, please don't rush or ask for an ETA, because I have to understand the pull request, make sure it is no breaking changes and stick to my vision of this project, especially for large pull requests. - ### Recommended Pull Request Guideline Before deep into coding, discussion first is preferred. Creating an empty pull request for discussion would be recommended. @@ -114,7 +116,7 @@ I personally do not like something that requires so many configurations before y ### GitHub Codespace -If you don't want to setup an local environment, you can now develop on GitHub Codespace, read more: +If you don't want to setup an local environment, you can now develop on GitHub Codespace, read more: https://github.com/louislam/uptime-kuma/tree/master/.devcontainer @@ -143,7 +145,8 @@ npm run dev ``` But sometimes, you would like to restart the server, but not the frontend, you can run these commands in two terminals: -``` + +```bash npm run start-frontend-dev npm run start-server-dev ``` @@ -152,15 +155,14 @@ npm run start-server-dev It binds to `0.0.0.0:3001` by default. - It is mainly a socket.io app + express.js. -express.js is used for: +express.js is used for: + - entry point such as redirecting to a status page or the dashboard - serving the frontend built files (index.html, .js and .css etc.) - serving internal APIs of the status page - ### Structure in /server/ - jobs/ (Jobs that are running in another process) @@ -175,9 +177,9 @@ express.js is used for: ## Frontend Dev Server -It binds to `0.0.0.0:3000` by default. The frontend dev server is used for development only. +It binds to `0.0.0.0:3000` by default. The frontend dev server is used for development only. -For production, it is not used. It will be compiled to `dist` directory instead. +For production, it is not used. It will be compiled to `dist` directory instead. You can use Vue.js devtools Chrome extension for debugging. @@ -231,7 +233,7 @@ If for security / bug / other reasons, a library must be updated, breaking chang Please add **all** the strings which are translatable to `src/lang/en.json` (If translation keys are omitted, they can not be translated). -**Don't include any other languages in your initial Pull-Request** (even if this is your mother tongue), to avoid merge-conflicts between weblate and `master`. +**Don't include any other languages in your initial Pull-Request** (even if this is your mother tongue), to avoid merge-conflicts between weblate and `master`. The translations can then (after merging a PR into `master`) be translated by awesome people donating their language skills. If you want to help by translating Uptime Kuma into your language, please visit the [instructions on how to translate using weblate](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md). @@ -249,7 +251,7 @@ https://github.com/louislam/uptime-kuma-wiki ## Docker -#### Arch +### Arch - amd64 - arm64 @@ -293,12 +295,12 @@ https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc 1. Draft a release note 2. Make sure the repo is cleared 3. If the healthcheck is updated, remember to re-compile it: `npm run build-docker-builder-go` -3. `npm run release-final` with env vars: `VERSION` and `GITHUB_TOKEN` -4. Wait until the `Press any key to continue` -5. `git push` -6. Publish the release note as 1.X.X -7. Press any key to continue -8. Deploy to the demo server: `npm run deploy-demo-server` +4. `npm run release-final` with env vars: `VERSION` and `GITHUB_TOKEN` +5. Wait until the `Press any key to continue` +6. `git push` +7. Publish the release note as 1.X.X +8. Press any key to continue +9. Deploy to the demo server: `npm run deploy-demo-server` Checking: @@ -336,6 +338,6 @@ git push production master Change the base of a pull request such as `master` to `1.23.X` -``` +```bash git rebase --onto ``` diff --git a/README.md b/README.md index 28840d8ac..12db07a03 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,17 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the ## ⭐ Features -* Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers -* Fancy, Reactive, Fast UI/UX -* Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications) -* 20-second intervals -* [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang) -* Multiple status pages -* Map status pages to specific domains -* Ping chart -* Certificate info -* Proxy support -* 2FA support +- Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers +- Fancy, Reactive, Fast UI/UX +- Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications) +- 20-second intervals +- [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang) +- Multiple status pages +- Map status pages to specific domains +- Ping chart +- Certificate info +- Proxy support +- 2FA support ## 🔧 How to Install @@ -50,6 +50,7 @@ Uptime Kuma is now running on http://localhost:3001 ### 💪🏻 Non-Docker Requirements: + - Platform - ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc. - ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher @@ -76,9 +77,8 @@ npm install pm2 -g && pm2 install pm2-logrotate # Start Server pm2 start server/server.js --name uptime-kuma - - ``` + Uptime Kuma is now running on http://localhost:3001 More useful PM2 Commands @@ -143,12 +143,12 @@ Telegram Notification Sample: ## Motivation -* I was looking for a self-hosted monitoring tool like "Uptime Robot", but it is hard to find a suitable one. One of the close ones is statping. Unfortunately, it is not stable and no longer maintained. -* Want to build a fancy UI. -* Learn Vue 3 and vite.js. -* Show the power of Bootstrap 5. -* Try to use WebSocket with SPA instead of REST API. -* Deploy my first Docker image to Docker Hub. +- I was looking for a self-hosted monitoring tool like "Uptime Robot", but it is hard to find a suitable one. One of the close ones is statping. Unfortunately, it is not stable and no longer maintained. +- Want to build a fancy UI. +- Learn Vue 3 and vite.js. +- Show the power of Bootstrap 5. +- Try to use WebSocket with SPA instead of REST API. +- Deploy my first Docker image to Docker Hub. If you love this project, please consider giving me a ⭐. @@ -161,10 +161,9 @@ I recommend using Google, GitHub Issues, or Uptime Kuma's Subreddit for finding - [GitHub Issues](https://github.com/louislam/uptime-kuma/issues) - [Subreddit r/Uptime kuma](https://www.reddit.com/r/UptimeKuma/) -My Reddit account: [u/louislamlam](https://reddit.com/u/louislamlam). +My Reddit account: [u/louislamlam](https://reddit.com/u/louislamlam). You can mention me if you ask a question on Reddit. - ## Contribute ### Test Pull Requests @@ -179,9 +178,11 @@ https://github.com/louislam/uptime-kuma/wiki/Test-Pull-Requests Check out the latest beta release here: https://github.com/louislam/uptime-kuma/releases ### Bug Reports / Feature Requests + If you want to report a bug or request a new feature, feel free to open a [new issue](https://github.com/louislam/uptime-kuma/issues). ### Translations + If you want to translate Uptime Kuma into your language, please visit [Weblate Readme](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md). ### Spelling & Grammar @@ -190,4 +191,5 @@ Feel free to correct the grammar in the documentation or code. My mother language is not english and my grammar is not that great. ### Create Pull Requests + If you want to modify Uptime Kuma, please read this guide and follow the rules here: https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md diff --git a/db/knex_migrations/README.md b/db/knex_migrations/README.md index 4bebe3482..d2b8470b1 100644 --- a/db/knex_migrations/README.md +++ b/db/knex_migrations/README.md @@ -1,10 +1,11 @@ -## Info +# Info https://knexjs.org/guide/migrations.html#knexfile-in-other-languages ## Basic rules + - All tables must have a primary key named `id` -- Filename format: `YYYY-MM-DD-HHMM-patch-name.js` +- Filename format: `YYYY-MM-DD-HHMM-patch-name.js` - Avoid native SQL syntax, use knex methods, because Uptime Kuma supports SQLite and MariaDB. ## Template diff --git a/extra/push-examples/typescript-fetch/README.md b/extra/push-examples/typescript-fetch/README.md index cf93439b7..c2c96ce0c 100644 --- a/extra/push-examples/typescript-fetch/README.md +++ b/extra/push-examples/typescript-fetch/README.md @@ -1,3 +1,4 @@ +# How to run Node.js (ts-node) @@ -16,4 +17,3 @@ Bun.js ```bash bun index.ts ``` - diff --git a/src/lang/README.md b/src/lang/README.md index aafda2de9..8c9b2379f 100644 --- a/src/lang/README.md +++ b/src/lang/README.md @@ -1,4 +1,6 @@ -# How to translate +# Translations + +## How to translate (2023-01-24 Updated) @@ -7,7 +9,7 @@ 3. Make sure your GitHub email is matched with Weblate's account, so that it could show you as a contributor on GitHub 4. Choose your language on Weblate and start translating. -# How to add a new language in the dropdown +## How to add a new language in the dropdown 1. Add your language at https://weblate.kuma.pet/projects/uptime-kuma/uptime-kuma/ 2. Find the language code (You can find it at the end of the URL) diff --git a/test/backend-test/README.md b/test/backend-test/README.md index e0a69dda7..5686fae78 100644 --- a/test/backend-test/README.md +++ b/test/backend-test/README.md @@ -1,12 +1,9 @@ - # Node.js Test Runner Documentation: https://nodejs.org/api/test.html Create a test file in this directory with the name `*.js`. - - ## Template ```js @@ -26,7 +23,7 @@ test("Test name", async (t) => { }); ``` -## Run +## Run Node.js >=18