mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-29 18:50:39 +00:00
Merge branch 'feature/time-format' of github.com-substancia:Substancia/uptime-kuma into feature/time-format
This commit is contained in:
commit
1db6722670
16 changed files with 65 additions and 64 deletions
2
.github/ISSUE_TEMPLATE/security.md
vendored
2
.github/ISSUE_TEMPLATE/security.md
vendored
|
@ -12,8 +12,6 @@ labels:
|
||||||
|
|
||||||
DO NOT PROVIDE ANY DETAILS HERE. Please privately report to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
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.
|
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:
|
Your GitHub Advisory URL:
|
||||||
|
|
||||||
|
|
|
@ -34,18 +34,21 @@ Yes or no, it depends on what you will try to do. Since I don't want to waste yo
|
||||||
|
|
||||||
Here are some references:
|
Here are some references:
|
||||||
|
|
||||||
### ✅ Usually accepted:
|
### ✅ Usually accepted
|
||||||
|
|
||||||
- Bug fix
|
- Bug fix
|
||||||
- Security fix
|
- Security fix
|
||||||
- Adding notification providers
|
- 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 files (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md))
|
||||||
- Adding new language keys: `$t("...")`
|
- Adding new language keys: `$t("...")`
|
||||||
|
|
||||||
### ⚠️ Discussion required:
|
### ⚠️ Discussion required
|
||||||
|
|
||||||
- Large pull requests
|
- Large pull requests
|
||||||
- New features
|
- 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))
|
- 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
|
- Do not pass the auto-test
|
||||||
- Any breaking changes
|
- Any breaking changes
|
||||||
|
@ -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.
|
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
|
### Recommended Pull Request Guideline
|
||||||
|
|
||||||
Before deep into coding, discussion first is preferred. Creating an empty pull request for discussion would be recommended.
|
Before deep into coding, discussion first is preferred. Creating an empty pull request for discussion would be recommended.
|
||||||
|
@ -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:
|
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-frontend-dev
|
||||||
npm run start-server-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 binds to `0.0.0.0:3001` by default.
|
||||||
|
|
||||||
|
|
||||||
It is mainly a socket.io app + express.js.
|
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
|
- entry point such as redirecting to a status page or the dashboard
|
||||||
- serving the frontend built files (index.html, .js and .css etc.)
|
- serving the frontend built files (index.html, .js and .css etc.)
|
||||||
- serving internal APIs of the status page
|
- serving internal APIs of the status page
|
||||||
|
|
||||||
|
|
||||||
### Structure in /server/
|
### Structure in /server/
|
||||||
|
|
||||||
- jobs/ (Jobs that are running in another process)
|
- jobs/ (Jobs that are running in another process)
|
||||||
|
@ -249,7 +251,7 @@ https://github.com/louislam/uptime-kuma-wiki
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
#### Arch
|
### Arch
|
||||||
|
|
||||||
- amd64
|
- amd64
|
||||||
- arm64
|
- arm64
|
||||||
|
@ -293,12 +295,12 @@ https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc
|
||||||
1. Draft a release note
|
1. Draft a release note
|
||||||
2. Make sure the repo is cleared
|
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. 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. `npm run release-final` with env vars: `VERSION` and `GITHUB_TOKEN`
|
||||||
4. Wait until the `Press any key to continue`
|
5. Wait until the `Press any key to continue`
|
||||||
5. `git push`
|
6. `git push`
|
||||||
6. Publish the release note as 1.X.X
|
7. Publish the release note as 1.X.X
|
||||||
7. Press any key to continue
|
8. Press any key to continue
|
||||||
8. Deploy to the demo server: `npm run deploy-demo-server`
|
9. Deploy to the demo server: `npm run deploy-demo-server`
|
||||||
|
|
||||||
Checking:
|
Checking:
|
||||||
|
|
||||||
|
@ -336,6 +338,6 @@ git push production master
|
||||||
|
|
||||||
Change the base of a pull request such as `master` to `1.23.X`
|
Change the base of a pull request such as `master` to `1.23.X`
|
||||||
|
|
||||||
```
|
```bash
|
||||||
git rebase --onto <new parent> <old parent>
|
git rebase --onto <new parent> <old parent>
|
||||||
```
|
```
|
||||||
|
|
42
README.md
42
README.md
|
@ -23,17 +23,17 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
|
||||||
|
|
||||||
## ⭐ Features
|
## ⭐ Features
|
||||||
|
|
||||||
* Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers
|
- 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
|
- 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)
|
- 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
|
- 20-second intervals
|
||||||
* [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang)
|
- [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang)
|
||||||
* Multiple status pages
|
- Multiple status pages
|
||||||
* Map status pages to specific domains
|
- Map status pages to specific domains
|
||||||
* Ping chart
|
- Ping chart
|
||||||
* Certificate info
|
- Certificate info
|
||||||
* Proxy support
|
- Proxy support
|
||||||
* 2FA support
|
- 2FA support
|
||||||
|
|
||||||
## 🔧 How to Install
|
## 🔧 How to Install
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ Uptime Kuma is now running on http://localhost:3001
|
||||||
### 💪🏻 Non-Docker
|
### 💪🏻 Non-Docker
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- Platform
|
- Platform
|
||||||
- ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
|
- ✅ Major Linux distros such as Debian, Ubuntu, CentOS, Fedora and ArchLinux etc.
|
||||||
- ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
|
- ✅ Windows 10 (x64), Windows Server 2012 R2 (x64) or higher
|
||||||
|
@ -76,9 +77,8 @@ npm install pm2 -g && pm2 install pm2-logrotate
|
||||||
|
|
||||||
# Start Server
|
# Start Server
|
||||||
pm2 start server/server.js --name uptime-kuma
|
pm2 start server/server.js --name uptime-kuma
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Uptime Kuma is now running on http://localhost:3001
|
Uptime Kuma is now running on http://localhost:3001
|
||||||
|
|
||||||
More useful PM2 Commands
|
More useful PM2 Commands
|
||||||
|
@ -143,12 +143,12 @@ Telegram Notification Sample:
|
||||||
|
|
||||||
## Motivation
|
## 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.
|
- 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.
|
- Want to build a fancy UI.
|
||||||
* Learn Vue 3 and vite.js.
|
- Learn Vue 3 and vite.js.
|
||||||
* Show the power of Bootstrap 5.
|
- Show the power of Bootstrap 5.
|
||||||
* Try to use WebSocket with SPA instead of REST API.
|
- Try to use WebSocket with SPA instead of REST API.
|
||||||
* Deploy my first Docker image to Docker Hub.
|
- Deploy my first Docker image to Docker Hub.
|
||||||
|
|
||||||
If you love this project, please consider giving me a ⭐.
|
If you love this project, please consider giving me a ⭐.
|
||||||
|
|
||||||
|
@ -164,7 +164,6 @@ I recommend using Google, GitHub Issues, or Uptime Kuma's Subreddit for finding
|
||||||
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.
|
You can mention me if you ask a question on Reddit.
|
||||||
|
|
||||||
|
|
||||||
## Contribute
|
## Contribute
|
||||||
|
|
||||||
### Test Pull Requests
|
### 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
|
Check out the latest beta release here: https://github.com/louislam/uptime-kuma/releases
|
||||||
|
|
||||||
### Bug Reports / Feature Requests
|
### 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).
|
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
|
### 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).
|
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
|
### 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.
|
My mother language is not english and my grammar is not that great.
|
||||||
|
|
||||||
### Create Pull Requests
|
### 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
|
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
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
## Info
|
# Info
|
||||||
|
|
||||||
https://knexjs.org/guide/migrations.html#knexfile-in-other-languages
|
https://knexjs.org/guide/migrations.html#knexfile-in-other-languages
|
||||||
|
|
||||||
## Basic rules
|
## Basic rules
|
||||||
|
|
||||||
- All tables must have a primary key named `id`
|
- 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.
|
- Avoid native SQL syntax, use knex methods, because Uptime Kuma supports SQLite and MariaDB.
|
||||||
|
|
|
@ -30,6 +30,8 @@ FROM $BASE_IMAGE AS release
|
||||||
USER node
|
USER node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/louislam/uptime-kuma"
|
||||||
|
|
||||||
ENV UPTIME_KUMA_IS_CONTAINER=1
|
ENV UPTIME_KUMA_IS_CONTAINER=1
|
||||||
|
|
||||||
# Copy app files from build layer
|
# Copy app files from build layer
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# How to run
|
||||||
|
|
||||||
Node.js (ts-node)
|
Node.js (ts-node)
|
||||||
|
|
||||||
|
@ -16,4 +17,3 @@ Bun.js
|
||||||
```bash
|
```bash
|
||||||
bun index.ts
|
bun index.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ const https = require("https");
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
const { Prometheus } = require("../prometheus");
|
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
|
SQL_DATETIME_FORMAT
|
||||||
} = require("../../src/util");
|
} = require("../../src/util");
|
||||||
const { tcping, ping, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, mqttAsync, setSetting, httpNtlm, radius, grpcQuery,
|
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:
|
* Example: http: or https:
|
||||||
* @returns {(null|string)}
|
* @returns {(null|string)} URL's protocol
|
||||||
*/
|
*/
|
||||||
getURLProtocol() {
|
getURLProtocol() {
|
||||||
const url = this.getUrl();
|
const url = this.getUrl();
|
||||||
|
|
|
@ -283,8 +283,6 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request,
|
||||||
requestedDuration = "24h";
|
requestedDuration = "24h";
|
||||||
}
|
}
|
||||||
|
|
||||||
const sqlHourOffset = Database.sqlHourOffset();
|
|
||||||
|
|
||||||
// Check if monitor is public
|
// Check if monitor is public
|
||||||
|
|
||||||
const uptimeCalculator = await UptimeCalculator.getUptimeCalculator(requestedMonitorId);
|
const uptimeCalculator = await UptimeCalculator.getUptimeCalculator(requestedMonitorId);
|
||||||
|
|
|
@ -4,7 +4,6 @@ const { UptimeKumaServer } = require("../uptime-kuma-server");
|
||||||
const StatusPage = require("../model/status_page");
|
const StatusPage = require("../model/status_page");
|
||||||
const { allowDevAllOrigin, sendHttpError } = require("../util-server");
|
const { allowDevAllOrigin, sendHttpError } = require("../util-server");
|
||||||
const { R } = require("redbean-node");
|
const { R } = require("redbean-node");
|
||||||
const Monitor = require("../model/monitor");
|
|
||||||
const { badgeConstants } = require("../config");
|
const { badgeConstants } = require("../config");
|
||||||
const { makeBadge } = require("badge-maker");
|
const { makeBadge } = require("badge-maker");
|
||||||
const { UptimeCalculator } = require("../uptime-calculator");
|
const { UptimeCalculator } = require("../uptime-calculator");
|
||||||
|
|
|
@ -346,7 +346,7 @@ export default {
|
||||||
pauseSelected() {
|
pauseSelected() {
|
||||||
Object.keys(this.selectedMonitors)
|
Object.keys(this.selectedMonitors)
|
||||||
.filter(id => this.$root.monitorList[id].active)
|
.filter(id => this.$root.monitorList[id].active)
|
||||||
.forEach(id => this.$root.getSocket().emit("pauseMonitor", id));
|
.forEach(id => this.$root.getSocket().emit("pauseMonitor", id, () => {}));
|
||||||
|
|
||||||
this.cancelSelectMode();
|
this.cancelSelectMode();
|
||||||
},
|
},
|
||||||
|
@ -357,7 +357,7 @@ export default {
|
||||||
resumeSelected() {
|
resumeSelected() {
|
||||||
Object.keys(this.selectedMonitors)
|
Object.keys(this.selectedMonitors)
|
||||||
.filter(id => !this.$root.monitorList[id].active)
|
.filter(id => !this.$root.monitorList[id].active)
|
||||||
.forEach(id => this.$root.getSocket().emit("resumeMonitor", id));
|
.forEach(id => this.$root.getSocket().emit("resumeMonitor", id, () => {}));
|
||||||
|
|
||||||
this.cancelSelectMode();
|
this.cancelSelectMode();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# How to translate
|
# Translations
|
||||||
|
|
||||||
|
## How to translate
|
||||||
|
|
||||||
(2023-01-24 Updated)
|
(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
|
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.
|
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/
|
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)
|
2. Find the language code (You can find it at the end of the URL)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Common Util for frontend and backend
|
// Common Util for frontend and backend
|
||||||
//
|
//
|
||||||
// DOT NOT MODIFY util.js!
|
// DOT NOT MODIFY util.js!
|
||||||
// Need to run "tsc" to compile if there are any changes.
|
// Need to run "npm run tsc" to compile if there are any changes.
|
||||||
//
|
//
|
||||||
// Backend uses the compiled file util.js
|
// Backend uses the compiled file util.js
|
||||||
// Frontend uses util.ts
|
// Frontend uses util.ts
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Common Util for frontend and backend
|
// Common Util for frontend and backend
|
||||||
//
|
//
|
||||||
// DOT NOT MODIFY util.js!
|
// DOT NOT MODIFY util.js!
|
||||||
// Need to run "tsc" to compile if there are any changes.
|
// Need to run "npm run tsc" to compile if there are any changes.
|
||||||
//
|
//
|
||||||
// Backend uses the compiled file util.js
|
// Backend uses the compiled file util.js
|
||||||
// Frontend uses util.ts
|
// Frontend uses util.ts
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
|
|
||||||
# Node.js Test Runner
|
# Node.js Test Runner
|
||||||
|
|
||||||
Documentation: https://nodejs.org/api/test.html
|
Documentation: https://nodejs.org/api/test.html
|
||||||
|
|
||||||
Create a test file in this directory with the name `*.js`.
|
Create a test file in this directory with the name `*.js`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Template
|
## Template
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
Loading…
Reference in a new issue