mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-09-14 15:36:59 +08:00
Compare commits
648 Commits
improve-he
...
extracted-
Author | SHA1 | Date | |
---|---|---|---|
|
2bd51a3145 | ||
|
6c49b53d6a | ||
|
334e37eaa0 | ||
|
4794f9eb0b | ||
|
77d82ec30f | ||
|
c7b83e729b | ||
|
f43fe53d28 | ||
|
10ebdcacaa | ||
|
a00b4ed285 | ||
|
a26d93ac52 | ||
|
c919d2c990 | ||
|
40d24e7837 | ||
|
30bf7a5e23 | ||
|
4e63d00007 | ||
|
9f35290c68 | ||
|
11007823e7 | ||
|
9ce0911e34 | ||
|
df663a81cd | ||
|
8b648a3ed1 | ||
|
9c7aa13190 | ||
|
823aeda9fe | ||
|
1590ca6c02 | ||
|
359e961aa7 | ||
|
e670b5f4cf | ||
|
b2ede38269 | ||
|
1ac5696463 | ||
|
63b8c52a65 | ||
|
4df71af34f | ||
|
07a0718272 | ||
|
46e4b16a7e | ||
|
5473bc9689 | ||
|
9f07011200 | ||
|
029944c655 | ||
|
b02a4055b8 | ||
|
82c59da16a | ||
|
888585dcef | ||
|
dd1eab1c6c | ||
|
a56c4ffa36 | ||
|
4e49dccd15 | ||
|
96560fff20 | ||
|
f5c59f403d | ||
|
798be2a4a8 | ||
|
ed69842939 | ||
|
5e1d2736eb | ||
|
9a83a9d6e7 | ||
|
325f3520e1 | ||
|
52036394a5 | ||
|
b112afba9b | ||
|
d0e1e40717 | ||
|
fff47248f0 | ||
|
48a1314de1 | ||
|
9a204fbfa9 | ||
|
9e6e21243f | ||
|
e355452b5c | ||
|
0279331326 | ||
|
ec66dca19b | ||
|
d36e6b09ae | ||
|
f4e80dbd02 | ||
|
7dc17bd796 | ||
|
68f9dfbcef | ||
|
f85c9b6b1d | ||
|
75426ffbe7 | ||
|
05c67d07c3 | ||
|
e6c85d3afc | ||
|
5d06378c11 | ||
|
3c85d86cda | ||
|
6fdcb1b909 | ||
|
1527a15dde | ||
|
5281dd47f7 | ||
|
43c10287a4 | ||
|
721234b5f6 | ||
|
ac4e1d890c | ||
|
584c8b05ca | ||
|
25b17e5dde | ||
|
17424f4e74 | ||
|
476d869321 | ||
|
c9a32bcdb2 | ||
|
ca28bee05f | ||
|
57c8656d32 | ||
|
a7f7aa1ce9 | ||
|
6bf5d97d66 | ||
|
1c438c91d5 | ||
|
561d307fb8 | ||
|
49605cd061 | ||
|
320d9712cd | ||
|
b0a855e218 | ||
|
04d46b6a43 | ||
|
50c8dd95c2 | ||
|
668aa49343 | ||
|
e2a2234504 | ||
|
8ccf536498 | ||
|
f828fee27e | ||
|
5df75b37ab | ||
|
b1f2e25188 | ||
|
c9eb483a58 | ||
|
22d97318c2 | ||
|
1d75d7cace | ||
|
5c72176ee4 | ||
|
b1e95968c0 | ||
|
88b7c047a8 | ||
|
533af0f56c | ||
|
daca38a554 | ||
|
55b2d4b907 | ||
|
168d1ca24f | ||
|
668e8bafed | ||
|
a581a85633 | ||
|
a3ac954140 | ||
|
e856cb6007 | ||
|
4e24e96dab | ||
|
6bfb1be71a | ||
|
237a6e8da9 | ||
|
dbbc79a05a | ||
|
9f2cf28a76 | ||
|
988ba79679 | ||
|
19e8c75c3b | ||
|
126d6cd912 | ||
|
c86706f189 | ||
|
1d091739c8 | ||
|
27bcc968ec | ||
|
c0db036187 | ||
|
7da5b2311c | ||
|
996db6281b | ||
|
63a380326d | ||
|
2778929f74 | ||
|
f71d35e53e | ||
|
1490443618 | ||
|
bab427f715 | ||
|
add5c128ce | ||
|
29575343ca | ||
|
e797abd108 | ||
|
7a9e2f5de6 | ||
|
7b5d2a71ff | ||
|
b25ac55a2f | ||
|
05606c69e7 | ||
|
893278bd3d | ||
|
0e30ea830d | ||
|
c67a2070b8 | ||
|
9863a10321 | ||
|
822ce5384b | ||
|
937c8a9a7b | ||
|
effd0197ac | ||
|
ee7f8680c1 | ||
|
08f75b0b99 | ||
|
c1301804d4 | ||
|
0923d05317 | ||
|
88187b66eb | ||
|
b8858f4605 | ||
|
49b6dacb4d | ||
|
e927327bad | ||
|
45690a25a0 | ||
|
5bc68fe0a7 | ||
|
bc077cc536 | ||
|
975761b448 | ||
|
0e3b3a9ab8 | ||
|
a9a1cf1353 | ||
|
bfd65ab6e3 | ||
|
1db750a2e1 | ||
|
abd62a12e4 | ||
|
ca14c34977 | ||
|
2a3a2201e6 | ||
|
6eef2192b0 | ||
|
9789931edf | ||
|
4aaa0b92fb | ||
|
fdf562fe39 | ||
|
b385e81608 | ||
|
e2239bc7b7 | ||
|
da92400401 | ||
|
daa59b812c | ||
|
574705a4c3 | ||
|
a0c62d8ab0 | ||
|
8fd713d642 | ||
|
4c683da0dd | ||
|
507ff76728 | ||
|
8bd69d78a8 | ||
|
cc09147b4b | ||
|
b8941403d1 | ||
|
5b87da94b3 | ||
|
9209210e7c | ||
|
c7b8bb9e4a | ||
|
7756070c57 | ||
|
d88e7702b9 | ||
|
ee99ee9460 | ||
|
800847d0df | ||
|
3fd0c822d6 | ||
|
e74d6a7471 | ||
|
99dccd9e90 | ||
|
e61589d02e | ||
|
17dfdacd93 | ||
|
6bfc58674a | ||
|
1b293f2754 | ||
|
9a52a8761c | ||
|
94154c49aa | ||
|
1fdb7e48ed | ||
|
cc000117ca | ||
|
4d6ea433e6 | ||
|
cf2d603e27 | ||
|
5a9c3ad353 | ||
|
4cdc8f344b | ||
|
0efdfc4497 | ||
|
673f9a7744 | ||
|
f254940b64 | ||
|
71dd5e2369 | ||
|
09d249ca36 | ||
|
5f25a75f65 | ||
|
92488290fa | ||
|
246316f55b | ||
|
10659d07b2 | ||
|
80bdc455da | ||
|
e8fada9386 | ||
|
93ac212aef | ||
|
f37f55e06c | ||
|
87d7a780e3 | ||
|
0fc372f558 | ||
|
67a13e1259 | ||
|
81e465f418 | ||
|
a5d0f7a7db | ||
|
a16b42f98c | ||
|
65ff08b38e | ||
|
56aa81e337 | ||
|
dc3abc68f0 | ||
|
89158be7de | ||
|
ac4355114a | ||
|
3cea7d4eb2 | ||
|
2bccae415f | ||
|
2b8f55194f | ||
|
538f83205d | ||
|
cf075a8793 | ||
|
288cab6dd7 | ||
|
95125cc417 | ||
|
20b69acde2 | ||
|
b4e45c7ce8 | ||
|
36196f632d | ||
|
c31475e020 | ||
|
9e21c7cb02 | ||
|
669fc02baa | ||
|
371eb38198 | ||
|
64fe00f9f2 | ||
|
2fbdf4886e | ||
|
5ebb160597 | ||
|
e47e3cf479 | ||
|
ef573d057b | ||
|
2d64204ff1 | ||
|
2afd743a6d | ||
|
08da5ad5d8 | ||
|
83c7b593da | ||
|
a2905b0686 | ||
|
7f4a23a5ac | ||
|
465531ad98 | ||
|
f491879214 | ||
|
5ea712e826 | ||
|
423e66d609 | ||
|
05f9f35cb3 | ||
|
3b0800b78e | ||
|
c33840fc9f | ||
|
44f8a8f8e9 | ||
|
ca0385c449 | ||
|
ceb1d90095 | ||
|
b6a75e198c | ||
|
999ed525e5 | ||
|
8773eed790 | ||
|
f9b3f9766e | ||
|
eaa8939098 | ||
|
055aa8d2da | ||
|
e815ee9192 | ||
|
3b7e3e093b | ||
|
8cce068224 | ||
|
f8650239a6 | ||
|
2a001d1aae | ||
|
0eca97f690 | ||
|
f296d8f533 | ||
|
8150700906 | ||
|
0ffa150c5d | ||
|
8456912ae3 | ||
|
17e284f011 | ||
|
d4c21a2259 | ||
|
7635ab54a0 | ||
|
f3dcdb6332 | ||
|
458cdf9f9b | ||
|
9356e7dd4f | ||
|
25cb78796a | ||
|
bf1e3a3d5e | ||
|
0060e46b91 | ||
|
23e80882c6 | ||
|
5ebea3134a | ||
|
2a315d4c84 | ||
|
f1e2ee74ea | ||
|
8d847abf35 | ||
|
d7d57eafe3 | ||
|
329e2042bc | ||
|
d830fa4a0e | ||
|
c9fe6b5d01 | ||
|
996ff28ed9 | ||
|
f24c3583fb | ||
|
e2fdfd2937 | ||
|
dd7a5064e3 | ||
|
6833594592 | ||
|
d1d6357453 | ||
|
8acbd14439 | ||
|
239b8f4c71 | ||
|
5b277ce4a4 | ||
|
3962617d74 | ||
|
2f982aad53 | ||
|
1b1ceeae1d | ||
|
85138679b1 | ||
|
9fb92123e5 | ||
|
0bba5810a4 | ||
|
6c95140db1 | ||
|
8fc693dab3 | ||
|
406e5d5fdd | ||
|
b801d22cd3 | ||
|
a3bb0243cf | ||
|
1f441fa3a4 | ||
|
b0a771e341 | ||
|
0065effc26 | ||
|
976b6e684b | ||
|
3e14c77b59 | ||
|
e21aa12fb1 | ||
|
d53d818321 | ||
|
05eb5b0884 | ||
|
2f595e464b | ||
|
b63305315a | ||
|
60503d0676 | ||
|
9113c049d4 | ||
|
b7ab17bf5e | ||
|
61f32f5bbe | ||
|
3dbc15cb69 | ||
|
caf4584311 | ||
|
2637f6665b | ||
|
cfe35c382e | ||
|
643ebea0a6 | ||
|
92324e94da | ||
|
43bfb366f2 | ||
|
5820c472cb | ||
|
127608ffe9 | ||
|
917b20fe3d | ||
|
221f625db1 | ||
|
45c83fdd49 | ||
|
a06d88832c | ||
|
59cadc20d0 | ||
|
2557cd3c3e | ||
|
8b1324493e | ||
|
f80168e0de | ||
|
332bc43bbc | ||
|
d28627e855 | ||
|
26c3b79d5c | ||
|
8151ac0e25 | ||
|
207847505a | ||
|
1a47563eb8 | ||
|
4185ec20b0 | ||
|
4245ea86e7 | ||
|
f861a48dfc | ||
|
fa1214ae5e | ||
|
99adac3eb9 | ||
|
89beb5f264 | ||
|
65e57e5621 | ||
|
719ef856e8 | ||
|
869ee8ec50 | ||
|
530c8e5328 | ||
|
621419e434 | ||
|
482049c72b | ||
|
2815cc73cf | ||
|
97ed0a96d8 | ||
|
e1147c06aa | ||
|
abc8f2b131 | ||
|
46b300808d | ||
|
777ef6bc7b | ||
|
b244e8fcbb | ||
|
ad4629cb03 | ||
|
478403ef63 | ||
|
81b84a3c53 | ||
|
031947319a | ||
|
74a908a069 | ||
|
20a68a16f5 | ||
|
8aa497fb89 | ||
|
9c56c9b346 | ||
|
db7a92a74c | ||
|
46432618e1 | ||
|
35479c7690 | ||
|
7772a546db | ||
|
c3260bbf51 | ||
|
c5d9c54a04 | ||
|
0110c4d57a | ||
|
37666bf35f | ||
|
90badfabee | ||
|
81c9900e23 | ||
|
62780001f7 | ||
|
e3396251a8 | ||
|
9c9a086788 | ||
|
9fb95fe95e | ||
|
1e75d81bcf | ||
|
cb3a104dc0 | ||
|
57a18958d6 | ||
|
0294118cbf | ||
|
1708b67949 | ||
|
01855e0ffe | ||
|
80efe9b831 | ||
|
b8bd17ddbd | ||
|
2ad8af9d14 | ||
|
5bc8c0c66f | ||
|
60be875edd | ||
|
676587b7fb | ||
|
e9bf02fc2c | ||
|
73239d441d | ||
|
4ceeb304f1 | ||
|
67250d6302 | ||
|
711380bbbe | ||
|
9536c6aa6a | ||
|
4255496b11 | ||
|
f28dccf4e1 | ||
|
b689733d59 | ||
|
afaa7bb2f0 | ||
|
ac452bbcb9 | ||
|
121d1a11af | ||
|
8e61158758 | ||
|
dc42420193 | ||
|
d810a74d70 | ||
|
bf58838b89 | ||
|
33ce0ef02c | ||
|
1550a5f792 | ||
|
92e0eec6d4 | ||
|
9973d73dd7 | ||
|
e2782810cf | ||
|
c1aaad0d85 | ||
|
954e05b72f | ||
|
2918f723c9 | ||
|
2aa15ea635 | ||
|
6d4a45f18c | ||
|
f0975cd929 | ||
|
40d6a21453 | ||
|
b383392e8f | ||
|
9964b6c4d8 | ||
|
2547515a37 | ||
|
014231ef86 | ||
|
188fdcb6ad | ||
|
0f980e97b1 | ||
|
65cbc7b318 | ||
|
ace1fe00c2 | ||
|
d56bf08cd7 | ||
|
291d5d7c55 | ||
|
8e3ff25f7b | ||
|
6e80c850f4 | ||
|
0608881954 | ||
|
38efd97b28 | ||
|
5b6522a54e | ||
|
b534fde265 | ||
|
ce0ba6c0ca | ||
|
fdfb572e09 | ||
|
c43223a16d | ||
|
df832f15fe | ||
|
d7b9bcf4b4 | ||
|
9f170a68d7 | ||
|
201c10416e | ||
|
b32d869823 | ||
|
ddd135efa8 | ||
|
9379498b49 | ||
|
1a862e47ab | ||
|
87b2e45fbf | ||
|
9b599ccd1d | ||
|
8412e19fe6 | ||
|
bbaba29222 | ||
|
e11aad2d60 | ||
|
8c7dea5219 | ||
|
adc3548e9d | ||
|
1515f4e121 | ||
|
3fcb7bf181 | ||
|
e64bf0e3fe | ||
|
523d137e2b | ||
|
18169c59a1 | ||
|
4ccf263481 | ||
|
579d7232c9 | ||
|
966dfa6f88 | ||
|
8e441dd8f7 | ||
|
9ebf4f97bb | ||
|
a362206fab | ||
|
f6bdaacbba | ||
|
03e43ab364 | ||
|
7212d884ef | ||
|
1c13a75970 | ||
|
aa676150eb | ||
|
a3a81f8059 | ||
|
4e401faefb | ||
|
53710b5f26 | ||
|
07a7233e6c | ||
|
d7797b8086 | ||
|
e9efbaa1df | ||
|
e0ffdb8371 | ||
|
87d595760d | ||
|
6b81554281 | ||
|
b70b8b8f12 | ||
|
0e97721c13 | ||
|
bfaa6fd86a | ||
|
b0421e9651 | ||
|
8691d171cf | ||
|
820950fced | ||
|
b8efc8603e | ||
|
0ba2c1181a | ||
|
aecd95e72b | ||
|
7c05ac6539 | ||
|
ce4461d85b | ||
|
b6f7e3fe2a | ||
|
58bf3c784f | ||
|
f527f4b69d | ||
|
bbca82845a | ||
|
8cb6df2718 | ||
|
58263c02af | ||
|
2d51cfbbe2 | ||
|
8e5317fdd0 | ||
|
89cfa74163 | ||
|
05fb3d942c | ||
|
bef4452af3 | ||
|
cd4404ce3b | ||
|
2af35c161a | ||
|
e40b48be8e | ||
|
1adda5899c | ||
|
6d83385742 | ||
|
fc01150af8 | ||
|
2e3565b345 | ||
|
a410a9d142 | ||
|
b484c90176 | ||
|
42bf27fe5a | ||
|
67d0ef571d | ||
|
9d5cf5ea03 | ||
|
b59054454d | ||
|
c39043ec32 | ||
|
45b6fab313 | ||
|
852b3fa61b | ||
|
c3e3f27457 | ||
|
794f1810bf | ||
|
168357d93c | ||
|
476deb9fec | ||
|
a36f2a75ca | ||
|
88afab6571 | ||
|
bd9c44cccf | ||
|
2fae40e677 | ||
|
b2439527de | ||
|
1b148786a5 | ||
|
5b7206f8e2 | ||
|
99179c82d7 | ||
|
3db418dcf6 | ||
|
91b4ffc6dd | ||
|
156614b303 | ||
|
04b8681cfb | ||
|
d5a3f7e385 | ||
|
6875ecdfbf | ||
|
66a10b8993 | ||
|
5ea9766cd5 | ||
|
e7980110fc | ||
|
2267655e99 | ||
|
98b93c887a | ||
|
bef6a7911f | ||
|
0fe8d04f78 | ||
|
2ab21ccf8a | ||
|
90d0e8ccde | ||
|
7c49f7e5a6 | ||
|
499429858c | ||
|
de7bc487ed | ||
|
16a396debb | ||
|
2266f31100 | ||
|
2ef759a362 | ||
|
33cc96f918 | ||
|
8c24b02fce | ||
|
34b9fe2ffe | ||
|
4156c78c09 | ||
|
38bcab67f9 | ||
|
22f5bb1684 | ||
|
6b3d69e1d3 | ||
|
7a7783a266 | ||
|
59119b9e71 | ||
|
b3b8e9f3a0 | ||
|
e5345848a2 | ||
|
0d846be10e | ||
|
d8a8f6c08b | ||
|
f98a1ce077 | ||
|
86fa57449e | ||
|
ff51704cdf | ||
|
33804d8823 | ||
|
1e12ca4786 | ||
|
9ef1e69ae0 | ||
|
9c24cd3973 | ||
|
1654d13db9 | ||
|
82bad6deaa | ||
|
83d91dbb1b | ||
|
13a799d778 | ||
|
0af4ee6c34 | ||
|
7711679e1a | ||
|
faf8b5e7ce | ||
|
fd680feb97 | ||
|
d6af9162c1 | ||
|
f0c54be43f | ||
|
9f7f7a182e | ||
|
1f29fabe64 | ||
|
d6302198f3 | ||
|
d243cd84bf | ||
|
f3e1a9c61a | ||
|
a8bc0f8d6a | ||
|
bfc7b498be | ||
|
62f4434711 | ||
|
33f7448048 | ||
|
9c61247162 | ||
|
ed04008569 | ||
|
f3517bc08d | ||
|
283d52a861 | ||
|
6e887b056c | ||
|
52946c3e08 | ||
|
64b97c0f29 | ||
|
38f5f16dc7 | ||
|
fd90828914 | ||
|
42bba73ffe | ||
|
5061e42d4b | ||
|
076331bf00 | ||
|
a13fc7079e | ||
|
c4e222d1e6 | ||
|
f2a1c26ef8 | ||
|
8772baad9a | ||
|
215c89e8d3 | ||
|
e6a055af19 | ||
|
88d71d2c7a | ||
|
cd2d5325df | ||
|
75a1245b70 | ||
|
f666eb6d83 | ||
|
cb10643f57 | ||
|
c9ba4e7e8b | ||
|
94187bca5d | ||
|
39b4aa5966 | ||
|
cd79df07e1 | ||
|
0c40f02584 | ||
|
db42c13e05 | ||
|
5f85d8f749 | ||
|
c0e273df5b | ||
|
4da1341aa5 | ||
|
e765e6a1b8 | ||
|
eee9a1f004 | ||
|
4d07b65bdd | ||
|
1772158d62 | ||
|
7bfdb82f5d | ||
|
8945316ce6 | ||
|
eec221247f | ||
|
9564550d5f | ||
|
a78e7a423e | ||
|
9dddd0b657 | ||
|
d04d86d74e | ||
|
eb11c18203 | ||
|
3da2d78ad9 | ||
|
2b4ec765ff | ||
|
72dcefff76 | ||
|
3a894958eb | ||
|
7f88aacbe7 | ||
|
f89ed0a3a4 |
@@ -14,7 +14,8 @@
|
|||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"GitHub.copilot-chat"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
/.idea
|
/.idea
|
||||||
/node_modules
|
/node_modules
|
||||||
/data*
|
/data*
|
||||||
/cypress
|
|
||||||
/out
|
/out
|
||||||
/test
|
/test
|
||||||
/kubernetes
|
/kubernetes
|
||||||
@@ -30,11 +29,15 @@ SECURITY.md
|
|||||||
tsconfig.json
|
tsconfig.json
|
||||||
.env
|
.env
|
||||||
/tmp
|
/tmp
|
||||||
/babel.config.js
|
|
||||||
/ecosystem.config.js
|
/ecosystem.config.js
|
||||||
/extra/healthcheck.exe
|
/extra/healthcheck.exe
|
||||||
/extra/healthcheck
|
/extra/healthcheck
|
||||||
extra/exe-builder
|
/extra/exe-builder
|
||||||
|
/extra/push-examples
|
||||||
|
/extra/uptime-kuma-push
|
||||||
|
|
||||||
|
# Comment the following line if you want to rebuild the healthcheck binary
|
||||||
|
/extra/healthcheck-armv7
|
||||||
|
|
||||||
|
|
||||||
### .gitignore content (commented rules are duplicated)
|
### .gitignore content (commented rules are duplicated)
|
||||||
|
37
.eslintrc.js
37
.eslintrc.js
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
ignorePatterns: [
|
ignorePatterns: [
|
||||||
"test/*",
|
"test/*.js",
|
||||||
"server/modules/apicache/*",
|
"server/modules/apicache/*",
|
||||||
"src/util.js"
|
"src/util.js"
|
||||||
],
|
],
|
||||||
@@ -18,12 +18,13 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
parser: "vue-eslint-parser",
|
parser: "vue-eslint-parser",
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: "@babel/eslint-parser",
|
parser: "@typescript-eslint/parser",
|
||||||
sourceType: "module",
|
sourceType: "module",
|
||||||
requireConfigFile: false,
|
requireConfigFile: false,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
"jsdoc"
|
"jsdoc",
|
||||||
|
"@typescript-eslint",
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"yoda": "error",
|
"yoda": "error",
|
||||||
@@ -75,14 +76,14 @@ module.exports = {
|
|||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"key-spacing": "warn",
|
"key-spacing": "warn",
|
||||||
"keyword-spacing": "warn",
|
"keyword-spacing": "warn",
|
||||||
"space-infix-ops": "warn",
|
"space-infix-ops": "error",
|
||||||
"arrow-spacing": "warn",
|
"arrow-spacing": "warn",
|
||||||
"no-trailing-spaces": "error",
|
"no-trailing-spaces": "error",
|
||||||
"no-constant-condition": [ "error", {
|
"no-constant-condition": [ "error", {
|
||||||
"checkLoops": false,
|
"checkLoops": false,
|
||||||
}],
|
}],
|
||||||
"space-before-blocks": "warn",
|
"space-before-blocks": "warn",
|
||||||
//'no-console': 'warn',
|
//"no-console": "warn",
|
||||||
"no-extra-boolean-cast": "off",
|
"no-extra-boolean-cast": "off",
|
||||||
"no-multiple-empty-lines": [ "warn", {
|
"no-multiple-empty-lines": [ "warn", {
|
||||||
"max": 1,
|
"max": 1,
|
||||||
@@ -94,7 +95,8 @@ module.exports = {
|
|||||||
"no-unneeded-ternary": "error",
|
"no-unneeded-ternary": "error",
|
||||||
"array-bracket-newline": [ "error", "consistent" ],
|
"array-bracket-newline": [ "error", "consistent" ],
|
||||||
"eol-last": [ "error", "always" ],
|
"eol-last": [ "error", "always" ],
|
||||||
//'prefer-template': 'error',
|
//"prefer-template": "error",
|
||||||
|
"template-curly-spacing": [ "warn", "never" ],
|
||||||
"comma-dangle": [ "warn", "only-multiline" ],
|
"comma-dangle": [ "warn", "only-multiline" ],
|
||||||
"no-empty": [ "error", {
|
"no-empty": [ "error", {
|
||||||
"allowEmptyCatch": true
|
"allowEmptyCatch": true
|
||||||
@@ -147,21 +149,20 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Override for jest puppeteer
|
// Override for TypeScript
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"**/*.spec.js",
|
"**/*.ts",
|
||||||
"**/*.spec.jsx"
|
|
||||||
],
|
],
|
||||||
env: {
|
extends: [
|
||||||
jest: true,
|
"plugin:@typescript-eslint/recommended",
|
||||||
},
|
],
|
||||||
globals: {
|
"rules": {
|
||||||
page: true,
|
"jsdoc/require-returns-type": "off",
|
||||||
browser: true,
|
"jsdoc/require-param-type": "off",
|
||||||
context: true,
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
jestPuppeteer: true,
|
"prefer-const": "off",
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
33
.github/ISSUE_TEMPLATE/ask-for-help.yaml
vendored
33
.github/ISSUE_TEMPLATE/ask-for-help.yaml
vendored
@@ -6,7 +6,7 @@ body:
|
|||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: no-duplicate-issues
|
id: no-duplicate-issues
|
||||||
attributes:
|
attributes:
|
||||||
label: "⚠️ Please verify that this bug has NOT been raised before."
|
label: "⚠️ Please verify that this question has NOT been raised before."
|
||||||
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
||||||
options:
|
options:
|
||||||
- label: "I checked and didn't find similar issue"
|
- label: "I checked and didn't find similar issue"
|
||||||
@@ -24,7 +24,7 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
attributes:
|
attributes:
|
||||||
label: "📝 Describe your problem"
|
label: "📝 Describe your problem"
|
||||||
description: "Please walk us through it step by step."
|
description: "Please walk us through it step by step. Include all important details and add screenshots where appropriate"
|
||||||
placeholder: "Describe what are you asking for..."
|
placeholder: "Describe what are you asking for..."
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: error-msg
|
id: error-msg
|
||||||
@@ -56,19 +56,20 @@ body:
|
|||||||
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: textarea
|
||||||
id: docker-version
|
id: deployment-info
|
||||||
attributes:
|
attributes:
|
||||||
label: "🐋 Docker Version"
|
label: "🖥️ Deployment Environment"
|
||||||
description: "If running with Docker, which version are you running?"
|
description: |
|
||||||
placeholder: "Ex. Docker 20.10.9 / K8S / Podman"
|
examples:
|
||||||
|
- **Runtime**: Docker 20.10.9 / nodejs 14.18.0 / K8S via ... v1.3.3 / ..
|
||||||
|
- **Database**: sqlite/embedded mariadb/external mariadb
|
||||||
|
- **Filesystem used to store the database on**: Windows/ZFS/btrfs/NFSv3 on a SSD/HDD/eMMC
|
||||||
|
- **number of monitors**: 42
|
||||||
|
value: |
|
||||||
|
- Runtime:
|
||||||
|
- Database:
|
||||||
|
- Filesystem used to store the database on:
|
||||||
|
- number of monitors:
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: input
|
|
||||||
id: nodejs-version
|
|
||||||
attributes:
|
|
||||||
label: "🟩 NodeJS Version"
|
|
||||||
description: "If running with Node.js? which version are you running?"
|
|
||||||
placeholder: "Ex. 14.18.0"
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
45
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
45
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@@ -3,14 +3,14 @@ description: "Submit a bug report to help us improve"
|
|||||||
#title: "[Bug] "
|
#title: "[Bug] "
|
||||||
labels: [bug]
|
labels: [bug]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: textarea
|
||||||
id: no-duplicate-issues
|
id: related-issues
|
||||||
attributes:
|
validations:
|
||||||
label: "⚠️ Please verify that this bug has NOT been raised before."
|
|
||||||
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
|
||||||
options:
|
|
||||||
- label: "I checked and didn't find similar issue"
|
|
||||||
required: true
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: "📑 I have found these related issues/pull requests"
|
||||||
|
description: "Search related issues by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=) and explain what the difference between them or explain that you are unable to find any related issues"
|
||||||
|
placeholder: "Related to #1 by also touching the ... system. They should not be merged because ..."
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: "🛡️ Security Policy"
|
label: "🛡️ Security Policy"
|
||||||
@@ -31,7 +31,7 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
attributes:
|
attributes:
|
||||||
label: "👟 Reproduction steps"
|
label: "👟 Reproduction steps"
|
||||||
description: "How do you trigger this bug? Please walk us through it step by step."
|
description: "How do you trigger this bug? Please walk us through it step by step. Include all important details and add screenshots where appropriate"
|
||||||
placeholder: "..."
|
placeholder: "..."
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: expected-behavior
|
id: expected-behavior
|
||||||
@@ -73,22 +73,23 @@ body:
|
|||||||
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
placeholder: "Ex. Google Chrome 95.0.4638.69"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: textarea
|
||||||
id: docker-version
|
id: deployment-info
|
||||||
attributes:
|
attributes:
|
||||||
label: "🐋 Docker Version"
|
label: "🖥️ Deployment Environment"
|
||||||
description: "If running with Docker, which version are you running?"
|
description: |
|
||||||
placeholder: "Ex. Docker 20.10.9 / K8S / Podman"
|
examples:
|
||||||
|
- **Runtime**: Docker 20.10.9 / nodejs 18.17.1 / K8S via ... v1.3.3 / ..
|
||||||
|
- **Database**: sqlite/embedded mariadb/external mariadb
|
||||||
|
- **Filesystem used to store the database on**: Windows/ZFS/btrfs/NFSv3 on a SSD/HDD/eMMC
|
||||||
|
- **number of monitors**: 42
|
||||||
|
value: |
|
||||||
|
- Runtime:
|
||||||
|
- Database:
|
||||||
|
- Filesystem used to store the database on:
|
||||||
|
- number of monitors:
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: true
|
||||||
- type: input
|
|
||||||
id: nodejs-version
|
|
||||||
attributes:
|
|
||||||
label: "🟩 NodeJS Version"
|
|
||||||
description: "If running with Node.js? which version are you running?"
|
|
||||||
placeholder: "Ex. 14.18.0"
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: logs
|
id: logs
|
||||||
attributes:
|
attributes:
|
||||||
|
29
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
29
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
@@ -3,14 +3,14 @@ description: "Submit a proposal for a new feature"
|
|||||||
#title: "[Feature] "
|
#title: "[Feature] "
|
||||||
labels: [feature-request]
|
labels: [feature-request]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: textarea
|
||||||
id: no-duplicate-issues
|
id: related-issues
|
||||||
attributes:
|
validations:
|
||||||
label: "⚠️ Please verify that this feature request has NOT been suggested before."
|
|
||||||
description: "Search in the issues sections by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=)"
|
|
||||||
options:
|
|
||||||
- label: "I checked and didn't find similar feature request"
|
|
||||||
required: true
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: "📑 I have found these related issues/pull requests"
|
||||||
|
description: "Search related issues by clicking [HERE](https://github.com/louislam/uptime-kuma/issues?q=) and explain what the difference between them or explain that you are unable to find any related issues"
|
||||||
|
placeholder: "Related to #1 by also touching the ... system. They should not be merged because ..."
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: feature-area
|
id: feature-area
|
||||||
attributes:
|
attributes:
|
||||||
@@ -18,10 +18,17 @@ body:
|
|||||||
description: "What kind of feature request is this?"
|
description: "What kind of feature request is this?"
|
||||||
multiple: true
|
multiple: true
|
||||||
options:
|
options:
|
||||||
- API
|
- API / automation options
|
||||||
- New Notification
|
- New notification-provider
|
||||||
- New Monitor
|
- Change to existing notification-provider
|
||||||
- UI Feature
|
- New monitor
|
||||||
|
- Change to existing monitor
|
||||||
|
- Dashboard
|
||||||
|
- Status-page
|
||||||
|
- Maintenance
|
||||||
|
- Deployment
|
||||||
|
- Certificate expiry
|
||||||
|
- Settings
|
||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
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:
|
||||||
|
|
||||||
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -15,7 +15,7 @@ Please delete any options that are not relevant.
|
|||||||
- Bug fix (non-breaking change which fixes an issue)
|
- Bug fix (non-breaking change which fixes an issue)
|
||||||
- User interface (UI)
|
- User interface (UI)
|
||||||
- New feature (non-breaking change which adds functionality)
|
- New feature (non-breaking change which adds functionality)
|
||||||
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
- Breaking change (a fix or feature that would cause existing functionality to not work as expected)
|
||||||
- Other
|
- Other
|
||||||
- This change requires a documentation update
|
- This change requires a documentation update
|
||||||
|
|
||||||
@@ -24,9 +24,8 @@ Please delete any options that are not relevant.
|
|||||||
- [ ] My code follows the style guidelines of this project
|
- [ ] My code follows the style guidelines of this project
|
||||||
- [ ] I ran ESLint and other linters for modified files
|
- [ ] I ran ESLint and other linters for modified files
|
||||||
- [ ] I have performed a self-review of my own code and tested it
|
- [ ] I have performed a self-review of my own code and tested it
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
- [ ] I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
|
||||||
(including JSDoc for methods)
|
- [ ] My changes generates no new warnings
|
||||||
- [ ] My changes generate no new warnings
|
|
||||||
- [ ] My code needed automated testing. I have added them (this is optional task)
|
- [ ] My code needed automated testing. I have added them (this is optional task)
|
||||||
|
|
||||||
## Screenshots (if any)
|
## Screenshots (if any)
|
||||||
|
61
.github/workflows/auto-test.yml
vendored
61
.github/workflows/auto-test.yml
vendored
@@ -5,38 +5,37 @@ name: Auto Test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ master, 1.23.X ]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '*.md'
|
- '*.md'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, 2.0.X ]
|
branches: [ master, 1.23.X ]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '*.md'
|
- '*.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
auto-test:
|
auto-test:
|
||||||
needs: [ check-linters ]
|
needs: [ check-linters, e2e-test ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, ubuntu-latest, windows-latest, ARM64]
|
os: [macos-latest, ubuntu-latest, windows-latest, ARM64]
|
||||||
node: [ 14, 20 ]
|
node: [ 18, 20.5 ]
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node }}
|
- name: Use Node.js ${{ matrix.node }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- run: npm install npm@latest -g
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm test
|
- run: npm run test-backend
|
||||||
env:
|
env:
|
||||||
HEADLESS_TEST: 1
|
HEADLESS_TEST: 1
|
||||||
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
||||||
@@ -46,22 +45,21 @@ jobs:
|
|||||||
needs: [ check-linters ]
|
needs: [ check-linters ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ARMv7 ]
|
os: [ ARMv7 ]
|
||||||
node: [ 14, 20 ]
|
node: [ 18, 20 ]
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node }}
|
- name: Use Node.js ${{ matrix.node }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- run: npm install npm@latest -g
|
|
||||||
- run: npm ci --production
|
- run: npm ci --production
|
||||||
|
|
||||||
check-linters:
|
check-linters:
|
||||||
@@ -69,42 +67,27 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm run lint
|
- run: npm run lint:prod
|
||||||
|
|
||||||
# TODO: Temporarily disable, as it cannot pass the test in 2.0.0 yet
|
e2e-test:
|
||||||
# e2e-tests:
|
|
||||||
# needs: [ check-linters ]
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - run: git config --global core.autocrlf false # Mainly for Windows
|
|
||||||
# - uses: actions/checkout@v3
|
|
||||||
#
|
|
||||||
# - name: Use Node.js 14
|
|
||||||
# uses: actions/setup-node@v3
|
|
||||||
# with:
|
|
||||||
# node-version: 14
|
|
||||||
# - run: npm install
|
|
||||||
# - run: npm run build
|
|
||||||
# - run: npm run cy:test
|
|
||||||
|
|
||||||
frontend-unit-tests:
|
|
||||||
needs: [ check-linters ]
|
needs: [ check-linters ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ARM64
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js 14
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 14
|
node-version: 20
|
||||||
- run: npm install
|
- run: npm install
|
||||||
|
- run: npx playwright install
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run cy:run:unit
|
- run: npm run test-e2e
|
||||||
|
6
.github/workflows/close-incorrect-issue.yml
vendored
6
.github/workflows/close-incorrect-issue.yml
vendored
@@ -11,13 +11,13 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
node-version: [16]
|
node-version: [18]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
43
.github/workflows/codeql-analysis.yml
vendored
Normal file
43
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master", "1.23.X"]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master", "1.23.X"]
|
||||||
|
schedule:
|
||||||
|
- cron: '16 22 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 360
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go', 'javascript-typescript' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
|
with:
|
||||||
|
category: "/language:${{matrix.language}}"
|
25
.github/workflows/conflict_labeler.yml
vendored
Normal file
25
.github/workflows/conflict_labeler.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Merge Conflict Labeler
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request_target:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
types: [synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label:
|
||||||
|
name: Labeling
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: Apply label
|
||||||
|
uses: eps1lon/actions-label-merge-conflict@v3
|
||||||
|
with:
|
||||||
|
dirtyLabel: 'needs:resolve-merge-conflict'
|
||||||
|
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
6
.github/workflows/json-yaml-validate.yml
vendored
6
.github/workflows/json-yaml-validate.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- 2.0.X
|
- 1.23.X
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -17,11 +17,11 @@ jobs:
|
|||||||
json-yaml-validate:
|
json-yaml-validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: json-yaml-validate
|
- name: json-yaml-validate
|
||||||
id: json-yaml-validate
|
id: json-yaml-validate
|
||||||
uses: GrantBirki/json-yaml-validate@v1.3.0
|
uses: GrantBirki/json-yaml-validate@v2.4.0
|
||||||
with:
|
with:
|
||||||
comment: "true" # enable comment mode
|
comment: "true" # enable comment mode
|
||||||
exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions
|
exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions
|
||||||
|
17
.github/workflows/prevent-file-change.yml
vendored
Normal file
17
.github/workflows/prevent-file-change.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: prevent-file-change
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-file-changes:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Prevent file change
|
||||||
|
uses: xalvarez/prevent-file-change-action@v1
|
||||||
|
with:
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# Regex, /src/lang/*.json is not allowed to be changed, except for /src/lang/en.json
|
||||||
|
pattern: '^(?!src/lang/en\.json$)src/lang/.*\.json$'
|
||||||
|
trustedAuthors: UptimeKumaBot
|
||||||
|
|
36
.github/workflows/stale-bot.yml
vendored
36
.github/workflows/stale-bot.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: 'Automatically close stale issues and PRs'
|
name: 'Automatically close stale issues'
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
@@ -9,14 +9,34 @@ jobs:
|
|||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v7
|
- uses: actions/stale@v8
|
||||||
with:
|
with:
|
||||||
stale-issue-message: 'We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.'
|
stale-issue-message: |-
|
||||||
close-issue-message: 'This issue was closed because it has been stalled for 2 days with no activity.'
|
We are clearing up our old `help`-issues and your issue has been open for 60 days with no activity.
|
||||||
days-before-stale: 90
|
If no comment is made and the stale label is not removed, this issue will be closed in 7 days.
|
||||||
days-before-close: 2
|
days-before-stale: 60
|
||||||
days-before-pr-stale: 999999999
|
days-before-close: 7
|
||||||
days-before-pr-close: 1
|
days-before-pr-stale: -1
|
||||||
|
days-before-pr-close: -1
|
||||||
exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,feature-request'
|
exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,feature-request'
|
||||||
exempt-issue-assignees: 'louislam'
|
exempt-issue-assignees: 'louislam'
|
||||||
operations-per-run: 200
|
operations-per-run: 200
|
||||||
|
- uses: actions/stale@v8
|
||||||
|
with:
|
||||||
|
stale-issue-message: |-
|
||||||
|
This issue was marked as `cannot-reproduce` by a maintainer.
|
||||||
|
If an issue is non-reproducible, we cannot fix it, as we do not know what the underlying issue is.
|
||||||
|
If you have any ideas how we can reproduce this issue, we would love to hear them.
|
||||||
|
|
||||||
|
We don't have a good way to deal with truely unreproducible issues and are going to close this issue in a month.
|
||||||
|
If think there might be other differences in our environment or in how we tried to reproduce this, we would appreciate any ideas.
|
||||||
|
close-issue-message: |-
|
||||||
|
This issue will be closed as no way to reproduce it has been found.
|
||||||
|
If you/somebody finds a way how to (semi-reliably) reproduce this, we can reopen this issue. ^^
|
||||||
|
days-before-stale: 180
|
||||||
|
days-before-close: 30
|
||||||
|
days-before-pr-stale: -1
|
||||||
|
days-before-pr-close: -1
|
||||||
|
any-of-issue-labels: 'cannot-reproduce'
|
||||||
|
operations-per-run: 200
|
||||||
|
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,9 +15,6 @@ dist-ssr
|
|||||||
/tmp
|
/tmp
|
||||||
.env
|
.env
|
||||||
|
|
||||||
cypress/videos
|
|
||||||
cypress/screenshots
|
|
||||||
|
|
||||||
/extra/healthcheck.exe
|
/extra/healthcheck.exe
|
||||||
/extra/healthcheck
|
/extra/healthcheck
|
||||||
/extra/healthcheck-armv7
|
/extra/healthcheck-armv7
|
||||||
|
460
CONTRIBUTING.md
460
CONTRIBUTING.md
@@ -1,93 +1,217 @@
|
|||||||
# Project Info
|
# Project Info
|
||||||
|
|
||||||
First of all, I want to thank everyone who made pull requests for Uptime Kuma. I never thought the GitHub Community would be so nice! Because of this, I also never thought that other people would actually read and edit my code. It is not very well structured or commented, sorry about that.
|
First of all, I want to thank everyone who have wrote issues or shared pull requests for Uptime Kuma.
|
||||||
|
I never thought the GitHub community would be so nice!
|
||||||
|
Because of this, I also never thought that other people would actually read and edit my code.
|
||||||
|
Parts of the code are not very well-structured or commented, sorry about that.
|
||||||
|
|
||||||
The project was created with vite.js (vue3). Then I created a subdirectory called "server" for server part. Both frontend and backend share the same package.json.
|
The project was created with `vite.js` and is written in `vue3`.
|
||||||
|
Our backend lives in the `server`-directory and mostly communicates via websockets.
|
||||||
|
Both frontend and backend share the same `package.json`.
|
||||||
|
|
||||||
The frontend code build into "dist" directory. The server (express.js) exposes the "dist" directory as root of the endpoint. This is how production is working.
|
For production, the frontend is build into `dist`-directory and the server (`express.js`) exposes the `dist` directory as the root of the endpoint.
|
||||||
|
For development, we run vite in development mode on another port.
|
||||||
## Key Technical Skills
|
|
||||||
|
|
||||||
- Node.js (You should know what are promise, async/await and arrow function etc.)
|
|
||||||
- Socket.io
|
|
||||||
- SCSS
|
|
||||||
- Vue.js
|
|
||||||
- Bootstrap
|
|
||||||
- SQLite
|
|
||||||
|
|
||||||
## Directories
|
## Directories
|
||||||
|
|
||||||
- config (dev config files)
|
- `config` (dev config files)
|
||||||
- data (App data)
|
- `data` (App data)
|
||||||
- db (Base database and migration scripts)
|
- `db` (Base database and migration scripts)
|
||||||
- dist (Frontend build)
|
- `dist` (Frontend build)
|
||||||
- docker (Dockerfiles)
|
- `docker` (Dockerfiles)
|
||||||
- extra (Extra useful scripts)
|
- `extra` (Extra useful scripts)
|
||||||
- public (Frontend resources for dev only)
|
- `public` (Frontend resources for dev only)
|
||||||
- server (Server source code)
|
- `server` (Server source code)
|
||||||
- src (Frontend source code)
|
- `src` (Frontend source code)
|
||||||
- test (unit test)
|
- `test` (unit test)
|
||||||
|
|
||||||
## Can I create a pull request for Uptime Kuma?
|
## Can I create a pull request for Uptime Kuma?
|
||||||
|
|
||||||
Yes or no, it depends on what you will try to do. Since I don't want to waste your time, be sure to **create an empty draft pull request or open an issue, so we can have a discussion first**. Especially for a large pull request or you don't know it will be merged or not.
|
Yes or no, it depends on what you will try to do.
|
||||||
|
Both your and our maintainers time is precious, and we don't want to waste both time.
|
||||||
|
|
||||||
Here are some references:
|
If you have any questions about any process/.. is not clear, you are likely not alone => please ask them ^^
|
||||||
|
|
||||||
### ✅ Usually accepted:
|
Different guidelines exist for different types of pull requests (PRs):
|
||||||
- Bug fix
|
- <details><summary><b>security fixes</b></summary>
|
||||||
- Security fix
|
<p>
|
||||||
- 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:
|
Submitting security fixes is something that may put the community at risk.
|
||||||
- Large pull requests
|
Please read through our [security policy](SECURITY.md) and submit vulnerabilities via an [advisory](https://github.com/louislam/uptime-kuma/security/advisories/new) + [issue](https://github.com/louislam/uptime-kuma/issues/new?assignees=&labels=help&template=security.md) instead.
|
||||||
- New features
|
We encourage you to submit how to fix a vulnerability if you know how to, this is not required.
|
||||||
|
Following the security policy allows us to properly test, fix bugs.
|
||||||
|
This review allows us to notice, if there are any changes necessary to unrelated parts like the documentation.
|
||||||
|
[**PLEASE SEE OUR SECURITY POLICY.**](SECURITY.md)
|
||||||
|
|
||||||
### ❌ Won't be merged:
|
</p>
|
||||||
- A dedicated pr for translating existing languages (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md))
|
</details>
|
||||||
- Do not pass the auto test
|
- <details><summary><b>small, non-breaking bug fixes</b></summary>
|
||||||
- Any breaking changes
|
<p>
|
||||||
- Duplicated pull requests
|
|
||||||
- Buggy
|
|
||||||
- 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
|
|
||||||
- Unnecessarily large code changes that are hard to review and cause conflicts with other PRs.
|
|
||||||
|
|
||||||
The above cases may not cover all possible situations.
|
If you come across a bug and think you can solve, we appreciate your work.
|
||||||
|
Please make sure that you follow by these rules:
|
||||||
|
- keep the PR as small as possible, fix only one thing at a time => keeping it reviewable
|
||||||
|
- test that your code does what you came it does.
|
||||||
|
|
||||||
I (@louislam) have the final say. If your pull request does not meet my expectations, I will reject it, no matter how much time you spend on it. Therefore, it is essential to have a discussion beforehand.
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>translations / internationalisation (i18n)</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
I will mark your pull request in the [milestones](https://github.com/louislam/uptime-kuma/milestones), if I am plan to review and merge it.
|
We use weblate to localise this project into many languages.
|
||||||
|
If you are unhappy with a translation this is the best start.
|
||||||
|
On how to translate using weblate, please see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
||||||
|
|
||||||
Also, please don't rush or ask for 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.
|
There are two cases in which a change cannot be done in weblate and requires a PR:
|
||||||
|
- A text may not be currently localisable. In this case, **adding a new language key** via `$t("languageKey")` might be nessesary
|
||||||
|
- language keys need to be **added to `en.json`** to be visible in weblate. If this has not happened, a PR is appreciated.
|
||||||
|
- **Adding a new language** requires a new file see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)
|
||||||
|
|
||||||
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>new notification providers</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
To set up a new notification provider these files need to be modified/created:
|
||||||
|
- `server/notification-providers/PROVIDER_NAME.js` is where the heart of the notification provider lives.
|
||||||
|
- Both `monitorJSON` and `heartbeatJSON` can be `null` for some events.
|
||||||
|
If both are `null`, this is a general testing message, but if just `heartbeatJSON` is `null` this is a certificate expiry.
|
||||||
|
- Please wrap the axios call into a
|
||||||
|
```js
|
||||||
|
try {
|
||||||
|
let result = await axios.post(...);
|
||||||
|
if (result.status === ...) ...
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- `server/notification.js` is where the backend of the notification provider needs to be registered.
|
||||||
|
*If you have an idea how we can skip this step, we would love to hear about it ^^*
|
||||||
|
- `src/components/NotificationDialog.vue` you need to decide if the provider is a regional or a global one and add it with a name to the respective list
|
||||||
|
- `src/components/notifications/PROVIDER_NAME.vue` is where the frontend of each provider lives.
|
||||||
|
Please make sure that you have:
|
||||||
|
- used `HiddenInput` for secret credentials
|
||||||
|
- included all the necessary helptexts/placeholder/.. to make sure the notification provider is simple to setup for new users.
|
||||||
|
- include all translations (`{{ $t("Translation key") }}`, [`i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html)) in `src/lang/en.json` to enable our translators to translate this
|
||||||
|
- `src/components/notifications/index.js` is where the frontend of the provider needs to be registered.
|
||||||
|
*If you have an idea how we can skip this step, we would love to hear about it ^^*
|
||||||
|
|
||||||
|
Offering notifications is close to the core of what we are as an uptime monitor.
|
||||||
|
Therefore, making sure that they work is also really important.
|
||||||
|
Because testing notification providers is quite time intensive, we mostly offload this onto the person contributing a notification provider.
|
||||||
|
|
||||||
|
To make shure you have tested the notification provider, please include screenshots of the following events in the pull-request description:
|
||||||
|
- `UP`/`DOWN`
|
||||||
|
- Certificate Expiry via https://expired.badssl.com/
|
||||||
|
- Testing (the test button on the notification provider setup page)
|
||||||
|
|
||||||
|
Using the following way to format this is encouraged:
|
||||||
|
```md
|
||||||
|
| Event | Before | After |
|
||||||
|
------------------
|
||||||
|
| `UP` | paste-image-here | paste-image-here |
|
||||||
|
| `DOWN` | paste-image-here | paste-image-here |
|
||||||
|
| Certificate-expiry | paste-image-here | paste-image-here |
|
||||||
|
| Testing | paste-image-here | paste-image-here |
|
||||||
|
```
|
||||||
|
|
||||||
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>new monitoring types</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
To set up a new notification provider these files need to be modified/created:
|
||||||
|
- `server/monitor-types/MONITORING_TYPE.js` is the core of each monitor.
|
||||||
|
the `async check(...)`-function should:
|
||||||
|
- throw an error for each fault that is detected with an actionable error message
|
||||||
|
- in the happy-path, you should set `heartbeat.msg` to a successfull message and set `heartbeat.status = UP`
|
||||||
|
- `server/uptime-kuma-server.js` is where the monitoring backend needs to be registered.
|
||||||
|
*If you have an idea how we can skip this step, we would love to hear about it ^^*
|
||||||
|
- `src/pages/EditMonitor.vue` is the shared frontend users interact with.
|
||||||
|
Please make sure that you have:
|
||||||
|
- used `HiddenInput` for secret credentials
|
||||||
|
- included all the necessary helptexts/placeholder/.. to make sure the notification provider is simple to setup for new users.
|
||||||
|
- include all translations (`{{ $t("Translation key") }}`, [`i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html)) in `src/lang/en.json` to enable our translators to translate this
|
||||||
|
-
|
||||||
|
|
||||||
|
|
||||||
|
<sub>Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary><b>new features/ major changes / breaking bugfixes</b></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
be sure to **create an empty draft pull request or open an issue, so we can have a discussion first**.
|
||||||
|
This is especially important for a large pull request or you don't know if it will be merged or not.
|
||||||
|
|
||||||
|
<sub>Because of the large impact of this work, only senior maintainers may merge PRs in this area.</sub>
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
The following rules are essential for making your PR mergable:
|
||||||
|
- Merging multiple issues by a huge PR is more difficult to review and causes conflicts with other PRs. Please
|
||||||
|
- (if possible) **create one PR for one issue** or
|
||||||
|
- (if not possible) **explain which issues a PR addresses and why this PR should not be broken apart**
|
||||||
|
- Make sure your **PR passes our continuous integration**.
|
||||||
|
PRs will not be merged unless all CI-Checks are green.
|
||||||
|
- **Breaking changes** (unless for a good reason and discussed beforehand) will not get merged / not get merged quickly.
|
||||||
|
Such changes require a major version release.
|
||||||
|
- **Test your code** before submitting a PR.
|
||||||
|
Buggy PRs will not be merged.
|
||||||
|
- Make sure the **UI/UX is close to Uptime Kuma**.
|
||||||
|
- **Think about the maintainability**:
|
||||||
|
Don't add functionality that is completely **out of scope**.
|
||||||
|
Keep in mind that we need to be able to maintain the functionality.
|
||||||
|
- Don't modify or delete existing logic without a valid reason.
|
||||||
|
- Don't convert existing code into other programming languages for no reason.
|
||||||
|
|
||||||
|
I ([@louislam](https://github.com/louislam)) have the final say.
|
||||||
|
If your pull request does not meet my expectations, I will reject it, no matter how much time you spent on it.
|
||||||
|
Therefore, it is essential to have a discussion beforehand.
|
||||||
|
|
||||||
|
I will assign your pull request to a [milestone](https://github.com/louislam/uptime-kuma/milestones), if I plan to review and merge it.
|
||||||
|
|
||||||
|
Please don't rush or ask for an ETA.
|
||||||
|
We have to understand the pull request, make sure it has no breaking changes and stick to the vision of this project, especially for large pull requests.
|
||||||
|
|
||||||
|
|
||||||
|
## I'd like to work on an issue. How do I do that?
|
||||||
|
|
||||||
|
We have found that assigning people to issues is management-overhead that we don't need.
|
||||||
|
A short comment that you want to try your hand at this issue is appreciated to save other devs time.
|
||||||
|
If you come across any problem during development, feel free to leave a comment with what you are stuck on.
|
||||||
|
|
||||||
### 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 diving deep into coding, having a discussion first by creating an empty pull request for discussion is preferred.
|
||||||
|
The rationale behind this is that we can align the direction and scope of the feature to eliminate any conflicts with existing and planned work, and can help by pointing out any potential pitfalls.
|
||||||
|
|
||||||
1. Fork the project
|
1. Fork the project
|
||||||
1. Clone your fork repo to local
|
2. Clone your fork repo to local
|
||||||
1. Create a new branch
|
3. Create a new branch
|
||||||
1. Create an empty commit
|
4. Create an empty commit: `git commit -m "<YOUR TASK NAME>" --allow-empty`
|
||||||
`git commit -m "[empty commit] pull request for <YOUR TASK NAME>" --allow-empty`
|
5. Push to your fork repo
|
||||||
1. Push to your fork repo
|
6. Prepare a pull request: https://github.com/louislam/uptime-kuma/compare
|
||||||
1. Create a pull request: https://github.com/louislam/uptime-kuma/compare
|
7. Write a proper description. You can mention @louislam in it, so @louislam will get the notification.
|
||||||
1. Write a proper description
|
8. Create your pull request as a Draft
|
||||||
1. Click "Change to draft"
|
9. Wait for the discussion
|
||||||
1. Discussion
|
|
||||||
|
|
||||||
## Project Styles
|
## Project Styles
|
||||||
|
|
||||||
I personally do not like something that requires so many configurations before you can finally start the app. I hope Uptime Kuma installation could be as easy as like installing a mobile app.
|
I personally do not like something that requires so many configurations before you can finally start the app.
|
||||||
|
The goal is to make the Uptime Kuma installation as easy as installing a mobile app.
|
||||||
|
|
||||||
- Easy to install for non-Docker users, no native build dependency is needed (for x86_64/armv7/arm64), no extra config, no extra effort required to get it running
|
- Easy to install for non-Docker users
|
||||||
- Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go
|
- no native build dependency is needed (for `x86_64`/`armv7`/`arm64`)
|
||||||
- Settings should be configurable in the frontend. Environment variable is not encouraged, unless it is related to startup such as `DATA_DIR`
|
- no extra configuration and
|
||||||
|
- no extra effort required to get it running
|
||||||
|
- Single container for Docker users
|
||||||
|
- no complex docker-compose file
|
||||||
|
- mapping the volume and exposing the port should be the only requirements
|
||||||
|
- Settings should be configurable in the frontend. Environment variables are discouraged, unless it is related to startup such as `DATA_DIR`
|
||||||
- Easy to use
|
- Easy to use
|
||||||
- The web UI styling should be consistent and nice
|
- The web UI styling should be consistent and nice
|
||||||
|
|
||||||
@@ -106,12 +230,24 @@ I personally do not like something that requires so many configurations before y
|
|||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
- [`Node.js`](https://nodejs.org/) >= 14
|
- [`Node.js`](https://nodejs.org/) >= 18
|
||||||
- [`npm`](https://www.npmjs.com/) >= 8.5
|
- [`npm`](https://www.npmjs.com/) >= 9.3
|
||||||
- [`git`](https://git-scm.com/)
|
- [`git`](https://git-scm.com/)
|
||||||
- IDE that supports [`ESLint`](https://eslint.org/) and EditorConfig (I am using [`IntelliJ IDEA`](https://www.jetbrains.com/idea/))
|
- IDE that supports [`ESLint`](https://eslint.org/) and EditorConfig (I am using [`IntelliJ IDEA`](https://www.jetbrains.com/idea/))
|
||||||
- A SQLite GUI tool (f.ex. [`SQLite Expert Personal`](https://www.sqliteexpert.com/download.html) or [`DBeaver Community`](https://dbeaver.io/download/))
|
- A SQLite GUI tool (f.ex. [`SQLite Expert Personal`](https://www.sqliteexpert.com/download.html) or [`DBeaver Community`](https://dbeaver.io/download/))
|
||||||
|
|
||||||
|
### GitHub Codespaces
|
||||||
|
|
||||||
|
If you don't want to setup an local environment, you can now develop on GitHub Codespaces, read more:
|
||||||
|
|
||||||
|
https://github.com/louislam/uptime-kuma/tree/master/.devcontainer
|
||||||
|
|
||||||
|
## Git Branches
|
||||||
|
|
||||||
|
- `master`: 2.X.X development. If you want to add a new feature, your pull request should base on this.
|
||||||
|
- `1.23.X`: 1.23.X development. If you want to fix a bug for v1 and v2, your pull request should base on this.
|
||||||
|
- All other branches are unused, outdated or for dev.
|
||||||
|
|
||||||
## Install Dependencies for Development
|
## Install Dependencies for Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -130,8 +266,9 @@ Port `3000` and port `3001` will be used.
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
But sometimes, you would like to keep restart the server, but not the frontend, you can run these command 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
|
||||||
```
|
```
|
||||||
@@ -140,30 +277,29 @@ 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.
|
||||||
|
|
||||||
|
The backend is an `express.js` server with `socket.io` integrated.
|
||||||
|
It uses `socket.io` to communicate with clients, and most server logic is encapsulated in the `socket.io` handlers.
|
||||||
|
`express.js` is also used to serve:
|
||||||
|
|
||||||
It is mainly a socket.io app + express.js.
|
- as an entry point for redirecting to a status page or the dashboard
|
||||||
|
- the frontend built files (`index.html`, `*.js`, `*.css`, etc.)
|
||||||
|
- internal APIs of the status page
|
||||||
|
|
||||||
express.js is used for:
|
### Structure in `/server/`
|
||||||
- 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 status page
|
|
||||||
|
|
||||||
|
- `jobs/` (Jobs that are running in another process)
|
||||||
### Structure in /server/
|
- `model/` (Object model, auto-mapping to the database table name)
|
||||||
|
- `modules/` (Modified 3rd-party modules)
|
||||||
- jobs/ (Jobs that are running in another process)
|
- `monitor_types/` (Monitor Types)
|
||||||
- model/ (Object model, auto mapping to the database table name)
|
- `notification-providers/` (individual notification logic)
|
||||||
- modules/ (Modified 3rd-party modules)
|
- `routers/` (Express Routers)
|
||||||
- monitor_types (Monitor Types)
|
- `socket-handler/` (Socket.io Handlers)
|
||||||
- notification-providers/ (individual notification logic)
|
- `server.js` (Server entry point)
|
||||||
- routers/ (Express Routers)
|
- `uptime-kuma-server.js` (UptimeKumaServer class, main logic should be here, but some still in `server.js`)
|
||||||
- socket-handler (Socket.io Handlers)
|
|
||||||
- server.js (Server entry point)
|
|
||||||
- uptime-kuma-server.js (UptimeKumaServer class, main logic should be here, but some still in `server.js`)
|
|
||||||
|
|
||||||
## Frontend Dev Server
|
## Frontend Dev Server
|
||||||
|
|
||||||
It binds to `0.0.0.0:3000` by default. 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.
|
||||||
|
|
||||||
@@ -181,14 +317,13 @@ Uptime Kuma Frontend is a single page application (SPA). Most paths are handled
|
|||||||
|
|
||||||
The router is in `src/router.js`
|
The router is in `src/router.js`
|
||||||
|
|
||||||
As you can see, most data in frontend is stored in root level, even though you changed the current router to any other pages.
|
As you can see, most data in the frontend is stored at the root level, even though you changed the current router to any other pages.
|
||||||
|
|
||||||
The data and socket logic are in `src/mixins/socket.js`.
|
The data and socket logic are in `src/mixins/socket.js`.
|
||||||
|
|
||||||
## Database Migration
|
## Database Migration
|
||||||
|
|
||||||
1. Create `patch-{name}.sql` in `./db/`
|
See: https://github.com/louislam/uptime-kuma/tree/master/db/knex_migrations
|
||||||
2. Add your patch filename in the `patchList` list in `./server/database.js`
|
|
||||||
|
|
||||||
## Unit Test
|
## Unit Test
|
||||||
|
|
||||||
@@ -199,18 +334,19 @@ npm test
|
|||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
Both frontend and backend share the same package.json. However, the frontend dependencies are eventually not used in the production environment, because it is usually also baked into dist files. So:
|
Both frontend and backend share the same `package.json`.
|
||||||
|
However, the frontend dependencies are eventually not used in the production environment, because it is usually also baked into `dist` files. So:
|
||||||
|
|
||||||
- Frontend dependencies = "devDependencies"
|
- Frontend dependencies = "devDependencies"
|
||||||
- Examples: vue, chart.js
|
- Examples: `vue`, `chart.js`
|
||||||
- Backend dependencies = "dependencies"
|
- Backend dependencies = "dependencies"
|
||||||
- Examples: socket.io, sqlite3
|
- Examples: `socket.io`, `sqlite3`
|
||||||
- Development dependencies = "devDependencies"
|
- Development dependencies = "devDependencies"
|
||||||
- Examples: eslint, sass
|
- Examples: `eslint`, `sass`
|
||||||
|
|
||||||
### Update Dependencies
|
### Update Dependencies
|
||||||
|
|
||||||
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.
|
Since previously updating Vite 2.5.10 to 2.6.0 broke the application completely, from now on, it should update the patch release version only.
|
||||||
|
|
||||||
Patch release = the third digit ([Semantic Versioning](https://semver.org/))
|
Patch release = the third digit ([Semantic Versioning](https://semver.org/))
|
||||||
|
|
||||||
@@ -218,59 +354,143 @@ If for security / bug / other reasons, a library must be updated, breaking chang
|
|||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
|
|
||||||
Please add **all** the strings which are translatable to `src/lang/en.json` (If translation keys are ommited, they can not be translated).
|
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 inital Pull-Request** (even if this is your mother tounge), 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.
|
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).
|
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).
|
||||||
|
|
||||||
## Spelling & Grammar
|
## Spelling & Grammar
|
||||||
|
|
||||||
Feel free to correct the grammar in the documentation or code.
|
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.
|
||||||
|
|
||||||
## Wiki
|
## Wiki
|
||||||
|
|
||||||
Since there is no way to make a pull request to wiki's repo, I have set up another repo to do that.
|
Since there is no way to make a pull request to the wiki, I have set up another repo to do that.
|
||||||
|
|
||||||
https://github.com/louislam/uptime-kuma-wiki
|
https://github.com/louislam/uptime-kuma-wiki
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
### Arch
|
||||||
|
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
- armv7
|
||||||
|
|
||||||
|
### Docker Tags
|
||||||
|
|
||||||
|
#### v2
|
||||||
|
|
||||||
|
- `2`, `latest-2`: v2 with full features such as Chromium and bundled MariaDB
|
||||||
|
- `2.x.x`
|
||||||
|
- `2-slim`: v2 with basic features
|
||||||
|
- `2.x.x-slim`
|
||||||
|
- `beta2`: Latest beta build
|
||||||
|
- `2.x.x-beta.x`
|
||||||
|
- `nightly2`: Dev build
|
||||||
|
- `base2`: Basic Debian setup without Uptime Kuma source code (Full features)
|
||||||
|
- `base2-slim`: Basic Debian setup without Uptime Kuma source code
|
||||||
|
- `pr-test2`: For testing pull request without setting up a local environment
|
||||||
|
|
||||||
|
#### v1
|
||||||
|
|
||||||
|
- `1`, `latest`, `1-debian`, `debian`: Latest version of v1
|
||||||
|
- `1.x.x`, `1.x.x-debian`
|
||||||
|
- `1.x.x-beta.x`: Beta build
|
||||||
|
- `beta`: Latest beta build
|
||||||
|
- `nightly`: Dev build
|
||||||
|
- `base-debian`: Basic Debian setup without Uptime Kuma source code
|
||||||
|
- `pr-test`: For testing pull request without setting up a local environment
|
||||||
|
- `base-alpine`: (Deprecated) Basic Alpine setup without Uptime Kuma source code
|
||||||
|
- `1-alpine`, `alpine`: (Deprecated)
|
||||||
|
- `1.x.x-alpine`: (Deprecated)
|
||||||
|
|
||||||
## Maintainer
|
## Maintainer
|
||||||
|
|
||||||
Check the latest issues and pull requests:
|
Check the latest issues and pull requests:
|
||||||
https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc
|
https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc
|
||||||
|
|
||||||
### Release Procedures
|
### What is a maintainer and what are their roles?
|
||||||
|
|
||||||
|
This project has multiple maintainers which specialise in different areas.
|
||||||
|
Currently, there are 3 maintainers:
|
||||||
|
|
||||||
|
| Person | Role | Main Area |
|
||||||
|
|-------------------|-------------------|------------------|
|
||||||
|
| `@louislam` | senior maintainer | major features |
|
||||||
|
| `@chakflying` | junior maintainer | fixing bugs |
|
||||||
|
| `@commanderstorm` | junior maintainer | issue-management |
|
||||||
|
|
||||||
|
### Procedures
|
||||||
|
|
||||||
|
We have a few procedures we follow. These are documented here:
|
||||||
|
- <details><summary>Set up a Docker Builder</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
- amd64, armv7 using local.
|
||||||
|
- arm64 using remote arm64 cpu, as the emulator is too slow and can no longer pass the `npm ci` command.
|
||||||
|
1. Add the public key to the remote server.
|
||||||
|
2. Add the remote context. The remote machine must be arm64 and installed Docker CE.
|
||||||
|
```
|
||||||
|
docker context create oracle-arm64-jp --docker "host=ssh://root@100.107.174.88"
|
||||||
|
```
|
||||||
|
3. Create a new builder.
|
||||||
|
```
|
||||||
|
docker buildx create --name kuma-builder --platform linux/amd64,linux/arm/v7
|
||||||
|
docker buildx use kuma-builder
|
||||||
|
docker buildx inspect --bootstrap
|
||||||
|
```
|
||||||
|
4. Append the remote context to the builder.
|
||||||
|
```
|
||||||
|
docker buildx create --append --name kuma-builder --platform linux/arm64 oracle-arm64-jp
|
||||||
|
```
|
||||||
|
5. Verify the builder and check if the builder is using `kuma-builder`.
|
||||||
|
```
|
||||||
|
docker buildx inspect kuma-builder
|
||||||
|
docker buildx ls
|
||||||
|
```
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Release</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
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:
|
These Items need to be checked:
|
||||||
|
|
||||||
- Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags
|
- [ ] Check all tags is fine on https://hub.docker.com/r/louislam/uptime-kuma/tags
|
||||||
- Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7)
|
- [ ] Try the Docker image with tag 1.X.X (Clean install / amd64 / arm64 / armv7)
|
||||||
- Try clean installation with Node.js
|
- [ ] Try clean installation with Node.js
|
||||||
|
|
||||||
### Release Beta Procedures
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Release Beta</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
1. Draft a release note, check "This is a pre-release"
|
1. Draft a release note, check `This is a pre-release`
|
||||||
2. Make sure the repo is cleared
|
2. Make sure the repo is cleared
|
||||||
3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN`
|
3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN`
|
||||||
4. Wait until the `Press any key to continue`
|
4. Wait until the `Press any key to continue`
|
||||||
5. Publish the release note as 1.X.X-beta.X
|
5. Publish the release note as `1.X.X-beta.X`
|
||||||
6. Press any key to continue
|
6. Press any key to continue
|
||||||
|
|
||||||
### Release Wiki
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Release Wiki</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
#### Setup Repo
|
**Setup Repo**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/louislam/uptime-kuma-wiki.git
|
git clone https://github.com/louislam/uptime-kuma-wiki.git
|
||||||
@@ -278,9 +498,21 @@ cd uptime-kuma-wiki
|
|||||||
git remote add production https://github.com/louislam/uptime-kuma.wiki.git
|
git remote add production https://github.com/louislam/uptime-kuma.wiki.git
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Push to Production Wiki
|
**Push to Production Wiki**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git pull
|
git pull
|
||||||
git push production master
|
git push production master
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
- <details><summary>Change the base of a pull request such as <code>master</code> to <code>1.23.X</code></summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git rebase --onto <new parent> <old parent>
|
||||||
|
```
|
||||||
|
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
102
README.md
102
README.md
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
||||||
|
|
||||||
<a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/stars/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/pulls/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/v/louislam/uptime-kuma/latest?label=docker%20image%20ver." /></a> <a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/last-commit/louislam/uptime-kuma" /></a> <a target="_blank" href="https://opencollective.com/uptime-kuma"><img src="https://opencollective.com/uptime-kuma/total/badge.svg?label=Open%20Collective%20Backers&color=brightgreen" /></a>
|
<a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/stars/louislam/uptime-kuma?style=flat" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/pulls/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/v/louislam/uptime-kuma/latest?label=docker%20image%20ver." /></a> <a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/last-commit/louislam/uptime-kuma" /></a> <a target="_blank" href="https://opencollective.com/uptime-kuma"><img src="https://opencollective.com/uptime-kuma/total/badge.svg?label=Open%20Collective%20Backers&color=brightgreen" /></a>
|
||||||
[](https://github.com/sponsors/louislam) <a href="https://weblate.kuma.pet/projects/uptime-kuma/uptime-kuma/">
|
[](https://github.com/sponsors/louislam) <a href="https://weblate.kuma.pet/projects/uptime-kuma/uptime-kuma/">
|
||||||
<img src="https://weblate.kuma.pet/widgets/uptime-kuma/-/svg-badge.svg" alt="Translation status" />
|
<img src="https://weblate.kuma.pet/widgets/uptime-kuma/-/svg-badge.svg" alt="Translation status" />
|
||||||
</a>
|
</a>
|
||||||
@@ -17,23 +17,23 @@ Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
|||||||
|
|
||||||
Try it!
|
Try it!
|
||||||
|
|
||||||
- Tokyo Demo Server: https://demo.uptime.kuma.pet (Sponsored by [Uptime Kuma Sponsors](https://github.com/louislam/uptime-kuma#%EF%B8%8F-sponsors))
|
Demo Server (Location: Frankfurt - Germany): https://demo.kuma.pet/start-demo
|
||||||
|
|
||||||
It is a temporary live demo, all data will be deleted after 10 minutes. Use the one that is closer to you, but I suggest that you should install and try it out for the best demo experience.
|
It is a temporary live demo, all data will be deleted after 10 minutes. Sponsored by [Uptime Kuma Sponsors](https://github.com/louislam/uptime-kuma#%EF%B8%8F-sponsors).
|
||||||
|
|
||||||
## ⭐ 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
|
||||||
|
|
||||||
@@ -43,26 +43,32 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
|
|||||||
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
||||||
```
|
```
|
||||||
|
|
||||||
⚠️ Please use a **local volume** only. Other types such as NFS are not supported.
|
Uptime Kuma is now running on <http://0.0.0.0:3001>.
|
||||||
|
|
||||||
Uptime Kuma is now running on http://localhost:3001
|
> [!WARNING]
|
||||||
|
> File Systems like **NFS** (Network File System) are **NOT** supported. Please map to a local directory or volume.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If you want to limit exposure to localhost (without exposing port for other users or to use a [reverse proxy](https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy)), you can expose the port like this:
|
||||||
|
>
|
||||||
|
> ```bash
|
||||||
|
> docker run -d --restart=always -p 127.0.0.1:3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
||||||
|
> ```
|
||||||
|
|
||||||
### 💪🏻 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
|
||||||
- ❌ Replit / Heroku
|
- ❌ Replit / Heroku
|
||||||
- [Node.js](https://nodejs.org/en/download/) 14 / 16 / 18 / 20.4
|
- [Node.js](https://nodejs.org/en/download/) 18 / 20.4
|
||||||
- [npm](https://docs.npmjs.com/cli/) >= 7
|
- [npm](https://docs.npmjs.com/cli/) 9
|
||||||
- [Git](https://git-scm.com/downloads)
|
- [Git](https://git-scm.com/downloads)
|
||||||
- [pm2](https://pm2.keymetrics.io/) - For running Uptime Kuma in the background
|
- [pm2](https://pm2.keymetrics.io/) - For running Uptime Kuma in the background
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Update your npm to the latest version
|
|
||||||
npm install npm -g
|
|
||||||
|
|
||||||
git clone https://github.com/louislam/uptime-kuma.git
|
git clone https://github.com/louislam/uptime-kuma.git
|
||||||
cd uptime-kuma
|
cd uptime-kuma
|
||||||
npm run setup
|
npm run setup
|
||||||
@@ -70,15 +76,14 @@ npm run setup
|
|||||||
# Option 1. Try it
|
# Option 1. Try it
|
||||||
node server/server.js
|
node server/server.js
|
||||||
|
|
||||||
# (Recommended) Option 2. Run in background using PM2
|
# (Recommended) Option 2. Run in the background using PM2
|
||||||
# Install PM2 if you don't have it:
|
# Install PM2 if you don't have it:
|
||||||
npm install pm2 -g && pm2 install pm2-logrotate
|
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
|
||||||
@@ -91,10 +96,6 @@ pm2 monit
|
|||||||
pm2 save && pm2 startup
|
pm2 save && pm2 startup
|
||||||
```
|
```
|
||||||
|
|
||||||
### Windows Portable (x64)
|
|
||||||
|
|
||||||
https://github.com/louislam/uptime-kuma/files/11886108/uptime-kuma-win64-portable-1.0.1.zip
|
|
||||||
|
|
||||||
### Advanced Installation
|
### Advanced Installation
|
||||||
|
|
||||||
If you need more options or need to browse via a reverse proxy, please read:
|
If you need more options or need to browse via a reverse proxy, please read:
|
||||||
@@ -109,14 +110,10 @@ https://github.com/louislam/uptime-kuma/wiki/%F0%9F%86%99-How-to-Update
|
|||||||
|
|
||||||
## 🆕 What's Next?
|
## 🆕 What's Next?
|
||||||
|
|
||||||
I will mark requests/issues to the next milestone.
|
I will assign requests/issues to the next milestone.
|
||||||
|
|
||||||
https://github.com/louislam/uptime-kuma/milestones
|
https://github.com/louislam/uptime-kuma/milestones
|
||||||
|
|
||||||
Project Plan:
|
|
||||||
|
|
||||||
https://github.com/users/louislam/projects/4/views/1
|
|
||||||
|
|
||||||
## ❤️ Sponsors
|
## ❤️ Sponsors
|
||||||
|
|
||||||
Thank you so much! (GitHub Sponsors will be updated manually. OpenCollective sponsors will be updated automatically, the list will be cached by GitHub though. It may need some time to be updated)
|
Thank you so much! (GitHub Sponsors will be updated manually. OpenCollective sponsors will be updated automatically, the list will be cached by GitHub though. It may need some time to be updated)
|
||||||
@@ -143,29 +140,33 @@ 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 closest ones is statping. Unfortunately, it is not stable and no longer maintained.
|
||||||
* Want to build a fancy UI.
|
- Wanted 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 a 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 it a ⭐.
|
||||||
|
|
||||||
## 🗣️ Discussion / Ask for Help
|
## 🗣️ Discussion / Ask for Help
|
||||||
|
|
||||||
⚠️ For any general or technical questions, please don't send me an email, as I am unable to provide support in that manner. I will not response if you asked such questions.
|
⚠️ For any general or technical questions, please don't send me an email, as I am unable to provide support in that manner. I will not respond if you ask questions there.
|
||||||
|
|
||||||
I recommend using Google, GitHub Issues, or Uptime Kuma's Subreddit for finding answers to your question. If you cannot find the information you need, feel free to ask:
|
I recommend using Google, GitHub Issues, or Uptime Kuma's subreddit for finding answers to your question. If you cannot find the information you need, feel free to ask:
|
||||||
|
|
||||||
- [GitHub Issues](https://github.com/louislam/uptime-kuma/issues)
|
- [GitHub Issues](https://github.com/louislam/uptime-kuma/issues)
|
||||||
- [Subreddit r/Uptime kuma](https://www.reddit.com/r/UptimeKuma/)
|
- [Subreddit (r/UptimeKuma)](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.
|
You can mention me if you ask a question on the subreddit.
|
||||||
|
|
||||||
|
## Contributions
|
||||||
|
|
||||||
## Contribute
|
### Create Pull Requests
|
||||||
|
|
||||||
|
We DO NOT accept all types of pull requests and do not want to waste your time. Please be sure that you have read and follow pull request rules:
|
||||||
|
[CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma)
|
||||||
|
|
||||||
### Test Pull Requests
|
### Test Pull Requests
|
||||||
|
|
||||||
@@ -179,15 +180,16 @@ 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
|
||||||
|
|
||||||
Feel free to correct the grammar in the documentation or code.
|
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
|
|
||||||
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
|
|
||||||
|
10
SECURITY.md
10
SECURITY.md
@@ -3,24 +3,24 @@
|
|||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
1. Please report security issues to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
1. Please report security issues to https://github.com/louislam/uptime-kuma/security/advisories/new.
|
||||||
1. Please also create a empty security issues for alerting me, as GitHub Advisory do not send a notification, I probably will miss without this. https://github.com/louislam/uptime-kuma/issues/new?assignees=&labels=help&template=security.md
|
2. Please also create an empty security issue to alert me, as GitHub Advisories do not send a notification, I probably will miss it without this. https://github.com/louislam/uptime-kuma/issues/new?assignees=&labels=help&template=security.md
|
||||||
|
|
||||||
Do not use the public issue tracker or discuss it in the public as it will cause more damage.
|
Do not use the public issue tracker or discuss it in public as it will cause more damage.
|
||||||
|
|
||||||
## Do you accept other 3rd-party bug bounty platforms?
|
## Do you accept other 3rd-party bug bounty platforms?
|
||||||
|
|
||||||
At this moment, I DO NOT accept other bug bounty platforms, because I am not familiar with these platforms and someone have tried to send a phishing link to me by this already. To minimize my own risk, please report through GitHub Advisories only. I will ignore all 3rd-party bug bounty platforms emails.
|
At this moment, I DO NOT accept other bug bounty platforms, because I am not familiar with these platforms and someone has tried to send a phishing link to me by doing this already. To minimize my own risk, please report through GitHub Advisories only. I will ignore all 3rd-party bug bounty platforms emails.
|
||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
|
|
||||||
### Uptime Kuma Versions
|
### Uptime Kuma Versions
|
||||||
|
|
||||||
You should use or upgrade to the latest version of Uptime Kuma. All `1.X.X` versions are upgradable to the lastest version.
|
You should use or upgrade to the latest version of Uptime Kuma. All `1.X.X` versions are upgradable to the latest version.
|
||||||
|
|
||||||
### Upgradable Docker Tags
|
### Upgradable Docker Tags
|
||||||
|
|
||||||
| Tag | Supported |
|
| Tag | Supported |
|
||||||
| ------- | ------------------ |
|
|-|-|
|
||||||
| 1 | :white_check_mark: |
|
| 1 | :white_check_mark: |
|
||||||
| 1-debian | :white_check_mark: |
|
| 1-debian | :white_check_mark: |
|
||||||
| latest | :white_check_mark: |
|
| latest | :white_check_mark: |
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
const config = {};
|
|
||||||
|
|
||||||
if (process.env.TEST_FRONTEND) {
|
|
||||||
config.presets = [ "@babel/preset-env" ];
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = config;
|
|
9
compose.yaml
Normal file
9
compose.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
services:
|
||||||
|
uptime-kuma:
|
||||||
|
image: louislam/uptime-kuma:1
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/data
|
||||||
|
ports:
|
||||||
|
# <Host Port>:<Container Port>
|
||||||
|
- 3001:3001
|
||||||
|
restart: unless-stopped
|
@@ -1,28 +0,0 @@
|
|||||||
const { defineConfig } = require("cypress");
|
|
||||||
|
|
||||||
module.exports = defineConfig({
|
|
||||||
projectId: "vyjuem",
|
|
||||||
e2e: {
|
|
||||||
experimentalStudio: true,
|
|
||||||
setupNodeEvents(on, config) {
|
|
||||||
|
|
||||||
},
|
|
||||||
fixturesFolder: "test/cypress/fixtures",
|
|
||||||
screenshotsFolder: "test/cypress/screenshots",
|
|
||||||
videosFolder: "test/cypress/videos",
|
|
||||||
downloadsFolder: "test/cypress/downloads",
|
|
||||||
supportFile: "test/cypress/support/e2e.js",
|
|
||||||
baseUrl: "http://localhost:3002",
|
|
||||||
defaultCommandTimeout: 10000,
|
|
||||||
pageLoadTimeout: 60000,
|
|
||||||
viewportWidth: 1920,
|
|
||||||
viewportHeight: 1080,
|
|
||||||
specPattern: [
|
|
||||||
"test/cypress/e2e/setup.cy.js",
|
|
||||||
"test/cypress/e2e/**/*.js"
|
|
||||||
],
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
baseUrl: "http://localhost:3002",
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,10 +0,0 @@
|
|||||||
const { defineConfig } = require("cypress");
|
|
||||||
|
|
||||||
module.exports = defineConfig({
|
|
||||||
e2e: {
|
|
||||||
supportFile: false,
|
|
||||||
specPattern: [
|
|
||||||
"test/cypress/unit/**/*.js"
|
|
||||||
],
|
|
||||||
}
|
|
||||||
});
|
|
60
config/playwright.config.js
Normal file
60
config/playwright.config.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import { defineConfig, devices } from "@playwright/test";
|
||||||
|
|
||||||
|
const port = 30001;
|
||||||
|
const url = `http://localhost:${port}`;
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
// Look for test files in the "tests" directory, relative to this configuration file.
|
||||||
|
testDir: "../test/e2e",
|
||||||
|
outputDir: "../private/playwright-test-results",
|
||||||
|
fullyParallel: false,
|
||||||
|
locale: "en-US",
|
||||||
|
|
||||||
|
// Fail the build on CI if you accidentally left test.only in the source code.
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
|
||||||
|
// Retry on CI only.
|
||||||
|
retries: process.env.CI ? 2 : 0,
|
||||||
|
|
||||||
|
// Opt out of parallel tests on CI.
|
||||||
|
workers: 1,
|
||||||
|
|
||||||
|
// Reporter to use
|
||||||
|
reporter: [
|
||||||
|
[
|
||||||
|
"html", {
|
||||||
|
outputFolder: "../private/playwright-report",
|
||||||
|
open: "never",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
use: {
|
||||||
|
// Base URL to use in actions like `await page.goto('/')`.
|
||||||
|
baseURL: url,
|
||||||
|
|
||||||
|
// Collect trace when retrying the failed test.
|
||||||
|
trace: "on-first-retry",
|
||||||
|
},
|
||||||
|
|
||||||
|
// Configure projects for major browsers.
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: "chromium",
|
||||||
|
use: { ...devices["Desktop Chrome"] },
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
name: "firefox",
|
||||||
|
use: { browserName: "firefox" }
|
||||||
|
},*/
|
||||||
|
],
|
||||||
|
|
||||||
|
// Run your local dev server before starting the tests.
|
||||||
|
webServer: {
|
||||||
|
command: `node extra/remove-playwright-test-data.js && node server/server.js --port=${port} --data-dir=./data/playwright-test`,
|
||||||
|
url,
|
||||||
|
reuseExistingServer: false,
|
||||||
|
cwd: "../",
|
||||||
|
},
|
||||||
|
});
|
@@ -1,9 +1,8 @@
|
|||||||
import legacy from "@vitejs/plugin-legacy";
|
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import visualizer from "rollup-plugin-visualizer";
|
import visualizer from "rollup-plugin-visualizer";
|
||||||
import viteCompression from "vite-plugin-compression";
|
import viteCompression from "vite-plugin-compression";
|
||||||
import commonjs from "vite-plugin-commonjs";
|
import VueDevTools from "vite-plugin-vue-devtools";
|
||||||
|
|
||||||
const postCssScss = require("postcss-scss");
|
const postCssScss = require("postcss-scss");
|
||||||
const postcssRTLCSS = require("postcss-rtlcss");
|
const postcssRTLCSS = require("postcss-rtlcss");
|
||||||
@@ -22,11 +21,7 @@ export default defineConfig({
|
|||||||
"CODESPACE_NAME": JSON.stringify(process.env.CODESPACE_NAME),
|
"CODESPACE_NAME": JSON.stringify(process.env.CODESPACE_NAME),
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
commonjs(),
|
|
||||||
vue(),
|
vue(),
|
||||||
legacy({
|
|
||||||
targets: [ "since 2015" ],
|
|
||||||
}),
|
|
||||||
visualizer({
|
visualizer({
|
||||||
filename: "tmp/dist-stats.html"
|
filename: "tmp/dist-stats.html"
|
||||||
}),
|
}),
|
||||||
@@ -38,6 +33,7 @@ export default defineConfig({
|
|||||||
algorithm: "brotliCompress",
|
algorithm: "brotliCompress",
|
||||||
filter: viteCompressionFilter,
|
filter: viteCompressionFilter,
|
||||||
}),
|
}),
|
||||||
|
VueDevTools(),
|
||||||
],
|
],
|
||||||
css: {
|
css: {
|
||||||
postcss: {
|
postcss: {
|
||||||
|
@@ -272,10 +272,10 @@ async function createTables() {
|
|||||||
await knex.schema.createTable("notification", (table) => {
|
await knex.schema.createTable("notification", (table) => {
|
||||||
table.increments("id");
|
table.increments("id");
|
||||||
table.string("name", 255);
|
table.string("name", 255);
|
||||||
table.string("config", 255); // TODO: should use TEXT!
|
|
||||||
table.boolean("active").notNullable().defaultTo(true);
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
table.integer("user_id").unsigned();
|
table.integer("user_id").unsigned();
|
||||||
table.boolean("is_default").notNullable().defaultTo(false);
|
table.boolean("is_default").notNullable().defaultTo(false);
|
||||||
|
table.text("config", "longtext");
|
||||||
});
|
});
|
||||||
|
|
||||||
// monitor_notification
|
// monitor_notification
|
||||||
@@ -318,7 +318,10 @@ async function createTables() {
|
|||||||
// monitor_tls_info
|
// monitor_tls_info
|
||||||
await knex.schema.createTable("monitor_tls_info", (table) => {
|
await knex.schema.createTable("monitor_tls_info", (table) => {
|
||||||
table.increments("id");
|
table.increments("id");
|
||||||
table.integer("monitor_id").unsigned().notNullable(); //TODO: no fk ?
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
table.text("info_json");
|
table.text("info_json");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -493,8 +496,11 @@ ALTER TABLE monitor
|
|||||||
await knex.schema.table("monitor", function (table) {
|
await knex.schema.table("monitor", function (table) {
|
||||||
table.string("kafka_producer_topic", 255);
|
table.string("kafka_producer_topic", 255);
|
||||||
table.text("kafka_producer_brokers");
|
table.text("kafka_producer_brokers");
|
||||||
table.integer("kafka_producer_ssl");
|
|
||||||
table.string("kafka_producer_allow_auto_topic_creation", 255);
|
// patch-fix-kafka-producer-booleans.sql
|
||||||
|
table.boolean("kafka_producer_ssl").defaultTo(0).notNullable();
|
||||||
|
table.boolean("kafka_producer_allow_auto_topic_creation").defaultTo(0).notNullable();
|
||||||
|
|
||||||
table.text("kafka_producer_sasl_options");
|
table.text("kafka_producer_sasl_options");
|
||||||
table.text("kafka_producer_message");
|
table.text("kafka_producer_message");
|
||||||
});
|
});
|
||||||
|
41
db/knex_migrations/2023-08-16-0000-create-uptime.js
Normal file
41
db/knex_migrations/2023-08-16-0000-create-uptime.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable("stat_minutely", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.comment("This table contains the minutely aggregate statistics for each monitor");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("timestamp")
|
||||||
|
.notNullable()
|
||||||
|
.comment("Unix timestamp rounded down to the nearest minute");
|
||||||
|
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||||
|
table.smallint("up").notNullable();
|
||||||
|
table.smallint("down").notNullable();
|
||||||
|
|
||||||
|
table.unique([ "monitor_id", "timestamp" ]);
|
||||||
|
})
|
||||||
|
.createTable("stat_daily", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.comment("This table contains the daily aggregate statistics for each monitor");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("timestamp")
|
||||||
|
.notNullable()
|
||||||
|
.comment("Unix timestamp rounded down to the nearest day");
|
||||||
|
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||||
|
table.smallint("up").notNullable();
|
||||||
|
table.smallint("down").notNullable();
|
||||||
|
|
||||||
|
table.unique([ "monitor_id", "timestamp" ]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.dropTable("stat_minutely")
|
||||||
|
.dropTable("stat_daily");
|
||||||
|
};
|
16
db/knex_migrations/2023-08-18-0301-heartbeat.js
Normal file
16
db/knex_migrations/2023-08-18-0301-heartbeat.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column heartbeat.end_time
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.datetime("end_time").nullable().defaultTo(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
// Rename heartbeat.start_time to heartbeat.time
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.dropColumn("end_time");
|
||||||
|
});
|
||||||
|
};
|
15
db/knex_migrations/2023-09-29-0000-heartbeat-retires.js
Normal file
15
db/knex_migrations/2023-09-29-0000-heartbeat-retires.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column heartbeat.retries
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.integer("retries").notNullable().defaultTo(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("heartbeat", function (table) {
|
||||||
|
table.dropColumn("retries");
|
||||||
|
});
|
||||||
|
};
|
16
db/knex_migrations/2023-10-08-0000-mqtt-query.js
Normal file
16
db/knex_migrations/2023-10-08-0000-mqtt-query.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column monitor.mqtt_check_type
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.string("mqtt_check_type", 255).notNullable().defaultTo("keyword");
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
// Drop column monitor.mqtt_check_type
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.dropColumn("mqtt_check_type");
|
||||||
|
});
|
||||||
|
};
|
14
db/knex_migrations/2023-10-11-1915-push-token-to-32.js
Normal file
14
db/knex_migrations/2023-10-11-1915-push-token-to-32.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
// update monitor.push_token to 32 length
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.string("push_token", 32).alter();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("monitor", function (table) {
|
||||||
|
table.string("push_token", 20).alter();
|
||||||
|
});
|
||||||
|
};
|
21
db/knex_migrations/2023-10-16-0000-create-remote-browsers.js
Normal file
21
db/knex_migrations/2023-10-16-0000-create-remote-browsers.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable("remote_browser", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.string("name", 255).notNullable();
|
||||||
|
table.string("url", 255).notNullable();
|
||||||
|
table.integer("user_id").unsigned();
|
||||||
|
}).alterTable("monitor", function (table) {
|
||||||
|
// Add new column monitor.remote_browser
|
||||||
|
table.integer("remote_browser").nullable().defaultTo(null).unsigned()
|
||||||
|
.index()
|
||||||
|
.references("id")
|
||||||
|
.inTable("remote_browser");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema.dropTable("remote_browser").alterTable("monitor", function (table) {
|
||||||
|
table.dropColumn("remote_browser");
|
||||||
|
});
|
||||||
|
};
|
12
db/knex_migrations/2023-12-20-0000-alter-status-page.js
Normal file
12
db/knex_migrations/2023-12-20-0000-alter-status-page.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("status_page", function (table) {
|
||||||
|
table.integer("auto_refresh_interval").defaultTo(300).unsigned();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema.alterTable("status_page", function (table) {
|
||||||
|
table.dropColumn("auto_refresh_interval");
|
||||||
|
});
|
||||||
|
};
|
24
db/knex_migrations/2023-12-21-0000-stat-ping-min-max.js
Normal file
24
db/knex_migrations/2023-12-21-0000-stat-ping-min-max.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||||
|
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||||
|
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.dropColumn("ping_min");
|
||||||
|
table.dropColumn("ping_max");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.dropColumn("ping_min");
|
||||||
|
table.dropColumn("ping_max");
|
||||||
|
});
|
||||||
|
};
|
26
db/knex_migrations/2023-12-22-0000-hourly-uptime.js
Normal file
26
db/knex_migrations/2023-12-22-0000-hourly-uptime.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.createTable("stat_hourly", function (table) {
|
||||||
|
table.increments("id");
|
||||||
|
table.comment("This table contains the hourly aggregate statistics for each monitor");
|
||||||
|
table.integer("monitor_id").unsigned().notNullable()
|
||||||
|
.references("id").inTable("monitor")
|
||||||
|
.onDelete("CASCADE")
|
||||||
|
.onUpdate("CASCADE");
|
||||||
|
table.integer("timestamp")
|
||||||
|
.notNullable()
|
||||||
|
.comment("Unix timestamp rounded down to the nearest hour");
|
||||||
|
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||||
|
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||||
|
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||||
|
table.smallint("up").notNullable();
|
||||||
|
table.smallint("down").notNullable();
|
||||||
|
|
||||||
|
table.unique([ "monitor_id", "timestamp" ]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.dropTable("stat_hourly");
|
||||||
|
};
|
26
db/knex_migrations/2024-01-22-0000-stats-extras.js
Normal file
26
db/knex_migrations/2024-01-22-0000-stats-extras.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||||
|
})
|
||||||
|
.alterTable("stat_hourly", function (table) {
|
||||||
|
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("stat_daily", function (table) {
|
||||||
|
table.dropColumn("extras");
|
||||||
|
})
|
||||||
|
.alterTable("stat_minutely", function (table) {
|
||||||
|
table.dropColumn("extras");
|
||||||
|
})
|
||||||
|
.alterTable("stat_hourly", function (table) {
|
||||||
|
table.dropColumn("extras");
|
||||||
|
});
|
||||||
|
};
|
@@ -1,16 +1,15 @@
|
|||||||
## 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 multiple databases
|
- Avoid native SQL syntax, use knex methods, because Uptime Kuma supports SQLite and MariaDB.
|
||||||
|
|
||||||
## Template
|
## Template
|
||||||
|
|
||||||
Filename: YYYYMMDDHHMMSS_name.js
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
exports.up = function(knex) {
|
exports.up = function(knex) {
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor_group
|
ALTER TABLE monitor_group
|
||||||
ADD send_url BOOLEAN DEFAULT 0 NOT NULL;
|
ADD send_url BOOLEAN DEFAULT 0 NOT NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD game VARCHAR(255);
|
ADD game VARCHAR(255);
|
||||||
COMMIT
|
|
||||||
|
COMMIT;
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
ALTER TABLE status_page ADD google_analytics_tag_id VARCHAR;
|
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD google_analytics_tag_id VARCHAR;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
|
|
||||||
COMMIT
|
COMMIT;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
@@ -15,4 +16,4 @@ ALTER TABLE monitor
|
|||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD radius_secret VARCHAR(255);
|
ADD radius_secret VARCHAR(255);
|
||||||
|
|
||||||
COMMIT
|
COMMIT;
|
||||||
|
@@ -3,4 +3,5 @@ BEGIN TRANSACTION;
|
|||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD timeout DOUBLE default 0 not null;
|
ADD timeout DOUBLE default 0 not null;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
@@ -1,5 +1,6 @@
|
|||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
CREATE TABLE [api_key] (
|
CREATE TABLE [api_key] (
|
||||||
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
[key] VARCHAR(255) NOT NULL,
|
[key] VARCHAR(255) NOT NULL,
|
||||||
@@ -10,4 +11,5 @@ CREATE TABLE [api_key] (
|
|||||||
[expires] DATETIME DEFAULT NULL,
|
[expires] DATETIME DEFAULT NULL,
|
||||||
CONSTRAINT FK_user FOREIGN KEY ([user_id]) REFERENCES [user]([id]) ON DELETE CASCADE ON UPDATE CASCADE
|
CONSTRAINT FK_user FOREIGN KEY ([user_id]) REFERENCES [user]([id]) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
34
db/old_migrations/patch-fix-kafka-producer-booleans.sql
Normal file
34
db/old_migrations/patch-fix-kafka-producer-booleans.sql
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
-- Rename COLUMNs to another one (suffixed by `_old`)
|
||||||
|
ALTER TABLE monitor
|
||||||
|
RENAME COLUMN kafka_producer_ssl TO kafka_producer_ssl_old;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
RENAME COLUMN kafka_producer_allow_auto_topic_creation TO kafka_producer_allow_auto_topic_creation_old;
|
||||||
|
|
||||||
|
-- Add correct COLUMNs
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD COLUMN kafka_producer_ssl BOOLEAN default 0 NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
ADD COLUMN kafka_producer_allow_auto_topic_creation BOOLEAN default 0 NOT NULL;
|
||||||
|
|
||||||
|
-- These SQL is still not fully safe. See https://github.com/louislam/uptime-kuma/issues/4039.
|
||||||
|
|
||||||
|
-- Set bring old values from `_old` COLUMNs to correct ones
|
||||||
|
-- UPDATE monitor SET kafka_producer_allow_auto_topic_creation = monitor.kafka_producer_allow_auto_topic_creation_old
|
||||||
|
-- WHERE monitor.kafka_producer_allow_auto_topic_creation_old IS NOT NULL;
|
||||||
|
|
||||||
|
-- UPDATE monitor SET kafka_producer_ssl = monitor.kafka_producer_ssl_old
|
||||||
|
-- WHERE monitor.kafka_producer_ssl_old IS NOT NULL;
|
||||||
|
|
||||||
|
-- Remove old COLUMNs
|
||||||
|
ALTER TABLE monitor
|
||||||
|
DROP COLUMN kafka_producer_allow_auto_topic_creation_old;
|
||||||
|
|
||||||
|
ALTER TABLE monitor
|
||||||
|
DROP COLUMN kafka_producer_ssl_old;
|
||||||
|
|
||||||
|
COMMIT;
|
18
db/old_migrations/patch-monitor-tls-info-add-fk.sql
Normal file
18
db/old_migrations/patch-monitor-tls-info-add-fk.sql
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
PRAGMA writable_schema = TRUE;
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
SQLITE_MASTER
|
||||||
|
SET
|
||||||
|
sql = replace(sql,
|
||||||
|
'monitor_id INTEGER NOT NULL',
|
||||||
|
'monitor_id INTEGER NOT NULL REFERENCES [monitor] ([id]) ON DELETE CASCADE ON UPDATE CASCADE'
|
||||||
|
)
|
||||||
|
WHERE
|
||||||
|
name = 'monitor_tls_info'
|
||||||
|
AND type = 'table';
|
||||||
|
|
||||||
|
PRAGMA writable_schema = RESET;
|
||||||
|
|
||||||
|
COMMIT;
|
10
db/old_migrations/patch-notification-config.sql
Normal file
10
db/old_migrations/patch-notification-config.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
-- SQLite: Change the data type of the column "config" from VARCHAR to TEXT
|
||||||
|
ALTER TABLE notification RENAME COLUMN config TO config_old;
|
||||||
|
ALTER TABLE notification ADD COLUMN config TEXT;
|
||||||
|
UPDATE notification SET config = config_old;
|
||||||
|
ALTER TABLE notification DROP COLUMN config_old;
|
||||||
|
|
||||||
|
COMMIT;
|
@@ -1,5 +1,7 @@
|
|||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE monitor
|
ALTER TABLE monitor
|
||||||
ADD packet_size INTEGER DEFAULT 56 NOT NULL;
|
ADD packet_size INTEGER DEFAULT 56 NOT NULL;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@@ -18,5 +18,4 @@ drop table setting;
|
|||||||
|
|
||||||
alter table setting_dg_tmp rename to setting;
|
alter table setting_dg_tmp rename to setting;
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
ALTER TABLE status_page ADD footer_text TEXT;
|
|
||||||
ALTER TABLE status_page ADD custom_css TEXT;
|
ALTER TABLE status_page
|
||||||
ALTER TABLE status_page ADD show_powered_by BOOLEAN NOT NULL DEFAULT 1;
|
ADD footer_text TEXT;
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD custom_css TEXT;
|
||||||
|
ALTER TABLE status_page
|
||||||
|
ADD show_powered_by BOOLEAN NOT NULL DEFAULT 1;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
7
db/old_migrations/patch-timeout.sql
Normal file
7
db/old_migrations/patch-timeout.sql
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
UPDATE monitor SET timeout = (interval * 0.8)
|
||||||
|
WHERE timeout IS NULL OR timeout <= 0;
|
||||||
|
|
||||||
|
COMMIT;
|
@@ -1,3 +1,4 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
CREATE TABLE monitor_tls_info (
|
CREATE TABLE monitor_tls_info (
|
||||||
|
18
db/patch-monitor-tls-info-add-fk.sql
Normal file
18
db/patch-monitor-tls-info-add-fk.sql
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
PRAGMA writable_schema = TRUE;
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
SQLITE_MASTER
|
||||||
|
SET
|
||||||
|
sql = replace(sql,
|
||||||
|
'monitor_id INTEGER NOT NULL',
|
||||||
|
'monitor_id INTEGER NOT NULL REFERENCES [monitor] ([id]) ON DELETE CASCADE ON UPDATE CASCADE'
|
||||||
|
)
|
||||||
|
WHERE
|
||||||
|
name = 'monitor_tls_info'
|
||||||
|
AND type = 'table';
|
||||||
|
|
||||||
|
PRAGMA writable_schema = RESET;
|
||||||
|
|
||||||
|
COMMIT;
|
@@ -2,8 +2,6 @@
|
|||||||
FROM node:20-bookworm-slim AS base2-slim
|
FROM node:20-bookworm-slim AS base2-slim
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Specify --no-install-recommends to skip unused dependencies, make the base much smaller!
|
# Specify --no-install-recommends to skip unused dependencies, make the base much smaller!
|
||||||
# apprise = for notifications (From testing repo)
|
# apprise = for notifications (From testing repo)
|
||||||
# sqlite3 = for debugging
|
# sqlite3 = for debugging
|
||||||
@@ -44,13 +42,10 @@ COPY ./docker/etc/sudoers /etc/sudoers
|
|||||||
|
|
||||||
# Full Base Image
|
# Full Base Image
|
||||||
# MariaDB, Chromium and fonts
|
# MariaDB, Chromium and fonts
|
||||||
# Not working for armv7, so use the older version (10.5) of MariaDB from the debian repo
|
|
||||||
# curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | bash -s -- --mariadb-server-version="mariadb-11.1" && \
|
|
||||||
FROM base2-slim AS base2
|
FROM base2-slim AS base2
|
||||||
ENV UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB=1
|
ENV UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB=1
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt --yes --no-install-recommends install chromium fonts-indic fonts-noto fonts-noto-cjk mariadb-server && \
|
apt --yes --no-install-recommends install chromium fonts-indic fonts-noto fonts-noto-cjk mariadb-server && \
|
||||||
apt --yes remove curl && \
|
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
apt --yes autoremove && \
|
apt --yes autoremove && \
|
||||||
chown -R node:node /var/lib/mysql
|
chown -R node:node /var/lib/mysql
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
uptime-kuma:
|
|
||||||
image: louislam/uptime-kuma:2
|
|
||||||
container_name: uptime-kuma
|
|
||||||
volumes:
|
|
||||||
- uptime-kuma:/app/data
|
|
||||||
ports:
|
|
||||||
- "3001:3001" # <Host Port>:<Container Port>
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
uptime-kuma:
|
|
||||||
|
|
@@ -21,6 +21,7 @@ COPY --chown=node:node package-lock.json package-lock.json
|
|||||||
RUN npm ci --omit=dev
|
RUN npm ci --omit=dev
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY --chown=node:node --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
|
COPY --chown=node:node --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
|
||||||
|
RUN mkdir ./data
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# ⭐ Main Image
|
# ⭐ Main Image
|
||||||
@@ -29,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
|
||||||
@@ -39,13 +42,20 @@ HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD ext
|
|||||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||||
CMD ["node", "server/server.js"]
|
CMD ["node", "server/server.js"]
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# Rootless Image
|
||||||
|
############################################
|
||||||
|
FROM release AS rootless
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Mark as Nightly
|
# Mark as Nightly
|
||||||
############################################
|
############################################
|
||||||
FROM release AS nightly
|
FROM release AS nightly
|
||||||
USER node
|
|
||||||
RUN npm run mark-as-nightly
|
RUN npm run mark-as-nightly
|
||||||
|
|
||||||
|
FROM nightly AS nightly-rootless
|
||||||
|
USER node
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Build an image for testing pr
|
# Build an image for testing pr
|
||||||
############################################
|
############################################
|
||||||
|
@@ -37,7 +37,7 @@ const github = require("@actions/github");
|
|||||||
owner: issue.owner,
|
owner: issue.owner,
|
||||||
repo: issue.repo,
|
repo: issue.repo,
|
||||||
issue_number: issue.number,
|
issue_number: issue.number,
|
||||||
body: `@${username}: Hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template. Please DO NOT open a blank issue.`
|
body: `@${username}: Hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template. Please **DO NOT open blank issues and use our [issue-templates](https://github.com/louislam/uptime-kuma/issues/new/choose) instead**.\nBlank Issues do not contain the context nessesary for a good discussions.`
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close the issue
|
// Close the issue
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
@@ -28,9 +28,15 @@ namespace UptimeKuma {
|
|||||||
Environment.CurrentDirectory = cwd;
|
Environment.CurrentDirectory = cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isIntranet = args.Contains("--intranet");
|
||||||
|
|
||||||
|
if (isIntranet) {
|
||||||
|
Console.WriteLine("The --intranet argument was provided, so we will not try to access the internet. The first time this application runs you'll need to run it without the --intranet param or copy the result from another machine to the intranet server.");
|
||||||
|
}
|
||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new UptimeKumaApplicationContext());
|
Application.Run(new UptimeKumaApplicationContext(isIntranet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +55,9 @@ namespace UptimeKuma {
|
|||||||
|
|
||||||
private RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
private RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
|
||||||
|
|
||||||
|
private readonly bool intranetOnly;
|
||||||
|
|
||||||
public UptimeKumaApplicationContext() {
|
public UptimeKumaApplicationContext(bool intranetOnly) {
|
||||||
|
|
||||||
// Single instance only
|
// Single instance only
|
||||||
bool createdNew;
|
bool createdNew;
|
||||||
@@ -59,6 +66,8 @@ namespace UptimeKuma {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.intranetOnly = intranetOnly;
|
||||||
|
|
||||||
var startingText = "Starting server...";
|
var startingText = "Starting server...";
|
||||||
trayIcon = new NotifyIcon();
|
trayIcon = new NotifyIcon();
|
||||||
trayIcon.Text = startingText;
|
trayIcon.Text = startingText;
|
||||||
@@ -98,6 +107,10 @@ namespace UptimeKuma {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DownloadFiles() {
|
void DownloadFiles() {
|
||||||
|
if (intranetOnly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var form = new DownloadForm();
|
var form = new DownloadForm();
|
||||||
form.Closed += Exit;
|
form.Closed += Exit;
|
||||||
form.Show();
|
form.Show();
|
||||||
@@ -173,7 +186,9 @@ namespace UptimeKuma {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckForUpdate(object sender, EventArgs e) {
|
void CheckForUpdate(object sender, EventArgs e) {
|
||||||
var needUpdate = false;
|
if (intranetOnly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check version.json exists
|
// Check version.json exists
|
||||||
if (File.Exists("version.json")) {
|
if (File.Exists("version.json")) {
|
||||||
@@ -204,8 +219,12 @@ namespace UptimeKuma {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisitGitHub(object sender, EventArgs e)
|
void VisitGitHub(object sender, EventArgs e) {
|
||||||
{
|
if (intranetOnly) {
|
||||||
|
MessageBox.Show("You have parsed in --intranet so we will not try to access the internet or visit github.com, please go to https://github.com/louislam/uptime-kuma if you want to visit github.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Process.Start("https://github.com/louislam/uptime-kuma");
|
Process.Start("https://github.com/louislam/uptime-kuma");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.1.0")]
|
[assembly: AssemblyVersion("1.0.2.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
[assembly: AssemblyFileVersion("1.0.2.0")]
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="packages\Costura.Fody.5.7.0\build\Costura.Fody.props" Condition="Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" />
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -42,9 +41,6 @@
|
|||||||
<PostBuildEvent>COPY "$(SolutionDir)bin\Debug\uptime-kuma.exe" "%UserProfile%\Desktop\uptime-kuma-win64\"</PostBuildEvent>
|
<PostBuildEvent>COPY "$(SolutionDir)bin\Debug\uptime-kuma.exe" "%UserProfile%\Desktop\uptime-kuma-win64\"</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Costura, Version=5.7.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
|
<HintPath>packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -201,12 +197,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.5.7.0\build\Costura.Fody.props'))" />
|
|
||||||
<Error Condition="!Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
|
|
||||||
<Error Condition="!Exists('packages\Fody.6.6.4\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.6.6.4\build\Fody.targets'))" />
|
|
||||||
<Error Condition="!Exists('packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
|
<Error Condition="!Exists('packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
|
|
||||||
<Import Project="packages\Fody.6.6.4\build\Fody.targets" Condition="Exists('packages\Fody.6.6.4\build\Fody.targets')" />
|
|
||||||
<Import Project="packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
|
<Import Project="packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||||
</Project>
|
</Project>
|
@@ -1,7 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Costura.Fody" version="5.7.0" targetFramework="net472" developmentDependency="true" />
|
|
||||||
<package id="Fody" version="6.6.4" targetFramework="net472" developmentDependency="true" />
|
|
||||||
<package id="Microsoft.NETCore.Platforms" version="7.0.0" targetFramework="net472" />
|
<package id="Microsoft.NETCore.Platforms" version="7.0.0" targetFramework="net472" />
|
||||||
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net472" />
|
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net472" />
|
||||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="net472" />
|
<package id="NETStandard.Library" version="2.0.3" targetFramework="net472" />
|
||||||
|
@@ -5,7 +5,7 @@ const fs = require("fs");
|
|||||||
* or the `recursive` property removing completely in the future Node.js version.
|
* or the `recursive` property removing completely in the future Node.js version.
|
||||||
* See the link below.
|
* See the link below.
|
||||||
* @todo Once we drop the support for Node.js v14 (or at least versions before v14.14.0), we can safely replace this function with `fs.rmSync`, since `fs.rmSync` was add in Node.js v14.14.0 and currently we supports all the Node.js v14 versions that include the versions before the v14.14.0, and this function have almost the same signature with `fs.rmSync`.
|
* @todo Once we drop the support for Node.js v14 (or at least versions before v14.14.0), we can safely replace this function with `fs.rmSync`, since `fs.rmSync` was add in Node.js v14.14.0 and currently we supports all the Node.js v14 versions that include the versions before the v14.14.0, and this function have almost the same signature with `fs.rmSync`.
|
||||||
* @link https://nodejs.org/docs/latest-v16.x/api/deprecations.html#dep0147-fsrmdirpath--recursive-true- the deprecation infomation of `fs.rmdirSync`
|
* @link https://nodejs.org/docs/latest-v16.x/api/deprecations.html#dep0147-fsrmdirpath--recursive-true- the deprecation information of `fs.rmdirSync`
|
||||||
* @link https://nodejs.org/docs/latest-v16.x/api/fs.html#fsrmsyncpath-options the document of `fs.rmSync`
|
* @link https://nodejs.org/docs/latest-v16.x/api/fs.html#fsrmsyncpath-options the document of `fs.rmSync`
|
||||||
* @param {fs.PathLike} path Valid types for path values in "fs".
|
* @param {fs.PathLike} path Valid types for path values in "fs".
|
||||||
* @param {fs.RmDirOptions} options options for `fs.rmdirSync`, if `fs.rmSync` is available and property `recursive` is true, it will automatically have property `force` with value `true`.
|
* @param {fs.RmDirOptions} options options for `fs.rmdirSync`, if `fs.rmSync` is available and property `recursive` is true, it will automatically have property `force` with value `true`.
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* ⚠️ Deprecated: Changed to healthcheck.go, it will be deleted in the future.
|
* ⚠️ Deprecated: Changed to healthcheck.go, it will be deleted in the future.
|
||||||
* This script should be run after a period of time (180s), because the server may need some time to prepare.
|
* This script should be run after a period of time (180s), because the server may need some time to prepare.
|
||||||
*/
|
*/
|
||||||
const { FBSD } = require("../server/util-server");
|
const FBSD = /^freebsd/.test(process.platform);
|
||||||
|
|
||||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||||
|
|
||||||
|
@@ -1,271 +0,0 @@
|
|||||||
// install.sh is generated by ./extra/install.batsh, do not modify it directly.
|
|
||||||
// "npm run compile-install-script" to compile install.sh
|
|
||||||
// The command is working on Windows PowerShell and Docker for Windows only.
|
|
||||||
|
|
||||||
|
|
||||||
// curl -o kuma_install.sh https://raw.githubusercontent.com/louislam/uptime-kuma/master/install.sh && sudo bash kuma_install.sh
|
|
||||||
println("=====================");
|
|
||||||
println("Uptime Kuma Install Script");
|
|
||||||
println("=====================");
|
|
||||||
println("Supported OS: Ubuntu >= 16.04, Debian and CentOS/RHEL 7/8");
|
|
||||||
println("---------------------------------------");
|
|
||||||
println("This script is designed for Linux and basic usage.");
|
|
||||||
println("For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation");
|
|
||||||
println("---------------------------------------");
|
|
||||||
println("");
|
|
||||||
println("Local - Install Uptime Kuma on your current machine with git, Node.js and pm2");
|
|
||||||
println("Docker - Install Uptime Kuma Docker container");
|
|
||||||
println("");
|
|
||||||
|
|
||||||
if ("$1" != "") {
|
|
||||||
type = "$1";
|
|
||||||
} else {
|
|
||||||
call("read", "-p", "Which installation method do you prefer? [DOCKER/local]: ", "type");
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultPort = "3001";
|
|
||||||
|
|
||||||
function checkNode() {
|
|
||||||
bash("nodeVersion=$(node -e 'console.log(process.versions.node.split(`.`)[0])')");
|
|
||||||
println("Node Version: " ++ nodeVersion);
|
|
||||||
|
|
||||||
if (nodeVersion <= "12") {
|
|
||||||
println("Error: Required Node.js 14");
|
|
||||||
call("exit", "1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function deb() {
|
|
||||||
bash("nodeCheck=$(node -v)");
|
|
||||||
bash("apt --yes update");
|
|
||||||
|
|
||||||
if (nodeCheck != "") {
|
|
||||||
checkNode();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Old nodejs binary name is "nodejs"
|
|
||||||
bash("check=$(nodejs --version)");
|
|
||||||
if (check != "") {
|
|
||||||
println("Error: 'node' command is not found, but 'nodejs' command is found. Your NodeJS should be too old.");
|
|
||||||
bash("exit 1");
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("curlCheck=$(curl --version)");
|
|
||||||
if (curlCheck == "") {
|
|
||||||
println("Installing Curl");
|
|
||||||
bash("apt --yes install curl");
|
|
||||||
}
|
|
||||||
|
|
||||||
println("Installing Node.js 16");
|
|
||||||
bash("curl -sL https://deb.nodesource.com/setup_16.x | bash - > log.txt");
|
|
||||||
bash("apt --yes install nodejs");
|
|
||||||
bash("node -v");
|
|
||||||
|
|
||||||
bash("nodeCheckAgain=$(node -v)");
|
|
||||||
|
|
||||||
if (nodeCheckAgain == "") {
|
|
||||||
println("Error during Node.js installation");
|
|
||||||
bash("exit 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("check=$(git --version)");
|
|
||||||
if (check == "") {
|
|
||||||
println("Installing Git");
|
|
||||||
bash("apt --yes install git");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == "local") {
|
|
||||||
defaultInstallPath = "/opt/uptime-kuma";
|
|
||||||
|
|
||||||
if (exists("/etc/redhat-release")) {
|
|
||||||
os = call("cat", "/etc/redhat-release");
|
|
||||||
distribution = "rhel";
|
|
||||||
|
|
||||||
} else if (exists("/etc/issue")) {
|
|
||||||
bash("os=$(head -n1 /etc/issue | cut -f 1 -d ' ')");
|
|
||||||
if (os == "Ubuntu") {
|
|
||||||
distribution = "ubuntu";
|
|
||||||
|
|
||||||
// Get ubuntu version
|
|
||||||
bash(". /etc/lsb-release");
|
|
||||||
version = DISTRIB_RELEASE;
|
|
||||||
}
|
|
||||||
if (os == "Debian") {
|
|
||||||
distribution = "debian";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("arch=$(uname -i)");
|
|
||||||
|
|
||||||
println("Your OS: " ++ os);
|
|
||||||
println("Distribution: " ++ distribution);
|
|
||||||
println("Version: " ++ version);
|
|
||||||
println("Arch: " ++ arch);
|
|
||||||
|
|
||||||
if ("$3" != "") {
|
|
||||||
port = "$3";
|
|
||||||
} else {
|
|
||||||
call("read", "-p", "Listening Port [$defaultPort]: ", "port");
|
|
||||||
|
|
||||||
if (port == "") {
|
|
||||||
port = defaultPort;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("$2" != "") {
|
|
||||||
installPath = "$2";
|
|
||||||
} else {
|
|
||||||
call("read", "-p", "Installation Path [$defaultInstallPath]: ", "installPath");
|
|
||||||
|
|
||||||
if (installPath == "") {
|
|
||||||
installPath = defaultInstallPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// CentOS
|
|
||||||
if (distribution == "rhel") {
|
|
||||||
bash("nodeCheck=$(node -v)");
|
|
||||||
|
|
||||||
if (nodeCheck != "") {
|
|
||||||
checkNode();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
bash("dnfCheck=$(dnf --version)");
|
|
||||||
|
|
||||||
// Use yum
|
|
||||||
if (dnfCheck == "") {
|
|
||||||
bash("curlCheck=$(curl --version)");
|
|
||||||
if (curlCheck == "") {
|
|
||||||
println("Installing Curl");
|
|
||||||
bash("yum -y -q install curl");
|
|
||||||
}
|
|
||||||
|
|
||||||
println("Installing Node.js 16");
|
|
||||||
bash("curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt");
|
|
||||||
bash("yum install -y -q nodejs");
|
|
||||||
} else {
|
|
||||||
bash("curlCheck=$(curl --version)");
|
|
||||||
if (curlCheck == "") {
|
|
||||||
println("Installing Curl");
|
|
||||||
bash("dnf -y install curl");
|
|
||||||
}
|
|
||||||
|
|
||||||
println("Installing Node.js 16");
|
|
||||||
bash("curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt");
|
|
||||||
bash("dnf install -y nodejs");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bash("node -v");
|
|
||||||
|
|
||||||
bash("nodeCheckAgain=$(node -v)");
|
|
||||||
|
|
||||||
if (nodeCheckAgain == "") {
|
|
||||||
println("Error during Node.js installation");
|
|
||||||
bash("exit 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("check=$(git --version)");
|
|
||||||
if (check == "") {
|
|
||||||
println("Installing Git");
|
|
||||||
bash("yum -y -q install git");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ubuntu
|
|
||||||
} else if (distribution == "ubuntu") {
|
|
||||||
deb();
|
|
||||||
|
|
||||||
// Debian
|
|
||||||
} else if (distribution == "debian") {
|
|
||||||
deb();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Unknown distribution
|
|
||||||
error = 0;
|
|
||||||
|
|
||||||
bash("check=$(git --version)");
|
|
||||||
if (check == "") {
|
|
||||||
error = 1;
|
|
||||||
println("Error: git is missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("check=$(node -v)");
|
|
||||||
if (check == "") {
|
|
||||||
error = 1;
|
|
||||||
println("Error: node is missing");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error > 0) {
|
|
||||||
println("Please install above missing software");
|
|
||||||
bash("exit 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("check=$(pm2 --version)");
|
|
||||||
if (check == "") {
|
|
||||||
println("Installing PM2");
|
|
||||||
bash("npm install pm2 -g && pm2 install pm2-logrotate");
|
|
||||||
bash("pm2 startup");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check again
|
|
||||||
bash("check=$(pm2 --version)");
|
|
||||||
if (check == "") {
|
|
||||||
println("Error: pm2 is not found!");
|
|
||||||
bash("exit 1");
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("mkdir -p $installPath");
|
|
||||||
bash("cd $installPath");
|
|
||||||
bash("git clone https://github.com/louislam/uptime-kuma.git .");
|
|
||||||
bash("npm run setup");
|
|
||||||
|
|
||||||
bash("pm2 start server/server.js --name uptime-kuma -- --port=$port");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
defaultVolume = "uptime-kuma";
|
|
||||||
|
|
||||||
bash("check=$(docker -v)");
|
|
||||||
if (check == "") {
|
|
||||||
println("Error: docker is not found!");
|
|
||||||
bash("exit 1");
|
|
||||||
}
|
|
||||||
|
|
||||||
bash("check=$(docker info)");
|
|
||||||
|
|
||||||
bash("if [[ \"$check\" == *\"Is the docker daemon running\"* ]]; then
|
|
||||||
\"echo\" \"Error: docker is not running\"
|
|
||||||
\"exit\" \"1\"
|
|
||||||
fi");
|
|
||||||
|
|
||||||
if ("$3" != "") {
|
|
||||||
port = "$3";
|
|
||||||
} else {
|
|
||||||
call("read", "-p", "Expose Port [$defaultPort]: ", "port");
|
|
||||||
|
|
||||||
if (port == "") {
|
|
||||||
port = defaultPort;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("$2" != "") {
|
|
||||||
volume = "$2";
|
|
||||||
} else {
|
|
||||||
call("read", "-p", "Volume Name [$defaultVolume]: ", "volume");
|
|
||||||
|
|
||||||
if (volume == "") {
|
|
||||||
volume = defaultVolume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
println("Port: $port");
|
|
||||||
println("Volume: $volume");
|
|
||||||
bash("docker volume create $volume");
|
|
||||||
bash("docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1");
|
|
||||||
}
|
|
||||||
|
|
||||||
println("http://localhost:$port");
|
|
3
extra/push-examples/.gitignore
vendored
Normal file
3
extra/push-examples/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
java/Index.class
|
||||||
|
csharp/index.exe
|
||||||
|
typescript-fetch/index.js
|
10
extra/push-examples/bash-curl/index.sh
Normal file
10
extra/push-examples/bash-curl/index.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Filename: index.sh
|
||||||
|
PUSH_URL="https://example.com/api/push/key?status=up&msg=OK&ping="
|
||||||
|
INTERVAL=60
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
curl -s -o /dev/null $PUSH_URL
|
||||||
|
echo "Pushed!"
|
||||||
|
sleep $INTERVAL
|
||||||
|
done
|
24
extra/push-examples/csharp/index.cs
Normal file
24
extra/push-examples/csharp/index.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile: C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe index.cs
|
||||||
|
* Run: index.exe
|
||||||
|
*/
|
||||||
|
class Index
|
||||||
|
{
|
||||||
|
const string PushURL = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||||
|
const int Interval = 60;
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
WebClient client = new WebClient();
|
||||||
|
client.DownloadString(PushURL);
|
||||||
|
Console.WriteLine("Pushed!");
|
||||||
|
Thread.Sleep(Interval * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
extra/push-examples/docker/index.sh
Normal file
1
extra/push-examples/docker/index.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
docker run -d --restart=always --name uptime-kuma-push louislam/uptime-kuma:push "https://example.com/api/push/key?status=up&msg=OK&ping=" 60
|
20
extra/push-examples/go/index.go
Normal file
20
extra/push-examples/go/index.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
const PushURL = "https://example.com/api/push/key?status=up&msg=OK&ping="
|
||||||
|
const Interval = 60
|
||||||
|
|
||||||
|
for {
|
||||||
|
_, err := http.Get(PushURL)
|
||||||
|
if err == nil {
|
||||||
|
fmt.Println("Pushed!")
|
||||||
|
}
|
||||||
|
time.Sleep(Interval * time.Second)
|
||||||
|
}
|
||||||
|
}
|
32
extra/push-examples/java/index.java
Normal file
32
extra/push-examples/java/index.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compile: javac index.java
|
||||||
|
* Run: java Index
|
||||||
|
*/
|
||||||
|
class Index {
|
||||||
|
|
||||||
|
public static final String PUSH_URL = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||||
|
public static final int INTERVAL = 60;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
URL url = new URL(PUSH_URL);
|
||||||
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
con.setRequestMethod("GET");
|
||||||
|
con.getResponseCode();
|
||||||
|
con.disconnect();
|
||||||
|
System.out.println("Pushed!");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(INTERVAL * 1000);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
extra/push-examples/javascript-fetch/index.js
Normal file
11
extra/push-examples/javascript-fetch/index.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Supports: Node.js >= 18, Deno, Bun
|
||||||
|
const pushURL = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||||
|
const interval = 60;
|
||||||
|
|
||||||
|
const push = async () => {
|
||||||
|
await fetch(pushURL);
|
||||||
|
console.log("Pushed!");
|
||||||
|
};
|
||||||
|
|
||||||
|
push();
|
||||||
|
setInterval(push, interval * 1000);
|
5
extra/push-examples/javascript-fetch/package.json
Normal file
5
extra/push-examples/javascript-fetch/package.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"start": "node index.js"
|
||||||
|
}
|
||||||
|
}
|
13
extra/push-examples/php/index.php
Normal file
13
extra/push-examples/php/index.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
const PUSH_URL = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||||
|
const interval = 60;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, PUSH_URL);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
echo "Pushed!\n";
|
||||||
|
sleep(interval);
|
||||||
|
}
|
9
extra/push-examples/powershell/index.ps1
Normal file
9
extra/push-examples/powershell/index.ps1
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Filename: index.ps1
|
||||||
|
$pushURL = "https://example.com/api/push/key?status=up&msg=OK&ping="
|
||||||
|
$interval = 60
|
||||||
|
|
||||||
|
while ($true) {
|
||||||
|
$res = Invoke-WebRequest -Uri $pushURL
|
||||||
|
Write-Host "Pushed!"
|
||||||
|
Start-Sleep -Seconds $interval
|
||||||
|
}
|
10
extra/push-examples/python/index.py
Normal file
10
extra/push-examples/python/index.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import urllib.request
|
||||||
|
import time
|
||||||
|
|
||||||
|
push_url = "https://example.com/api/push/key?status=up&msg=OK&ping="
|
||||||
|
interval = 60
|
||||||
|
|
||||||
|
while True:
|
||||||
|
urllib.request.urlopen(push_url)
|
||||||
|
print("Pushed!\n")
|
||||||
|
time.sleep(interval)
|
19
extra/push-examples/typescript-fetch/README.md
Normal file
19
extra/push-examples/typescript-fetch/README.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# How to run
|
||||||
|
|
||||||
|
Node.js (ts-node)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ts-node index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
Deno
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deno run --allow-net index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
Bun.js
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun index.ts
|
||||||
|
```
|
11
extra/push-examples/typescript-fetch/index.ts
Normal file
11
extra/push-examples/typescript-fetch/index.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Supports: Deno, Bun, Node.js >= 18 (ts-node)
|
||||||
|
const pushURL : string = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||||
|
const interval : number = 60;
|
||||||
|
|
||||||
|
const push = async () => {
|
||||||
|
await fetch(pushURL);
|
||||||
|
console.log("Pushed!");
|
||||||
|
};
|
||||||
|
|
||||||
|
push();
|
||||||
|
setInterval(push, interval * 1000);
|
13
extra/push-examples/typescript-fetch/package.json
Normal file
13
extra/push-examples/typescript-fetch/package.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"ts-node": "ts-node index.ts",
|
||||||
|
"deno": "deno run --allow-net index.ts",
|
||||||
|
"bun": "bun index.ts"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.6.0",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.6.2",
|
||||||
|
"typescript": "^5.2.2"
|
||||||
|
}
|
||||||
|
}
|
40
extra/rebase-pr.js
Normal file
40
extra/rebase-pr.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const { execSync } = require("child_process");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebase a PR onto such as 1.23.X or master
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
const branch = process.argv[2];
|
||||||
|
|
||||||
|
// Use gh to get current branch's pr id
|
||||||
|
let currentBranchPRID = execSync("gh pr view --json number --jq \".number\"").toString().trim();
|
||||||
|
console.log("Pr ID: ", currentBranchPRID);
|
||||||
|
|
||||||
|
// Use gh commend to get pr commits
|
||||||
|
const prCommits = JSON.parse(execSync(`gh pr view ${currentBranchPRID} --json commits`).toString().trim()).commits;
|
||||||
|
|
||||||
|
console.log("Found commits: ", prCommits.length);
|
||||||
|
|
||||||
|
// Sort the commits by authoredDate
|
||||||
|
prCommits.sort((a, b) => {
|
||||||
|
return new Date(a.authoredDate) - new Date(b.authoredDate);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get the oldest commit id
|
||||||
|
const oldestCommitID = prCommits[0].oid;
|
||||||
|
console.log("Oldest commit id of this pr:", oldestCommitID);
|
||||||
|
|
||||||
|
// Get the latest commit id of the target branch
|
||||||
|
const latestCommitID = execSync(`git rev-parse origin/${branch}`).toString().trim();
|
||||||
|
console.log("Latest commit id of " + branch + ":", latestCommitID);
|
||||||
|
|
||||||
|
// Get the original parent commit id of the oldest commit
|
||||||
|
const originalParentCommitID = execSync(`git log --pretty=%P -n 1 "${oldestCommitID}"`).toString().trim();
|
||||||
|
console.log("Original parent commit id of the oldest commit:", originalParentCommitID);
|
||||||
|
|
||||||
|
// Rebase the pr onto the target branch
|
||||||
|
execSync(`git rebase --onto ${latestCommitID} ${originalParentCommitID}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
44
extra/reformat-changelog.js
Normal file
44
extra/reformat-changelog.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Generate on GitHub
|
||||||
|
const input = `
|
||||||
|
* Add Korean translation by @Alanimdeo in https://github.com/louislam/dockge/pull/86
|
||||||
|
`;
|
||||||
|
|
||||||
|
const template = `
|
||||||
|
### 🆕 New Features
|
||||||
|
|
||||||
|
### 💇♀️ Improvements
|
||||||
|
|
||||||
|
### 🐞 Bug Fixes
|
||||||
|
|
||||||
|
### ⬆️ Security Fixes
|
||||||
|
|
||||||
|
### 🦎 Translation Contributions
|
||||||
|
|
||||||
|
### Others
|
||||||
|
- Other small changes, code refactoring and comment/doc updates in this repo:
|
||||||
|
`;
|
||||||
|
|
||||||
|
const lines = input.split("\n").filter((line) => line.trim() !== "");
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
// Split the last " by "
|
||||||
|
const usernamePullRequesURL = line.split(" by ").pop();
|
||||||
|
|
||||||
|
if (!usernamePullRequesURL) {
|
||||||
|
console.log("Unable to parse", line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [ username, pullRequestURL ] = usernamePullRequesURL.split(" in ");
|
||||||
|
const pullRequestID = "#" + pullRequestURL.split("/").pop();
|
||||||
|
let message = line.split(" by ").shift();
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
|
console.log("Unable to parse", line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = message.split("* ").pop();
|
||||||
|
console.log("-", pullRequestID, message, `(Thanks ${username})`);
|
||||||
|
}
|
||||||
|
console.log(template);
|
6
extra/remove-playwright-test-data.js
Normal file
6
extra/remove-playwright-test-data.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
fs.rmSync("./data/playwright-test", {
|
||||||
|
recursive: true,
|
||||||
|
force: true,
|
||||||
|
});
|
@@ -5,18 +5,25 @@ const { R } = require("redbean-node");
|
|||||||
const readline = require("readline");
|
const readline = require("readline");
|
||||||
const { initJWTSecret } = require("../server/util-server");
|
const { initJWTSecret } = require("../server/util-server");
|
||||||
const User = require("../server/model/user");
|
const User = require("../server/model/user");
|
||||||
|
const { io } = require("socket.io-client");
|
||||||
|
const { localWebSocketURL } = require("../server/config");
|
||||||
const args = require("args-parser")(process.argv);
|
const args = require("args-parser")(process.argv);
|
||||||
|
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
output: process.stdout
|
output: process.stdout
|
||||||
});
|
});
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
|
if ("dry-run" in args) {
|
||||||
|
console.log("Dry run mode, no changes will be made.");
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Connecting the database");
|
console.log("Connecting the database");
|
||||||
Database.initDataDir(args);
|
|
||||||
await Database.connect(false, false, true);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Database.initDataDir(args);
|
||||||
|
await Database.connect(false, false, true);
|
||||||
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
|
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
|
||||||
if (!process.env.TEST_BACKEND) {
|
if (!process.env.TEST_BACKEND) {
|
||||||
const user = await R.findOne("user");
|
const user = await R.findOne("user");
|
||||||
@@ -27,21 +34,36 @@ const main = async () => {
|
|||||||
console.log("Found user: " + user.username);
|
console.log("Found user: " + user.username);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
let password = await question("New Password: ");
|
let password;
|
||||||
let confirmPassword = await question("Confirm New Password: ");
|
let confirmPassword;
|
||||||
|
|
||||||
|
// When called with "--new-password" argument for unattended modification (e.g. npm run reset-password -- --new_password=secret)
|
||||||
|
if ("new-password" in args) {
|
||||||
|
console.log("Using password from argument");
|
||||||
|
console.warn("\x1b[31m%s\x1b[0m", "Warning: the password might be stored, in plain text, in your shell's history");
|
||||||
|
password = confirmPassword = args["new-password"] + "";
|
||||||
|
} else {
|
||||||
|
password = await question("New Password: ");
|
||||||
|
confirmPassword = await question("Confirm New Password: ");
|
||||||
|
}
|
||||||
|
|
||||||
if (password === confirmPassword) {
|
if (password === confirmPassword) {
|
||||||
|
if (!("dry-run" in args)) {
|
||||||
await User.resetPassword(user.id, password);
|
await User.resetPassword(user.id, password);
|
||||||
|
|
||||||
// Reset all sessions by reset jwt secret
|
// Reset all sessions by reset jwt secret
|
||||||
await initJWTSecret();
|
await initJWTSecret();
|
||||||
|
|
||||||
|
// Disconnect all other socket clients of the user
|
||||||
|
await disconnectAllSocketClients(user.username, password);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
console.log("Passwords do not match, please try again.");
|
console.log("Passwords do not match, please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("Password reset successfully.");
|
console.log("Password reset successfully.");
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error: " + e.message);
|
console.error("Error: " + e.message);
|
||||||
@@ -66,6 +88,50 @@ function question(question) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnect all socket clients of the user
|
||||||
|
* @param {string} username Username
|
||||||
|
* @param {string} password Password
|
||||||
|
* @returns {Promise<void>} Promise
|
||||||
|
*/
|
||||||
|
function disconnectAllSocketClients(username, password) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
console.log("Connecting to " + localWebSocketURL + " to disconnect all other socket clients");
|
||||||
|
|
||||||
|
// Disconnect all socket connections
|
||||||
|
const socket = io(localWebSocketURL, {
|
||||||
|
reconnection: false,
|
||||||
|
timeout: 5000,
|
||||||
|
});
|
||||||
|
socket.on("connect", () => {
|
||||||
|
socket.emit("login", {
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
}, (res) => {
|
||||||
|
if (res.ok) {
|
||||||
|
console.log("Logged in.");
|
||||||
|
socket.emit("disconnectOtherSocketClients");
|
||||||
|
} else {
|
||||||
|
console.warn("Login failed.");
|
||||||
|
console.warn("Please restart the server to disconnect all sessions.");
|
||||||
|
}
|
||||||
|
socket.close();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on("connect_error", function () {
|
||||||
|
// The localWebSocketURL is not guaranteed to be working for some complicated Uptime Kuma setup
|
||||||
|
// Ask the user to restart the server manually
|
||||||
|
console.warn("Failed to connect to " + localWebSocketURL);
|
||||||
|
console.warn("Please restart the server to disconnect all sessions manually.");
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
socket.on("disconnect", () => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!process.env.TEST_BACKEND) {
|
if (!process.env.TEST_BACKEND) {
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
1
extra/uptime-kuma-push/.gitignore
vendored
Normal file
1
extra/uptime-kuma-push/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
build/*
|
18
extra/uptime-kuma-push/Dockerfile
Normal file
18
extra/uptime-kuma-push/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
FROM node AS build
|
||||||
|
RUN useradd --create-home kuma
|
||||||
|
USER kuma
|
||||||
|
WORKDIR /home/kuma
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
COPY --chown=kuma:kuma ./build/ ./build/
|
||||||
|
COPY --chown=kuma:kuma build.js build.js
|
||||||
|
RUN node build.js $TARGETPLATFORM
|
||||||
|
|
||||||
|
FROM debian:bookworm-slim AS release
|
||||||
|
RUN useradd --create-home kuma
|
||||||
|
USER kuma
|
||||||
|
WORKDIR /home/kuma
|
||||||
|
COPY --from=build /home/kuma/uptime-kuma-push ./uptime-kuma-push
|
||||||
|
|
||||||
|
ENTRYPOINT ["/home/kuma/uptime-kuma-push"]
|
||||||
|
|
||||||
|
|
48
extra/uptime-kuma-push/build.js
Normal file
48
extra/uptime-kuma-push/build.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const platform = process.argv[2];
|
||||||
|
|
||||||
|
if (!platform) {
|
||||||
|
console.error("No platform??");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const supportedPlatforms = [
|
||||||
|
{
|
||||||
|
name: "linux/amd64",
|
||||||
|
bin: "./build/uptime-kuma-push-amd64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "linux/arm64",
|
||||||
|
bin: "./build/uptime-kuma-push-arm64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "linux/arm/v7",
|
||||||
|
bin: "./build/uptime-kuma-push-armv7"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
let platformObj = null;
|
||||||
|
|
||||||
|
// Check if the platform is supported
|
||||||
|
for (let i = 0; i < supportedPlatforms.length; i++) {
|
||||||
|
if (supportedPlatforms[i].name === platform) {
|
||||||
|
platformObj = supportedPlatforms[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platformObj) {
|
||||||
|
let filename = platformObj.bin;
|
||||||
|
|
||||||
|
if (!fs.existsSync(filename)) {
|
||||||
|
console.error(`prebuilt: ${filename} is not found, please build it first`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.renameSync(filename, "./uptime-kuma-push");
|
||||||
|
process.exit(0);
|
||||||
|
} else {
|
||||||
|
console.error("Unsupported platform: " + platform);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
13
extra/uptime-kuma-push/package.json
Normal file
13
extra/uptime-kuma-push/package.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"build-docker": "npm run build-all && docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:push . --push --target release",
|
||||||
|
"build-all": "npm run build-win && npm run build-linux-amd64 && npm run build-linux-arm64 && npm run build-linux-armv7 && npm run build-linux-armv6 && npm run build-linux-armv5 && npm run build-linux-riscv64",
|
||||||
|
"build-win": "cross-env GOOS=windows GOARCH=amd64 go build -x -o ./build/uptime-kuma-push.exe uptime-kuma-push.go",
|
||||||
|
"build-linux-amd64": "cross-env GOOS=linux GOARCH=amd64 go build -x -o ./build/uptime-kuma-push-amd64 uptime-kuma-push.go",
|
||||||
|
"build-linux-arm64": "cross-env GOOS=linux GOARCH=arm64 go build -x -o ./build/uptime-kuma-push-arm64 uptime-kuma-push.go",
|
||||||
|
"build-linux-armv7": "cross-env GOOS=linux GOARCH=arm GOARM=7 go build -x -o ./build/uptime-kuma-push-armv7 uptime-kuma-push.go",
|
||||||
|
"build-linux-armv6": "cross-env GOOS=linux GOARCH=arm GOARM=6 go build -x -o ./build/uptime-kuma-push-armv6 uptime-kuma-push.go",
|
||||||
|
"build-linux-armv5": "cross-env GOOS=linux GOARCH=arm GOARM=5 go build -x -o ./build/uptime-kuma-push-armv5 uptime-kuma-push.go",
|
||||||
|
"build-linux-riscv64": "cross-env GOOS=linux GOARCH=riscv64 go build -x -o ./build/uptime-kuma-push-riscv64 uptime-kuma-push.go"
|
||||||
|
}
|
||||||
|
}
|
44
extra/uptime-kuma-push/uptime-kuma-push.go
Normal file
44
extra/uptime-kuma-push/uptime-kuma-push.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
os "os"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if len(os.Args) < 2 {
|
||||||
|
fmt.Fprintln(os.Stderr, "Usage: uptime-kuma-push <url> [<interval>]")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
pushURL := os.Args[1]
|
||||||
|
|
||||||
|
var interval time.Duration
|
||||||
|
|
||||||
|
if len(os.Args) >= 3 {
|
||||||
|
intervalString, err := time.ParseDuration(os.Args[2] + "s")
|
||||||
|
interval = intervalString
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, "Error: Invalid interval", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
interval = 60 * time.Second
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
_, err := http.Get(pushURL)
|
||||||
|
if err == nil {
|
||||||
|
fmt.Print("Pushed!")
|
||||||
|
} else {
|
||||||
|
fmt.Print("Error: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(" Sleeping for", interval)
|
||||||
|
time.Sleep(interval)
|
||||||
|
}
|
||||||
|
}
|
223
install.sh
223
install.sh
@@ -1,223 +0,0 @@
|
|||||||
# install.sh is generated by ./extra/install.batsh, do not modify it directly.
|
|
||||||
# "npm run compile-install-script" to compile install.sh
|
|
||||||
# The command is working on Windows PowerShell and Docker for Windows only.
|
|
||||||
# curl -o kuma_install.sh https://raw.githubusercontent.com/louislam/uptime-kuma/master/install.sh && sudo bash kuma_install.sh
|
|
||||||
"echo" "-e" "====================="
|
|
||||||
"echo" "-e" "Uptime Kuma Install Script"
|
|
||||||
"echo" "-e" "====================="
|
|
||||||
"echo" "-e" "Supported OS: Ubuntu >= 16.04, Debian and CentOS/RHEL 7/8"
|
|
||||||
"echo" "-e" "---------------------------------------"
|
|
||||||
"echo" "-e" "This script is designed for Linux and basic usage."
|
|
||||||
"echo" "-e" "For advanced usage, please go to https://github.com/louislam/uptime-kuma/wiki/Installation"
|
|
||||||
"echo" "-e" "---------------------------------------"
|
|
||||||
"echo" "-e" ""
|
|
||||||
"echo" "-e" "Local - Install Uptime Kuma on your current machine with git, Node.js and pm2"
|
|
||||||
"echo" "-e" "Docker - Install Uptime Kuma Docker container"
|
|
||||||
"echo" "-e" ""
|
|
||||||
if [ "$1" != "" ]; then
|
|
||||||
type="$1"
|
|
||||||
else
|
|
||||||
"read" "-p" "Which installation method do you prefer? [DOCKER/local]: " "type"
|
|
||||||
fi
|
|
||||||
defaultPort="3001"
|
|
||||||
function checkNode {
|
|
||||||
local _0
|
|
||||||
nodeVersion=$(node -e 'console.log(process.versions.node.split(`.`)[0])')
|
|
||||||
"echo" "-e" "Node Version: ""$nodeVersion"
|
|
||||||
_0="12"
|
|
||||||
if [ $(($nodeVersion <= $_0)) == 1 ]; then
|
|
||||||
"echo" "-e" "Error: Required Node.js 14"
|
|
||||||
"exit" "1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
function deb {
|
|
||||||
nodeCheck=$(node -v)
|
|
||||||
apt --yes update
|
|
||||||
if [ "$nodeCheck" != "" ]; then
|
|
||||||
"checkNode"
|
|
||||||
else
|
|
||||||
# Old nodejs binary name is "nodejs"
|
|
||||||
check=$(nodejs --version)
|
|
||||||
if [ "$check" != "" ]; then
|
|
||||||
"echo" "-e" "Error: 'node' command is not found, but 'nodejs' command is found. Your NodeJS should be too old."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
curlCheck=$(curl --version)
|
|
||||||
if [ "$curlCheck" == "" ]; then
|
|
||||||
"echo" "-e" "Installing Curl"
|
|
||||||
apt --yes install curl
|
|
||||||
fi
|
|
||||||
"echo" "-e" "Installing Node.js 16"
|
|
||||||
curl -sL https://deb.nodesource.com/setup_16.x | bash - > log.txt
|
|
||||||
apt --yes install nodejs
|
|
||||||
node -v
|
|
||||||
nodeCheckAgain=$(node -v)
|
|
||||||
if [ "$nodeCheckAgain" == "" ]; then
|
|
||||||
"echo" "-e" "Error during Node.js installation"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
check=$(git --version)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
"echo" "-e" "Installing Git"
|
|
||||||
apt --yes install git
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
if [ "$type" == "local" ]; then
|
|
||||||
defaultInstallPath="/opt/uptime-kuma"
|
|
||||||
if [ -e "/etc/redhat-release" ]; then
|
|
||||||
os=$("cat" "/etc/redhat-release")
|
|
||||||
distribution="rhel"
|
|
||||||
else
|
|
||||||
if [ -e "/etc/issue" ]; then
|
|
||||||
os=$(head -n1 /etc/issue | cut -f 1 -d ' ')
|
|
||||||
if [ "$os" == "Ubuntu" ]; then
|
|
||||||
distribution="ubuntu"
|
|
||||||
# Get ubuntu version
|
|
||||||
. /etc/lsb-release
|
|
||||||
version="$DISTRIB_RELEASE"
|
|
||||||
fi
|
|
||||||
if [ "$os" == "Debian" ]; then
|
|
||||||
distribution="debian"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
arch=$(uname -i)
|
|
||||||
"echo" "-e" "Your OS: ""$os"
|
|
||||||
"echo" "-e" "Distribution: ""$distribution"
|
|
||||||
"echo" "-e" "Version: ""$version"
|
|
||||||
"echo" "-e" "Arch: ""$arch"
|
|
||||||
if [ "$3" != "" ]; then
|
|
||||||
port="$3"
|
|
||||||
else
|
|
||||||
"read" "-p" "Listening Port [$defaultPort]: " "port"
|
|
||||||
if [ "$port" == "" ]; then
|
|
||||||
port="$defaultPort"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ "$2" != "" ]; then
|
|
||||||
installPath="$2"
|
|
||||||
else
|
|
||||||
"read" "-p" "Installation Path [$defaultInstallPath]: " "installPath"
|
|
||||||
if [ "$installPath" == "" ]; then
|
|
||||||
installPath="$defaultInstallPath"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# CentOS
|
|
||||||
if [ "$distribution" == "rhel" ]; then
|
|
||||||
nodeCheck=$(node -v)
|
|
||||||
if [ "$nodeCheck" != "" ]; then
|
|
||||||
"checkNode"
|
|
||||||
else
|
|
||||||
dnfCheck=$(dnf --version)
|
|
||||||
# Use yum
|
|
||||||
if [ "$dnfCheck" == "" ]; then
|
|
||||||
curlCheck=$(curl --version)
|
|
||||||
if [ "$curlCheck" == "" ]; then
|
|
||||||
"echo" "-e" "Installing Curl"
|
|
||||||
yum -y -q install curl
|
|
||||||
fi
|
|
||||||
"echo" "-e" "Installing Node.js 16"
|
|
||||||
curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt
|
|
||||||
yum install -y -q nodejs
|
|
||||||
else
|
|
||||||
curlCheck=$(curl --version)
|
|
||||||
if [ "$curlCheck" == "" ]; then
|
|
||||||
"echo" "-e" "Installing Curl"
|
|
||||||
dnf -y install curl
|
|
||||||
fi
|
|
||||||
"echo" "-e" "Installing Node.js 16"
|
|
||||||
curl -sL https://rpm.nodesource.com/setup_16.x | bash - > log.txt
|
|
||||||
dnf install -y nodejs
|
|
||||||
fi
|
|
||||||
node -v
|
|
||||||
nodeCheckAgain=$(node -v)
|
|
||||||
if [ "$nodeCheckAgain" == "" ]; then
|
|
||||||
"echo" "-e" "Error during Node.js installation"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
check=$(git --version)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
"echo" "-e" "Installing Git"
|
|
||||||
yum -y -q install git
|
|
||||||
fi
|
|
||||||
# Ubuntu
|
|
||||||
else
|
|
||||||
if [ "$distribution" == "ubuntu" ]; then
|
|
||||||
"deb"
|
|
||||||
# Debian
|
|
||||||
else
|
|
||||||
if [ "$distribution" == "debian" ]; then
|
|
||||||
"deb"
|
|
||||||
else
|
|
||||||
# Unknown distribution
|
|
||||||
error=$((0))
|
|
||||||
check=$(git --version)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
error=$((1))
|
|
||||||
"echo" "-e" "Error: git is missing"
|
|
||||||
fi
|
|
||||||
check=$(node -v)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
error=$((1))
|
|
||||||
"echo" "-e" "Error: node is missing"
|
|
||||||
fi
|
|
||||||
if [ $(($error > 0)) == 1 ]; then
|
|
||||||
"echo" "-e" "Please install above missing software"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
check=$(pm2 --version)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
"echo" "-e" "Installing PM2"
|
|
||||||
npm install pm2 -g && pm2 install pm2-logrotate
|
|
||||||
pm2 startup
|
|
||||||
fi
|
|
||||||
# Check again
|
|
||||||
check=$(pm2 --version)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
"echo" "-e" "Error: pm2 is not found!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mkdir -p $installPath
|
|
||||||
cd $installPath
|
|
||||||
git clone https://github.com/louislam/uptime-kuma.git .
|
|
||||||
npm run setup
|
|
||||||
pm2 start server/server.js --name uptime-kuma -- --port=$port
|
|
||||||
else
|
|
||||||
defaultVolume="uptime-kuma"
|
|
||||||
check=$(docker -v)
|
|
||||||
if [ "$check" == "" ]; then
|
|
||||||
"echo" "-e" "Error: docker is not found!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
check=$(docker info)
|
|
||||||
if [[ "$check" == *"Is the docker daemon running"* ]]; then
|
|
||||||
"echo" "Error: docker is not running"
|
|
||||||
"exit" "1"
|
|
||||||
fi
|
|
||||||
if [ "$3" != "" ]; then
|
|
||||||
port="$3"
|
|
||||||
else
|
|
||||||
"read" "-p" "Expose Port [$defaultPort]: " "port"
|
|
||||||
if [ "$port" == "" ]; then
|
|
||||||
port="$defaultPort"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ "$2" != "" ]; then
|
|
||||||
volume="$2"
|
|
||||||
else
|
|
||||||
"read" "-p" "Volume Name [$defaultVolume]: " "volume"
|
|
||||||
if [ "$volume" == "" ]; then
|
|
||||||
volume="$defaultVolume"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
"echo" "-e" "Port: $port"
|
|
||||||
"echo" "-e" "Volume: $volume"
|
|
||||||
docker volume create $volume
|
|
||||||
docker run -d --restart=always -p $port:3001 -v $volume:/app/data --name uptime-kuma louislam/uptime-kuma:1
|
|
||||||
fi
|
|
||||||
"echo" "-e" "http://localhost:$port"
|
|
13545
package-lock.json
generated
13545
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
106
package.json
106
package.json
@@ -1,32 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "uptime-kuma",
|
"name": "uptime-kuma",
|
||||||
"version": "1.23.0-beta.1",
|
"version": "2.0.0-dev",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/louislam/uptime-kuma.git"
|
"url": "https://github.com/louislam/uptime-kuma.git"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "14 || 16 || 18 || >= 20.4.0"
|
"node": "18 || >= 20.4.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install-legacy": "npm install",
|
|
||||||
"update-legacy": "npm update",
|
|
||||||
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
|
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
|
||||||
|
"lint:js-prod": "npm run lint:js -- --max-warnings 0",
|
||||||
"lint-fix:js": "eslint --ext \".js,.vue\" --fix --ignore-path .gitignore .",
|
"lint-fix:js": "eslint --ext \".js,.vue\" --fix --ignore-path .gitignore .",
|
||||||
"lint:style": "stylelint \"**/*.{vue,css,scss}\" --ignore-path .gitignore",
|
"lint:style": "stylelint \"**/*.{vue,css,scss}\" --ignore-path .gitignore",
|
||||||
"lint-fix:style": "stylelint \"**/*.{vue,css,scss}\" --fix --ignore-path .gitignore",
|
"lint-fix:style": "stylelint \"**/*.{vue,css,scss}\" --fix --ignore-path .gitignore",
|
||||||
"lint": "npm run lint:js && npm run lint:style",
|
"lint": "npm run lint:js && npm run lint:style",
|
||||||
|
"lint:prod": "npm run lint:js-prod && npm run lint:style",
|
||||||
"dev": "concurrently -k -r \"wait-on tcp:3000 && npm run start-server-dev \" \"npm run start-frontend-dev\"",
|
"dev": "concurrently -k -r \"wait-on tcp:3000 && npm run start-server-dev \" \"npm run start-frontend-dev\"",
|
||||||
"start-frontend-dev": "cross-env NODE_ENV=development vite --host --config ./config/vite.config.js",
|
"start-frontend-dev": "cross-env NODE_ENV=development vite --host --config ./config/vite.config.js",
|
||||||
"start-frontend-devcontainer": "cross-env NODE_ENV=development DEVCONTAINER=1 vite --host --config ./config/vite.config.js",
|
"start-frontend-devcontainer": "cross-env NODE_ENV=development DEVCONTAINER=1 vite --host --config ./config/vite.config.js",
|
||||||
"start": "npm run start-server",
|
"start": "npm run start-server",
|
||||||
"start-server": "node server/server.js",
|
"start-server": "node server/server.js",
|
||||||
"start-server-dev": "cross-env NODE_ENV=development node server/server.js",
|
"start-server-dev": "cross-env NODE_ENV=development node server/server.js",
|
||||||
|
"start-server-dev:watch": "cross-env NODE_ENV=development node --watch server/server.js",
|
||||||
"build": "vite build --config ./config/vite.config.js",
|
"build": "vite build --config ./config/vite.config.js",
|
||||||
"test": "node test/prepare-test-server.js && npm run jest-backend",
|
"test": "npm run test-backend && npm run test-e2e",
|
||||||
"test-with-build": "npm run build && npm test",
|
"test-with-build": "npm run build && npm test",
|
||||||
"jest-backend": "cross-env TEST_BACKEND=1 jest --runInBand --detectOpenHandles --forceExit --config=./config/jest-backend.config.js",
|
"test-backend": "node test/backend-test-entry.js",
|
||||||
|
"test-backend:14": "cross-env TEST_BACKEND=1 NODE_OPTIONS=\"--experimental-abortcontroller --no-warnings\" node--test test/backend-test",
|
||||||
|
"test-backend:18": "cross-env TEST_BACKEND=1 node --test test/backend-test",
|
||||||
|
"test-e2e": "playwright test --config ./config/playwright.config.js",
|
||||||
|
"test-e2e-ui": "playwright test --config ./config/playwright.config.js --ui --ui-port=51063",
|
||||||
|
"playwright-codegen": "playwright codegen localhost:3000 --save-storage=./private/e2e-auth.json",
|
||||||
|
"playwright-show-report": "playwright show-report ./private/playwright-report",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"vite-preview-dist": "vite preview --host --config ./config/vite.config.js",
|
"vite-preview-dist": "vite preview --host --config ./config/vite.config.js",
|
||||||
"build-docker": "npm run build && npm run build-docker-full && npm run build-docker-slim",
|
"build-docker": "npm run build && npm run build-docker-full && npm run build-docker-slim",
|
||||||
@@ -36,50 +43,45 @@
|
|||||||
"build-docker-slim": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:2-slim -t louislam/uptime-kuma:$VERSION-slim --target release --build-arg BASE_IMAGE=louislam/uptime-kuma:base2-slim . --push",
|
"build-docker-slim": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:2-slim -t louislam/uptime-kuma:$VERSION-slim --target release --build-arg BASE_IMAGE=louislam/uptime-kuma:base2-slim . --push",
|
||||||
"build-docker-full": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:2 -t louislam/uptime-kuma:$VERSION --target release . --push",
|
"build-docker-full": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:2 -t louislam/uptime-kuma:$VERSION --target release . --push",
|
||||||
"build-docker-nightly": "node ./extra/test-docker.js && npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly2 --target nightly . --push",
|
"build-docker-nightly": "node ./extra/test-docker.js && npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly2 --target nightly . --push",
|
||||||
|
"build-docker-slim-rootless": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:2-slim-rootless -t louislam/uptime-kuma:$VERSION-slim-rootless --target rootless --build-arg BASE_IMAGE=louislam/uptime-kuma:base2-slim . --push",
|
||||||
|
"build-docker-full-rootless": "node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:2-rootless -t louislam/uptime-kuma:$VERSION-rootless --target rootless . --push",
|
||||||
|
"build-docker-nightly-rootless": "node ./extra/test-docker.js && npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly2-rootless --target nightly-rootless . --push",
|
||||||
"build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .",
|
"build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .",
|
||||||
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test --target pr-test . --push",
|
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test2 --target pr-test2 . --push",
|
||||||
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
||||||
"setup": "git checkout 1.22.1 && npm ci --production && npm run download-dist",
|
"setup": "git checkout 1.23.13 && npm ci --production && npm run download-dist",
|
||||||
"download-dist": "node extra/download-dist.js",
|
"download-dist": "node extra/download-dist.js",
|
||||||
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
||||||
"reset-password": "node extra/reset-password.js",
|
"reset-password": "node extra/reset-password.js",
|
||||||
"remove-2fa": "node extra/remove-2fa.js",
|
"remove-2fa": "node extra/remove-2fa.js",
|
||||||
"compile-install-script": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./extra/compile-install-script.ps1",
|
|
||||||
"test-install-script-rockylinux": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/rockylinux.dockerfile .",
|
|
||||||
"test-install-script-centos7": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/centos7.dockerfile .",
|
|
||||||
"test-install-script-debian": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/debian.dockerfile .",
|
|
||||||
"test-install-script-debian-buster": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/debian-buster.dockerfile .",
|
|
||||||
"test-install-script-ubuntu": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu.dockerfile .",
|
|
||||||
"test-install-script-ubuntu1804": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1804.dockerfile .",
|
|
||||||
"test-install-script-ubuntu1604": "npm run compile-install-script && docker build --progress plain -f test/test_install_script/ubuntu1604.dockerfile .",
|
|
||||||
"simple-dns-server": "node extra/simple-dns-server.js",
|
"simple-dns-server": "node extra/simple-dns-server.js",
|
||||||
"simple-mqtt-server": "node extra/simple-mqtt-server.js",
|
"simple-mqtt-server": "node extra/simple-mqtt-server.js",
|
||||||
|
"simple-mongo": "docker run --rm -p 27017:27017 mongo",
|
||||||
|
"simple-postgres": "docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres",
|
||||||
|
"simple-mariadb": "docker run --rm -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mariadb# mariadb",
|
||||||
"update-language-files": "cd extra/update-language-files && node index.js && cross-env-shell eslint ../../src/languages/$npm_config_language.js --fix",
|
"update-language-files": "cd extra/update-language-files && node index.js && cross-env-shell eslint ../../src/languages/$npm_config_language.js --fix",
|
||||||
"release-final": "node ./extra/test-docker.js && node extra/update-version.js && npm run build-docker && node ./extra/press-any-key.js && npm run upload-artifacts && node ./extra/update-wiki-version.js",
|
"release-final": "node ./extra/test-docker.js && node extra/update-version.js && npm run build-docker && node ./extra/press-any-key.js && npm run upload-artifacts && node ./extra/update-wiki-version.js",
|
||||||
"release-beta": "node ./extra/test-docker.js && node extra/beta/update-version.js && npm run build && node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:beta . --target release --push && node ./extra/press-any-key.js && npm run upload-artifacts",
|
"release-beta": "node ./extra/test-docker.js && node extra/beta/update-version.js && npm run build && node ./extra/env2arg.js docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:$VERSION -t louislam/uptime-kuma:beta . --target release --push && node ./extra/press-any-key.js && npm run upload-artifacts",
|
||||||
"git-remove-tag": "git tag -d",
|
"git-remove-tag": "git tag -d",
|
||||||
"build-dist-and-restart": "npm run build && npm run start-server-dev",
|
"build-dist-and-restart": "npm run build && npm run start-server-dev",
|
||||||
"start-pr-test": "node extra/checkout-pr.js && npm install && npm run dev",
|
"start-pr-test": "node extra/checkout-pr.js && npm install && npm run dev",
|
||||||
"cy:test": "node test/prepare-test-server.js && node server/server.js --port=3002 --data-dir=./data/test/ --e2e",
|
|
||||||
"cy:run": "npx cypress run --browser chrome --headless --config-file ./config/cypress.config.js",
|
|
||||||
"cy:run:unit": "npx cypress run --browser chrome --headless --config-file ./config/cypress.frontend.config.js",
|
|
||||||
"cypress-open": "concurrently -k -r \"node test/prepare-test-server.js && node server/server.js --port=3002 --data-dir=./data/test/\" \"cypress open --config-file ./config/cypress.config.js\"",
|
|
||||||
"build-healthcheck-armv7": "cross-env GOOS=linux GOARCH=arm GOARM=7 go build -x -o ./extra/healthcheck-armv7 ./extra/healthcheck.go",
|
"build-healthcheck-armv7": "cross-env GOOS=linux GOARCH=arm GOARM=7 go build -x -o ./extra/healthcheck-armv7 ./extra/healthcheck.go",
|
||||||
"deploy-demo-server": "node extra/deploy-demo-server.js",
|
"deploy-demo-server": "node extra/deploy-demo-server.js",
|
||||||
"sort-contributors": "node extra/sort-contributors.js",
|
"sort-contributors": "node extra/sort-contributors.js",
|
||||||
"quick-run-nightly": "docker run --rm --env NODE_ENV=development -p 3001:3001 louislam/uptime-kuma:nightly2",
|
"quick-run-nightly": "docker run --rm --env NODE_ENV=development -p 3001:3001 louislam/uptime-kuma:nightly2",
|
||||||
"start-dev-container": "cd docker && docker-compose -f docker-compose-dev.yml up --force-recreate"
|
"start-dev-container": "cd docker && docker-compose -f docker-compose-dev.yml up --force-recreate",
|
||||||
|
"rebase-pr-to-1.23.X": "node extra/rebase-pr.js 1.23.X",
|
||||||
|
"start-server-node14-win": "private\\node14\\node.exe server/server.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "~1.7.3",
|
"@grpc/grpc-js": "~1.7.3",
|
||||||
"@louislam/ping": "~0.4.4-mod.1",
|
"@louislam/ping": "~0.4.4-mod.1",
|
||||||
"@louislam/sqlite3": "15.1.6",
|
"@vvo/tzdb": "^6.125.0",
|
||||||
"args-parser": "~1.3.0",
|
"args-parser": "~1.3.0",
|
||||||
"axios": "~0.27.0",
|
"axios": "~0.28.1",
|
||||||
"axios-ntlm": "1.3.0",
|
"axios-ntlm": "1.3.0",
|
||||||
"badge-maker": "~3.3.1",
|
"badge-maker": "~3.3.1",
|
||||||
"bcryptjs": "~2.4.3",
|
"bcryptjs": "~2.4.3",
|
||||||
"cacheable-lookup": "~6.0.4",
|
|
||||||
"chardet": "~1.4.0",
|
"chardet": "~1.4.0",
|
||||||
"check-password-strength": "^2.0.5",
|
"check-password-strength": "^2.0.5",
|
||||||
"cheerio": "~1.0.0-rc.12",
|
"cheerio": "~1.0.0-rc.12",
|
||||||
@@ -90,11 +92,13 @@
|
|||||||
"croner": "~6.0.5",
|
"croner": "~6.0.5",
|
||||||
"dayjs": "~1.11.5",
|
"dayjs": "~1.11.5",
|
||||||
"dotenv": "~16.0.3",
|
"dotenv": "~16.0.3",
|
||||||
"express": "~4.17.3",
|
"express": "~4.19.2",
|
||||||
"express-basic-auth": "~1.2.1",
|
"express-basic-auth": "~1.2.1",
|
||||||
"express-static-gzip": "~2.1.7",
|
"express-static-gzip": "~2.1.7",
|
||||||
"form-data": "~4.0.0",
|
"form-data": "~4.0.0",
|
||||||
"gamedig": "~4.0.5",
|
"gamedig": "^4.2.0",
|
||||||
|
"html-escaper": "^3.0.3",
|
||||||
|
"http-cookie-agent": "~5.0.4",
|
||||||
"http-graceful-shutdown": "~3.1.7",
|
"http-graceful-shutdown": "~3.1.7",
|
||||||
"http-proxy-agent": "~5.0.0",
|
"http-proxy-agent": "~5.0.0",
|
||||||
"https-proxy-agent": "~5.0.1",
|
"https-proxy-agent": "~5.0.1",
|
||||||
@@ -108,23 +112,25 @@
|
|||||||
"knex": "^2.4.2",
|
"knex": "^2.4.2",
|
||||||
"limiter": "~2.1.0",
|
"limiter": "~2.1.0",
|
||||||
"liquidjs": "^10.7.0",
|
"liquidjs": "^10.7.0",
|
||||||
"mongodb": "~4.14.0",
|
"mitt": "~3.0.1",
|
||||||
|
"mongodb": "~4.17.1",
|
||||||
"mqtt": "~4.3.7",
|
"mqtt": "~4.3.7",
|
||||||
"mssql": "~8.1.4",
|
"mssql": "~8.1.4",
|
||||||
"mysql2": "~2.3.3",
|
"mysql2": "~3.9.6",
|
||||||
"nanoid": "~3.3.4",
|
"nanoid": "~3.3.4",
|
||||||
"node-cloudflared-tunnel": "~1.0.9",
|
"node-cloudflared-tunnel": "~1.0.9",
|
||||||
"node-radius-client": "~1.0.0",
|
"node-radius-client": "~1.0.0",
|
||||||
"nodemailer": "~6.6.5",
|
"nodemailer": "~6.9.13",
|
||||||
"nostr-tools": "^1.13.1",
|
"nostr-tools": "^1.13.1",
|
||||||
"notp": "~2.0.3",
|
"notp": "~2.0.3",
|
||||||
"openid-client": "^5.4.2",
|
"openid-client": "^5.4.2",
|
||||||
"password-hash": "~1.2.2",
|
"password-hash": "~1.2.2",
|
||||||
"pg": "~8.8.0",
|
"pg": "~8.11.3",
|
||||||
"pg-connection-string": "~2.5.0",
|
"pg-connection-string": "~2.6.2",
|
||||||
"playwright-core": "~1.35.1",
|
"playwright-core": "~1.39.0",
|
||||||
"prom-client": "~13.2.0",
|
"prom-client": "~13.2.0",
|
||||||
"prometheus-api-metrics": "~3.2.1",
|
"prometheus-api-metrics": "~3.2.1",
|
||||||
|
"promisify-child-process": "~4.1.2",
|
||||||
"protobufjs": "~7.2.4",
|
"protobufjs": "~7.2.4",
|
||||||
"qs": "~6.10.4",
|
"qs": "~6.10.4",
|
||||||
"redbean-node": "~0.3.0",
|
"redbean-node": "~0.3.0",
|
||||||
@@ -133,24 +139,27 @@
|
|||||||
"socket.io": "~4.6.1",
|
"socket.io": "~4.6.1",
|
||||||
"socket.io-client": "~4.6.1",
|
"socket.io-client": "~4.6.1",
|
||||||
"socks-proxy-agent": "6.1.1",
|
"socks-proxy-agent": "6.1.1",
|
||||||
"tar": "~6.1.11",
|
"sqlite3": "~5.1.7",
|
||||||
|
"tar": "~6.2.1",
|
||||||
"tcp-ping": "~0.1.1",
|
"tcp-ping": "~0.1.1",
|
||||||
"thirty-two": "~1.0.2",
|
"thirty-two": "~1.0.2",
|
||||||
|
"tough-cookie": "~4.1.3",
|
||||||
"ws": "^8.13.0"
|
"ws": "^8.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@actions/github": "~5.0.1",
|
"@actions/github": "~5.1.1",
|
||||||
"@babel/eslint-parser": "^7.22.7",
|
|
||||||
"@babel/preset-env": "^7.15.8",
|
|
||||||
"@fortawesome/fontawesome-svg-core": "~1.2.36",
|
"@fortawesome/fontawesome-svg-core": "~1.2.36",
|
||||||
"@fortawesome/free-regular-svg-icons": "~5.15.4",
|
"@fortawesome/free-regular-svg-icons": "~5.15.4",
|
||||||
"@fortawesome/free-solid-svg-icons": "~5.15.4",
|
"@fortawesome/free-solid-svg-icons": "~5.15.4",
|
||||||
"@fortawesome/vue-fontawesome": "~3.0.0-5",
|
"@fortawesome/vue-fontawesome": "~3.0.0-5",
|
||||||
|
"@playwright/test": "~1.39.0",
|
||||||
"@popperjs/core": "~2.10.2",
|
"@popperjs/core": "~2.10.2",
|
||||||
"@types/bootstrap": "~5.1.9",
|
"@types/bootstrap": "~5.1.9",
|
||||||
"@vitejs/plugin-legacy": "~4.1.0",
|
"@types/node": "^20.8.6",
|
||||||
"@vitejs/plugin-vue": "~4.2.3",
|
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||||
"@vue/compiler-sfc": "~3.3.4",
|
"@typescript-eslint/parser": "^6.7.5",
|
||||||
|
"@vitejs/plugin-vue": "~5.0.1",
|
||||||
|
"@vue/compiler-sfc": "~3.4.2",
|
||||||
"@vuepic/vue-datepicker": "~3.4.8",
|
"@vuepic/vue-datepicker": "~3.4.8",
|
||||||
"aedes": "^0.46.3",
|
"aedes": "^0.46.3",
|
||||||
"bootstrap": "5.1.3",
|
"bootstrap": "5.1.3",
|
||||||
@@ -160,15 +169,14 @@
|
|||||||
"core-js": "~3.26.1",
|
"core-js": "~3.26.1",
|
||||||
"cronstrue": "~2.24.0",
|
"cronstrue": "~2.24.0",
|
||||||
"cross-env": "~7.0.3",
|
"cross-env": "~7.0.3",
|
||||||
"cypress": "^12.17.0",
|
|
||||||
"delay": "^5.0.0",
|
"delay": "^5.0.0",
|
||||||
"dns2": "~2.0.1",
|
"dns2": "~2.0.1",
|
||||||
"dompurify": "~2.4.3",
|
"dompurify": "~3.0.11",
|
||||||
"eslint": "~8.14.0",
|
"eslint": "~8.14.0",
|
||||||
"eslint-plugin-jsdoc": "^46.4.6",
|
"eslint-plugin-jsdoc": "~46.4.6",
|
||||||
"eslint-plugin-vue": "~8.7.1",
|
"eslint-plugin-vue": "~8.7.1",
|
||||||
"favico.js": "~0.3.10",
|
"favico.js": "~0.3.10",
|
||||||
"jest": "~29.6.1",
|
"get-port-please": "^3.1.1",
|
||||||
"marked": "~4.2.5",
|
"marked": "~4.2.5",
|
||||||
"node-ssh": "~13.1.0",
|
"node-ssh": "~13.1.0",
|
||||||
"postcss-html": "~1.5.0",
|
"postcss-html": "~1.5.0",
|
||||||
@@ -181,13 +189,13 @@
|
|||||||
"stylelint": "^15.10.1",
|
"stylelint": "^15.10.1",
|
||||||
"stylelint-config-standard": "~25.0.0",
|
"stylelint-config-standard": "~25.0.0",
|
||||||
"terser": "~5.15.0",
|
"terser": "~5.15.0",
|
||||||
"timezones-list": "~3.0.1",
|
"test": "~3.3.0",
|
||||||
"typescript": "~4.4.4",
|
"typescript": "~4.4.4",
|
||||||
"v-pagination-3": "~0.1.7",
|
"v-pagination-3": "~0.1.7",
|
||||||
"vite": "~4.4.1",
|
"vite": "~5.2.8",
|
||||||
"vite-plugin-commonjs": "^0.8.0",
|
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vue": "~3.3.4",
|
"vite-plugin-vue-devtools": "^7.0.15",
|
||||||
|
"vue": "~3.4.2",
|
||||||
"vue-chartjs": "~5.2.0",
|
"vue-chartjs": "~5.2.0",
|
||||||
"vue-confirm-dialog": "~1.0.2",
|
"vue-confirm-dialog": "~1.0.2",
|
||||||
"vue-contenteditable": "~3.0.4",
|
"vue-contenteditable": "~3.0.4",
|
||||||
@@ -196,10 +204,10 @@
|
|||||||
"vue-multiselect": "~3.0.0-alpha.2",
|
"vue-multiselect": "~3.0.0-alpha.2",
|
||||||
"vue-prism-editor": "~2.0.0-alpha.2",
|
"vue-prism-editor": "~2.0.0-alpha.2",
|
||||||
"vue-qrcode": "~1.0.0",
|
"vue-qrcode": "~1.0.0",
|
||||||
"vue-router": "~4.0.14",
|
"vue-router": "~4.2.5",
|
||||||
"vue-toastification": "~2.0.0-rc.5",
|
"vue-toastification": "~2.0.0-rc.5",
|
||||||
"vuedraggable": "~4.1.0",
|
"vuedraggable": "~4.1.0",
|
||||||
"wait-on": "^6.0.1",
|
"wait-on": "^7.2.0",
|
||||||
"whatwg-url": "~12.0.1"
|
"whatwg-url": "~12.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
<svg width="640" height="640" viewBox="0 0 640 640" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="640" height="640" viewBox="0 0 640 640" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M490.4 235.64C544.09 358.38 544.09 435.34 490.4 466.5C409.85 513.24 199.96 527.49 139.54 455.64C99.2601 407.74 99.2601 334.4 139.54 235.64C180.5 168.18 238.71 134.45 314.17 134.45C389.64 134.45 448.38 168.18 490.4 235.64Z" fill="url(#paint0_linear_381_799)"/>
|
<g transform="matrix(1 0 0 1 320 320)">
|
||||||
<path d="M490.4 235.64C544.09 358.38 544.09 435.34 490.4 466.5C409.85 513.24 199.96 527.49 139.54 455.64C99.2601 407.74 99.2601 334.4 139.54 235.64C180.5 168.18 238.71 134.45 314.17 134.45C389.64 134.45 448.38 168.18 490.4 235.64Z" stroke="#F2F2F2" stroke-opacity="0.51" stroke-width="200"/>
|
<linearGradient id="S3" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1 0 0 1 -319.99875 -320.0001577393)" x1="259.78" y1="261.15" x2="463.85" y2="456.49">
|
||||||
<defs>
|
|
||||||
<linearGradient id="paint0_linear_381_799" x1="259.78" y1="261.15" x2="463.85" y2="456.49" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#5CDD8B"/>
|
<stop stop-color="#5CDD8B"/>
|
||||||
<stop offset="1" stop-color="#86E6A9"/>
|
<stop offset="1" stop-color="#86E6A9"/>
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
</defs>
|
<path style="stroke: rgb(242,242,242); stroke-opacity: 0.51; stroke-width: 200; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: url(#S3); fill-rule: nonzero; opacity: 1;" transform=" translate(0, 0)" d="M 170.40125 -84.36016 C 224.09125 38.37984 224.09125 115.33984 170.40125 146.49984 C 89.85125000000001 193.23984000000002 -120.03875 207.48984000000002 -180.45875 135.63984 C -220.73875 87.73983999999999 -220.73875 14.399839999999998 -180.45875 -84.36016000000001 C -139.49875 -151.82016 -81.28875000000001 -185.55016 -5.828750000000014 -185.55016 C 69.64124999999999 -185.55016 128.38125 -151.82016000000002 170.40124999999998 -84.36016000000001 z" stroke-linecap="round" />
|
||||||
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 893 B After Width: | Height: | Size: 1.1 KiB |
@@ -130,7 +130,7 @@ function userAuthorizer(username, password, callback) {
|
|||||||
* @param {express.Request} req Express request object
|
* @param {express.Request} req Express request object
|
||||||
* @param {express.Response} res Express response object
|
* @param {express.Response} res Express response object
|
||||||
* @param {express.NextFunction} next Next handler in chain
|
* @param {express.NextFunction} next Next handler in chain
|
||||||
* @returns {void}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
exports.basicAuth = async function (req, res, next) {
|
exports.basicAuth = async function (req, res, next) {
|
||||||
const middleware = basicAuth({
|
const middleware = basicAuth({
|
||||||
@@ -153,7 +153,7 @@ exports.basicAuth = async function (req, res, next) {
|
|||||||
* @param {express.Request} req Express request object
|
* @param {express.Request} req Express request object
|
||||||
* @param {express.Response} res Express response object
|
* @param {express.Response} res Express response object
|
||||||
* @param {express.NextFunction} next Next handler in chain
|
* @param {express.NextFunction} next Next handler in chain
|
||||||
* @returns {void}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
exports.apiAuth = async function (req, res, next) {
|
exports.apiAuth = async function (req, res, next) {
|
||||||
if (!await Settings.get("disableAuth")) {
|
if (!await Settings.get("disableAuth")) {
|
||||||
|
@@ -1,88 +0,0 @@
|
|||||||
const https = require("https");
|
|
||||||
const http = require("http");
|
|
||||||
const CacheableLookup = require("cacheable-lookup");
|
|
||||||
const { Settings } = require("./settings");
|
|
||||||
const { log } = require("../src/util");
|
|
||||||
|
|
||||||
class CacheableDnsHttpAgent {
|
|
||||||
|
|
||||||
static cacheable = new CacheableLookup();
|
|
||||||
|
|
||||||
static httpAgentList = {};
|
|
||||||
static httpsAgentList = {};
|
|
||||||
|
|
||||||
static enable = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register/Disable cacheable to global agents
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
static async update() {
|
|
||||||
log.debug("CacheableDnsHttpAgent", "update");
|
|
||||||
let isEnable = await Settings.get("dnsCache");
|
|
||||||
|
|
||||||
if (isEnable !== this.enable) {
|
|
||||||
log.debug("CacheableDnsHttpAgent", "value changed");
|
|
||||||
|
|
||||||
if (isEnable) {
|
|
||||||
log.debug("CacheableDnsHttpAgent", "enable");
|
|
||||||
this.cacheable.install(http.globalAgent);
|
|
||||||
this.cacheable.install(https.globalAgent);
|
|
||||||
} else {
|
|
||||||
log.debug("CacheableDnsHttpAgent", "disable");
|
|
||||||
this.cacheable.uninstall(http.globalAgent);
|
|
||||||
this.cacheable.uninstall(https.globalAgent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.enable = isEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attach cacheable to HTTP agent
|
|
||||||
* @param {http.Agent} agent Agent to install
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
static install(agent) {
|
|
||||||
this.cacheable.install(agent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {https.AgentOptions} agentOptions Options to pass to HTTPS agent
|
|
||||||
* @returns {https.Agent} The new HTTPS agent
|
|
||||||
*/
|
|
||||||
static getHttpsAgent(agentOptions) {
|
|
||||||
if (!this.enable) {
|
|
||||||
return new https.Agent(agentOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
let key = JSON.stringify(agentOptions);
|
|
||||||
if (!(key in this.httpsAgentList)) {
|
|
||||||
this.httpsAgentList[key] = new https.Agent(agentOptions);
|
|
||||||
this.cacheable.install(this.httpsAgentList[key]);
|
|
||||||
}
|
|
||||||
return this.httpsAgentList[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {http.AgentOptions} agentOptions Options to pass to the HTTP agent
|
|
||||||
* @returns {https.Agents} The new HTTP agent
|
|
||||||
*/
|
|
||||||
static getHttpAgent(agentOptions) {
|
|
||||||
if (!this.enable) {
|
|
||||||
return new http.Agent(agentOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
let key = JSON.stringify(agentOptions);
|
|
||||||
if (!(key in this.httpAgentList)) {
|
|
||||||
this.httpAgentList[key] = new http.Agent(agentOptions);
|
|
||||||
this.cacheable.install(this.httpAgentList[key]);
|
|
||||||
}
|
|
||||||
return this.httpAgentList[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
CacheableDnsHttpAgent,
|
|
||||||
};
|
|
@@ -8,6 +8,7 @@ const server = UptimeKumaServer.getInstance();
|
|||||||
const io = server.io;
|
const io = server.io;
|
||||||
const { setting } = require("./util-server");
|
const { setting } = require("./util-server");
|
||||||
const checkVersion = require("./check-version");
|
const checkVersion = require("./check-version");
|
||||||
|
const Database = require("./database");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send list of notification providers to client
|
* Send list of notification providers to client
|
||||||
@@ -45,8 +46,6 @@ async function sendNotificationList(socket) {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite = false) {
|
async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite = false) {
|
||||||
const timeLogger = new TimeLogger();
|
|
||||||
|
|
||||||
let list = await R.getAll(`
|
let list = await R.getAll(`
|
||||||
SELECT * FROM heartbeat
|
SELECT * FROM heartbeat
|
||||||
WHERE monitor_id = ?
|
WHERE monitor_id = ?
|
||||||
@@ -63,8 +62,6 @@ async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite =
|
|||||||
} else {
|
} else {
|
||||||
socket.emit("heartbeatList", monitorID, result, overwrite);
|
socket.emit("heartbeatList", monitorID, result, overwrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeLogger.print(`[Monitor: ${monitorID}] sendHeartbeatList`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,15 +144,21 @@ async function sendAPIKeyList(socket) {
|
|||||||
async function sendInfo(socket, hideVersion = false) {
|
async function sendInfo(socket, hideVersion = false) {
|
||||||
let version;
|
let version;
|
||||||
let latestVersion;
|
let latestVersion;
|
||||||
|
let isContainer;
|
||||||
|
let dbType;
|
||||||
|
|
||||||
if (!hideVersion) {
|
if (!hideVersion) {
|
||||||
version = checkVersion.version;
|
version = checkVersion.version;
|
||||||
latestVersion = checkVersion.latestVersion;
|
latestVersion = checkVersion.latestVersion;
|
||||||
|
isContainer = (process.env.UPTIME_KUMA_IS_CONTAINER === "1");
|
||||||
|
dbType = Database.dbConfig.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.emit("info", {
|
socket.emit("info", {
|
||||||
version,
|
version,
|
||||||
latestVersion,
|
latestVersion,
|
||||||
|
isContainer,
|
||||||
|
dbType,
|
||||||
primaryBaseURL: await setting("primaryBaseURL"),
|
primaryBaseURL: await setting("primaryBaseURL"),
|
||||||
serverTimezone: await server.getTimezone(),
|
serverTimezone: await server.getTimezone(),
|
||||||
serverTimezoneOffset: server.getTimezoneOffset(),
|
serverTimezoneOffset: server.getTimezoneOffset(),
|
||||||
@@ -186,6 +189,30 @@ async function sendDockerHostList(socket) {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send list of docker hosts to client
|
||||||
|
* @param {Socket} socket Socket.io socket instance
|
||||||
|
* @returns {Promise<Bean[]>} List of docker hosts
|
||||||
|
*/
|
||||||
|
async function sendRemoteBrowserList(socket) {
|
||||||
|
const timeLogger = new TimeLogger();
|
||||||
|
|
||||||
|
let result = [];
|
||||||
|
let list = await R.find("remote_browser", " user_id = ? ", [
|
||||||
|
socket.userID,
|
||||||
|
]);
|
||||||
|
|
||||||
|
for (let bean of list) {
|
||||||
|
result.push(bean.toJSON());
|
||||||
|
}
|
||||||
|
|
||||||
|
io.to(socket.userID).emit("remoteBrowserList", result);
|
||||||
|
|
||||||
|
timeLogger.print("Send Remote Browser List");
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
sendNotificationList,
|
sendNotificationList,
|
||||||
sendImportantHeartbeatList,
|
sendImportantHeartbeatList,
|
||||||
@@ -193,5 +220,6 @@ module.exports = {
|
|||||||
sendProxyList,
|
sendProxyList,
|
||||||
sendAPIKeyList,
|
sendAPIKeyList,
|
||||||
sendInfo,
|
sendInfo,
|
||||||
sendDockerHostList
|
sendDockerHostList,
|
||||||
|
sendRemoteBrowserList,
|
||||||
};
|
};
|
||||||
|
@@ -1,29 +1,46 @@
|
|||||||
|
const isFreeBSD = /^freebsd/.test(process.platform);
|
||||||
|
|
||||||
// Interop with browser
|
// Interop with browser
|
||||||
const args = (typeof process !== "undefined") ? require("args-parser")(process.argv) : {};
|
const args = (typeof process !== "undefined") ? require("args-parser")(process.argv) : {};
|
||||||
const demoMode = args["demo"] || false;
|
|
||||||
|
|
||||||
const badgeConstants = {
|
// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise.
|
||||||
naColor: "#999",
|
// Dual-stack support for (::)
|
||||||
defaultUpColor: "#66c20a",
|
// Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD
|
||||||
defaultWarnColor: "#eed202",
|
let hostEnv = isFreeBSD ? null : process.env.HOST;
|
||||||
defaultDownColor: "#c2290a",
|
const hostname = args.host || process.env.UPTIME_KUMA_HOST || hostEnv;
|
||||||
defaultPendingColor: "#f8a306",
|
|
||||||
defaultMaintenanceColor: "#1747f5",
|
const port = [ args.port, process.env.UPTIME_KUMA_PORT, process.env.PORT, 3001 ]
|
||||||
defaultPingColor: "blue", // as defined by badge-maker / shields.io
|
.map(portValue => parseInt(portValue))
|
||||||
defaultStyle: "flat",
|
.find(portValue => !isNaN(portValue));
|
||||||
defaultPingValueSuffix: "ms",
|
|
||||||
defaultPingLabelSuffix: "h",
|
const sslKey = args["ssl-key"] || process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || undefined;
|
||||||
defaultUptimeValueSuffix: "%",
|
const sslCert = args["ssl-cert"] || process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || undefined;
|
||||||
defaultUptimeLabelSuffix: "h",
|
const sslKeyPassphrase = args["ssl-key-passphrase"] || process.env.UPTIME_KUMA_SSL_KEY_PASSPHRASE || process.env.SSL_KEY_PASSPHRASE || undefined;
|
||||||
defaultCertExpValueSuffix: " days",
|
|
||||||
defaultCertExpLabelSuffix: "h",
|
const isSSL = sslKey && sslCert;
|
||||||
// Values Come From Default Notification Times
|
|
||||||
defaultCertExpireWarnDays: "14",
|
/**
|
||||||
defaultCertExpireDownDays: "7"
|
* Get the local WebSocket URL
|
||||||
};
|
* @returns {string} The local WebSocket URL
|
||||||
|
*/
|
||||||
|
function getLocalWebSocketURL() {
|
||||||
|
const protocol = isSSL ? "wss" : "ws";
|
||||||
|
const host = hostname || "localhost";
|
||||||
|
return `${protocol}://${host}:${port}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const localWebSocketURL = getLocalWebSocketURL();
|
||||||
|
|
||||||
|
const demoMode = args["demo"] || false;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
args,
|
args,
|
||||||
|
hostname,
|
||||||
|
port,
|
||||||
|
sslKey,
|
||||||
|
sslCert,
|
||||||
|
sslKeyPassphrase,
|
||||||
|
isSSL,
|
||||||
|
localWebSocketURL,
|
||||||
demoMode,
|
demoMode,
|
||||||
badgeConstants,
|
|
||||||
};
|
};
|
||||||
|
@@ -12,22 +12,40 @@ const mysql = require("mysql2/promise");
|
|||||||
*/
|
*/
|
||||||
class Database {
|
class Database {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boostrap database for SQLite
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
static templatePath = "./db/kuma.db";
|
static templatePath = "./db/kuma.db";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data Dir (Default: ./data)
|
* Data Dir (Default: ./data)
|
||||||
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
static dataDir;
|
static dataDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Upload Dir (Default: ./data/upload)
|
* User Upload Dir (Default: ./data/upload)
|
||||||
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
static uploadDir;
|
static uploadDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chrome Screenshot Dir (Default: ./data/screenshots)
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
static screenshotDir;
|
static screenshotDir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQLite file path (Default: ./data/kuma.db)
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
static sqlitePath;
|
static sqlitePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For storing Docker TLS certs (Default: ./data/docker-tls)
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
static dockerTLSDir;
|
static dockerTLSDir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +102,11 @@ class Database {
|
|||||||
"patch-add-certificate-expiry-status-page.sql": true,
|
"patch-add-certificate-expiry-status-page.sql": true,
|
||||||
"patch-monitor-oauth-cc.sql": true,
|
"patch-monitor-oauth-cc.sql": true,
|
||||||
"patch-add-timeout-monitor.sql": true,
|
"patch-add-timeout-monitor.sql": true,
|
||||||
"patch-add-gamedig-given-port.sql": true, // The last file so far converted to a knex migration file
|
"patch-add-gamedig-given-port.sql": true,
|
||||||
|
"patch-notification-config.sql": true,
|
||||||
|
"patch-fix-kafka-producer-booleans.sql": true,
|
||||||
|
"patch-timeout.sql": true,
|
||||||
|
"patch-monitor-tls-info-add-fk.sql": true, // The last file so far converted to a knex migration file
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,11 +152,14 @@ class Database {
|
|||||||
fs.mkdirSync(Database.dockerTLSDir, { recursive: true });
|
fs.mkdirSync(Database.dockerTLSDir, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("db", `Data Dir: ${Database.dataDir}`);
|
log.info("server", `Data Dir: ${Database.dataDir}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Read the database config
|
||||||
|
* @throws {Error} If the config is invalid
|
||||||
|
* @typedef {string|undefined} envString
|
||||||
|
* @returns {{type: "sqlite"} | {type:envString, hostname:envString, port:envString, database:envString, username:envString, password:envString}} Database config
|
||||||
*/
|
*/
|
||||||
static readDBConfig() {
|
static readDBConfig() {
|
||||||
let dbConfig;
|
let dbConfig;
|
||||||
@@ -153,7 +178,9 @@ class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dbConfig
|
* @typedef {string|undefined} envString
|
||||||
|
* @param {{type: "sqlite"} | {type:envString, hostname:envString, port:envString, database:envString, username:envString, password:envString}} dbConfig the database configuration that should be written
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
static writeDBConfig(dbConfig) {
|
static writeDBConfig(dbConfig) {
|
||||||
fs.writeFileSync(path.join(Database.dataDir, "db-config.json"), JSON.stringify(dbConfig, null, 4));
|
fs.writeFileSync(path.join(Database.dataDir, "db-config.json"), JSON.stringify(dbConfig, null, 4));
|
||||||
@@ -161,10 +188,8 @@ class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to the database
|
* Connect to the database
|
||||||
* @param {boolean} testMode Should the connection be
|
* @param {boolean} testMode Should the connection be started in test mode?
|
||||||
* started in test mode?
|
* @param {boolean} autoloadModels Should models be automatically loaded?
|
||||||
* @param {boolean} autoloadModels Should models be
|
|
||||||
* automatically loaded?
|
|
||||||
* @param {boolean} noLog Should logs not be output?
|
* @param {boolean} noLog Should logs not be output?
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@@ -183,6 +208,12 @@ class Database {
|
|||||||
|
|
||||||
let config = {};
|
let config = {};
|
||||||
|
|
||||||
|
let mariadbPoolConfig = {
|
||||||
|
min: 0,
|
||||||
|
max: 10,
|
||||||
|
idleTimeoutMillis: 30000,
|
||||||
|
};
|
||||||
|
|
||||||
log.info("db", `Database Type: ${dbConfig.type}`);
|
log.info("db", `Database Type: ${dbConfig.type}`);
|
||||||
|
|
||||||
if (dbConfig.type === "sqlite") {
|
if (dbConfig.type === "sqlite") {
|
||||||
@@ -192,11 +223,8 @@ class Database {
|
|||||||
fs.copyFileSync(Database.templatePath, Database.sqlitePath);
|
fs.copyFileSync(Database.templatePath, Database.sqlitePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Dialect = require("knex/lib/dialects/sqlite3/index.js");
|
|
||||||
Dialect.prototype._driver = () => require("@louislam/sqlite3");
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
client: Dialect,
|
client: "sqlite3",
|
||||||
connection: {
|
connection: {
|
||||||
filename: Database.sqlitePath,
|
filename: Database.sqlitePath,
|
||||||
acquireConnectionTimeout: acquireConnectionTimeout,
|
acquireConnectionTimeout: acquireConnectionTimeout,
|
||||||
@@ -233,7 +261,16 @@ class Database {
|
|||||||
user: dbConfig.username,
|
user: dbConfig.username,
|
||||||
password: dbConfig.password,
|
password: dbConfig.password,
|
||||||
database: dbConfig.dbName,
|
database: dbConfig.dbName,
|
||||||
|
timezone: "Z",
|
||||||
|
typeCast: function (field, next) {
|
||||||
|
if (field.type === "DATETIME") {
|
||||||
|
// Do not perform timezone conversion
|
||||||
|
return field.string();
|
||||||
}
|
}
|
||||||
|
return next();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pool: mariadbPoolConfig,
|
||||||
};
|
};
|
||||||
} else if (dbConfig.type === "embedded-mariadb") {
|
} else if (dbConfig.type === "embedded-mariadb") {
|
||||||
let embeddedMariaDB = EmbeddedMariaDB.getInstance();
|
let embeddedMariaDB = EmbeddedMariaDB.getInstance();
|
||||||
@@ -245,7 +282,16 @@ class Database {
|
|||||||
socketPath: embeddedMariaDB.socketPath,
|
socketPath: embeddedMariaDB.socketPath,
|
||||||
user: "node",
|
user: "node",
|
||||||
database: "kuma",
|
database: "kuma",
|
||||||
|
timezone: "Z",
|
||||||
|
typeCast: function (field, next) {
|
||||||
|
if (field.type === "DATETIME") {
|
||||||
|
// Do not perform timezone conversion
|
||||||
|
return field.string();
|
||||||
}
|
}
|
||||||
|
return next();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pool: mariadbPoolConfig,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Unknown Database type: " + dbConfig.type);
|
throw new Error("Unknown Database type: " + dbConfig.type);
|
||||||
@@ -283,8 +329,9 @@ class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param testMode
|
@param {boolean} testMode Should the connection be started in test mode?
|
||||||
* @param noLog
|
@param {boolean} noLog Should logs not be output?
|
||||||
|
@returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async initSQLite(testMode, noLog) {
|
static async initSQLite(testMode, noLog) {
|
||||||
await R.exec("PRAGMA foreign_keys = ON");
|
await R.exec("PRAGMA foreign_keys = ON");
|
||||||
@@ -304,15 +351,16 @@ class Database {
|
|||||||
await R.exec("PRAGMA synchronous = NORMAL");
|
await R.exec("PRAGMA synchronous = NORMAL");
|
||||||
|
|
||||||
if (!noLog) {
|
if (!noLog) {
|
||||||
log.info("db", "SQLite config:");
|
log.debug("db", "SQLite config:");
|
||||||
log.info("db", await R.getAll("PRAGMA journal_mode"));
|
log.debug("db", await R.getAll("PRAGMA journal_mode"));
|
||||||
log.info("db", await R.getAll("PRAGMA cache_size"));
|
log.debug("db", await R.getAll("PRAGMA cache_size"));
|
||||||
log.info("db", "SQLite Version: " + await R.getCell("SELECT sqlite_version()"));
|
log.debug("db", "SQLite Version: " + await R.getCell("SELECT sqlite_version()"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Initialize MariaDB
|
||||||
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async initMariaDB() {
|
static async initMariaDB() {
|
||||||
log.debug("db", "Checking if MariaDB database exists...");
|
log.debug("db", "Checking if MariaDB database exists...");
|
||||||
@@ -328,7 +376,7 @@ class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch the database
|
* Patch the database
|
||||||
* @returns {void}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async patch() {
|
static async patch() {
|
||||||
// Still need to keep this for old versions of Uptime Kuma
|
// Still need to keep this for old versions of Uptime Kuma
|
||||||
@@ -344,12 +392,19 @@ class Database {
|
|||||||
directory: Database.knexMigrationsPath,
|
directory: Database.knexMigrationsPath,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// Allow missing patch files for downgrade or testing pr.
|
||||||
|
if (e.message.includes("the following files are missing:")) {
|
||||||
|
log.warn("db", e.message);
|
||||||
|
log.warn("db", "Database migration failed, you may be downgrading Uptime Kuma.");
|
||||||
|
} else {
|
||||||
log.error("db", "Database migration failed");
|
log.error("db", "Database migration failed");
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async rollbackLatestPatch() {
|
static async rollbackLatestPatch() {
|
||||||
@@ -358,6 +413,7 @@ class Database {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch the database for SQLite
|
* Patch the database for SQLite
|
||||||
|
* @returns {Promise<void>}
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
static async patchSqlite() {
|
static async patchSqlite() {
|
||||||
@@ -367,13 +423,15 @@ class Database {
|
|||||||
version = 0;
|
version = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version !== this.latestVersion) {
|
||||||
log.info("db", "Your database version: " + version);
|
log.info("db", "Your database version: " + version);
|
||||||
log.info("db", "Latest database version: " + this.latestVersion);
|
log.info("db", "Latest database version: " + this.latestVersion);
|
||||||
|
}
|
||||||
|
|
||||||
if (version === this.latestVersion) {
|
if (version === this.latestVersion) {
|
||||||
log.info("db", "Database patch not needed");
|
log.debug("db", "Database patch not needed");
|
||||||
} else if (version > this.latestVersion) {
|
} else if (version > this.latestVersion) {
|
||||||
log.info("db", "Warning: Database version is newer than expected");
|
log.warn("db", "Warning: Database version is newer than expected");
|
||||||
} else {
|
} else {
|
||||||
log.info("db", "Database patch is needed");
|
log.info("db", "Database patch is needed");
|
||||||
|
|
||||||
@@ -409,7 +467,7 @@ class Database {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async patchSqlite2() {
|
static async patchSqlite2() {
|
||||||
log.info("db", "Database Patch 2.0 Process");
|
log.debug("db", "Database Patch 2.0 Process");
|
||||||
let databasePatchedFiles = await setting("databasePatchedFiles");
|
let databasePatchedFiles = await setting("databasePatchedFiles");
|
||||||
|
|
||||||
if (! databasePatchedFiles) {
|
if (! databasePatchedFiles) {
|
||||||
@@ -582,14 +640,6 @@ class Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Aquire a direct connection to database
|
|
||||||
* @returns {any} Database connection
|
|
||||||
*/
|
|
||||||
static getBetterSQLite3Database() {
|
|
||||||
return R.knex.client.acquireConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special handle, because tarn.js throw a promise reject that cannot be caught
|
* Special handle, because tarn.js throw a promise reject that cannot be caught
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
@@ -603,7 +653,9 @@ class Database {
|
|||||||
log.info("db", "Closing the database");
|
log.info("db", "Closing the database");
|
||||||
|
|
||||||
// Flush WAL to main database
|
// Flush WAL to main database
|
||||||
|
if (Database.dbConfig.type === "sqlite") {
|
||||||
await R.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
await R.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
||||||
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Database.noReject = true;
|
Database.noReject = true;
|
||||||
@@ -616,35 +668,40 @@ class Database {
|
|||||||
log.info("db", "Waiting to close the database");
|
log.info("db", "Waiting to close the database");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("db", "SQLite closed");
|
log.info("db", "Database closed");
|
||||||
|
|
||||||
process.removeListener("unhandledRejection", listener);
|
process.removeListener("unhandledRejection", listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the database
|
* Get the size of the database (SQLite only)
|
||||||
* @returns {number} Size of database
|
* @returns {number} Size of database
|
||||||
*/
|
*/
|
||||||
static getSize() {
|
static getSize() {
|
||||||
|
if (Database.dbConfig.type === "sqlite") {
|
||||||
log.debug("db", "Database.getSize()");
|
log.debug("db", "Database.getSize()");
|
||||||
let stats = fs.statSync(Database.sqlitePath);
|
let stats = fs.statSync(Database.sqlitePath);
|
||||||
log.debug("db", stats);
|
log.debug("db", stats);
|
||||||
return stats.size;
|
return stats.size;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shrink the database
|
* Shrink the database
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async shrink() {
|
static async shrink() {
|
||||||
|
if (Database.dbConfig.type === "sqlite") {
|
||||||
await R.exec("VACUUM");
|
await R.exec("VACUUM");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @returns {string} Get the SQL for the current time plus a number of hours
|
||||||
*/
|
*/
|
||||||
static sqlHourOffset() {
|
static sqlHourOffset() {
|
||||||
if (this.dbConfig.client === "sqlite3") {
|
if (Database.dbConfig.type === "sqlite") {
|
||||||
return "DATETIME('now', ? || ' hours')";
|
return "DATETIME('now', ? || ' hours')";
|
||||||
} else {
|
} else {
|
||||||
return "DATE_ADD(NOW(), INTERVAL ? HOUR)";
|
return "DATE_ADD(NOW(), INTERVAL ? HOUR)";
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
const { R } = require("redbean-node");
|
const { R } = require("redbean-node");
|
||||||
const version = require("../package.json").version;
|
|
||||||
const https = require("https");
|
const https = require("https");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const Database = require("./database");
|
const Database = require("./database");
|
||||||
|
const { axiosAbortSignal } = require("./util-server");
|
||||||
|
|
||||||
class DockerHost {
|
class DockerHost {
|
||||||
|
|
||||||
@@ -65,24 +65,26 @@ class DockerHost {
|
|||||||
/**
|
/**
|
||||||
* Fetches the amount of containers on the Docker host
|
* Fetches the amount of containers on the Docker host
|
||||||
* @param {object} dockerHost Docker host to check for
|
* @param {object} dockerHost Docker host to check for
|
||||||
* @returns {number} Total amount of containers on the host
|
* @returns {Promise<number>} Total amount of containers on the host
|
||||||
*/
|
*/
|
||||||
static async testDockerHost(dockerHost) {
|
static async testDockerHost(dockerHost) {
|
||||||
const options = {
|
const options = {
|
||||||
url: "/containers/json?all=true",
|
url: "/containers/json?all=true",
|
||||||
|
timeout: 5000,
|
||||||
headers: {
|
headers: {
|
||||||
"Accept": "*/*",
|
"Accept": "*/*",
|
||||||
"User-Agent": "Uptime-Kuma/" + version
|
|
||||||
},
|
},
|
||||||
|
signal: axiosAbortSignal(6000),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dockerHost.dockerType === "socket") {
|
if (dockerHost.dockerType === "socket") {
|
||||||
options.socketPath = dockerHost.dockerDaemon;
|
options.socketPath = dockerHost.dockerDaemon;
|
||||||
} else if (dockerHost.dockerType === "tcp") {
|
} else if (dockerHost.dockerType === "tcp") {
|
||||||
options.baseURL = DockerHost.patchDockerURL(dockerHost.dockerDaemon);
|
options.baseURL = DockerHost.patchDockerURL(dockerHost.dockerDaemon);
|
||||||
}
|
|
||||||
options.httpsAgent = new https.Agent(DockerHost.getHttpsAgentOptions(dockerHost.dockerType, options.baseURL));
|
options.httpsAgent = new https.Agent(DockerHost.getHttpsAgentOptions(dockerHost.dockerType, options.baseURL));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
let res = await axios.request(options);
|
let res = await axios.request(options);
|
||||||
|
|
||||||
if (Array.isArray(res.data)) {
|
if (Array.isArray(res.data)) {
|
||||||
@@ -102,7 +104,13 @@ class DockerHost {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error("Invalid Docker response, is it Docker really a daemon?");
|
throw new Error("Invalid Docker response, is it Docker really a daemon?");
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code === "ECONNABORTED" || e.name === "CanceledError") {
|
||||||
|
throw new Error("Connection to Docker daemon timed out.");
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -18,13 +18,17 @@ class EmbeddedMariaDB {
|
|||||||
|
|
||||||
socketPath = this.runDir + "/mysqld.sock";
|
socketPath = this.runDir + "/mysqld.sock";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {ChildProcessWithoutNullStreams}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
childProcess = null;
|
childProcess = null;
|
||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
started = false;
|
started = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {EmbeddedMariaDB}
|
* @returns {EmbeddedMariaDB} The singleton instance
|
||||||
*/
|
*/
|
||||||
static getInstance() {
|
static getInstance() {
|
||||||
if (!EmbeddedMariaDB.instance) {
|
if (!EmbeddedMariaDB.instance) {
|
||||||
@@ -34,14 +38,15 @@ class EmbeddedMariaDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @returns {boolean} If the singleton instance is created
|
||||||
*/
|
*/
|
||||||
static hasInstance() {
|
static hasInstance() {
|
||||||
return !!EmbeddedMariaDB.instance;
|
return !!EmbeddedMariaDB.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Start the embedded MariaDB
|
||||||
|
* @returns {Promise<void>|void} A promise that resolves when the MariaDB is started or void if it is already started
|
||||||
*/
|
*/
|
||||||
start() {
|
start() {
|
||||||
if (this.childProcess) {
|
if (this.childProcess) {
|
||||||
@@ -103,7 +108,8 @@ class EmbeddedMariaDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Stop all the child processes
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
stop() {
|
stop() {
|
||||||
if (this.childProcess) {
|
if (this.childProcess) {
|
||||||
@@ -113,7 +119,8 @@ class EmbeddedMariaDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Install MariaDB if it is not installed and make sure the `runDir` directory exists
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
initDB() {
|
initDB() {
|
||||||
if (!fs.existsSync(this.mariadbDataDir)) {
|
if (!fs.existsSync(this.mariadbDataDir)) {
|
||||||
@@ -146,7 +153,8 @@ class EmbeddedMariaDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Initialise the "kuma" database in mariadb if it does not exist
|
||||||
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async initDBAfterStarted() {
|
async initDBAfterStarted() {
|
||||||
const connection = mysql.createConnection({
|
const connection = mysql.createConnection({
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
const jsesc = require("jsesc");
|
const jsesc = require("jsesc");
|
||||||
|
const { escape } = require("html-escaper");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a string that represents the javascript that is required to insert the Google Analytics scripts
|
* Returns a string that represents the javascript that is required to insert the Google Analytics scripts
|
||||||
@@ -7,15 +8,18 @@ const jsesc = require("jsesc");
|
|||||||
* @returns {string} HTML script tags to inject into page
|
* @returns {string} HTML script tags to inject into page
|
||||||
*/
|
*/
|
||||||
function getGoogleAnalyticsScript(tagId) {
|
function getGoogleAnalyticsScript(tagId) {
|
||||||
let escapedTagId = jsesc(tagId, { isScriptContext: true });
|
let escapedTagIdJS = jsesc(tagId, { isScriptContext: true });
|
||||||
|
|
||||||
if (escapedTagId) {
|
if (escapedTagIdJS) {
|
||||||
escapedTagId = escapedTagId.trim();
|
escapedTagIdJS = escapedTagIdJS.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Escape the tag ID for use in an HTML attribute.
|
||||||
|
let escapedTagIdHTMLAttribute = escape(tagId);
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=${escapedTagId}"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${escapedTagIdHTMLAttribute}"></script>
|
||||||
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date());gtag('config', '${escapedTagId}'); </script>
|
<script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date());gtag('config', '${escapedTagIdJS}'); </script>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,9 @@ const clearOldData = async () => {
|
|||||||
[ parsedPeriod * -24 ]
|
[ parsedPeriod * -24 ]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (Database.dbConfig.type === "sqlite") {
|
||||||
await R.exec("PRAGMA optimize;");
|
await R.exec("PRAGMA optimize;");
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error("clearOldData", `Failed to clear old data: ${e.message}`);
|
log.error("clearOldData", `Failed to clear old data: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user