Compare commits

..

65 Commits
1.0.0 ... 1.0.2

Author SHA1 Message Date
LouisLam
af838d62e8 update 1.0.2 2021-07-13 23:09:12 +08:00
LouisLam
5a6e83b777 remove debug msg 2021-07-13 23:05:52 +08:00
LouisLam
c81930cacc add build-docker-nightly script 2021-07-13 23:03:55 +08:00
LouisLam
6d4694da43 add version-global-replace.js 2021-07-13 22:58:30 +08:00
LouisLam
9c23cd09ce use bcrypt for password hash 2021-07-13 22:22:46 +08:00
LouisLam
a60bf1528a drop ie support when build the frontend 2021-07-13 18:34:09 +08:00
LouisLam
1f3b337806 reset auto increment for new users 2021-07-13 18:21:06 +08:00
LouisLam
010ebea210 show version in the footer 2021-07-13 18:08:12 +08:00
LouisLam
b3a5d868a7 catch timezone error if browser do not have 2021-07-13 17:46:39 +08:00
LouisLam
312dec7393 add png icon 2021-07-13 12:38:59 +08:00
LouisLam
be1ef24cce add a comment 2021-07-13 12:24:33 +08:00
Louis Lam
c5de82b220 Merge pull request #35 from louislam/revert-32-feature/darkmode
Revert "basic darkmode"
2021-07-13 12:16:24 +08:00
Louis Lam
fef41b44a8 Revert "basic darkmode" 2021-07-13 12:16:11 +08:00
Louis Lam
6af65b688d Merge pull request #32 from philippdormann/feature/darkmode
basic darkmode
2021-07-13 11:58:57 +08:00
LouisLam
3e4a98b6bc Merge branch 'dev'
# Conflicts:
#	server/notification.js
2021-07-13 11:42:51 +08:00
LouisLam
866bf56319 add build-docker-nightly script 2021-07-13 11:32:40 +08:00
LouisLam
99afdabcac change the docker base image to node:14-alpine3.14, reduce the container size 2021-07-13 11:32:09 +08:00
LouisLam
0f1a95fde9 smtp without username password 2021-07-13 11:01:02 +08:00
LouisLam
edbab8163e update .editorconfig 2021-07-13 10:31:31 +08:00
LouisLam
551d00fc24 add some comments and remove traefik-network from docker-composer.yml 2021-07-13 10:28:07 +08:00
Louis Lam
3e4cdbecf2 Merge pull request #28 from yatadev/master
Create docker-compose.yml
2021-07-13 10:21:21 +08:00
Louis Lam
622681470d Merge pull request #22 from TheGuyDanish/master
Discord notification rework
2021-07-13 10:20:47 +08:00
Philipp Dormann
d9e2c230bf Merge branch 'master' of philippdormann/uptime-kuma into philippdormann/uptime-kuma->feature/darkmode
darkmode based on css variables. ref https://github.com/louislam/uptime-kuma/issues/21
2021-07-12 22:21:19 +02:00
Philipp Dormann
010302395f clean, multistage Dockerfile 2021-07-12 22:11:47 +02:00
jacr13
e053ee6573 fix bad pasting 2021-07-12 22:10:26 +02:00
Philipp Dormann
c4bc95927f dependency bumps 2021-07-12 22:09:27 +02:00
jacr13
3e305b79b2 remove debub console log 2021-07-12 22:08:42 +02:00
jacr13
c6237277c0 add support for signal notifications 2021-07-12 22:06:03 +02:00
Philipp Dormann
900219deb1 Merge remote-tracking branch 'theguydanish/master'
# Conflicts:
#	package-lock.json
#	package.json
2021-07-12 21:58:13 +02:00
Philipp Dormann
7ebeee3455 README: add sample docker-compose link
ref https://github.com/louislam/uptime-kuma/issues/25
2021-07-12 21:53:49 +02:00
Philipp Dormann
0abd3b2d16 README cleanup 2021-07-12 21:53:28 +02:00
Philipp Dormann
f452bf6b13 properly name Dockerfile 2021-07-12 21:50:51 +02:00
Philipp Dormann
8cd90d1e96 🐳 Docker 2021-07-12 21:50:39 +02:00
Philipp Dormann
789094a2ee formatting socket.js + deal with broken windows ports - default :50013 2021-07-12 21:49:18 +02:00
Philipp Dormann
5515437eab 🧹 cleanup 2021-07-12 21:47:32 +02:00
Philipp Dormann
7acb347012 🧹 fix formatting in server.js 2021-07-12 21:43:31 +02:00
Philipp Dormann
9d57e93367 Merge branch 'master' of https://github.com/philippdormann/uptime-kuma 2021-07-12 21:41:01 +02:00
Philipp Dormann
dae92d0ae4 Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	package.json
2021-07-12 21:40:35 +02:00
LouisLam
1259ff5368 smtp username/password is not required 2021-07-13 01:02:50 +08:00
yatadev
8debce82b1 Create docker-compose.yml 2021-07-12 18:23:38 +02:00
LouisLam
11a2adcb7c Merge remote-tracking branch 'origin/master' 2021-07-12 23:29:13 +08:00
LouisLam
ad615d1a90 remove some timezones which may cause error 2021-07-12 23:28:56 +08:00
TheGuyDanish
613c42b6d8 Discord revamp! Changed from bot to webhook, removed discord.js dep 2021-07-12 14:13:36 +01:00
Louis Lam
a6e16116f2 improve the docker script 2021-07-12 20:08:51 +08:00
Louis Lam
c7dfb36349 Update README.md 2021-07-12 20:00:12 +08:00
LouisLam
459dde2761 update the setup script to 1.0.1 2021-07-12 19:03:25 +08:00
LouisLam
cb94ab3bb5 add update guide 2021-07-12 18:59:48 +08:00
LouisLam
0176857a2c add ability to change the listening port and hostname 2021-07-12 18:33:25 +08:00
Philipp Dormann
763d7f2683 Merge branch 'louislam:master' into master 2021-07-12 12:01:00 +02:00
Louis Lam
c436ef4e05 Update README.md 2021-07-12 11:42:36 +08:00
LouisLam
56fcfc9369 fix show N/A if the ping is 0ms 2021-07-12 11:20:18 +08:00
LouisLam
a9d19ae06a support json for keyword type 2021-07-12 10:52:41 +08:00
Louis Lam
35ce54f30c Merge pull request #6 from TheGuyDanish/patch-1
Introduce custom user agent. Fixes #5
2021-07-12 09:39:15 +08:00
Philipp Dormann
e4f38d833d 🌑 darkmode support for nav link hover 2021-07-12 00:41:28 +02:00
Philipp Dormann
8b83266b00 🌑 add darkmode support for focused input elements 2021-07-12 00:37:08 +02:00
Philipp Dormann
6fb1b344f6 🌑 darkmode support on form elements 2021-07-12 00:33:52 +02:00
Philipp Dormann
b15b44e290 🐳 move Dockerfile to base node:alpine image
reduces size from about 1.08GB to 345MB (still not great but hey)
2021-07-12 00:28:11 +02:00
Philipp Dormann
66d991bd05 🐞 added missing v-bind:key to Dashboard 2021-07-12 00:27:29 +02:00
Philipp Dormann
673d3c124c 🚧 WIP on darkmode 🌑 2021-07-12 00:26:33 +02:00
Philipp Dormann
e568cad22c dependency bump + version pin 2021-07-12 00:25:22 +02:00
TheGuyDanish
f84f7aca75 Introduce custom user agent. Fixes #5
Quick and easy fix. Could be improved by adding a version number as well. Like `Uptime-Kuma/0.0.1`, for example.
2021-07-11 21:01:34 +01:00
LouisLam
b198b3dde4 Merge remote-tracking branch 'origin/master' 2021-07-12 01:18:18 +08:00
LouisLam
0b294815c7 add back arm/v7 for build-docker 2021-07-12 01:18:02 +08:00
Louis Lam
83935a2cf4 Update README.md 2021-07-11 23:41:21 +08:00
Louis Lam
838913f0a1 Update README.md 2021-07-11 23:41:04 +08:00
21 changed files with 465 additions and 108 deletions

View File

@@ -13,3 +13,6 @@ trim_trailing_whitespace = false
[*.yaml]
indent_size = 2
[*.yml]
indent_size = 2

View File

@@ -19,11 +19,21 @@ It is a self-hosted monitoring tool like "Uptime Robot".
### Docker
```bash
docker run -d --restart=always -p 3001:3001 louislam/uptime-kuma
# Create a volume
docker volume create uptime-kuma
# Start the container
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma
```
Browse to http://localhost:3001 after started.
Change Port and Volume
```bash
docker run -d --restart=always -p <YOUR_PORT>:3001 -v <YOUR_DIR OR VOLUME>:/app/data --name uptime-kuma louislam/uptime-kuma
```
### Without Docker
Required Tools: Node.js >= 14, git and pm2.
@@ -36,11 +46,14 @@ npm run setup
# Option 1. Try it
npm run start-server
# (Recommanded)
# (Recommended)
# Option 2. Run in background using PM2
# Install PM2 if you don't have: npm install pm2 -g
pm2 start npm --name uptime-kuma -- run start-server
# Listen to different port or hostname
pm2 start npm --name uptime-kuma -- run start-server -- --port=80 --hostname=0.0.0.0
```
Browse to http://localhost:3001 after started.
@@ -49,6 +62,23 @@ Browse to http://localhost:3001 after started.
[![Deploy to DO](https://www.deploytodo.com/do-btn-blue.svg)](https://cloud.digitalocean.com/apps/new?repo=https://github.com/louislam/uptime-kuma/tree/master&refcode=e2c7eb658434)
Choose Cheapest Plan is enough. (US$ 5)
# How to Update
### Docker
Re-pull the latest docker image and create another container with the same volume.
### Without Docker
```bash
git fetch --all
git checkout 1.0.2 --force
npm install
npm run build
pm2 restart uptime-kuma
```
# More Screenshots

Binary file not shown.

13
docker-compose.yml Normal file
View File

@@ -0,0 +1,13 @@
# Simple docker-composer.yml
# You can change your port or volume location
version: '3.3'
services:
uptime-kuma:
image: louislam/uptime-kuma
container_name: uptime-kuma
volumes:
- ./uptime-kuma:/app/data
ports:
- 3001:3001

View File

@@ -1,4 +1,9 @@
FROM node:14
FROM node:14-alpine3.14
# sqlite have to build on arm
# TODO: use prebuilt sqlite for arm, because it is very very slow.
RUN apk add --no-cache make g++ python3
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /app
COPY . .

View File

@@ -0,0 +1,39 @@
/**
* String.prototype.replaceAll() polyfill
* https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/
* @author Chris Ferdinandi
* @license MIT
*/
if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function(str, newStr){
// If a regex pattern
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
return this.replace(str, newStr);
}
// If a string
return this.replace(new RegExp(str, 'g'), newStr);
};
}
const pkg = require('../package.json');
const fs = require("fs");
const oldVersion = pkg.version
const newVersion = process.argv[2]
console.log("Old Version: " + oldVersion)
console.log("New Version: " + newVersion)
if (newVersion) {
// Process package.json
pkg.version = newVersion
pkg.scripts.setup = pkg.scripts.setup.replaceAll(oldVersion, newVersion)
pkg.scripts["build-docker"] = pkg.scripts["build-docker"].replaceAll(oldVersion, newVersion)
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 4) + "\n")
// Process README.md
fs.writeFileSync("README.md", fs.readFileSync("README.md", 'utf8').replaceAll(oldVersion, newVersion))
}

233
package-lock.json generated
View File

@@ -1,8 +1,7 @@
{
"name": "uptime-kuma",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@babel/helper-validator-identifier": {
"version": "7.14.5",
@@ -29,21 +28,6 @@
"to-fast-properties": "^2.0.0"
}
},
"@discordjs/collection": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
"integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
},
"@discordjs/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"@popperjs/core": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.2.tgz",
@@ -185,14 +169,6 @@
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
},
"abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"requires": {
"event-target-shim": "^5.0.0"
}
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
@@ -202,6 +178,14 @@
"negotiator": "0.6.2"
}
},
"agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
"requires": {
"debug": "4"
}
},
"ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -243,6 +227,11 @@
"readable-stream": "^2.0.6"
}
},
"args-parser": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/args-parser/-/args-parser-1.3.0.tgz",
"integrity": "sha512-If3Zi4BSjlQIJ9fgAhSiKi0oJtgMzSqh0H4wvl7XSeO16FKx7QqaHld8lZeEajPX7y1C5qKKeNgyrfyvmjmjUQ=="
},
"arr-diff": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
@@ -403,6 +392,70 @@
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog=="
},
"bcrypt": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-5.0.1.tgz",
"integrity": "sha512-9BTgmrhZM2t1bNuDtrtIMVSmmxZBrJ71n8Wg+YgdjHuIWYF7SjjmCPZFB+/5i/o/PIeRpwVJR3P+NrpIItUjqw==",
"requires": {
"@mapbox/node-pre-gyp": "^1.0.0",
"node-addon-api": "^3.1.0"
},
"dependencies": {
"@mapbox/node-pre-gyp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz",
"integrity": "sha512-4srsKPXWlIxp5Vbqz5uLfBN+du2fJChBoYn/f2h991WLdk7jUvcSk/McVLSv/X+xQIPI8eGD5GjrnygdyHnhPA==",
"requires": {
"detect-libc": "^1.0.3",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.1",
"nopt": "^5.0.0",
"npmlog": "^4.1.2",
"rimraf": "^3.0.2",
"semver": "^7.3.4",
"tar": "^6.1.0"
}
},
"lru-cache": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"requires": {
"yallist": "^4.0.0"
}
},
"nopt": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
"integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
"requires": {
"abbrev": "1"
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"requires": {
"glob": "^7.1.3"
}
},
"semver": {
"version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"requires": {
"lru-cache": "^6.0.0"
}
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
@@ -788,28 +841,6 @@
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
},
"discord.js": {
"version": "12.5.3",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
"integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
"requires": {
"@discordjs/collection": "^0.1.6",
"@discordjs/form-data": "^3.0.1",
"abort-controller": "^3.0.0",
"node-fetch": "^2.6.1",
"prism-media": "^1.2.9",
"setimmediate": "^1.0.5",
"tweetnacl": "^1.0.3",
"ws": "^7.4.4"
},
"dependencies": {
"tweetnacl": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
}
}
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@@ -915,11 +946,6 @@
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
},
"event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
},
"expand-brackets": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
@@ -1244,6 +1270,14 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
"requires": {
"minipass": "^3.0.0"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -1495,6 +1529,15 @@
"sshpk": "^1.7.0"
}
},
"https-proxy-agent": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",
"integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",
"requires": {
"agent-base": "6",
"debug": "4"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@@ -1926,6 +1969,21 @@
"sourcemap-codec": "^1.4.4"
}
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
"requires": {
"semver": "^6.0.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
}
}
},
"make-iterator": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz",
@@ -2099,6 +2157,37 @@
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
},
"minipass": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz",
"integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==",
"requires": {
"yallist": "^4.0.0"
},
"dependencies": {
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
"minizlib": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"requires": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
},
"dependencies": {
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
"mixin-deep": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
@@ -2118,6 +2207,11 @@
}
}
},
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -2653,11 +2747,6 @@
"integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==",
"dev": true
},
"prism-media": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.1.tgz",
"integrity": "sha512-nyYAa3KB4qteJIqdguKmwxTJgy55xxUtkJ3uRnOvO5jO+frci+9zpRXw6QZVcfDeva3S654fU9+26P2OSTzjHw=="
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -3001,11 +3090,6 @@
}
}
},
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
@@ -3317,6 +3401,31 @@
"integrity": "sha512-PwaC0Z6Y1E6gFekY2u38EC5+5w2M65jYVrD1aAcOptpHVhCwPIwPFJvYJyryQKUyeuQ5bKKI3PBHWNjdE9aizg==",
"dev": true
},
"tar": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.1.0.tgz",
"integrity": "sha512-DUCttfhsnLCjwoDoFcI+B2iJgYa93vBnDUATYEeRx6sntCTdN01VnqsIuTlALXla/LWooNg0yEGeB+Y8WdFxGA==",
"requires": {
"chownr": "^2.0.0",
"fs-minipass": "^2.0.0",
"minipass": "^3.0.0",
"minizlib": "^2.1.1",
"mkdirp": "^1.0.3",
"yallist": "^4.0.0"
},
"dependencies": {
"chownr": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
"integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ=="
},
"yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
},
"tarn": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.1.tgz",

View File

@@ -1,21 +1,24 @@
{
"name": "uptime-kuma",
"version": "1.0.0",
"version": "1.0.2",
"scripts": {
"dev": "vite --host",
"start-server": "node server/server.js",
"update": "",
"build": "vite build",
"vite-preview-dist": "vite preview --host",
"build-docker": "docker buildx build --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 . --push",
"setup": "git checkout 1.0.0 && npm install && npm run build"
"build-docker": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.0.2 . --push",
"build-docker-nightly": "docker buildx build --platform linux/amd64 -t louislam/uptime-kuma:nightly . --push",
"setup": "git checkout 1.0.2 && npm install && npm run build",
"version-global-replace": "node extra/version-global-replace.js"
},
"dependencies": {
"@popperjs/core": "^2.9.2",
"args-parser": "^1.3.0",
"axios": "^0.21.1",
"bcrypt": "^5.0.1",
"bootstrap": "^5.0.0",
"dayjs": "^1.10.4",
"discord.js": "^12.5.3",
"express": "^4.17.1",
"form-data": "^4.0.0",
"jsonwebtoken": "^8.5.1",
@@ -24,6 +27,7 @@
"redbean-node": "0.0.20",
"socket.io": "^4.0.2",
"socket.io-client": "^4.1.2",
"sqlite3": "^5.0.0",
"tcp-ping": "^0.1.1",
"vue": "^3.0.5",
"vue-confirm-dialog": "^1.0.2",

BIN
public/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -71,7 +71,9 @@ class Monitor extends BeanModel {
try {
if (this.type === "http" || this.type === "keyword") {
let startTime = dayjs().valueOf();
let res = await axios.get(this.url)
let res = await axios.get(this.url, {
headers: { 'User-Agent':'Uptime-Kuma' }
})
bean.msg = `${res.status} - ${res.statusText}`
bean.ping = dayjs().valueOf() - startTime;
@@ -79,7 +81,14 @@ class Monitor extends BeanModel {
bean.status = 1;
} else {
if (res.data.includes(this.keyword)) {
let data = res.data;
// Convert to string for object/array
if (typeof data !== "string") {
data = JSON.stringify(data)
}
if (data.includes(this.keyword)) {
bean.msg += ", keyword is found"
bean.status = 1;
} else {

View File

@@ -2,7 +2,6 @@ const axios = require("axios");
const {R} = require("redbean-node");
const FormData = require('form-data');
const nodemailer = require("nodemailer");
const Discord = require('discord.js');
class Notification {
static async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
@@ -54,8 +53,63 @@ class Notification {
return await Notification.smtp(notification, msg)
} else if (notification.type === "discord") {
try {
// If heartbeatJSON is null, assume we're testing.
if(heartbeatJSON == null) {
let data = {
username: 'Uptime-Kuma',
content: msg
}
let res = await axios.post(notification.discordWebhookUrl, data)
return true;
}
// If heartbeatJSON is not null, we go into the normal alerting loop.
if(heartbeatJSON['status'] == 0) {
var alertColor = "16711680";
} else if(heartbeatJSON['status'] == 1) {
var alertColor = "65280";
}
let data = {
username: 'Uptime-Kuma',
embeds: [{
title: "Uptime-Kuma Alert",
color: alertColor,
fields: [
{
name: "Time (UTC)",
value: heartbeatJSON["time"]
},
{
name: "Message",
value: msg
}
]
}]
}
let res = await axios.post(notification.discordWebhookUrl, data)
return true;
} catch(error) {
console.log(error)
return false;
}
return await Notification.discord(notification, msg)
} else if (notification.type === "signal") {
try {
let data = {
"message": msg,
"number": notification.signalNumber,
"recipients": notification.signalRecipients.replace(/\s/g, '').split(",")
};
let config = {};
let res = await axios.post(notification.signalURL, data, config)
return true;
} catch (error) {
console.log(error)
return false;
}
} else {
throw new Error("Notification type is not supported")
}

23
server/password-hash.js Normal file
View File

@@ -0,0 +1,23 @@
const passwordHashOld = require('password-hash');
const bcrypt = require('bcrypt');
const saltRounds = 10;
exports.generate = function (password) {
return bcrypt.hashSync(password, saltRounds);
}
exports.verify = function (password, hash) {
if (isSHA1(hash)) {
return passwordHashOld.verify(password, hash)
} else {
return bcrypt.compareSync(password, hash);
}
}
function isSHA1(hash) {
return (typeof hash === "string" && hash.startsWith("sha1"))
}
exports.needRehash = function (hash) {
return isSHA1(hash);
}

View File

@@ -6,12 +6,17 @@ const { Server } = require("socket.io");
const io = new Server(server);
const dayjs = require("dayjs");
const {R} = require("redbean-node");
const passwordHash = require('password-hash');
const passwordHash = require('./password-hash');
const jwt = require('jsonwebtoken');
const Monitor = require("./model/monitor");
const fs = require("fs");
const {getSettings} = require("./util-server");
const {Notification} = require("./notification")
const args = require('args-parser')(process.argv);
const version = require('../package.json').version;
const hostname = args.host || "0.0.0.0"
const port = args.port || 3001
app.use(express.json())
@@ -25,18 +30,16 @@ let needSetup = false;
app.use('/', express.static("dist"));
app.post('/test-webhook', function(request, response, next) {
console.log("Test Webhook (application/json only)")
console.log("Content-Type: " + request.header("Content-Type"))
console.log(request.body)
response.end();
});
app.get('*', function(request, response, next) {
response.sendFile(process.cwd() + '/dist/index.html');
});
io.on('connection', async (socket) => {
socket.emit("info", {
version,
})
console.log('a user connected');
totalClient++;
@@ -93,6 +96,14 @@ let needSetup = false;
if (user && passwordHash.verify(data.password, user.password)) {
// Upgrade the hash to bcrypt
if (passwordHash.needRehash(user.password)) {
await R.exec("UPDATE `user` SET password = ? WHERE id = ? ", [
passwordHash.generate(data.password),
user.id
]);
}
await afterLogin(socket, user)
callback({
@@ -435,8 +446,8 @@ let needSetup = false;
});
});
server.listen(3001, () => {
console.log('Listening on 3001');
server.listen(port, hostname, () => {
console.log(`Listening on ${hostname}:${port}`);
startMonitors();
});

View File

@@ -56,7 +56,5 @@ exports.getSettings = async function (type) {
result[row.key] = row.value;
}
console.log(result)
return result;
}

View File

@@ -17,6 +17,7 @@
<option value="webhook">Webhook</option>
<option value="smtp">Email (SMTP)</option>
<option value="discord">Discord</option>
<option value="signal">Signal</option>
</select>
</div>
@@ -105,12 +106,12 @@
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" required v-model="notification.smtpUsername" autocomplete="false">
<input type="text" class="form-control" id="username" v-model="notification.smtpUsername" autocomplete="false">
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" required v-model="notification.smtpPassword" autocomplete="false">
<input type="password" class="form-control" id="password" v-model="notification.smtpPassword" autocomplete="false">
</div>
<div class="mb-3">
@@ -127,18 +128,43 @@
<template v-if="notification.type === 'discord'">
<div class="mb-3">
<label for="discord-token" class="form-label">Discord Bot Token</label>
<input type="text" class="form-control" id="discord-token" required v-model="notification.discordToken" autocomplete="false">
<div class="form-text">You should create a Discord app and create a bot from <a href="https://discord.com/developers/applications" target="_blank">here</a>.</div>
<label for="discord-webhook-url" class="form-label">Discord Webhook URL</label>
<input type="text" class="form-control" id="discord-webhook-url" required v-model="notification.discordWebhookUrl" autocomplete="false">
<div class="form-text">You can get this by going to Server Settings -> Integrations -> Create Webhook</div>
</div>
</template>
<template v-if="notification.type === 'signal'">
<div class="mb-3">
<label for="signal-url" class="form-label">Post URL</label>
<input type="url" pattern="https?://.+" class="form-control" id="signal-url" required v-model="notification.signalURL">
</div>
<div class="mb-3">
<label for="discordChannelID" class="form-label">Channel ID</label>
<input type="text" class="form-control" id="discordChannelID" required v-model="notification.discordChannelID" autocomplete="false">
<label for="signal-number" class="form-label">Number</label>
<input type="text" class="form-control" id="signal-number" required v-model="notification.signalNumber">
</div>
<div class="mb-3">
<label for="signal-recipients" class="form-label">Recipients</label>
<input type="text" class="form-control" id="signal-recipients" required v-model="notification.signalRecipients">
<div class="form-text">
You should add the bot to your channel. <br />
<a href="https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-" target="_blank">Where can I find the channel id?</a><br />
<a href="https://discordapi.com/permissions.html#8" target="_blank">How to add a bot to your channel?</a>
You need to have a signal client with REST API.
<p style="margin-top: 8px;">
You can check this url to view how to setup one:
</p>
<p style="margin-top: 8px;">
<a href="https://github.com/bbernhard/signal-cli-rest-api" target="_blank">https://github.com/bbernhard/signal-cli-rest-api</a>
</p>
<p style="margin-top: 8px;">
IMPORTANT: You cannot mix groups and numbers in recipients!
</p>
</div>
</div>
</template>

View File

@@ -33,6 +33,14 @@
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
</main>
<footer>
<div class="container-fluid">
Uptime Kuma -
Version: {{ $root.info.version }} -
<a href="https://github.com/louislam/uptime-kuma/releases" target="_blank">Check Update On GitHub</a>
</div>
</footer>
<!-- Mobile Only -->
<div style="width: 100%;height: 60px;" v-if="$root.isMobile"></div>
<nav class="bottom-nav" v-if="$root.isMobile">
@@ -130,6 +138,14 @@ export default {
}
main {
margin-bottom: 30px;
}
footer {
color: #AAA;
font-size: 13px;
margin-bottom: 30px;
margin-left: 10px;
}
</style>

View File

@@ -9,6 +9,7 @@ export default {
data() {
return {
info: { },
socket: {
token: null,
firstConnect: true,
@@ -44,6 +45,10 @@ export default {
transports: ['websocket']
});
socket.on('info', (info) => {
this.info = info;
});
socket.on('setup', (monitorID, data) => {
this.$router.push("/setup")
});
@@ -280,6 +285,13 @@ export default {
watch: {
// Reload the SPA if the server version is changed.
"info.version"(to, from) {
if (from && from !== to) {
window.location.reload()
}
},
remember() {
localStorage.remember = (this.remember) ? "1" : "0"
}

View File

@@ -137,7 +137,7 @@ export default {
},
ping() {
if (this.lastHeartBeat.ping) {
if (this.lastHeartBeat.ping || this.lastHeartBeat.ping === 0) {
return this.lastHeartBeat.ping;
} else {
return "N/A"
@@ -145,7 +145,7 @@ export default {
},
avgPing() {
if (this.$root.avgPingList[this.monitor.id]) {
if (this.$root.avgPingList[this.monitor.id] || this.$root.avgPingList[this.monitor.id] === 0) {
return this.$root.avgPingList[this.monitor.id];
} else {
return "N/A"

View File

@@ -30,7 +30,7 @@
<div class="mb-3" v-if="monitor.type === 'keyword' ">
<label for="keyword" class="form-label">Keyword</label>
<input type="text" class="form-control" id="keyword" v-model="monitor.keyword" required>
<div class="form-text">Search keyword in plain html response and it is case-sensitive</div>
<div class="form-text">Search keyword in plain html or JSON response and it is case-sensitive</div>
</div>
<div class="mb-3" v-if="monitor.type === 'port' || monitor.type === 'ping' ">

View File

@@ -24,7 +24,6 @@ const aryIannaTimeZones = [
'Asia/Yerevan',
'Antarctica/Casey',
'Antarctica/Davis',
'Antarctica/DumontDUrville', // https://bugs.chromium.org/p/chromium/issues/detail?id=928068
'Antarctica/Mawson',
'Antarctica/Palmer',
'Antarctica/Rothera',
@@ -195,7 +194,6 @@ const aryIannaTimeZones = [
'Asia/Seoul',
'Asia/Almaty',
'Asia/Qyzylorda',
'Asia/Qostanay', // https://bugs.chromium.org/p/chromium/issues/detail?id=928068
'Asia/Aqtobe',
'Asia/Aqtau',
'Asia/Atyrau',
@@ -364,22 +362,29 @@ const aryIannaTimeZones = [
'Pacific/Efate',
'Pacific/Wallis',
'Pacific/Apia',
'Africa/Johannesburg'
'Africa/Johannesburg',
];
export function timezoneList() {
let result = [];
for (let timezone of aryIannaTimeZones) {
let display = dayjs().tz(timezone).format("Z");
try {
let display = dayjs().tz(timezone).format("Z");
result.push({
name: `(UTC${display}) ${timezone}`,
value: timezone,
time: getTimezoneOffset(timezone),
})
} catch (e) {
console.log(e.message);
console.log("Skip this timezone")
}
result.push({
name: `(UTC${display}) ${timezone}`,
value: timezone,
time: getTimezoneOffset(timezone),
})
}
result.sort((a, b) => {

View File

@@ -7,7 +7,7 @@ export default defineConfig({
plugins: [
vue(),
legacy({
targets: ['ie >= 11'],
targets: ['ie > 11'],
additionalLegacyPolyfills: ['regenerator-runtime/runtime']
})
]