diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d2b2fef8..d94eb71d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,13 +2,13 @@ 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. +The project was created with vite.js (vue3). Then I created a subdirectory called "server" for the server part. 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. +The frontend code builds into "dist" directory. The server (express.js) exposes the "dist" directory as the root of the endpoint. This is how production is working. ## Key Technical Skills -- Node.js (You should know what are promise, async/await and arrow function etc.) +- Node.js (You should know about promise, async/await and arrow function etc.) - Socket.io - SCSS - Vue.js @@ -30,7 +30,7 @@ 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 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. 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 if it will be merged or not. Here are some references: @@ -46,8 +46,8 @@ Here are some references: - New features ### ❌ Won't be merged: -- A dedicated pr for translating existing languages (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)) -- Do not pass the auto test +- A dedicated PR for translating existing languages (see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md)) +- Do not pass the auto-test - Any breaking changes - Duplicated pull requests - Buggy @@ -61,9 +61,9 @@ The above cases may not cover all possible 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. +I will assign your pull request to a [milestone](https://github.com/louislam/uptime-kuma/milestones), if I 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. +Also, please don't rush or ask for an ETA, because I have to understand the pull request, make sure it is no breaking changes and stick to my vision of this project, especially for large pull requests. ### Recommended Pull Request Guideline @@ -83,11 +83,11 @@ Before deep into coding, discussion first is preferred. Creating an empty pull r ## 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. I hope Uptime Kuma installation will be as easy as like 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, no native build dependency is needed (for x86_64/armv7/arm64), no extra config, and 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` +- Settings should be configurable in the frontend. Environment variables are discouraged, unless it is related to startup such as `DATA_DIR` - Easy to use - The web UI styling should be consistent and nice @@ -130,7 +130,7 @@ Port `3000` and port `3001` will be used. 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: ``` npm run start-frontend-dev npm run start-server-dev @@ -146,13 +146,13 @@ It is mainly a socket.io app + express.js. express.js is used for: - entry point such as redirecting to a status page or the dashboard - serving the frontend built files (index.html, .js and .css etc.) -- serving internal APIs of status page +- serving internal APIs of the status page ### Structure in /server/ - jobs/ (Jobs that are running in another process) -- model/ (Object model, auto mapping to the database table name) +- model/ (Object model, auto-mapping to the database table name) - modules/ (Modified 3rd-party modules) - monitor_types (Monitor Types) - notification-providers/ (individual notification logic) @@ -163,7 +163,7 @@ express.js is used for: ## 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. @@ -181,7 +181,7 @@ Uptime Kuma Frontend is a single page application (SPA). Most paths are handled 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`. @@ -210,7 +210,7 @@ Both frontend and backend share the same package.json. However, the frontend dep ### 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/)) @@ -218,17 +218,17 @@ If for security / bug / other reasons, a library must be updated, breaking chang ## 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`. -The translations can then (after merging a PR into `master`) be translated by awesome people donating their language-skills. +**Don't include any other languages in your initial Pull-Request** (even if this is your mother tongue), to avoid merge-conflicts between weblate and `master`. +The translations can then (after merging a PR into `master`) be translated by awesome people donating their language skills. If you want to help by translating Uptime Kuma into your language, please visit the [instructions on how to translate using weblate](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md). ## Spelling & Grammar 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 diff --git a/README.md b/README.md index 151e9a6e..54b6892a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Use the * Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers * Fancy, Reactive, Fast UI/UX * Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications) -* 20 second intervals +* 20-second intervals * [Multi Languages](https://github.com/louislam/uptime-kuma/tree/master/src/lang) * Multiple status pages * Map status pages to specific domains @@ -70,7 +70,7 @@ npm run setup # Option 1. Try it 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: npm install pm2 -g && pm2 install pm2-logrotate @@ -93,7 +93,7 @@ pm2 save && pm2 startup ### Windows Portable (x64) -https://github.com/louislam/uptime-kuma/files/11886108/uptime-kuma-win64-portable-1.0.1.zip +https://github.com/louislam/uptime-kuma/releases/download/1.23.1/uptime-kuma-windows-x64-portable-1.23.1.zip ### Advanced Installation @@ -109,7 +109,7 @@ https://github.com/louislam/uptime-kuma/wiki/%F0%9F%86%99-How-to-Update ## 🆕 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 diff --git a/SECURITY.md b/SECURITY.md index 43dc7654..db4bc138 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,19 +3,19 @@ ## Reporting a Vulnerability 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 +1. 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? -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 ### 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 diff --git a/extra/install.batsh b/extra/install.batsh index 84099202..e2f9a751 100644 --- a/extra/install.batsh +++ b/extra/install.batsh @@ -189,13 +189,15 @@ if (type == "local") { bash("check=$(git --version)"); if (check == "") { error = 1; - println("Error: git is missing"); + println("Error: git is not found!"); + println("help: an installation guide is available at https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"); } bash("check=$(node -v)"); if (check == "") { error = 1; - println("Error: node is missing"); + println("Error: node is not found"); + println("help: an installation guide is available at https://nodejs.org/en/download"); } if (error > 0) { @@ -216,6 +218,7 @@ if (type == "local") { bash("check=$(pm2 --version)"); if (check == "") { println("Error: pm2 is not found!"); + println("help: an installation guide is available at https://pm2.keymetrics.io/docs/usage/quick-start/"); bash("exit 1"); } @@ -232,6 +235,7 @@ if (type == "local") { bash("check=$(docker -v)"); if (check == "") { println("Error: docker is not found!"); + println("help: an installation guide is available at https://docs.docker.com/desktop/"); bash("exit 1"); } @@ -239,6 +243,7 @@ if (type == "local") { bash("if [[ \"$check\" == *\"Is the docker daemon running\"* ]]; then \"echo\" \"Error: docker is not running\" + \"echo\" \"help: a troubleshooting guide is available at https://docs.docker.com/config/daemon/troubleshoot/\" \"exit\" \"1\" fi"); diff --git a/install.sh b/install.sh index a206e558..d965867c 100644 --- a/install.sh +++ b/install.sh @@ -156,12 +156,14 @@ fi check=$(git --version) if [ "$check" == "" ]; then error=$((1)) - "echo" "-e" "Error: git is missing" + "echo" "-e" "Error: git is not found!" + "echo" "-e" "help: an installation guide is available at https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" fi check=$(node -v) if [ "$check" == "" ]; then error=$((1)) - "echo" "-e" "Error: node is missing" + "echo" "-e" "Error: node is not found" + "echo" "-e" "help: an installation guide is available at https://nodejs.org/en/download" fi if [ $(($error > 0)) == 1 ]; then "echo" "-e" "Please install above missing software" @@ -180,6 +182,7 @@ fi check=$(pm2 --version) if [ "$check" == "" ]; then "echo" "-e" "Error: pm2 is not found!" + "echo" "-e" "help: an installation guide is available at https://pm2.keymetrics.io/docs/usage/quick-start/" exit 1 fi mkdir -p $installPath @@ -192,11 +195,13 @@ else check=$(docker -v) if [ "$check" == "" ]; then "echo" "-e" "Error: docker is not found!" + "echo" "-e" "help: an installation guide is available at https://docs.docker.com/desktop/" exit 1 fi check=$(docker info) if [[ "$check" == *"Is the docker daemon running"* ]]; then "echo" "Error: docker is not running" + "echo" "help: a troubleshooting guide is available at https://docs.docker.com/config/daemon/troubleshoot/" "exit" "1" fi if [ "$3" != "" ]; then diff --git a/package.json b/package.json index 16d53816..0c438a6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uptime-kuma", - "version": "1.23.0", + "version": "1.23.1", "license": "MIT", "repository": { "type": "git", @@ -39,7 +39,7 @@ "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", "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.23.0 && npm ci --production && npm run download-dist", + "setup": "git checkout 1.23.1 && npm ci --production && npm run download-dist", "download-dist": "node extra/download-dist.js", "mark-as-nightly": "node extra/mark-as-nightly.js", "reset-password": "node extra/reset-password.js", diff --git a/server/client.js b/server/client.js index e00fdb1e..774aeae2 100644 --- a/server/client.js +++ b/server/client.js @@ -147,15 +147,18 @@ async function sendAPIKeyList(socket) { async function sendInfo(socket, hideVersion = false) { let version; let latestVersion; + let isContainer; if (!hideVersion) { version = checkVersion.version; latestVersion = checkVersion.latestVersion; + isContainer = (process.env.UPTIME_KUMA_IS_CONTAINER === "1"); } socket.emit("info", { version, latestVersion, + isContainer, primaryBaseURL: await setting("primaryBaseURL"), serverTimezone: await server.getTimezone(), serverTimezoneOffset: server.getTimezoneOffset(), diff --git a/server/docker.js b/server/docker.js index 18346e08..545c14bd 100644 --- a/server/docker.js +++ b/server/docker.js @@ -80,8 +80,8 @@ class DockerHost { options.socketPath = dockerHost.dockerDaemon; } else if (dockerHost.dockerType === "tcp") { 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)); let res = await axios.request(options); diff --git a/server/model/monitor.js b/server/model/monitor.js index 577a55cd..e1ac48c4 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -595,13 +595,13 @@ class Monitor extends BeanModel { let dnsRes = await dnsResolve(this.hostname, this.dns_resolve_server, this.port, this.dns_resolve_type); bean.ping = dayjs().valueOf() - startTime; - if (this.dns_resolve_type === "A" || this.dns_resolve_type === "AAAA" || this.dns_resolve_type === "TXT") { + if (this.dns_resolve_type === "A" || this.dns_resolve_type === "AAAA" || this.dns_resolve_type === "TXT" || this.dns_resolve_type === "PTR") { dnsMessage += "Records: "; dnsMessage += dnsRes.join(" | "); - } else if (this.dns_resolve_type === "CNAME" || this.dns_resolve_type === "PTR") { - dnsMessage = dnsRes[0]; + } else if (this.dns_resolve_type === "CNAME") { + dnsMessage += dnsRes[0]; } else if (this.dns_resolve_type === "CAA") { - dnsMessage = dnsRes[0].issue; + dnsMessage += dnsRes[0].issue; } else if (this.dns_resolve_type === "MX") { dnsRes.forEach(record => { dnsMessage += `Hostname: ${record.exchange} - Priority: ${record.priority} | `; @@ -619,7 +619,7 @@ class Monitor extends BeanModel { dnsMessage = dnsMessage.slice(0, -2); } - if (this.dnsLastResult !== dnsMessage) { + if (this.dnsLastResult !== dnsMessage && dnsMessage !== undefined) { R.exec("UPDATE `monitor` SET dns_last_result = ? WHERE id = ? ", [ dnsMessage, this.id diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index 94cca3a8..f24cd616 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -33,6 +33,7 @@ class Discord extends NotificationProvider { break; case "port": case "dns": + case "gamedig": case "steam": address = monitorJSON["hostname"]; if (monitorJSON["port"]) { diff --git a/server/notification-providers/opsgenie.js b/server/notification-providers/opsgenie.js index 05c855d7..e2dc38a7 100644 --- a/server/notification-providers/opsgenie.js +++ b/server/notification-providers/opsgenie.js @@ -20,10 +20,10 @@ class Opsgenie extends NotificationProvider { try { switch (notification.opsgenieRegion) { - case "US": + case "us": opsgenieAlertsUrl = opsgenieAlertsUrlUS; break; - case "EU": + case "eu": opsgenieAlertsUrl = opsgenieAlertsUrlEU; break; default: diff --git a/server/server.js b/server/server.js index cedef1d5..93a85502 100644 --- a/server/server.js +++ b/server/server.js @@ -1153,9 +1153,6 @@ let needSetup = false; value, ]); - // Cleanup unused Tags - await R.exec("delete from tag where ( select count(*) from monitor_tag mt where tag.id = mt.tag_id ) = 0"); - callback({ ok: true, msg: "Deleted Successfully.", @@ -1234,6 +1231,7 @@ let needSetup = false; } const previousChromeExecutable = await Settings.get("chromeExecutable"); + const previousNSCDStatus = await Settings.get("nscd"); await setSettings("general", data); server.entryPage = data.entryPage; @@ -1251,6 +1249,15 @@ let needSetup = false; await resetChrome(); } + // Update nscd status + if (previousNSCDStatus !== data.nscd) { + if (data.nscd) { + server.startNSCDServices(); + } else { + server.stopNSCDServices(); + } + } + callback({ ok: true, msg: "Saved" diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index ce3d0ad0..ff34e8ac 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -361,7 +361,11 @@ class UptimeKumaServer { * @returns {Promise} */ async start() { - this.startServices(); + let enable = await Settings.get("nscd"); + + if (enable || enable === null) { + this.startNSCDServices(); + } } /** @@ -369,7 +373,11 @@ class UptimeKumaServer { * @returns {Promise} */ async stop() { - this.stopServices(); + let enable = await Settings.get("nscd"); + + if (enable || enable === null) { + this.stopNSCDServices(); + } } /** @@ -377,7 +385,7 @@ class UptimeKumaServer { * For now, only used in Docker * @returns {void} */ - startServices() { + startNSCDServices() { if (process.env.UPTIME_KUMA_IS_CONTAINER) { try { log.info("services", "Starting nscd"); @@ -392,7 +400,7 @@ class UptimeKumaServer { * Stop all system services * @returns {void} */ - stopServices() { + stopNSCDServices() { if (process.env.UPTIME_KUMA_IS_CONTAINER) { try { log.info("services", "Stopping nscd"); diff --git a/src/components/Login.vue b/src/components/Login.vue index f9ec9798..2661ab09 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -5,18 +5,18 @@

- +
- +
- +
diff --git a/src/components/MonitorListFilter.vue b/src/components/MonitorListFilter.vue index dbb1eb94..c7598cfd 100644 --- a/src/components/MonitorListFilter.vue +++ b/src/components/MonitorListFilter.vue @@ -258,6 +258,10 @@ export default {