diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 4d2105d4..87e7f5ff 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -16,7 +16,6 @@ Please delete any options that are not relevant.
- User interface (UI)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
-- Translation update
- Other
- This change requires a documentation update
diff --git a/.github/workflows/auto-test.yml b/.github/workflows/auto-test.yml
index b49a253c..273b1dba 100644
--- a/.github/workflows/auto-test.yml
+++ b/.github/workflows/auto-test.yml
@@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
- node: [ 14, 16, 17, 18 ]
+ node: [ 14, 16, 18, 19 ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
@@ -66,3 +66,19 @@ jobs:
- run: npm install
- run: npm run build
- run: npm run cy:test
+
+ frontend-unit-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
+ cache: 'npm'
+ - run: npm install
+ - run: npm run build
+ - run: npm run cy:run:unit
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a1a4a982..f46b17e1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,6 +1,6 @@
# Project Info
-First of all, thank you everyone who made pull requests for Uptime Kuma, I never thought GitHub Community can be that nice! And also because of this, I also never thought other people actually read my code and edit my code. It is not structured and commented so well, lol. Sorry about that.
+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.
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.
@@ -27,20 +27,23 @@ The frontend code build into "dist" directory. The server (express.js) exposes t
## 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 discuss 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. 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.
Here are some references:
✅ Usually Accept:
-- Bug/Security fix
-- Translations
+- Bug fix
+- Security fix
- Adding notification providers
+- Adding new language files (You should go to https://weblate.kuma.pet for existing languages)
+- Adding new language keys: `$t("...")`
⚠️ Discussion First
- Large pull requests
- New features
❌ Won't Merge
+- A dedicated pr for translating existing languages (You can now translate on https://weblate.kuma.pet)
- Do not pass auto test
- Any breaking changes
- Duplicated pull request
@@ -51,6 +54,10 @@ Here are some references:
- Convert existing code into other programming languages
- Unnecessary large code changes (Hard to review, causes code conflicts to other pull requests)
+The above cases cannot cover all situations.
+
+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.
+
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.
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.
@@ -73,9 +80,9 @@ Before deep into coding, discussion first is preferred. Creating an empty pull r
## Project Styles
-I personally do not like something need to learn so much and need to config so much before you can finally start the app.
+I personally do not like it when something requires so much learning and configuration before you can finally start the app.
-- Easy to install for non-Docker users, no native build dependency is needed (at least for x86_64), no extra config, no extra effort to get it run
+- Easy to install for non-Docker users, no native build dependency is needed (at least for x86_64), no extra config, no extra effort required to get it running
- Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go
- Settings should be configurable in the frontend. Environment variable is not encouraged, unless it is related to startup such as `DATA_DIR`.
- Easy to use
@@ -173,15 +180,11 @@ The data and socket logic are in `src/mixins/socket.js`.
## Unit Test
-It is an end-to-end testing. It is using Jest and Puppeteer.
-
```bash
npm run build
npm test
```
-By default, the Chromium window will be shown up during the test. Specifying `HEADLESS_TEST=1` for terminal environments.
-
## 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:
diff --git a/README.md b/README.md
index 1f26da8b..f29622a6 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,17 @@
# Uptime Kuma
-[](https://github.com/sponsors/louislam)
+[](https://github.com/sponsors/louislam)
+
+
+
## 🥔 Live Demo
@@ -26,7 +28,7 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the
* Fancy, Reactive, Fast UI/UX
* Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications)
* 20 second intervals
-* [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/languages)
+* [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang)
* Multiple status pages
* Map status pages to specific domains
* Ping chart
@@ -171,7 +173,7 @@ Check out the latest beta release here: https://github.com/louislam/uptime-kuma/
If you want to report a bug or request a new feature, feel free to open a [new issue](https://github.com/louislam/uptime-kuma/issues).
### Translations
-If you want to translate Uptime Kuma into your language, please read: https://github.com/louislam/uptime-kuma/tree/master/src/languages
+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).
Feel free to correct my grammar in this README, source code, or wiki, as my mother language is not English and my grammar is not that great.
diff --git a/config/cypress.frontend.config.js b/config/cypress.frontend.config.js
new file mode 100644
index 00000000..eecdcb8d
--- /dev/null
+++ b/config/cypress.frontend.config.js
@@ -0,0 +1,10 @@
+const { defineConfig } = require("cypress");
+
+module.exports = defineConfig({
+ e2e: {
+ supportFile: false,
+ specPattern: [
+ "test/cypress/unit/**/*.js"
+ ],
+ }
+});
diff --git a/db/patch-add-gamedig-monitor.sql b/db/patch-add-gamedig-monitor.sql
new file mode 100644
index 00000000..061bed30
--- /dev/null
+++ b/db/patch-add-gamedig-monitor.sql
@@ -0,0 +1,5 @@
+BEGIN TRANSACTION;
+
+ ALTER TABLE monitor
+ ADD game VARCHAR(255);
+ COMMIT
diff --git a/docker/builder-go.dockerfile b/docker/builder-go.dockerfile
new file mode 100644
index 00000000..79c1a95b
--- /dev/null
+++ b/docker/builder-go.dockerfile
@@ -0,0 +1,16 @@
+############################################
+# Build in Golang
+# Run npm run build-healthcheck-armv7 in the host first, another it will be super slow where it is building the armv7 healthcheck
+############################################
+FROM golang:1.19.4-buster
+WORKDIR /app
+ARG TARGETPLATFORM
+COPY ./extra/ ./extra/
+
+# Compile healthcheck.go
+RUN apt update && \
+ apt --yes --no-install-recommends install curl && \
+ curl -sL https://deb.nodesource.com/setup_18.x | bash && \
+ apt --yes --no-install-recommends install nodejs && \
+ node ./extra/build-healthcheck.js $TARGETPLATFORM && \
+ apt --yes remove nodejs
diff --git a/docker/dockerfile b/docker/dockerfile
index e084d649..775cec59 100644
--- a/docker/dockerfile
+++ b/docker/dockerfile
@@ -1,19 +1,9 @@
############################################
# Build in Golang
# Run npm run build-healthcheck-armv7 in the host first, another it will be super slow where it is building the armv7 healthcheck
+# Check file: builder-go.dockerfile
############################################
-FROM golang:1.19.4-buster AS build_healthcheck
-WORKDIR /app
-ARG TARGETPLATFORM
-COPY ./extra/ ./extra/
-
-# Compile healthcheck.go
-RUN apt update
-RUN apt --yes --no-install-recommends install curl
-RUN curl -sL https://deb.nodesource.com/setup_18.x | bash
-RUN apt --yes --no-install-recommends install nodejs
-RUN node -v
-RUN node ./extra/build-healthcheck.js $TARGETPLATFORM
+FROM louislam/uptime-kuma:builder-go AS build_healthcheck
############################################
# Build in Node.js
@@ -22,10 +12,13 @@ FROM louislam/uptime-kuma:base-debian AS build
WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
+COPY .npmrc .npmrc
+COPY package.json package.json
+COPY package-lock.json package-lock.json
+RUN npm ci --omit=dev
COPY . .
COPY --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
-RUN npm ci --production && \
- chmod +x /app/extra/entrypoint.sh
+RUN chmod +x /app/extra/entrypoint.sh
############################################
# ⭐ Main Image
diff --git a/docker/dockerfile-alpine b/docker/dockerfile-alpine
index ab9255f9..43f26b8b 100644
--- a/docker/dockerfile-alpine
+++ b/docker/dockerfile-alpine
@@ -3,10 +3,12 @@ WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
+COPY .npmrc .npmrc
+COPY package.json package.json
+COPY package-lock.json package-lock.json
+RUN npm ci --omit=dev
COPY . .
-RUN npm ci --production && \
- chmod +x /app/extra/entrypoint.sh
-
+RUN chmod +x /app/extra/entrypoint.sh
FROM louislam/uptime-kuma:base-alpine AS release
WORKDIR /app
diff --git a/extra/beta/update-version.js b/extra/beta/update-version.js
index df2cb40a..7abac5ef 100644
--- a/extra/beta/update-version.js
+++ b/extra/beta/update-version.js
@@ -32,6 +32,10 @@ if (! exists) {
process.exit(1);
}
+/**
+ * Commit updated files
+ * @param {string} version Version to update to
+ */
function commit(version) {
let msg = "Update to " + version;
@@ -47,6 +51,10 @@ function commit(version) {
console.log(res.stdout.toString().trim());
}
+/**
+ * Create a tag with the specified version
+ * @param {string} version Tag to create
+ */
function tag(version) {
let res = childProcess.spawnSync("git", [ "tag", version ]);
console.log(res.stdout.toString().trim());
@@ -55,6 +63,11 @@ function tag(version) {
console.log(res.stdout.toString().trim());
}
+/**
+ * Check if a tag exists for the specified version
+ * @param {string} version Version to check
+ * @returns {boolean} Does the tag already exist
+ */
function tagExists(version) {
if (! version) {
throw new Error("invalid version");
diff --git a/extra/download-cloudflared.js b/extra/download-cloudflared.js
index 41519b7c..74b9bad2 100644
--- a/extra/download-cloudflared.js
+++ b/extra/download-cloudflared.js
@@ -25,6 +25,10 @@ if (platform === "linux/amd64") {
const file = fs.createWriteStream("cloudflared.deb");
get("https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-" + arch + ".deb");
+/**
+ * Download specified file
+ * @param {string} url URL to request
+ */
function get(url) {
http.get(url, function (res) {
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
diff --git a/extra/healthcheck.go b/extra/healthcheck.go
index 779b1583..302883d8 100644
--- a/extra/healthcheck.go
+++ b/extra/healthcheck.go
@@ -1,3 +1,7 @@
+/*
+ * If changed, have to run `npm run build-docker-builder-go`.
+ * This script should be run after a period of time (180s), because the server may need some time to prepare.
+ */
package main
import (
diff --git a/extra/remove-2fa.js b/extra/remove-2fa.js
index 0f3f6346..f88c43fc 100644
--- a/extra/remove-2fa.js
+++ b/extra/remove-2fa.js
@@ -43,6 +43,11 @@ const main = async () => {
console.log("Finished.");
};
+/**
+ * Ask question of user
+ * @param {string} question Question to ask
+ * @returns {Promise