Compare commits

..

No commits in common. "master" and "2.0.0-beta.2-temp" have entirely different histories.

148 changed files with 2909 additions and 8359 deletions

View file

@ -0,0 +1,75 @@
name: "❓ Ask for help"
description: "Submit any question related to Uptime Kuma"
#title: "[Help] "
labels: [help]
body:
- type: checkboxes
id: no-duplicate-issues
attributes:
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=)"
options:
- label: "I checked and didn't find similar issue"
required: true
- type: checkboxes
attributes:
label: "🛡️ Security Policy"
description: Please review the security policy before reporting security related issues/bugs.
options:
- label: I agree to have read this project [Security Policy](https://github.com/louislam/uptime-kuma/security/policy)
required: true
- type: textarea
id: steps-to-reproduce
validations:
required: true
attributes:
label: "📝 Describe your problem"
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..."
- type: textarea
id: error-msg
validations:
required: false
attributes:
label: "📝 Error Message(s) or Log"
- type: input
id: uptime-kuma-version
attributes:
label: "🐻 Uptime-Kuma Version"
description: "Which version of Uptime-Kuma are you running? Please do NOT provide the docker tag such as latest or 1"
placeholder: "Ex. 1.10.0"
validations:
required: true
- type: input
id: operating-system
attributes:
label: "💻 Operating System and Arch"
description: "Which OS is your server/device running on? (For Replit, please do not report this bug)"
placeholder: "Ex. Ubuntu 20.04 x86"
validations:
required: true
- type: input
id: browser-vendor
attributes:
label: "🌐 Browser"
description: "Which browser are you running on? (For Replit, please do not report this bug)"
placeholder: "Ex. Google Chrome 95.0.4638.69"
validations:
required: true
- type: textarea
id: deployment-info
attributes:
label: "🖥️ Deployment Environment"
description: |
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:
required: true

View file

@ -1,120 +0,0 @@
---
name: ❓ Ask for help
description: |
Submit any question related to Uptime Kuma
#title: "[Help]"
labels: ["help"]
body:
- type: markdown
attributes:
value: |
🚫 **We kindly ask you to refrain from pinging maintainers unless absolutely necessary. Pings are reserved for critical/urgent issues that require immediate attention.**
**Why**: Reserving pings for urgent matters ensures maintainers can prioritize critical tasks effectively
- type: checkboxes
id: no-duplicate-question
attributes:
label: ⚠️ Please verify that your question has not already been reported
description: |
To avoid duplicate reports, please search for any existing issues before submitting a new one. You can find the list of existing issues **[HERE](https://github.com/louislam/uptime-kuma/issues?q=is%3Aissue%20sort%3Acreated-desc%20)**.
options:
- label: |
I have searched the [existing issues](https://github.com/louislam/uptime-kuma/issues?q=is%3Aissue%20sort%3Acreated-desc%20) and found no similar reports.
required: true
- type: checkboxes
id: security-policy
attributes:
label: 🛡️ Security Policy
description: |
Please review and acknowledge the Security Policy before reporting any security-related issues or bugs. You can find the full Security Policy **[HERE](https://github.com/louislam/uptime-kuma/security/policy)**.
options:
- label: |
I have read and agree to Uptime Kuma's [Security Policy](https://github.com/louislam/uptime-kuma/security/policy).
required: true
- type: textarea
id: steps-to-reproduce
validations:
required: true
attributes:
label: 📝 Describe your problem
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 ...
- type: textarea
id: error-msg
attributes:
label: 📝 Error Message(s) or Log
description: |
Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash session
validations:
required: false
- type: input
id: uptime-kuma-version
attributes:
label: 🐻 Uptime-Kuma Version
description: |
What version of Uptime-Kuma are you running? Please do not provide Docker tags like `latest` or `1`.
placeholder: |
e.g., 1.23.16 or 2.0.0-beta.2
validations:
required: true
- type: input
id: operating-system
attributes:
label: 💻 Operating System and Arch
description: |
Which OS is your server/device running on? (For Replit, please do not report this bug)
placeholder: |
e.g., Ubuntu Server 24.04.2 LTS (GNU/Linux 6.8.0-55-generic x86_64)
validations:
required: true
- type: input
id: browser-vendor
attributes:
label: 🌐 Browser
description: |
Which browser are you running on? (For Replit, please do not report this bug)
placeholder: |
e.g., Google Chrome 134.0.6998.183 (Official Build) (64-bit)
validations:
required: true
- type: textarea
id: deployment-info
attributes:
label: 🖥️ Deployment Environment
description: |
Provide details about the deployment environment, including runtime components, databases, and storage configurations. This will
help assess the infrastructure and identify any potential compatibility requirements.
**Remove any fields that do not apply to your setup.**
value: |
- **Runtime Environment**:
- Docker: Version `X.X.X` (Build `Y.Y.Y`)
- Docker Compose: Version `X.X.X`
- Portainer (BE/CE): Version `X.X.X` (LTS: Yes/No)
- MariaDB: Version `X.X.X` (LTS: Yes/No)
- Node.js: Version `X.X.X` (LTS: Yes/No)
- Kubernetes (K3S/K8S): Version `X.X.X` (LTS: Yes/No, via `[method/tool]`)
- **Database**:
- SQLite: Embedded
- MariaDB: Embedded/External
- **Database Storage**:
- **Filesystem**:
- Linux: ext4/XFS/Btrfs/ZFS/F2FS
- macOS: APFS/ HFS+
- Windows: NTFS/ReFS
- **Storage Medium**: HDD/eMMC/SSD/NVMe
- **Uptime Kuma Setup**:
- Number of monitors: `X`
validations:
required: true

100
.github/ISSUE_TEMPLATE/bug_report.yaml vendored Normal file
View file

@ -0,0 +1,100 @@
name: "🐛 Bug Report"
description: "Submit a bug report to help us improve"
#title: "[Bug] "
labels: [bug]
body:
- type: textarea
id: related-issues
validations:
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
attributes:
label: "🛡️ Security Policy"
description: Please review the security policy before reporting security related issues/bugs.
options:
- label: I agree to have read this project [Security Policy](https://github.com/louislam/uptime-kuma/security/policy)
required: true
- type: textarea
id: description
validations:
required: false
attributes:
label: "Description"
description: "You could also upload screenshots"
- type: textarea
id: steps-to-reproduce
validations:
required: true
attributes:
label: "👟 Reproduction steps"
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: "..."
- type: textarea
id: expected-behavior
validations:
required: true
attributes:
label: "👀 Expected behavior"
description: "What did you think would happen?"
placeholder: "..."
- type: textarea
id: actual-behavior
validations:
required: true
attributes:
label: "😓 Actual Behavior"
description: "What actually happen?"
placeholder: "..."
- type: input
id: uptime-kuma-version
attributes:
label: "🐻 Uptime-Kuma Version"
description: "Which version of Uptime-Kuma are you running? Please do NOT provide the docker tag such as latest or 1"
placeholder: "Ex. 1.10.0"
validations:
required: true
- type: input
id: operating-system
attributes:
label: "💻 Operating System and Arch"
description: "Which OS is your server/device running on? (For Replit, please do not report this bug)"
placeholder: "Ex. Ubuntu 20.04 x64 "
validations:
required: true
- type: input
id: browser-vendor
attributes:
label: "🌐 Browser"
description: "Which browser are you running on?"
placeholder: "Ex. Google Chrome 95.0.4638.69"
validations:
required: true
- type: textarea
id: deployment-info
attributes:
label: "🖥️ Deployment Environment"
description: |
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:
required: true
- type: textarea
id: logs
attributes:
label: "📝 Relevant log output"
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
validations:
required: false

View file

@ -1,154 +0,0 @@
---
name: 🐛 Bug Report
description: |
Submit a bug report to help us improve
#title: "[Bug]"
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
🚫 **We kindly ask you to refrain from pinging maintainers unless absolutely necessary. Pings are reserved for critical/urgent issues that require immediate attention.**
**Why**: Reserving pings for urgent matters ensures maintainers can prioritize critical tasks effectively
- type: textarea
id: related-issues
validations:
required: true
attributes:
label: 📑 I have found these related issues/pull requests
description: |
Please search for related **[ISSUES](https://github.com/louislam/uptime-kuma/issues?q=is%3Aissue%20sort%3Acreated-desc)**
and **[PULL REQUESTS](https://github.com/louislam/uptime-kuma/pulls?q=is%3Apr+sort%3Acreated-desc+)**.
Explain the differences between them or clarify if you were unable to find any related issues/pull requests.
placeholder: |
Example: This relates to issue #1, which also affects the ... system. It should not be merged because ...
- type: checkboxes
id: security-policy
attributes:
label: 🛡️ Security Policy
description: |
Please review and acknowledge the Security Policy before reporting any security-related issues or bugs. You can find the full Security Policy **[HERE](https://github.com/louislam/uptime-kuma/security/policy)**.
options:
- label: |
I have read and agree to Uptime Kuma's [Security Policy](https://github.com/louislam/uptime-kuma/security/policy).
required: true
- type: textarea
id: description
validations:
required: false
attributes:
label: 📝 Description
description: |
You could also upload screenshots
- type: textarea
id: steps-to-reproduce
validations:
required: true
attributes:
label: 👟 Reproduction steps
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: |
...
- type: textarea
id: expected-behavior
validations:
required: true
attributes:
label: 👀 Expected behavior
description: |
What did you think would happen?
placeholder: |
...
- type: textarea
id: actual-behavior
validations:
required: true
attributes:
label: 😓 Actual Behavior
description: |
What actually happen?
placeholder: |
...
- type: input
id: uptime-kuma-version
attributes:
label: 🐻 Uptime-Kuma Version
description: |
What version of Uptime-Kuma are you running? Please do not provide Docker tags like `latest` or `1`.
placeholder: |
e.g., 1.23.16 or 2.0.0-beta.2
validations:
required: true
- type: input
id: operating-system
attributes:
label: 💻 Operating System and Arch
description: |
Which OS is your server/device running on? (For Replit, please do not
report this bug)
placeholder: |
e.g., Ubuntu Server 24.04.2 LTS (GNU/Linux 6.8.0-55-generic x86_64)
validations:
required: true
- type: input
id: browser-vendor
attributes:
label: 🌐 Browser
description: |
Which browser are you running on?
placeholder: |
e.g., Google Chrome 134.0.6998.183 (Official Build) (64-bit)
validations:
required: true
- type: textarea
id: deployment-info
attributes:
label: 🖥️ Deployment Environment
description: |
Provide details about the deployment environment, including runtime components, databases, and storage configurations. This will
help assess the infrastructure and identify any potential compatibility requirements.
**Remove any fields that do not apply to your setup.**
value: |
- **Runtime Environment**:
- Docker: Version `X.X.X` (Build `Y.Y.Y`)
- Docker Compose: Version `X.X.X`
- Portainer (BE/CE): Version `X.X.X` (LTS: Yes/No)
- MariaDB: Version `X.X.X` (LTS: Yes/No)
- Node.js: Version `X.X.X` (LTS: Yes/No)
- Kubernetes (K3S/K8S): Version `X.X.X` (LTS: Yes/No, via `[method/tool]`)
- **Database**:
- SQLite: Embedded
- MariaDB: Embedded/External
- **Database Storage**:
- **Filesystem**:
- Linux: ext4/XFS/Btrfs/ZFS/F2FS
- macOS: APFS/ HFS+
- Windows: NTFS/ReFS
- **Storage Medium**: HDD/eMMC/SSD/NVMe
- **Uptime Kuma Setup**:
- Number of monitors: `X`
validations:
required: true
- type: textarea
id: logs
attributes:
label: 📝 Relevant log output
description: |
Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: bash session
validations:
required: false

View file

@ -0,0 +1,66 @@
name: 🚀 Feature Request
description: "Submit a proposal for a new feature"
#title: "[Feature] "
labels: [feature-request]
body:
- type: textarea
id: related-issues
validations:
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
id: feature-area
attributes:
label: "🏷️ Feature Request Type"
description: "What kind of feature request is this?"
multiple: true
options:
- API / automation options
- New notification-provider
- Change to existing notification-provider
- New monitor
- Change to existing monitor
- Dashboard
- Status-page
- Maintenance
- Deployment
- Certificate expiry
- Settings
- Other
validations:
required: true
- type: textarea
id: feature-description
validations:
required: true
attributes:
label: "🔖 Feature description"
description: "A clear and concise description of what the feature request is."
placeholder: "You should add ..."
- type: textarea
id: solution
validations:
required: true
attributes:
label: "✔️ Solution"
description: "A clear and concise description of what you want to happen."
placeholder: "In my use-case, ..."
- type: textarea
id: alternatives
validations:
required: false
attributes:
label: "❓ Alternatives"
description: "A clear and concise description of any alternative solutions or features you've considered."
placeholder: "I have considered ..."
- type: textarea
id: additional-context
validations:
required: false
attributes:
label: "📝 Additional Context"
description: "Add any other context or screenshots about the feature request here."
placeholder: "..."

View file

@ -1,93 +0,0 @@
---
name: 🚀 Feature Request
description: |
Submit a proposal for a new feature
# title: "[Feature]"
labels: ["feature-request"]
body:
- type: markdown
attributes:
value: |
### 🚫 Please Avoid Unnecessary Pinging of Maintainers
We kindly ask you to refrain from pinging maintainers unless absolutely necessary.
Pings are for critical/urgent pull requests that require immediate attention.
- type: textarea
id: related-issues
validations:
required: true
attributes:
label: 📑 I have found these related issues/pull requests
description: |
Please search for related **[ISSUES](https://github.com/louislam/uptime-kuma/issues?q=is%3Aissue%20sort%3Acreated-desc)**
and **[PULL REQUESTS](https://github.com/louislam/uptime-kuma/pulls?q=is%3Apr+sort%3Acreated-desc+)**.
Explain the differences between them or clarify if you were unable to find any related issues/pull requests.
placeholder: |
Example: This relates to issue #1, which also affects the ... system. It should not be merged because ...
- type: dropdown
id: feature-area
attributes:
label: 🏷️ Feature Request Type
description: |
What kind of feature request is this?
multiple: true
options:
- API / automation options
- New notification-provider
- Change to existing notification-provider
- New monitor
- Change to existing monitor
- Dashboard
- Status-page
- Maintenance
- Deployment
- Certificate expiry
- Settings
- Other
validations:
required: true
- type: textarea
id: feature-description
validations:
required: true
attributes:
label: 🔖 Feature description
description: |
A clear and concise description of what the feature request is.
placeholder: |
You should add ...
- type: textarea
id: solution
validations:
required: true
attributes:
label: ✔️ Solution
description: |
A clear and concise description of what you want to happen.
placeholder: |
In my use-case, ...
- type: textarea
id: alternatives
validations:
required: false
attributes:
label: ❓ Alternatives
description: |
A clear and concise description of any alternative solutions or features you've considered.
placeholder: |
I have considered ...
- type: textarea
id: additional-context
validations:
required: false
attributes:
label: 📝 Additional Context
description: |
Add any other context or screenshots about the feature request here.
placeholder: |
...

View file

@ -1,19 +1,19 @@
---
name: 🛡️ Security Issue
name: "🛡️ Security Issue"
description: |
Notify Louis Lam about a security concern. Please do NOT include any sensitive details in this issue.
# title: "Security Issue"
labels: ["security"]
labels: [security]
assignees: [louislam]
body:
- type: markdown
- type: "markdown"
attributes:
value: |
## ❗ IMPORTANT: DO NOT SHARE VULNERABILITY DETAILS HERE
## **⚠️ Report a Security Vulnerability**
### ⚠️ Report a Security Vulnerability
### **IMPORTANT: DO NOT SHARE VULNERABILITY DETAILS HERE**
**If you have discovered a security vulnerability, please report it securely using the GitHub Security Advisory.**
If you have discovered a security vulnerability, please report it securely using the GitHub Security Advisory.
**Note**: This issue is only for notifying the maintainers of the repository, as the GitHub Security Advisory does not automatically send notifications.
@ -34,12 +34,12 @@ body:
Once you've created your advisory, please share the URL below. This will notify Louis Lam and enable them to take the appropriate action.
- type: textarea
- type: "textarea"
id: github-advisory-url
validations:
required: true
attributes:
label: GitHub Advisory URL for @louislam
label: "GitHub Advisory URL for @louislam"
placeholder: |
Please paste the GitHub Advisory URL here. Only the URL is required.
Example: https://github.com/louislam/uptime-kuma/security/advisories/GHSA-8h5r-7t6l-q3kz

View file

@ -1,80 +1,33 @@
## ❗ Important Announcements
⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
<details><summary>Click here for more details:</summary>
</p>
Tick the checkbox if you understand [x]:
- [ ] I have read and understand the pull request rules.
**⚠️ Please Note: We do not accept all types of pull requests, and we want to ensure we dont waste your time. Before submitting, make sure you have read our pull request guidelines: [Pull Request Rules](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma)**
# Description
### 🚫 Please Avoid Unnecessary Pinging of Maintainers
Fixes #(issue)
We kindly ask you to refrain from pinging maintainers unless absolutely necessary. Pings are for critical/urgent pull requests that require immediate attention.
## Type of change
</p>
</details>
Please delete any options that are not relevant.
## 📋 Overview
- Bug fix (non-breaking change which fixes an issue)
- User interface (UI)
- New feature (non-breaking change which adds functionality)
- Breaking change (a fix or feature that would cause existing functionality to not work as expected)
- Other
- This change requires a documentation update
<!-- Provide a clear summary of the purpose and scope of this pull request:-->
## Checklist
- **What problem does this pull request address?**
- Please provide a detailed explanation here.
- **What features or functionality does this pull request introduce or enhance?**
- Please provide a detailed explanation here.
- [ ] My code follows the style guidelines of this project
- [ ] I ran ESLint and other linters for modified files
- [ ] I have performed a self-review of my own code and tested it
- [ ] I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
- [ ] My changes generates no new warnings
- [ ] My code needed automated testing. I have added them (this is optional task)
<!--
Please link any GitHub issues or tasks that this pull request addresses.
Use the appropriate issue numbers or links to enable auto-closing.
-->
## Screenshots (if any)
- Relates to #issue-number
- Resolves #issue-number
## 🛠️ Type of change
<!-- Please select all options that apply -->
- [ ] 🐛 Bugfix (a non-breaking change that resolves an issue)
- [ ] ✨ New feature (a non-breaking change that adds new functionality)
- [ ] ⚠️ Breaking change (a fix or feature that alters existing functionality in a way that could cause issues)
- [ ] 🎨 User Interface (UI) updates
- [ ] 📄 New Documentation (addition of new documentation)
- [ ] 📄 Documentation Update (modification of existing documentation)
- [ ] 📄 Documentation Update Required (the change requires updates to related documentation)
- [ ] 🔧 Other (please specify):
- Provide additional details here.
## 📄 Checklist
<!-- Please select all options that apply -->
- [ ] 🔍 My code adheres to the style guidelines of this project.
- [ ] 🦿 I have indicated where (if any) I used an LLM for the contributions
- [ ] ✅ I ran ESLint and other code linters for modified files.
- [ ] 🛠️ I have reviewed and tested my code.
- [ ] 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
- [ ] ⚠️ My changes generate no new warnings.
- [ ] 🤖 My code needed automated testing. I have added them (this is an optional task).
- [ ] 📄 Documentation updates are included (if applicable).
- [ ] 🔒 I have considered potential security impacts and mitigated risks.
- [ ] 🧰 Dependency updates are listed and explained.
- [ ] 📚 I have read and understood the [Pull Request guidelines](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#recommended-pull-request-guideline).
## 📷 Screenshots or Visual Changes
<!--
If this pull request introduces visual changes, please provide the following details.
If not, remove this section.
Please upload the image directly here by pasting it or dragging and dropping.
Avoid using external image services as the image will be uploaded automatically.
-->
- **UI Modifications**: Highlight any changes made to the user interface.
- **Before & After**: Include screenshots or comparisons (if applicable).
| Event | Before | After |
| ------------------ | --------------------- | -------------------- |
| `UP` | ![Before](image-link) | ![After](image-link) |
| `DOWN` | ![Before](image-link) | ![After](image-link) |
| Certificate-expiry | ![Before](image-link) | ![After](image-link) |
| Testing | ![Before](image-link) | ![After](image-link) |
Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

View file

@ -1,224 +0,0 @@
# Uptime Kuma Review Guidelines
> [!NOTE]
> These review guidelines are a work in progress, and are frequently
> updated and improved, so please check back frequently for the latest version.
## Preparing for a PR Review
### Read the PR description carefully
Make sure you understand what the PR is trying to solve or implement. This could
be a bug fix, a new feature, or a refactor.
### Check the linked issues
If the PR has a linked issue, read it to better understand the context and the
reason for the change.
### Check the test coverage
Make sure relevant tests have been added or modified. If the PR adds new
functionality, there should be tests covering the change.
## General Review
### Code formatting and style
Check if the code adheres to the style guidelines of the project. Make sure
there are no unused imports, variables, `console.log` for debugging in the PR.
- [Project Style](../CONTRIBUTING.md#project-styles)
- [Coding Style](../CONTRIBUTING.md#coding-styles)
### Readability and maintainability
Is the code easy to understand for other developers? Make sure complex parts are
explained with comments about **_why_** something is done, and use clear names
to show **_how_**. Are variables and functions well-named, and is there a
consistent naming style? Also, check if the code is maintainable:
- Is it unnecessarily complex? Could it be simplified?
- Does it follow the **[Single Responsibility Principle (SRP)]**?
[Single Responsibility Principle (SRP)]: https://www.geeksforgeeks.org/single-responsibility-in-solid-design-principle/
### Documentation
Is the PR well documented? Check if the descriptions of functions, parameters,
and return values are present. Are there any changes needed to the README or
other documentation, for example, if new features or configurations are
introduced?
## Functional Review
### Testing
Ensure that the new code is properly tested. This includes unit tests,
integration tests, and if necessary, end-to-end tests.
### Test results
Did all tests pass in the CI pipeline (e.g., GitHub Actions, Travis, CircleCI)?
### Testing in different environments
If the changes depend on certain environments or configurations, verify that the
code has been tested in various environments (e.g., local development, staging,
production).
- [How to test Pull Requests](https://github.com/louislam/uptime-kuma/wiki/Test-Pull-Requests)
### Edge cases and regressions
- Are there test cases for possible edge cases?
- Could this change introduce regressions in other parts of the system?
## Security
### Security issues
Check for potential security problems, such as SQL injection, XSS attacks, or
unsafe API calls. Are there passwords, tokens, or other sensitive data left in
the code by mistake?
### Authentication and authorization
Is access to sensitive data or functionality properly secured? Check that the
correct authorization and authentication mechanisms are in place.
### Security Best Practices
- Ensure that the code is free from common vulnerabilities like **SQL
injection**, **XSS attacks**, and **insecure API calls**.
- Check for proper encryption of sensitive data, and ensure that **passwords**
or **API tokens** are not hardcoded in the code.
## Performance
### Performance impact
Check if the changes negatively impact performance. This can include factors
like load times, memory usage, or other performance aspects.
### Use of external libraries
- Have the right libraries been chosen?
- Are there unnecessary dependencies that might reduce performance or increase
code complexity?
- Are these dependencies actively maintained and free of known vulnerabilities?
### Performance Best Practices
- **Measure performance** using tools like Lighthouse or profiling libraries.
- **Avoid unnecessary dependencies** that may bloat the codebase.
- Ensure that the **code does not degrade the user experience** (e.g., by
increasing load times or memory consumption).
## Compliance and Integration
### Alignment with the project
Are the changes consistent with the project goals and requirements? Ensure the
PR aligns with the architecture and design principles of the project.
### Integration
If the PR depends on other PRs or changes, verify that they integrate well with
the rest of the project. Ensure the code does not cause conflicts with other
active PRs.
### Backward compatibility
Does the change break compatibility with older versions of the software or
dependencies? If so, is there a migration plan in place?
## Logging and Error Handling
### Proper error handling
- Are errors properly caught and handled instead of being silently ignored?
- Are exceptions used appropriately?
### Logging
- Is sufficient logging included for debugging and monitoring?
- Is there excessive logging that could affect performance?
## Accessibility (for UI-related changes)
If the PR affects the user interface, ensure that it meets accessibility
standards:
- Can users navigate using only the keyboard?
- Are screen readers supported?
- Is there proper color contrast for readability?
- Are there **WCAG** (Web Content Accessibility Guidelines) compliance issues?
- Use tools like **Axe** or **Lighthouse** to evaluate accessibility.
## Providing Feedback
### Constructive feedback
Provide clear, constructive feedback on what is good and what can be improved.
If improvements are needed, be specific about what should change.
### Clarity and collaboration
Ensure your feedback is friendly and open, so the team member who submitted the
PR feels supported and motivated to make improvements.
<details><summary><b>For Maintainers only</b> (click to expand)</summary>
<p>
## Go/No-Go Decision
### Go
If the code has no issues and meets the project requirements, approve it (and
possibly merge it).
### No-Go
If there are significant issues, such as missing tests, security
vulnerabilities, or performance problems, request the necessary changes before
the PR can be approved. Some examples of **significant issues** include:
- Missing tests for new functionality.
- Identified **security vulnerabilities**.
- Code changes that break **backward compatibility** without a proper migration
plan.
- Code that causes **major performance regressions** (e.g., high CPU/memory
usage).
## After the Review
### Reordering and merging
Once the necessary changes have been made and the PR is approved, the code can
be merged into the main branch (e.g., `main` or `master`).
### Testing after merging
Ensure that the build passes after merging the PR, and re-test the functionality
in the production environment if necessary.
## Follow-up
### Communication with team members
If the PR has long-term technical or functional implications, communicate the
changes to the team.
### Monitoring
Continue monitoring the production environment for any unexpected issues that
may arise after the code has been merged.
</p>
</details>
---
This process ensures that PRs are systematically and thoroughly reviewed,
improving overall code quality.

View file

@ -6,8 +6,8 @@ We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
@ -52,7 +52,7 @@ decisions when appropriate.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
@ -60,8 +60,8 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
<uptime@kuma.pet>. All complaints will be reviewed and investigated promptly and
fairly.
uptime@kuma.pet.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
@ -82,15 +82,15 @@ behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
@ -109,24 +109,20 @@ Violating these terms may lead to a permanent ban.
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View file

@ -1,18 +1,16 @@
# Project Info
First of all, I want to thank everyone who has submitted 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.
First of all, I want to thank everyone who has submitted 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` 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 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`.
For production, the frontend is built into the `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.
For production, the frontend is built into the `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.
## Directories
@ -27,92 +25,60 @@ development, we run vite in development mode on another port.
- `src` (Frontend source code)
- `test` (unit test)
## Can I Create a Pull Request for Uptime Kuma?
## Can I create a pull request for Uptime Kuma?
Whether or not you can create a pull request depends on the nature of your
contribution. We value both your time and our maintainers' time, so we want to
make sure it's spent efficiently.
Yes or no, it depends on what you will try to do.
Both yours and our maintainers' time is precious, and we don't want to waste either.
If you're unsure about any process or step, you're probably not the only one
with that question—please feel free to ask. We're happy to help!
If you have any questions about any process/.. is not clear, you are likely not alone => please ask them ^^
Different types of pull requests (PRs) may have different guidelines, so be sure
to review the appropriate one for your contribution.
- <details><summary><b>Security Fixes</b> (click to expand)</summary>
Different guidelines exist for different types of pull requests (PRs):
- <details><summary><b>security fixes</b></summary>
<p>
Submitting security fixes is something that may put the community at risk.
Please read through our [security policy](SECURITY.md) and submit
vulnerabilities via an [advisory] + [issue] instead. 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 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.
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)
[advisory]: https://github.com/louislam/uptime-kuma/security/advisories/new
[issue]:
https://github.com/louislam/uptime-kuma/issues/new?template=security_issue.yml
</p>
</details>
- <details><summary><b>Small, Non-Breaking Bug Fixes</b> (click to expand)</summary>
- <details><summary><b>small, non-breaking bug fixes</b></summary>
<p>
If you come across a bug and think you can solve, we appreciate your work.
Please make sure that you follow these rules:
- keep the PR as small as possible, fix only one thing at a time => keeping it
reviewable
- keep the PR as small as possible, fix only one thing at a time => keeping it reviewable
- test that your code does what you claim it does.
<sub>Because maintainer time is precious, junior maintainers may merge
uncontroversial PRs in this area.</sub>
<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> (click to expand)</summary>
- <details><summary><b>translations / internationalisation (i18n)</b></summary>
<p>
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).
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).
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 necessary
- 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>
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> (click to expand)</summary>
- <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.
- `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(...);
@ -121,343 +87,131 @@ to review the appropriate one for your contribution.
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:
- `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
- 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 ^^*
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 sure you have tested the notification provider, please include
screenshots of the following events in the pull-request description:
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 sure 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/>
- Certificate Expiry via https://expired.badssl.com/
- Testing (the test button on the notification provider setup page)
<br/>
Using the following way to format this is encouraged:
```md
| Event | Before | After |
| ------------------ | --------------------- | -------------------- |
| `UP` | ![Before](image-link) | ![After](image-link) |
| `DOWN` | ![Before](image-link) | ![After](image-link) |
| Certificate-expiry | ![Before](image-link) | ![After](image-link) |
| Testing | ![Before](image-link) | ![After](image-link) |
------------------
| `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>
<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> (click to expand)</summary>
- <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 successful
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 ^^_
- `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 successful 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
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>
<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> (click to expand)</summary>
- <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 when 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>
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 when 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>
- <details><summary><b>Pull Request Guidelines</b> (click to expand)</summary>
<p>
## Steps to Submit a Pull Request
1. **Fork** the [Uptime-Kuma repository].
[Uptime-Kuma repository]: https://github.com/louislam/uptime-kuma/
2. **Clone** your forked repository to your local machine.
3. **Create a new branch** for your changes (e.g.,
`feature/add-new-notification-provider-signal`).
4. **Initiate a discussion before making major changes** by creating an empty
commit:
```sh
git commit -m "<YOUR TASK NAME>" --allow-empty
```
5. **Push** your branch to your forked repository.
6. **Open a pull request** using this link: [Compare & Pull Request].
[Compare & Pull Request]: https://github.com/louislam/uptime-kuma/compare/
7. **Select the correct source and target branches**.
8. **Link to related issues** for context.
9. **Provide a clear and concise description** explaining the changes and
their purpose.
- **Type of changes**
- Bugfix (a non-breaking change that resolves an issue)
- New feature (a non-breaking change that adds new functionality)
- Breaking change (a fix or feature that alters existing functionality in a
way that could cause issues)
- User Interface (UI) updates
- New Documentation (addition of new documentation)
- Documentation Update (modification of existing documentation)
- Documentation Update Required (the change requires updates to related
documentation)
- Other (please specify):
- Provide additional details here.
- **Checklist**
- My code adheres to the style guidelines of this project.
- I ran ESLint and other code linters for modified files.
- I have reviewed and tested my code.
- I have commented my code, especially in hard-to-understand areas (e.g.,
using JSDoc for methods).
- My changes generate no new warnings.
- My code needed automated testing. I have added them (this is an optional
task).
- Documentation updates are included (if applicable).
- I have considered potential security impacts and mitigated risks.
- Dependency updates are listed and explained.
- I have read and understood the
[Pull Request guidelines](#recommended-pull-request-guideline).
10. **When publishing your PR, set it as a** `Draft pull request` **to allow
for review and prevent automatic merging.**
11. **Maintainers will assign relevant labels** (e.g., `A:maintenance`,
`A:notifications`).
12. **Complete the PR checklist**, ensuring that:
- Documentation is updated if necessary.
- Tests are written or updated.
- CI/CD checks pass successfully.
13. **Request feedback** from team members to refine your changes before the
final review.
## When Can You Change the PR Status to "Ready for Review"?
A PR should remain in **draft status** until all tasks are completed. Only
change the status to **Ready for Review** when:
- You have implemented all planned changes.
- You have addressed all feedback.
- Your code is fully tested and ready for integration.
- You have updated or created the necessary tests.
- You have verified that CI/CD checks pass successfully.
<br />
A **work-in-progress (WIP) PR** must stay in **draft status** until everything
is finalized.
<sub>Since maintainer time is valuable, junior maintainers may merge
uncontroversial PRs.</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
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.
- (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.
- **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 ([@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], if I 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.
[milestone]: https://github.com/louislam/uptime-kuma/milestones
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.
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?
## I'd like to work on an issue. How do I do that?
We have found that assigning people to issues is unnecessary management
overhead. Instead, a short comment stating that you want to work on an issue is
appreciated, as it saves time for other developers. If you encounter any
problems during development, feel free to leave a comment describing what you
are stuck on.
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
Before jumping into coding, it's recommended to initiate a discussion by
creating an empty pull request. This approach allows us to align on the
direction and scope of the feature, ensuring it doesn't conflict with existing
or planned work. It also provides an opportunity to identify potential pitfalls
early on, helping to avoid issues down the line.
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 [Uptime-Kuma repository].
2. **Clone** your forked repository to your local machine.
3. **Create a new branch** for your changes (e.g.,
`feature/add-new-notification-provider-signal`).
4. **Initiate a discussion before making major changes** by creating an empty
commit:
```sh
git commit -m "<YOUR TASK NAME>" --allow-empty
```
5. **Push** your branch to your forked repository.
6. **Open a pull request** using this link: [Compare & Pull Request].
7. **Select the correct source and target branches**.
8. **Link to related issues** for context.
9. **Provide a clear and concise description** explaining the changes and their
purpose.
- **Type of changes**
- Bugfix (a non-breaking change that resolves an issue)
- New feature (a non-breaking change that adds new functionality)
- Breaking change (a fix or feature that alters existing functionality in a
way that could cause issues)
- User Interface (UI) updates
- New Documentation (addition of new documentation)
- Documentation Update (modification of existing documentation)
- Documentation Update Required (the change requires updates to related
documentation)
- Other (please specify):
- Provide additional details here.
- **Checklist**
- My code adheres to the style guidelines of this project.
- I ran ESLint and other code linters for modified files.
- I have reviewed and tested my code.
- I have commented my code, especially in hard-to-understand areas (e.g.,
using JSDoc for methods).
- My changes generate no new warnings.
- My code needed automated testing. I have added them (this is an optional
task).
- Documentation updates are included (if applicable).
- I have considered potential security impacts and mitigated risks.
- Dependency updates are listed and explained.
- I have read and understood the
[Pull Request guidelines](#recommended-pull-request-guideline).
10. **When publishing your PR, set it as a** `Draft pull request` **to allow for
review and prevent automatic merging.**
11. **Maintainers will assign relevant labels** (e.g., `A:maintenance`,
`A:notifications`).
12. **Complete the PR checklist**, ensuring that:
- Documentation is updated if necessary.
- Tests are written or updated.
- CI/CD checks pass successfully.
13. **Request feedback** from team members to refine your changes before the
final review.
### When Can You Change the PR Status to "Ready for Review"?
A PR should remain in **draft status** until all tasks are completed. Only
change the status to **Ready for Review** when:
- You have implemented all planned changes.
- You have addressed all feedback.
- Your code is fully tested and ready for integration.
- You have updated or created the necessary tests.
- You have verified that CI/CD checks pass successfully.
A **work-in-progress (WIP) PR** must stay in **draft status** until everything
is finalized.
1. Fork the project
2. Clone your fork repo to local
3. Create a new branch
4. Create an empty commit: `git commit -m "<YOUR TASK NAME>" --allow-empty`
5. Push to your fork repo
6. Prepare 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.
8. Create your pull request as a Draft
9. Wait for the discussion
## Project Styles
I personally do not like something that requires a lot of configuration before
you can finally start the app. The goal is to make the Uptime Kuma installation
as easy as installing a mobile app.
I personally do not like something that requires a lot of configuration 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 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`
- 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
@ -479,18 +233,13 @@ as easy as installing a mobile app.
- [`Node.js`](https://nodejs.org/) >= 18
- [`npm`](https://www.npmjs.com/) >= 9.3
- [`git`](https://git-scm.com/)
- 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/))
- 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/))
## 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.
- `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
@ -511,8 +260,7 @@ Port `3000` and port `3001` will be used.
npm run dev
```
But sometimes you may want to restart the server without restarting the
frontend. In that case, you can run these commands in two terminals:
But sometimes you may want to restart the server without restarting the frontend. In that case, you can run these commands in two terminals:
```bash
npm run start-frontend-dev
@ -523,9 +271,9 @@ npm run start-server-dev
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:
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:
- as an entry point for redirecting to a status page or the dashboard
- the frontend built files (`index.html`, `*.js`, `*.css`, etc.)
@ -541,13 +289,11 @@ in the `socket.io` handlers. `express.js` is also used to serve:
- `routers/` (Express Routers)
- `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`)
- `uptime-kuma-server.js` (UptimeKumaServer class, main logic should be here, but some still in `server.js`)
## Frontend Dev Server
It binds to `0.0.0.0:3000` by default. The 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.
@ -561,19 +307,17 @@ npm run build
### Frontend Details
Uptime Kuma Frontend is a single page application (SPA). Most paths are handled
by Vue Router.
Uptime Kuma Frontend is a single page application (SPA). Most paths are handled by Vue Router.
The router is in `src/router.js`
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.
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`.
## Database Migration
See: <https://github.com/louislam/uptime-kuma/tree/master/db/knex_migrations>
See: https://github.com/louislam/uptime-kuma/tree/master/db/knex_migrations
## Unit Test
@ -584,12 +328,11 @@ npm test
## 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"
- Examples: - `vue`, `chart.js`
- Examples: `vue`, `chart.js`
- Backend dependencies = "dependencies"
- Examples: `socket.io`, `sqlite3`
- Development dependencies = "devDependencies"
@ -597,41 +340,31 @@ is usually also baked into `dist` files. So:
### Update Dependencies
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.
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/))
If for security / bug / other reasons, a library must be updated, breaking
changes need to be checked by the person proposing the change.
If for security / bug / other reasons, a library must be updated, breaking changes need to be checked by the person proposing the change.
## Translations
Please add **all** the strings which are translatable to `src/lang/en.json` (if
translation keys are omitted, 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 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.
**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].
[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
Feel free to correct the grammar in the documentation or code. My mother
language is not English and my grammar is not that great.
Feel free to correct the grammar in the documentation or code.
My mother language is not English and my grammar is not that great.
## Wiki
Since there is no way to make a pull request to the wiki, 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
@ -672,7 +405,7 @@ repo to do that.
## Maintainer
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
### What is a maintainer and what are their roles?
@ -680,7 +413,7 @@ This project has multiple maintainers who 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 |
@ -688,49 +421,39 @@ Currently, there are 3 maintainers:
### Procedures
We have a few procedures we follow. These are documented here:
- <details><summary><b>Set up a Docker Builder</b> (click to expand)</summary>
- <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.
- 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.
```bash
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.
```bash
```
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.
```bash
```
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`
```
docker buildx inspect kuma-builder
docker buildx ls
```
</p>
</details>
- <details><summary><b>Release</b> (click to expand)</summary>
- <details><summary>Release</summary>
<p>
1. Draft a release note
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`
4. `npm run release-final` with env vars: `VERSION` and `GITHUB_TOKEN`
5. Wait until the `Press any key to continue`
6. `git push`
@ -740,16 +463,13 @@ We have a few procedures we follow. These are documented here:
These Items need to be checked:
- [ ] 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)
- [ ] 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 clean installation with Node.js
</p>
</details>
- <details><summary><b>Release Beta</b> (click to expand)</summary>
- <details><summary>Release Beta</summary>
<p>
1. Draft a release note, check `This is a pre-release`
@ -761,8 +481,7 @@ We have a few procedures we follow. These are documented here:
</p>
</details>
- <details><summary><b>Release Wiki</b> (click to expand)</summary>
- <details><summary>Release Wiki</summary>
<p>
**Setup Repo**
@ -782,8 +501,7 @@ We have a few procedures we follow. These are documented here:
</p>
</details>
- <details><summary>Change the base of a pull request such as <code>master</code> to <code>1.23.X</code> (click to expand)</summary>
- <details><summary>Change the base of a pull request such as <code>master</code> to <code>1.23.X</code></summary>
<p>
```bash

View file

@ -2,33 +2,25 @@
## Reporting a Vulnerability
1. Please report security issues to
<https://github.com/louislam/uptime-kuma/security/advisories/new>.
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>
1. Please report security issues to https://github.com/louislam/uptime-kuma/security/advisories/new.
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 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 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.
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 latest 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
| Tag | Supported |
| -------------- | ------------------ |
|-|-|
| 1 | :white_check_mark: |
| 1-debian | :white_check_mark: |
| latest | :white_check_mark: |

View file

@ -1,12 +0,0 @@
exports.up = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.string("smtp_security").defaultTo(null);
});
};
exports.down = function (knex) {
return knex.schema.alterTable("monitor", function (table) {
table.dropColumn("smtp_security");
});
};

View file

@ -1,24 +0,0 @@
/* SQL:
ALTER TABLE monitor ADD ping_count INTEGER default 1 not null;
ALTER TABLE monitor ADD ping_numeric BOOLEAN default true not null;
ALTER TABLE monitor ADD ping_per_request_timeout INTEGER default 2 not null;
*/
exports.up = function (knex) {
// Add new columns to table monitor
return knex.schema
.alterTable("monitor", function (table) {
table.integer("ping_count").defaultTo(1).notNullable();
table.boolean("ping_numeric").defaultTo(true).notNullable();
table.integer("ping_per_request_timeout").defaultTo(2).notNullable();
});
};
exports.down = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.dropColumn("ping_count");
table.dropColumn("ping_numeric");
table.dropColumn("ping_per_request_timeout");
});
};

View file

@ -1,13 +0,0 @@
// Add column custom_url to monitor_group table
exports.up = function (knex) {
return knex.schema
.alterTable("monitor_group", function (table) {
table.text("custom_url", "text");
});
};
exports.down = function (knex) {
return knex.schema.alterTable("monitor_group", function (table) {
table.dropColumn("custom_url");
});
};

View file

@ -1,13 +0,0 @@
exports.up = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.boolean("ip_family").defaultTo(null);
});
};
exports.down = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.dropColumn("ip_family");
});
};

View file

@ -1,12 +0,0 @@
exports.up = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.string("manual_status").defaultTo(null);
});
};
exports.down = function (knex) {
return knex.schema.alterTable("monitor", function (table) {
table.dropColumn("manual_status");
});
};

View file

@ -1,34 +0,0 @@
// Add column last_start_date to maintenance table
exports.up = async function (knex) {
await knex.schema
.alterTable("maintenance", function (table) {
table.datetime("last_start_date");
});
// Perform migration for recurring-interval strategy
const recurringMaintenances = await knex("maintenance").where({
strategy: "recurring-interval",
cron: "* * * * *"
}).select("id", "start_time");
// eslint-disable-next-line camelcase
const maintenanceUpdates = recurringMaintenances.map(async ({ start_time, id }) => {
// eslint-disable-next-line camelcase
const [ hourStr, minuteStr ] = start_time.split(":");
const hour = parseInt(hourStr, 10);
const minute = parseInt(minuteStr, 10);
const cron = `${minute} ${hour} * * *`;
await knex("maintenance")
.where({ id })
.update({ cron });
});
await Promise.all(maintenanceUpdates);
};
exports.down = function (knex) {
return knex.schema.alterTable("maintenance", function (table) {
table.dropColumn("last_start_date");
});
};

View file

@ -1,13 +0,0 @@
// Fix: Change manual_status column type to smallint
exports.up = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.smallint("manual_status").alter();
});
};
exports.down = function (knex) {
return knex.schema.alterTable("monitor", function (table) {
table.string("manual_status").alter();
});
};

View file

@ -1,12 +0,0 @@
exports.up = function (knex) {
return knex.schema
.alterTable("monitor", function (table) {
table.string("oauth_audience").nullable().defaultTo(null);
});
};
exports.down = function (knex) {
return knex.schema.alterTable("monitor", function (table) {
table.string("oauth_audience").alter();
});
};

View file

@ -1,15 +0,0 @@
exports.up = function (knex) {
// Add new column monitor.mqtt_websocket_path
return knex.schema
.alterTable("monitor", function (table) {
table.string("mqtt_websocket_path", 255).nullable();
});
};
exports.down = function (knex) {
// Drop column monitor.mqtt_websocket_path
return knex.schema
.alterTable("monitor", function (table) {
table.dropColumn("mqtt_websocket_path");
});
};

View file

@ -79,10 +79,6 @@ USER node
RUN git config --global user.email "no-reply@no-reply.com"
RUN git config --global user.name "PR Tester"
RUN git clone https://github.com/louislam/uptime-kuma.git .
# Hide the warning when running in detached head state
RUN git config --global advice.detachedHead false
RUN npm ci
EXPOSE 3000 3001

33
extra/checkout-pr.js Normal file
View file

@ -0,0 +1,33 @@
const childProcess = require("child_process");
if (!process.env.UPTIME_KUMA_GH_REPO) {
console.error("Please set a repo to the environment variable 'UPTIME_KUMA_GH_REPO' (e.g. mhkarimi1383:goalert-notification)");
process.exit(1);
}
let inputArray = process.env.UPTIME_KUMA_GH_REPO.split(":");
if (inputArray.length !== 2) {
console.error("Invalid format. Please set a repo to the environment variable 'UPTIME_KUMA_GH_REPO' (e.g. mhkarimi1383:goalert-notification)");
}
let name = inputArray[0];
let branch = inputArray[1];
console.log("Checkout pr");
// Checkout the pr
let result = childProcess.spawnSync("git", [ "remote", "add", name, `https://github.com/${name}/uptime-kuma` ]);
console.log(result.stdout.toString());
console.error(result.stderr.toString());
result = childProcess.spawnSync("git", [ "fetch", name, branch ]);
console.log(result.stdout.toString());
console.error(result.stderr.toString());
result = childProcess.spawnSync("git", [ "checkout", `${name}/${branch}`, "--force" ]);
console.log(result.stdout.toString());
console.error(result.stderr.toString());

View file

@ -1,34 +0,0 @@
import childProcess from "child_process";
import { parsePrName } from "./kuma-pr/pr-lib.mjs";
let { name, branch } = parsePrName(process.env.UPTIME_KUMA_GH_REPO);
console.log(`Checking out PR from ${name}:${branch}`);
// Checkout the pr
let result = childProcess.spawnSync("git", [ "remote", "add", name, `https://github.com/${name}/uptime-kuma` ], {
stdio: "inherit"
});
if (result.status !== 0) {
console.error("Failed to add remote repository.");
process.exit(1);
}
result = childProcess.spawnSync("git", [ "fetch", name, branch ], {
stdio: "inherit"
});
if (result.status !== 0) {
console.error("Failed to fetch the branch.");
process.exit(1);
}
result = childProcess.spawnSync("git", [ "checkout", `${name}/${branch}`, "--force" ], {
stdio: "inherit"
});
if (result.status !== 0) {
console.error("Failed to checkout the branch.");
process.exit(1);
}

View file

@ -37,7 +37,7 @@ const github = require("@actions/github");
owner: issue.owner,
repo: issue.repo,
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 blank issues and use our [issue-templates](https://github.com/louislam/uptime-kuma/issues/new/choose) instead**.\nBlank Issues do not contain the context necessary for a good discussions.`
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

View file

@ -1,26 +0,0 @@
#!/usr/bin/env node
import { spawn } from "child_process";
import { parsePrName } from "./pr-lib.mjs";
const prName = process.argv[2];
// Pre-check the prName here, so testers don't need to wait until the Docker image is pulled to see the error.
try {
parsePrName(prName);
} catch (error) {
console.error(error.message);
process.exit(1);
}
spawn("docker", [
"run",
"--rm",
"-it",
"-p", "3000:3000",
"-p", "3001:3001",
"--pull", "always",
"-e", `UPTIME_KUMA_GH_REPO=${prName}`,
"louislam/uptime-kuma:pr-test2"
], {
stdio: "inherit",
});

View file

@ -1,8 +0,0 @@
{
"name": "kuma-pr",
"version": "1.0.0",
"type": "module",
"bin": {
"kuma-pr": "./index.mjs"
}
}

View file

@ -1,39 +0,0 @@
/**
* Parse <name>:<branch> to an object.
* @param {string} prName <name>:<branch>
* @returns {object} An object with name and branch properties.
*/
export function parsePrName(prName) {
let name = "louislam";
let branch;
const errorMessage = "Please set a repo to the environment variable 'UPTIME_KUMA_GH_REPO' (e.g. mhkarimi1383:goalert-notification)";
if (!prName) {
throw new Error(errorMessage);
}
prName = prName.trim();
if (prName === "") {
throw new Error(errorMessage);
}
let inputArray = prName.split(":");
// Just realized that owner's prs are not prefixed with "louislam:"
if (inputArray.length === 1) {
branch = inputArray[0];
} else if (inputArray.length === 2) {
name = inputArray[0];
branch = inputArray[1];
} else {
throw new Error("Invalid format. The format is like this: mhkarimi1383:goalert-notification");
}
return {
name,
branch
};
}

View file

@ -3,7 +3,6 @@ console.log("== Uptime Kuma Reset Password Tool ==");
const Database = require("../server/database");
const { R } = require("redbean-node");
const readline = require("readline");
const { passwordStrength } = require("check-password-strength");
const { initJWTSecret } = require("../server/util-server");
const User = require("../server/model/user");
const { io } = require("socket.io-client");
@ -43,15 +42,8 @@ const main = async () => {
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"] + "";
if (passwordStrength(password).value === "Too weak") {
throw new Error("Password is too weak, please use a stronger password.");
}
} else {
password = await question("New Password: ");
if (passwordStrength(password).value === "Too weak") {
console.log("Password is too weak, please try again.");
continue;
}
confirmPassword = await question("Confirm New Password: ");
}

2565
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "uptime-kuma",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"license": "MIT",
"repository": {
"type": "git",
@ -32,7 +32,7 @@
"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 --project ./tsconfig-backend.json",
"tsc": "tsc",
"vite-preview-dist": "vite preview --host --config ./config/vite.config.js",
"build-docker-base": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base2 --target base2 . --push",
"build-docker-base-slim": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base2-slim --target base2-slim . --push",
@ -57,7 +57,7 @@
"release-nightly": "node ./extra/release/nightly.mjs",
"git-remove-tag": "git tag -d",
"build-dist-and-restart": "npm run build && npm run start-server-dev",
"start-pr-test": "node extra/checkout-pr.mjs && npm install && npm run dev",
"start-pr-test": "node extra/checkout-pr.js && npm install && npm run dev",
"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",
"sort-contributors": "node extra/sort-contributors.js",
@ -72,7 +72,7 @@
"@louislam/sqlite3": "15.1.6",
"@vvo/tzdb": "^6.125.0",
"args-parser": "~1.3.0",
"axios": "~0.30.0",
"axios": "~0.29.0",
"badge-maker": "~3.3.1",
"bcryptjs": "~2.4.3",
"chardet": "~1.4.0",
@ -82,7 +82,6 @@
"command-exists": "~1.2.9",
"compare-versions": "~3.6.0",
"compression": "~1.7.4",
"country-flag-emoji-polyfill": "^0.1.8",
"croner": "~8.1.0",
"dayjs": "~1.11.5",
"dev-null": "^0.1.1",
@ -99,7 +98,6 @@
"http-proxy-agent": "~7.0.2",
"https-proxy-agent": "~7.0.6",
"iconv-lite": "~0.6.3",
"is-url": "^1.2.4",
"isomorphic-ws": "^5.0.0",
"jsesc": "~3.0.2",
"jsonata": "^2.0.3",

View file

@ -26,7 +26,7 @@ exports.login = async function (username, password) {
// Upgrade the hash to bcrypt
if (passwordHash.needRehash(user.password)) {
await R.exec("UPDATE `user` SET password = ? WHERE id = ? ", [
await passwordHash.generate(password),
passwordHash.generate(password),
user.id,
]);
}

View file

@ -1,5 +1,4 @@
const fs = require("fs");
const fsAsync = fs.promises;
const { R } = require("redbean-node");
const { setSetting, setting } = require("./util-server");
const { log, sleep } = require("../src/util");
@ -19,7 +18,7 @@ const KumaColumnCompiler = require("./utils/knex/lib/dialects/mysql2/schema/mysq
class Database {
/**
* Bootstrap database for SQLite
* Boostrap database for SQLite
* @type {string}
*/
static templatePath = "./db/kuma.db";
@ -708,12 +707,12 @@ class Database {
/**
* Get the size of the database (SQLite only)
* @returns {Promise<number>} Size of database
* @returns {number} Size of database
*/
static async getSize() {
static getSize() {
if (Database.dbConfig.type === "sqlite") {
log.debug("db", "Database.getSize()");
let stats = await fsAsync.stat(Database.sqlitePath);
let stats = fs.statSync(Database.sqlitePath);
log.debug("db", stats);
return stats.size;
}
@ -737,7 +736,7 @@ class Database {
if (Database.dbConfig.type === "sqlite") {
return "DATETIME('now', ? || ' hours')";
} else {
return "DATE_ADD(UTC_TIMESTAMP(), INTERVAL ? HOUR)";
return "DATE_ADD(NOW(), INTERVAL ? HOUR)";
}
}

View file

@ -1,10 +1,10 @@
const axios = require("axios");
const { R } = require("redbean-node");
const https = require("https");
const fsAsync = require("fs").promises;
const fs = require("fs");
const path = require("path");
const Database = require("./database");
const { axiosAbortSignal, fsExists } = require("./util-server");
const { axiosAbortSignal } = require("./util-server");
class DockerHost {
@ -81,7 +81,7 @@ class DockerHost {
options.socketPath = dockerHost.dockerDaemon;
} else if (dockerHost.dockerType === "tcp") {
options.baseURL = DockerHost.patchDockerURL(dockerHost.dockerDaemon);
options.httpsAgent = new https.Agent(await DockerHost.getHttpsAgentOptions(dockerHost.dockerType, options.baseURL));
options.httpsAgent = new https.Agent(DockerHost.getHttpsAgentOptions(dockerHost.dockerType, options.baseURL));
}
try {
@ -141,9 +141,9 @@ class DockerHost {
* File names can also be overridden via 'DOCKER_TLS_FILE_NAME_(CA|KEY|CERT)'.
* @param {string} dockerType i.e. "tcp" or "socket"
* @param {string} url The docker host URL rewritten to https://
* @returns {Promise<object>} HTTP agent options
* @returns {object} HTTP agent options
*/
static async getHttpsAgentOptions(dockerType, url) {
static getHttpsAgentOptions(dockerType, url) {
let baseOptions = {
maxCachedSessions: 0,
rejectUnauthorized: true
@ -156,10 +156,10 @@ class DockerHost {
let certPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameCert);
let keyPath = path.join(Database.dockerTLSDir, dirName, DockerHost.CertificateFileNameKey);
if (dockerType === "tcp" && await fsExists(caPath) && await fsExists(certPath) && await fsExists(keyPath)) {
let ca = await fsAsync.readFile(caPath);
let key = await fsAsync.readFile(keyPath);
let cert = await fsAsync.readFile(certPath);
if (dockerType === "tcp" && fs.existsSync(caPath) && fs.existsSync(certPath) && fs.existsSync(keyPath)) {
let ca = fs.readFileSync(caPath);
let key = fs.readFileSync(keyPath);
let cert = fs.readFileSync(certPath);
certOptions = {
ca,
key,

View file

@ -33,7 +33,7 @@ class Group extends BeanModel {
*/
async getMonitorList() {
return R.convertToBeans("monitor", await R.getAll(`
SELECT monitor.*, monitor_group.send_url, monitor_group.custom_url FROM monitor, monitor_group
SELECT monitor.*, monitor_group.send_url FROM monitor, monitor_group
WHERE monitor.id = monitor_group.monitor_id
AND group_id = ?
ORDER BY monitor_group.weight

View file

@ -158,22 +158,12 @@ class Maintenance extends BeanModel {
bean.active = obj.active;
if (obj.dateRange[0]) {
const parsedDate = new Date(obj.dateRange[0]);
if (isNaN(parsedDate.getTime()) || parsedDate.getFullYear() > 9999) {
throw new Error("Invalid start date");
}
bean.start_date = obj.dateRange[0];
} else {
bean.start_date = null;
}
if (obj.dateRange[1]) {
const parsedDate = new Date(obj.dateRange[1]);
if (isNaN(parsedDate.getTime()) || parsedDate.getFullYear() > 9999) {
throw new Error("Invalid end date");
}
bean.end_date = obj.dateRange[1];
} else {
bean.end_date = null;
@ -202,7 +192,7 @@ class Maintenance extends BeanModel {
* @returns {void}
*/
static validateCron(cron) {
let job = new Cron(cron, () => { });
let job = new Cron(cron, () => {});
job.stop();
}
@ -239,13 +229,11 @@ class Maintenance extends BeanModel {
apicache.clear();
});
} else if (this.cron != null) {
let current = dayjs();
// Here should be cron or recurring
try {
this.beanMeta.status = "scheduled";
let startEvent = async (customDuration = 0) => {
let startEvent = (customDuration = 0) => {
log.info("maintenance", "Maintenance id: " + this.id + " is under maintenance now");
this.beanMeta.status = "under-maintenance";
@ -260,10 +248,6 @@ class Maintenance extends BeanModel {
this.beanMeta.status = "scheduled";
UptimeKumaServer.getInstance().sendMaintenanceListByUserID(this.user_id);
}, duration);
// Set last start date to current time
this.last_start_date = current.toISOString();
R.store(this);
};
// Create Cron
@ -274,25 +258,9 @@ class Maintenance extends BeanModel {
const startDateTime = startDate.hour(hour).minute(minute);
this.beanMeta.job = new Cron(this.cron, {
timezone: await this.getTimezone(),
interval: this.interval_day * 24 * 60 * 60,
startAt: startDateTime.toISOString(),
}, () => {
if (!this.lastStartDate || this.interval_day === 1) {
return startEvent();
}
// If last start date is set, it means the maintenance has been started before
let lastStartDate = dayjs(this.lastStartDate)
.subtract(1.1, "hour"); // Subtract 1.1 hour to avoid issues with timezone differences
// Check if the interval is enough
if (current.diff(lastStartDate, "day") < this.interval_day) {
log.debug("maintenance", "Maintenance id: " + this.id + " is still in the window, skipping start event");
return;
}
log.debug("maintenance", "Maintenance id: " + this.id + " is not in the window, starting event");
return startEvent();
});
}, startEvent);
} else {
this.beanMeta.job = new Cron(this.cron, {
timezone: await this.getTimezone(),
@ -301,6 +269,7 @@ class Maintenance extends BeanModel {
// Continue if the maintenance is still in the window
let runningTimeslot = this.getRunningTimeslot();
let current = dayjs();
if (runningTimeslot) {
let duration = dayjs(runningTimeslot.endDate).diff(current, "second") * 1000;
@ -444,11 +413,8 @@ class Maintenance extends BeanModel {
} else if (!this.strategy.startsWith("recurring-")) {
this.cron = "";
} else if (this.strategy === "recurring-interval") {
// For intervals, the pattern is used to check if the execution should be started
let array = this.start_time.split(":");
let hour = parseInt(array[0]);
let minute = parseInt(array[1]);
this.cron = `${minute} ${hour} * * *`;
// For intervals, the pattern is calculated in the run function as the interval-option is set
this.cron = "* * * * *";
this.duration = this.calcDuration();
log.debug("maintenance", "Cron: " + this.cron);
log.debug("maintenance", "Duration: " + this.duration);

View file

@ -2,11 +2,7 @@ const dayjs = require("dayjs");
const axios = require("axios");
const { Prometheus } = require("../prometheus");
const { log, UP, DOWN, PENDING, MAINTENANCE, flipStatus, MAX_INTERVAL_SECOND, MIN_INTERVAL_SECOND,
SQL_DATETIME_FORMAT, evaluateJsonQuery,
PING_PACKET_SIZE_MIN, PING_PACKET_SIZE_MAX, PING_PACKET_SIZE_DEFAULT,
PING_GLOBAL_TIMEOUT_MIN, PING_GLOBAL_TIMEOUT_MAX, PING_GLOBAL_TIMEOUT_DEFAULT,
PING_COUNT_MIN, PING_COUNT_MAX, PING_COUNT_DEFAULT,
PING_PER_REQUEST_TIMEOUT_MIN, PING_PER_REQUEST_TIMEOUT_MAX, PING_PER_REQUEST_TIMEOUT_DEFAULT
SQL_DATETIME_FORMAT, evaluateJsonQuery
} = require("../../src/util");
const { tcping, ping, checkCertificate, checkStatusCode, getTotalClientInRoom, setting, mssqlQuery, postgresQuery, mysqlQuery, setSetting, httpNtlm, radius, grpcQuery,
redisPingAsync, kafkaProducerAsync, getOidcTokenClientCredentials, rootCertificatesFingerprints, axiosAbortSignal
@ -57,7 +53,7 @@ class Monitor extends BeanModel {
};
if (this.sendUrl) {
obj.url = this.customUrl ?? this.url;
obj.url = this.url;
}
if (showTags) {
@ -157,15 +153,8 @@ class Monitor extends BeanModel {
snmpOid: this.snmpOid,
jsonPathOperator: this.jsonPathOperator,
snmpVersion: this.snmpVersion,
smtpSecurity: this.smtpSecurity,
rabbitmqNodes: JSON.parse(this.rabbitmqNodes),
conditions: JSON.parse(this.conditions),
ipFamily: this.ipFamily,
// ping advanced options
ping_numeric: this.isPingNumeric(),
ping_count: this.ping_count,
ping_per_request_timeout: this.ping_per_request_timeout,
};
if (includeSensitiveData) {
@ -181,7 +170,6 @@ class Monitor extends BeanModel {
oauth_client_secret: this.oauth_client_secret,
oauth_token_url: this.oauth_token_url,
oauth_scopes: this.oauth_scopes,
oauth_audience: this.oauth_audience,
oauth_auth_method: this.oauth_auth_method,
pushToken: this.pushToken,
databaseConnectionString: this.databaseConnectionString,
@ -190,7 +178,6 @@ class Monitor extends BeanModel {
radiusSecret: this.radiusSecret,
mqttUsername: this.mqttUsername,
mqttPassword: this.mqttPassword,
mqttWebsocketPath: this.mqttWebsocketPath,
authWorkstation: this.authWorkstation,
authDomain: this.authDomain,
tlsCa: this.tlsCa,
@ -260,14 +247,6 @@ class Monitor extends BeanModel {
return Boolean(this.expiryNotification);
}
/**
* Check if ping should use numeric output only
* @returns {boolean} True if IP addresses will be output instead of symbolic hostnames
*/
isPingNumeric() {
return Boolean(this.ping_numeric);
}
/**
* Parse to boolean
* @returns {boolean} Should TLS errors be ignored?
@ -401,6 +380,39 @@ class Monitor extends BeanModel {
if (await Monitor.isUnderMaintenance(this.id)) {
bean.msg = "Monitor under maintenance";
bean.status = MAINTENANCE;
} else if (this.type === "group") {
const children = await Monitor.getChildren(this.id);
if (children.length > 0) {
bean.status = UP;
bean.msg = "All children up and running";
for (const child of children) {
if (!child.active) {
// Ignore inactive childs
continue;
}
const lastBeat = await Monitor.getPreviousHeartbeat(child.id);
// Only change state if the monitor is in worse conditions then the ones before
// lastBeat.status could be null
if (!lastBeat) {
bean.status = PENDING;
} else if (bean.status === UP && (lastBeat.status === PENDING || lastBeat.status === DOWN)) {
bean.status = lastBeat.status;
} else if (bean.status === PENDING && lastBeat.status === DOWN) {
bean.status = lastBeat.status;
}
}
if (bean.status !== UP) {
bean.msg = "Child inaccessible";
}
} else {
// Set status pending if group is empty
bean.status = PENDING;
bean.msg = "Group empty";
}
} else if (this.type === "http" || this.type === "keyword" || this.type === "json-query") {
// Do not do any queries/high loading things before the "bean.ping"
let startTime = dayjs().valueOf();
@ -429,26 +441,10 @@ class Monitor extends BeanModel {
}
}
let agentFamily = undefined;
if (this.ipFamily === "ipv4") {
agentFamily = 4;
}
if (this.ipFamily === "ipv6") {
agentFamily = 6;
}
const httpsAgentOptions = {
maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940)
rejectUnauthorized: !this.getIgnoreTls(),
secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT,
autoSelectFamily: true,
...(agentFamily ? { family: agentFamily } : {})
};
const httpAgentOptions = {
maxCachedSessions: 0,
autoSelectFamily: true,
...(agentFamily ? { family: agentFamily } : {})
};
log.debug("monitor", `[${this.name}] Prepare Options for axios`);
@ -510,7 +506,6 @@ class Monitor extends BeanModel {
if (proxy && proxy.active) {
const { httpAgent, httpsAgent } = Proxy.createAgents(proxy, {
httpsAgentOptions: httpsAgentOptions,
httpAgentOptions: httpAgentOptions,
});
options.proxy = false;
@ -519,10 +514,6 @@ class Monitor extends BeanModel {
}
}
if (!options.httpAgent) {
options.httpAgent = new http.Agent(httpAgentOptions);
}
if (!options.httpsAgent) {
let jar = new CookieJar();
let httpsCookieAgentOptions = {
@ -626,7 +617,7 @@ class Monitor extends BeanModel {
bean.status = UP;
} else if (this.type === "ping") {
bean.ping = await ping(this.hostname, this.ping_count, "", this.ping_numeric, this.packetSize, this.timeout, this.ping_per_request_timeout);
bean.ping = await ping(this.hostname, this.packetSize);
bean.msg = "";
bean.status = UP;
} else if (this.type === "push") { // Type: Push
@ -698,7 +689,7 @@ class Monitor extends BeanModel {
bean.msg = res.data.response.servers[0].name;
try {
bean.ping = await ping(this.hostname, PING_COUNT_DEFAULT, "", true, this.packetSize, PING_GLOBAL_TIMEOUT_DEFAULT, PING_PER_REQUEST_TIMEOUT_DEFAULT);
bean.ping = await ping(this.hostname, this.packetSize);
} catch (_) { }
} else {
throw new Error("Server not found on Steam");
@ -748,7 +739,7 @@ class Monitor extends BeanModel {
} else if (dockerHost._dockerType === "tcp") {
options.baseURL = DockerHost.patchDockerURL(dockerHost._dockerDaemon);
options.httpsAgent = new https.Agent(
await DockerHost.getHttpsAgentOptions(dockerHost._dockerType, options.baseURL)
DockerHost.getHttpsAgentOptions(dockerHost._dockerType, options.baseURL)
);
}
@ -1315,7 +1306,7 @@ class Monitor extends BeanModel {
/**
* Send a notification about a monitor
* @param {boolean} isFirstBeat Is this beat the first of this monitor?
* @param {Monitor} monitor The monitor to send a notification about
* @param {Monitor} monitor The monitor to send a notificaton about
* @param {Bean} bean Status information about monitor
* @returns {void}
*/
@ -1336,8 +1327,7 @@ class Monitor extends BeanModel {
try {
const heartbeatJSON = bean.toJSON();
const monitorData = [{ id: monitor.id,
active: monitor.active,
name: monitor.name
active: monitor.active
}];
const preloadData = await Monitor.preparePreloadData(monitorData);
// Prevent if the msg is undefined, notifications such as Discord cannot send out.
@ -1510,31 +1500,6 @@ class Monitor extends BeanModel {
if (this.interval < MIN_INTERVAL_SECOND) {
throw new Error(`Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);
}
if (this.type === "ping") {
// ping parameters validation
if (this.packetSize && (this.packetSize < PING_PACKET_SIZE_MIN || this.packetSize > PING_PACKET_SIZE_MAX)) {
throw new Error(`Packet size must be between ${PING_PACKET_SIZE_MIN} and ${PING_PACKET_SIZE_MAX} (default: ${PING_PACKET_SIZE_DEFAULT})`);
}
if (this.ping_per_request_timeout && (this.ping_per_request_timeout < PING_PER_REQUEST_TIMEOUT_MIN || this.ping_per_request_timeout > PING_PER_REQUEST_TIMEOUT_MAX)) {
throw new Error(`Per-ping timeout must be between ${PING_PER_REQUEST_TIMEOUT_MIN} and ${PING_PER_REQUEST_TIMEOUT_MAX} seconds (default: ${PING_PER_REQUEST_TIMEOUT_DEFAULT})`);
}
if (this.ping_count && (this.ping_count < PING_COUNT_MIN || this.ping_count > PING_COUNT_MAX)) {
throw new Error(`Echo requests count must be between ${PING_COUNT_MIN} and ${PING_COUNT_MAX} (default: ${PING_COUNT_DEFAULT})`);
}
if (this.timeout) {
const pingGlobalTimeout = Math.round(Number(this.timeout));
if (pingGlobalTimeout < this.ping_per_request_timeout || pingGlobalTimeout < PING_GLOBAL_TIMEOUT_MIN || pingGlobalTimeout > PING_GLOBAL_TIMEOUT_MAX) {
throw new Error(`Timeout must be between ${PING_GLOBAL_TIMEOUT_MIN} and ${PING_GLOBAL_TIMEOUT_MAX} seconds (default: ${PING_GLOBAL_TIMEOUT_DEFAULT})`);
}
this.timeout = pingGlobalTimeout;
}
}
}
/**
@ -1660,7 +1625,7 @@ class Monitor extends BeanModel {
/**
* Gets all Children of the monitor
* @param {number} monitorID ID of monitor to get
* @returns {Promise<LooseObject<any>[]>} Children
* @returns {Promise<LooseObject<any>>} Children
*/
static async getChildren(monitorID) {
return await R.getAll(`
@ -1748,7 +1713,7 @@ class Monitor extends BeanModel {
*/
async makeOidcTokenClientCredentialsRequest() {
log.debug("monitor", `[${this.name}] The oauth access-token undefined or expired. Requesting a new token`);
const oAuthAccessToken = await getOidcTokenClientCredentials(this.oauth_token_url, this.oauth_client_id, this.oauth_client_secret, this.oauth_scopes, this.oauth_audience, this.oauth_auth_method);
const oAuthAccessToken = await getOidcTokenClientCredentials(this.oauth_token_url, this.oauth_client_id, this.oauth_client_secret, this.oauth_scopes, this.oauth_auth_method);
if (this.oauthAccessToken?.expires_at) {
log.debug("monitor", `[${this.name}] Obtained oauth access-token. Expires at ${new Date(this.oauthAccessToken?.expires_at * 1000)}`);
} else {

View file

@ -120,8 +120,8 @@ class StatusPage extends BeanModel {
const head = $("head");
if (statusPage.google_analytics_tag_id) {
let escapedGoogleAnalyticsScript = googleAnalytics.getGoogleAnalyticsScript(statusPage.google_analytics_tag_id);
if (statusPage.googleAnalyticsTagId) {
let escapedGoogleAnalyticsScript = googleAnalytics.getGoogleAnalyticsScript(statusPage.googleAnalyticsTagId);
head.append($(escapedGoogleAnalyticsScript));
}

View file

@ -14,7 +14,7 @@ class User extends BeanModel {
*/
static async resetPassword(userID, newPassword) {
await R.exec("UPDATE `user` SET password = ? WHERE id = ? ", [
await passwordHash.generate(newPassword),
passwordHash.generate(newPassword),
userID
]);
}
@ -25,7 +25,7 @@ class User extends BeanModel {
* @returns {Promise<void>}
*/
async resetPassword(newPassword) {
const hashedPassword = await passwordHash.generate(newPassword);
const hashedPassword = passwordHash.generate(newPassword);
await R.exec("UPDATE `user` SET password = ? WHERE id = ? ", [
hashedPassword,

View file

@ -89,9 +89,6 @@ function NtlmClient(credentials, AxiosConfig) {
switch (_b.label) {
case 0:
error = err.response;
// The header may look like this: `Negotiate, NTLM, Basic realm="itsahiddenrealm.example.net"`Add commentMore actions
// so extract the 'NTLM' part first
const ntlmheader = error.headers['www-authenticate'].split(',').find(_ => _.match(/ *NTLM/))?.trim() || '';
if (!(error && error.status === 401
&& error.headers['www-authenticate']
&& error.headers['www-authenticate'].includes('NTLM'))) return [3 /*break*/, 3];
@ -99,12 +96,12 @@ function NtlmClient(credentials, AxiosConfig) {
// include the Negotiate option when responding with the T2 message
// There is nore we could do to ensure we are processing correctly,
// but this is the easiest option for now
if (ntlmheader.length < 50) {
if (error.headers['www-authenticate'].length < 50) {
t1Msg = ntlm.createType1Message(credentials.workstation, credentials.domain);
error.config.headers["Authorization"] = t1Msg;
}
else {
t2Msg = ntlm.decodeType2Message((ntlmheader.match(/^NTLM\s+(.+?)(,|\s+|$)/) || [])[1]);
t2Msg = ntlm.decodeType2Message((error.headers['www-authenticate'].match(/^NTLM\s+(.+?)(,|\s+|$)/) || [])[1]);
t3Msg = ntlm.createType3Message(t2Msg, credentials.username, credentials.password, credentials.workstation, credentials.domain);
error.config.headers["X-retry"] = "false";
error.config.headers["Authorization"] = t3Msg;

View file

@ -34,16 +34,12 @@ class DnsMonitorType extends MonitorType {
switch (monitor.dns_resolve_type) {
case "A":
case "AAAA":
case "TXT":
case "PTR":
dnsMessage = `Records: ${dnsRes.join(" | ")}`;
conditionsResult = dnsRes.some(record => handleConditions({ record }));
break;
case "TXT":
dnsMessage = `Records: ${dnsRes.join(" | ")}`;
conditionsResult = dnsRes.flat().some(record => handleConditions({ record }));
break;
case "CNAME":
dnsMessage = dnsRes[0];
conditionsResult = handleConditions({ record: dnsRes[0] });

View file

@ -1,49 +0,0 @@
const { UP, PENDING, DOWN } = require("../../src/util");
const { MonitorType } = require("./monitor-type");
const Monitor = require("../model/monitor");
class GroupMonitorType extends MonitorType {
name = "group";
/**
* @inheritdoc
*/
async check(monitor, heartbeat, _server) {
const children = await Monitor.getChildren(monitor.id);
if (children.length > 0) {
heartbeat.status = UP;
heartbeat.msg = "All children up and running";
for (const child of children) {
if (!child.active) {
// Ignore inactive childs
continue;
}
const lastBeat = await Monitor.getPreviousHeartbeat(child.id);
// Only change state if the monitor is in worse conditions then the ones before
// lastBeat.status could be null
if (!lastBeat) {
heartbeat.status = PENDING;
} else if (heartbeat.status === UP && (lastBeat.status === PENDING || lastBeat.status === DOWN)) {
heartbeat.status = lastBeat.status;
} else if (heartbeat.status === PENDING && lastBeat.status === DOWN) {
heartbeat.status = lastBeat.status;
}
}
if (heartbeat.status !== UP) {
heartbeat.msg = "Child inaccessible";
}
} else {
// Set status pending if group is empty
heartbeat.status = PENDING;
heartbeat.msg = "Group empty";
}
}
}
module.exports = {
GroupMonitorType,
};

View file

@ -1,36 +0,0 @@
const { MonitorType } = require("./monitor-type");
const { UP, DOWN, PENDING } = require("../../src/util");
class ManualMonitorType extends MonitorType {
name = "Manual";
type = "manual";
description = "A monitor that allows manual control of the status";
supportsConditions = false;
conditionVariables = [];
/**
* @inheritdoc
*/
async check(monitor, heartbeat) {
if (monitor.manual_status !== null) {
heartbeat.status = monitor.manual_status;
switch (monitor.manual_status) {
case UP:
heartbeat.msg = "Up";
break;
case DOWN:
heartbeat.msg = "Down";
break;
default:
heartbeat.msg = "Pending";
}
} else {
heartbeat.status = PENDING;
heartbeat.msg = "Manual monitoring - No status set";
}
}
}
module.exports = {
ManualMonitorType
};

View file

@ -15,7 +15,6 @@ class MqttMonitorType extends MonitorType {
username: monitor.mqttUsername,
password: monitor.mqttPassword,
interval: monitor.interval,
websocketPath: monitor.mqttWebsocketPath,
});
if (monitor.mqttCheckType == null || monitor.mqttCheckType === "") {
@ -53,12 +52,12 @@ class MqttMonitorType extends MonitorType {
* @param {string} hostname Hostname / address of machine to test
* @param {string} topic MQTT topic
* @param {object} options MQTT options. Contains port, username,
* password, websocketPath and interval (interval defaults to 20)
* password and interval (interval defaults to 20)
* @returns {Promise<string>} Received MQTT message
*/
mqttAsync(hostname, topic, options = {}) {
return new Promise((resolve, reject) => {
const { port, username, password, websocketPath, interval = 20 } = options;
const { port, username, password, interval = 20 } = options;
// Adds MQTT protocol to the hostname if not already present
if (!/^(?:http|mqtt|ws)s?:\/\//.test(hostname)) {
@ -71,15 +70,7 @@ class MqttMonitorType extends MonitorType {
reject(new Error("Timeout, Message not received"));
}, interval * 1000 * 0.8);
// Construct the URL based on protocol
let mqttUrl = `${hostname}:${port}`;
if (hostname.startsWith("ws://") || hostname.startsWith("wss://")) {
if (websocketPath && !websocketPath.startsWith("/")) {
mqttUrl = `${hostname}:${port}/${websocketPath || ""}`;
} else {
mqttUrl = `${hostname}:${port}${websocketPath || ""}`;
}
}
const mqttUrl = `${hostname}:${port}`;
log.debug("mqtt", `MQTT connecting to ${mqttUrl}`);

View file

@ -1,35 +0,0 @@
const { MonitorType } = require("./monitor-type");
const { UP } = require("../../src/util");
const nodemailer = require("nodemailer");
class SMTPMonitorType extends MonitorType {
name = "smtp";
/**
* @inheritdoc
*/
async check(monitor, heartbeat, _server) {
let options = {
port: monitor.port || 25,
host: monitor.hostname,
secure: monitor.smtpSecurity === "secure", // use SMTPS (not STARTTLS)
ignoreTLS: monitor.smtpSecurity === "nostarttls", // don't use STARTTLS even if it's available
requireTLS: monitor.smtpSecurity === "starttls", // use STARTTLS or fail
};
let transporter = nodemailer.createTransport(options);
try {
await transporter.verify();
heartbeat.status = UP;
heartbeat.msg = "SMTP connection verifies successfully";
} catch (e) {
throw new Error(`SMTP connection doesn't verify: ${e}`);
} finally {
transporter.close();
}
}
}
module.exports = {
SMTPMonitorType,
};

View file

@ -18,28 +18,17 @@ class Discord extends NotificationProvider {
webhookUrl.searchParams.append("thread_id", notification.threadId);
}
// Check if the webhook has an avatar
let webhookHasAvatar = true;
try {
const webhookInfo = await axios.get(webhookUrl.toString());
webhookHasAvatar = !!webhookInfo.data.avatar;
} catch (e) {
// If we can't verify, we assume he has an avatar to avoid forcing the default avatar
webhookHasAvatar = true;
}
// If heartbeatJSON is null, assume we're testing.
if (heartbeatJSON == null) {
let discordtestdata = {
username: discordDisplayName,
content: msg,
};
if (!webhookHasAvatar) {
discordtestdata.avatar_url = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png";
}
if (notification.discordChannelType === "createNewForumPost") {
discordtestdata.thread_name = notification.postName;
}
await axios.post(webhookUrl.toString(), discordtestdata);
return okMsg;
}
@ -57,10 +46,10 @@ class Discord extends NotificationProvider {
name: "Service Name",
value: monitorJSON["name"],
},
...(!notification.disableUrl ? [{
{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
value: this.extractAddress(monitorJSON),
}] : []),
},
{
name: `Time (${heartbeatJSON["timezone"]})`,
value: heartbeatJSON["localDateTime"],
@ -72,9 +61,6 @@ class Discord extends NotificationProvider {
],
}],
};
if (!webhookHasAvatar) {
discorddowndata.avatar_url = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png";
}
if (notification.discordChannelType === "createNewForumPost") {
discorddowndata.thread_name = notification.postName;
}
@ -97,10 +83,10 @@ class Discord extends NotificationProvider {
name: "Service Name",
value: monitorJSON["name"],
},
...(!notification.disableUrl ? [{
{
name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL",
value: this.extractAddress(monitorJSON),
}] : []),
},
{
name: `Time (${heartbeatJSON["timezone"]})`,
value: heartbeatJSON["localDateTime"],
@ -112,9 +98,6 @@ class Discord extends NotificationProvider {
],
}],
};
if (!webhookHasAvatar) {
discordupdata.avatar_url = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png";
}
if (notification.discordChannelType === "createNewForumPost") {
discordupdata.thread_name = notification.postName;

View file

@ -38,7 +38,7 @@ class FlashDuty extends NotificationProvider {
}
/**
* Generate a monitor url from the monitors information
* Generate a monitor url from the monitors infomation
* @param {object} monitorInfo Monitor details
* @returns {string|undefined} Monitor URL
*/
@ -73,13 +73,13 @@ class FlashDuty extends NotificationProvider {
}
const options = {
method: "POST",
url: notification.flashdutyIntegrationKey.startsWith("http") ? notification.flashdutyIntegrationKey : "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey,
url: "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + notification.flashdutyIntegrationKey,
headers: { "Content-Type": "application/json" },
data: {
description: `[${title}] [${monitorInfo.name}] ${body}`,
title,
event_status: eventStatus || "Info",
alert_key: monitorInfo.id ? String(monitorInfo.id) : Math.random().toString(36).substring(7),
alert_key: String(monitorInfo.id) || Math.random().toString(36).substring(7),
labels,
}
};

View file

@ -1,53 +0,0 @@
const { getMonitorRelativeURL, UP } = require("../../src/util");
const { setting } = require("../util-server");
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class Notifery extends NotificationProvider {
name = "notifery";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = "https://api.notifery.com/event";
let data = {
title: notification.notiferyTitle || "Uptime Kuma Alert",
message: msg,
};
if (notification.notiferyGroup) {
data.group = notification.notiferyGroup;
}
// Link to the monitor
const baseURL = await setting("primaryBaseURL");
if (baseURL && monitorJSON) {
data.message += `\n\nMonitor: ${baseURL}${getMonitorRelativeURL(monitorJSON.id)}`;
}
if (heartbeatJSON) {
data.code = heartbeatJSON.status === UP ? 0 : 1;
if (heartbeatJSON.ping) {
data.duration = heartbeatJSON.ping;
}
}
try {
const headers = {
"Content-Type": "application/json",
"x-api-key": notification.notiferyApiKey,
};
await axios.post(url, data, { headers });
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = Notifery;

View file

@ -41,8 +41,8 @@ class Ntfy extends NotificationProvider {
if (heartbeatJSON.status === DOWN) {
tags = [ "red_circle" ];
status = "Down";
// defaults to max(priority + 1, 5)
priority = notification.ntfyPriorityDown || (priority === 5 ? priority : priority + 1);
// if priority is not 5, increase priority for down alerts
priority = priority === 5 ? priority : priority + 1;
} else if (heartbeatJSON["status"] === UP) {
tags = [ "green_circle" ];
status = "Up";

View file

@ -1,73 +0,0 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { DOWN, UP } = require("../../src/util");
class OneChat extends NotificationProvider {
name = "OneChat";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = "https://chat-api.one.th/message/api/v1/push_message";
try {
const config = {
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + notification.accessToken,
},
};
if (heartbeatJSON == null) {
const testMessage = {
to: notification.recieverId,
bot_id: notification.botId,
type: "text",
message: "Test Successful!",
};
await axios.post(url, testMessage, config);
} else if (heartbeatJSON["status"] === DOWN) {
const downMessage = {
to: notification.recieverId,
bot_id: notification.botId,
type: "text",
message:
`UptimeKuma Alert:
[🔴 Down]
Name: ${monitorJSON["name"]}
${heartbeatJSON["msg"]}
Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
};
await axios.post(url, downMessage, config);
} else if (heartbeatJSON["status"] === UP) {
const upMessage = {
to: notification.recieverId,
bot_id: notification.botId,
type: "text",
message:
`UptimeKuma Alert:
[🟢 Up]
Name: ${monitorJSON["name"]}
${heartbeatJSON["msg"]}
Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
};
await axios.post(url, upMessage, config);
}
return okMsg;
} catch (error) {
// Handle errors and throw a descriptive message
if (error.response) {
const errorMessage =
error.response.data?.message ||
"Unknown API error occurred.";
throw new Error(`OneChat API Error: ${errorMessage}`);
} else {
this.throwGeneralAxiosError(error);
}
}
}
}
module.exports = OneChat;

View file

@ -15,7 +15,7 @@ class PromoSMS extends NotificationProvider {
notification.promosmsAllowLongSMS = false;
}
//TODO: Add option for enabling special characters. It will decrease message max length from 160 to 70 chars.
//TODO: Add option for enabling special characters. It will decrese message max length from 160 to 70 chars.
//Lets remove non ascii char
let cleanMsg = msg.replace(/[^\x00-\x7F]/g, "");

View file

@ -1,48 +0,0 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { UP } = require("../../src/util");
class Pumble extends NotificationProvider {
name = "pumble";
/**
* @inheritDoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
try {
if (heartbeatJSON === null && monitorJSON === null) {
let data = {
"attachments": [
{
"title": "Uptime Kuma Alert",
"text": msg,
"color": "#5BDD8B"
}
]
};
await axios.post(notification.webhookURL, data);
return okMsg;
}
let data = {
"attachments": [
{
"title": `${monitorJSON["name"]} is ${heartbeatJSON["status"] === UP ? "up" : "down"}`,
"text": heartbeatJSON["msg"],
"color": (heartbeatJSON["status"] === UP ? "#5BDD8B" : "#DC3645"),
}
]
};
await axios.post(notification.webhookURL, data);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = Pumble;

View file

@ -11,7 +11,7 @@ class PushDeer extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com";
// capture group below is necessary to prevent an ReDOS-attack
// capture group below is nessesary to prevent an ReDOS-attack
const url = `${serverUrl.trim().replace(/([^/])\/+$/, "$1")}/message/push`;
let valid = msg != null && monitorJSON != null && heartbeatJSON != null;

View file

@ -1,6 +1,5 @@
const { getMonitorRelativeURL } = require("../../src/util");
const { setting } = require("../util-server");
const { UP } = require("../../src/util");
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
@ -44,20 +43,15 @@ class Pushover extends NotificationProvider {
if (heartbeatJSON == null) {
await axios.post(url, data);
return okMsg;
}
if (heartbeatJSON.status === UP && notification.pushoversounds_up) {
// default = DOWN => DOWN-sound is also played for non-UP/DOWN notiifcations
data.sound = notification.pushoversounds_up;
}
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>: ${heartbeatJSON["localDateTime"]}`;
} else {
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>:${heartbeatJSON["localDateTime"]}`;
await axios.post(url, data);
return okMsg;
}
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}

View file

@ -2,7 +2,6 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { setSettings, setting } = require("../util-server");
const { getMonitorRelativeURL, UP, log } = require("../../src/util");
const isUrl = require("is-url");
class Slack extends NotificationProvider {
name = "slack";
@ -50,7 +49,7 @@ class Slack extends NotificationProvider {
}
const address = this.extractAddress(monitorJSON);
if (isUrl(address)) {
if (address) {
try {
actions.push({
"type": "button",
@ -146,7 +145,6 @@ class Slack extends NotificationProvider {
const title = "Uptime Kuma Alert";
let data = {
"text": msg,
"channel": notification.slackchannel,
"username": notification.slackusername,
"icon_emoji": notification.slackiconemo,

View file

@ -1,40 +0,0 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class SMSPlanet extends NotificationProvider {
name = "SMSPlanet";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = "https://api2.smsplanet.pl/sms";
try {
let config = {
headers: {
"Authorization": "Bearer " + notification.smsplanetApiToken,
"content-type": "multipart/form-data"
}
};
let data = {
"from": notification.smsplanetSenderName,
"to": notification.smsplanetPhoneNumbers,
"msg": msg.replace(/🔴/, "❌")
};
let response = await axios.post(url, data, config);
if (!response.data?.messageId) {
throw new Error(response.data?.errorMsg ?? "SMSPlanet server did not respond with the expected result");
}
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = SMSPlanet;

View file

@ -11,127 +11,59 @@ class SMSEagle extends NotificationProvider {
const okMsg = "Sent Successfully.";
try {
if (notification.smseagleApiType === "smseagle-apiv1") { // according to https://www.smseagle.eu/apiv1/
let config = {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
}
};
let sendMethod;
let recipientType;
let duration;
let voiceId;
if (notification.smseagleRecipientType === "smseagle-contact") {
recipientType = "contactname";
sendMethod = "/send_tocontact";
} else if (notification.smseagleRecipientType === "smseagle-group") {
recipientType = "groupname";
sendMethod = "/send_togroup";
} else if (notification.smseagleRecipientType === "smseagle-to") {
recipientType = "to";
sendMethod = "/send_sms";
if (notification.smseagleMsgType !== "smseagle-sms") {
duration = notification.smseagleDuration ?? 10;
if (notification.smseagleMsgType === "smseagle-ring") {
sendMethod = "/ring_call";
} else if (notification.smseagleMsgType === "smseagle-tts") {
sendMethod = "/tts_call";
} else if (notification.smseagleMsgType === "smseagle-tts-advanced") {
sendMethod = "/tts_adv_call";
voiceId = notification.smseagleTtsModel ? notification.smseagleTtsModel : 1;
}
}
}
const url = new URL(notification.smseagleUrl + "/http_api" + sendMethod);
url.searchParams.append("access_token", notification.smseagleToken);
url.searchParams.append(recipientType, notification.smseagleRecipient);
if (!notification.smseagleRecipientType || notification.smseagleRecipientType === "smseagle-sms") {
url.searchParams.append("unicode", (notification.smseagleEncoding) ? "1" : "0");
url.searchParams.append("highpriority", notification.smseaglePriority ?? "0");
} else {
url.searchParams.append("duration", duration);
}
if (notification.smseagleRecipientType !== "smseagle-ring") {
url.searchParams.append("message", msg);
}
if (voiceId) {
url.searchParams.append("voice_id", voiceId);
}
let resp = await axios.get(url.toString(), config);
if (resp.data.indexOf("OK") === -1) {
let error = `SMSEagle API returned error: ${resp.data}`;
throw new Error(error);
}
return okMsg;
} else if (notification.smseagleApiType === "smseagle-apiv2") { // according to https://www.smseagle.eu/docs/apiv2/
let config = {
headers: {
"access-token": notification.smseagleToken,
"Content-Type": "application/json",
}
};
let encoding = (notification.smseagleEncoding) ? "unicode" : "standard";
let priority = (notification.smseaglePriority) ?? 0;
let postData;
let sendMethod;
let recipientType;
let postData = {
text: msg,
encoding: encoding,
priority: priority
let encoding = (notification.smseagleEncoding) ? "1" : "0";
let priority = (notification.smseaglePriority) ? notification.smseaglePriority : "0";
if (notification.smseagleRecipientType === "smseagle-contact") {
recipientType = "contactname";
sendMethod = "sms.send_tocontact";
}
if (notification.smseagleRecipientType === "smseagle-group") {
recipientType = "groupname";
sendMethod = "sms.send_togroup";
}
if (notification.smseagleRecipientType === "smseagle-to") {
recipientType = "to";
sendMethod = "sms.send_sms";
}
let params = {
access_token: notification.smseagleToken,
[recipientType]: notification.smseagleRecipient,
message: msg,
responsetype: "extended",
unicode: encoding,
highpriority: priority
};
if (notification.smseagleRecipientContact) {
postData["contacts"] = notification.smseagleRecipientContact.split(",").map(Number);
postData = {
method: sendMethod,
params: params
};
let resp = await axios.post(notification.smseagleUrl + "/jsonrpc/sms", postData, config);
if ((JSON.stringify(resp.data)).indexOf("message_id") === -1) {
let error = "";
if (resp.data.result && resp.data.result.error_text) {
error = `SMSEagle API returned error: ${JSON.stringify(resp.data.result.error_text)}`;
} else {
error = "SMSEagle API returned an unexpected response";
}
if (notification.smseagleRecipientGroup) {
postData["groups"] = notification.smseagleRecipientGroup.split(",").map(Number);
}
if (notification.smseagleRecipientTo) {
postData["to"] = notification.smseagleRecipientTo.split(",");
}
let endpoint = "/messages/sms";
if (notification.smseagleMsgType !== "smseagle-sms") {
postData["duration"] = notification.smseagleDuration ?? 10;
if (notification.smseagleMsgType === "smseagle-ring") {
endpoint = "/calls/ring";
} else if (notification.smseagleMsgType === "smseagle-tts") {
endpoint = "/calls/tts";
} else if (notification.smseagleMsgType === "smseagle-tts-advanced") {
endpoint = "/calls/tts_advanced";
postData["voice_id"] = notification.smseagleTtsModel ?? 1;
}
}
let resp = await axios.post(notification.smseagleUrl + "/api/v2" + endpoint, postData, config);
const queuedCount = resp.data.filter(x => x.status === "queued").length;
const unqueuedCount = resp.data.length - queuedCount;
if (resp.status !== 200 || queuedCount === 0) {
if (!resp.data.length) {
throw new Error("SMSEagle API returned an empty response");
}
throw new Error(`SMSEagle API returned error: ${JSON.stringify(resp.data)}`);
}
if (unqueuedCount) {
return `Sent ${queuedCount}/${resp.data.length} Messages Successfully.`;
throw new Error(error);
}
return okMsg;
}
} catch (error) {
this.throwGeneralAxiosError(error);
}

View file

@ -42,7 +42,6 @@ class SMTP extends NotificationProvider {
// default values in case the user does not want to template
let subject = msg;
let body = msg;
let useHTMLBody = false;
if (heartbeatJSON) {
body = `${msg}\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`;
}
@ -51,11 +50,11 @@ class SMTP extends NotificationProvider {
// cannot end with whitespace as this often raises spam scores
const customSubject = notification.customSubject?.trim() || "";
const customBody = notification.customBody?.trim() || "";
if (customSubject !== "") {
subject = await this.renderTemplate(customSubject, msg, monitorJSON, heartbeatJSON);
}
if (customBody !== "") {
useHTMLBody = notification.htmlBody || false;
body = await this.renderTemplate(customBody, msg, monitorJSON, heartbeatJSON);
}
}
@ -68,8 +67,7 @@ class SMTP extends NotificationProvider {
bcc: notification.smtpBCC,
to: notification.smtpTo,
subject: subject,
// If the email body is custom, and the user wants it, set the email body as HTML
[useHTMLBody ? "html" : "text"]: body
text: body,
});
return okMsg;

View file

@ -1,37 +0,0 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { DOWN, UP } = require("../../src/util");
class SpugPush extends NotificationProvider {
name = "SpugPush";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
try {
let formData = {
title: "Uptime Kuma Message",
content: msg
};
if (heartbeatJSON) {
if (heartbeatJSON["status"] === UP) {
formData.title = `UptimeKuma 「${monitorJSON["name"]}」 is Up`;
formData.content = `[✅ Up] ${heartbeatJSON["msg"]}`;
} else if (heartbeatJSON["status"] === DOWN) {
formData.title = `UptimeKuma 「${monitorJSON["name"]}」 is Down`;
formData.content = `[🔴 Down] ${heartbeatJSON["msg"]}`;
}
}
const apiUrl = `https://push.spug.cc/send/${notification.templateKey}`;
await axios.post(apiUrl, formData);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = SpugPush;

View file

@ -13,7 +13,6 @@ const DingDing = require("./notification-providers/dingding");
const Discord = require("./notification-providers/discord");
const Elks = require("./notification-providers/46elks");
const Feishu = require("./notification-providers/feishu");
const Notifery = require("./notification-providers/notifery");
const FreeMobile = require("./notification-providers/freemobile");
const GoogleChat = require("./notification-providers/google-chat");
const Gorush = require("./notification-providers/gorush");
@ -31,11 +30,9 @@ const Mattermost = require("./notification-providers/mattermost");
const Nostr = require("./notification-providers/nostr");
const Ntfy = require("./notification-providers/ntfy");
const Octopush = require("./notification-providers/octopush");
const OneChat = require("./notification-providers/onechat");
const OneBot = require("./notification-providers/onebot");
const Opsgenie = require("./notification-providers/opsgenie");
const PagerDuty = require("./notification-providers/pagerduty");
const Pumble = require("./notification-providers/pumble");
const FlashDuty = require("./notification-providers/flashduty");
const PagerTree = require("./notification-providers/pagertree");
const PromoSMS = require("./notification-providers/promosms");
@ -75,8 +72,6 @@ const Onesender = require("./notification-providers/onesender");
const Wpush = require("./notification-providers/wpush");
const SendGrid = require("./notification-providers/send-grid");
const YZJ = require("./notification-providers/yzj");
const SMSPlanet = require("./notification-providers/sms-planet");
const SpugPush = require("./notification-providers/spugpush");
class Notification {
@ -124,7 +119,6 @@ class Notification {
new Nostr(),
new Ntfy(),
new Octopush(),
new OneChat(),
new OneBot(),
new Onesender(),
new Opsgenie(),
@ -132,7 +126,6 @@ class Notification {
new FlashDuty(),
new PagerTree(),
new PromoSMS(),
new Pumble(),
new Pushbullet(),
new PushDeer(),
new Pushover(),
@ -167,10 +160,7 @@ class Notification {
new Cellsynt(),
new Wpush(),
new SendGrid(),
new YZJ(),
new SMSPlanet(),
new SpugPush(),
new Notifery(),
new YZJ()
];
for (let item of list) {
if (! item.name) {

View file

@ -5,10 +5,10 @@ const saltRounds = 10;
/**
* Hash a password
* @param {string} password Password to hash
* @returns {Promise<string>} Hash
* @returns {string} Hash
*/
exports.generate = function (password) {
return bcrypt.hash(password, saltRounds);
return bcrypt.hashSync(password, saltRounds);
};
/**

View file

@ -2,7 +2,6 @@ const PrometheusClient = require("prom-client");
const { log } = require("../src/util");
const commonLabels = [
"monitor_id",
"monitor_name",
"monitor_type",
"monitor_url",
@ -41,7 +40,6 @@ class Prometheus {
*/
constructor(monitor) {
this.monitorLabelValues = {
monitor_id: monitor.id,
monitor_name: monitor.name,
monitor_type: monitor.type,
monitor_url: monitor.url,

View file

@ -50,7 +50,7 @@ router.all("/api/push/:pushToken", async (request, response) => {
let msg = request.query.msg || "OK";
let ping = parseFloat(request.query.ping) || null;
let statusString = request.query.status || "up";
const statusFromParam = (statusString === "up") ? UP : DOWN;
let status = (statusString === "up") ? UP : DOWN;
let monitor = await R.findOne("monitor", " push_token = ? AND active = 1 ", [
pushToken
@ -80,7 +80,7 @@ router.all("/api/push/:pushToken", async (request, response) => {
msg = "Monitor under maintenance";
bean.status = MAINTENANCE;
} else {
determineStatus(statusFromParam, previousHeartbeat, monitor.maxretries, monitor.isUpsideDown(), bean);
determineStatus(status, previousHeartbeat, monitor.maxretries, monitor.isUpsideDown(), bean);
}
// Calculate uptime
@ -92,21 +92,21 @@ router.all("/api/push/:pushToken", async (request, response) => {
log.debug("router", "PreviousStatus: " + previousHeartbeat?.status);
log.debug("router", "Current Status: " + bean.status);
bean.important = Monitor.isImportantBeat(isFirstBeat, previousHeartbeat?.status, bean.status);
bean.important = Monitor.isImportantBeat(isFirstBeat, previousHeartbeat?.status, status);
if (Monitor.isImportantForNotification(isFirstBeat, previousHeartbeat?.status, bean.status)) {
if (Monitor.isImportantForNotification(isFirstBeat, previousHeartbeat?.status, status)) {
// Reset down count
bean.downCount = 0;
log.debug("monitor", `[${monitor.name}] sendNotification`);
log.debug("monitor", `[${this.name}] sendNotification`);
await Monitor.sendNotification(isFirstBeat, monitor, bean);
} else {
if (bean.status === DOWN && monitor.resendInterval > 0) {
if (bean.status === DOWN && this.resendInterval > 0) {
++bean.downCount;
if (bean.downCount >= monitor.resendInterval) {
if (bean.downCount >= this.resendInterval) {
// Send notification again, because we are still DOWN
log.debug("monitor", `[${monitor.name}] sendNotification again: Down Count: ${bean.downCount} | Resend Interval: ${monitor.resendInterval}`);
await Monitor.sendNotification(isFirstBeat, monitor, bean);
log.debug("monitor", `[${this.name}] sendNotification again: Down Count: ${bean.downCount} | Resend Interval: ${this.resendInterval}`);
await Monitor.sendNotification(isFirstBeat, this, bean);
// Reset down count
bean.downCount = 0;

View file

@ -89,7 +89,7 @@ router.get("/api/status-page/heartbeat/:slug", cache("1 minutes"), async (reques
SELECT * FROM heartbeat
WHERE monitor_id = ?
ORDER BY time DESC
LIMIT 100
LIMIT 50
`, [
monitorID,
]);

View file

@ -674,7 +674,7 @@ let needSetup = false;
let user = R.dispense("user");
user.username = username;
user.password = await passwordHash.generate(password);
user.password = passwordHash.generate(password);
await R.store(user);
needSetup = false;
@ -720,17 +720,6 @@ let needSetup = false;
monitor.rabbitmqNodes = JSON.stringify(monitor.rabbitmqNodes);
/*
* List of frontend-only properties that should not be saved to the database.
* Should clean up before saving to the database.
*/
const frontendOnlyProperties = [ "humanReadableInterval" ];
for (const prop of frontendOnlyProperties) {
if (prop in monitor) {
delete monitor[prop];
}
}
bean.import(monitor);
bean.user_id = socket.userID;
@ -803,7 +792,6 @@ let needSetup = false;
bean.url = monitor.url;
bean.method = monitor.method;
bean.body = monitor.body;
bean.ipFamily = monitor.ipFamily;
bean.headers = monitor.headers;
bean.basic_auth_user = monitor.basic_auth_user;
bean.basic_auth_pass = monitor.basic_auth_pass;
@ -813,7 +801,6 @@ let needSetup = false;
bean.oauth_auth_method = monitor.oauth_auth_method;
bean.oauth_token_url = monitor.oauth_token_url;
bean.oauth_scopes = monitor.oauth_scopes;
bean.oauth_audience = monitor.oauth_audience;
bean.tlsCa = monitor.tlsCa;
bean.tlsCert = monitor.tlsCert;
bean.tlsKey = monitor.tlsKey;
@ -848,7 +835,6 @@ let needSetup = false;
bean.mqttTopic = monitor.mqttTopic;
bean.mqttSuccessMessage = monitor.mqttSuccessMessage;
bean.mqttCheckType = monitor.mqttCheckType;
bean.mqttWebsocketPath = monitor.mqttWebsocketPath;
bean.databaseConnectionString = monitor.databaseConnectionString;
bean.databaseQuery = monitor.databaseQuery;
bean.authMethod = monitor.authMethod;
@ -880,7 +866,6 @@ let needSetup = false;
monitor.kafkaProducerAllowAutoTopicCreation;
bean.gamedigGivenPortOnly = monitor.gamedigGivenPortOnly;
bean.remote_browser = monitor.remote_browser;
bean.smtpSecurity = monitor.smtpSecurity;
bean.snmpVersion = monitor.snmpVersion;
bean.snmpOid = monitor.snmpOid;
bean.jsonPathOperator = monitor.jsonPathOperator;
@ -889,12 +874,6 @@ let needSetup = false;
bean.rabbitmqUsername = monitor.rabbitmqUsername;
bean.rabbitmqPassword = monitor.rabbitmqPassword;
bean.conditions = JSON.stringify(monitor.conditions);
bean.manual_status = monitor.manual_status;
// ping advanced options
bean.ping_numeric = monitor.ping_numeric;
bean.ping_count = monitor.ping_count;
bean.ping_per_request_timeout = monitor.ping_per_request_timeout;
bean.validate();

View file

@ -20,14 +20,14 @@ module.exports.apiKeySocketHandler = (socket) => {
checkLogin(socket);
let clearKey = nanoid(40);
let hashedKey = await passwordHash.generate(clearKey);
let hashedKey = passwordHash.generate(clearKey);
key["key"] = hashedKey;
let bean = await APIKey.save(key, socket.userID);
log.debug("apikeys", "Added API Key");
log.debug("apikeys", key);
// Append key ID and prefix to start of key separated by _, used to get
// Append key ID and prefix to start of key seperated by _, used to get
// correct hash when validating key.
let formattedKey = "uk" + bean.id + "_" + clearKey;
await sendAPIKeyList(socket);

View file

@ -14,7 +14,7 @@ module.exports.databaseSocketHandler = (socket) => {
checkLogin(socket);
callback({
ok: true,
size: await Database.getSize(),
size: Database.getSize(),
});
} catch (error) {
callback({

View file

@ -4,7 +4,7 @@ const { sendInfo } = require("../client");
const { checkLogin } = require("../util-server");
const GameResolver = require("gamedig/lib/GameResolver");
const { testChrome } = require("../monitor-types/real-browser-monitor-type");
const fsAsync = require("fs").promises;
const fs = require("fs");
const path = require("path");
let gameResolver = new GameResolver();
@ -90,29 +90,17 @@ module.exports.generalSocketHandler = (socket, server) => {
}
});
socket.on("getPushExample", async (language, callback) => {
try {
checkLogin(socket);
if (!/^[a-z-]+$/.test(language)) {
throw new Error("Invalid language");
}
} catch (e) {
callback({
ok: false,
msg: e.message,
});
return;
}
socket.on("getPushExample", (language, callback) => {
try {
let dir = path.join("./extra/push-examples", language);
let files = await fsAsync.readdir(dir);
let files = fs.readdirSync(dir);
for (let file of files) {
if (file.startsWith("index.")) {
callback({
ok: true,
code: await fsAsync.readFile(path.join(dir, file), "utf8"),
code: fs.readFileSync(path.join(dir, file), "utf8"),
});
return;
}

View file

@ -211,10 +211,6 @@ module.exports.statusPageSocketHandler = (socket) => {
relationBean.send_url = monitor.sendUrl;
}
if (monitor.url !== undefined) {
relationBean.custom_url = monitor.url;
}
await R.store(relationBean);
}

View file

@ -582,7 +582,7 @@ class UptimeCalculator {
let totalPing = 0;
let endTimestamp;
// Get the earliest timestamp of the required period based on the type
// Get the eariest timestamp of the required period based on the type
switch (type) {
case "day":
endTimestamp = key - 86400 * (num - 1);
@ -710,7 +710,7 @@ class UptimeCalculator {
let endTimestamp;
// Get the earliest timestamp of the required period based on the type
// Get the eariest timestamp of the required period based on the type
switch (type) {
case "day":
endTimestamp = key - 86400 * (num - 1);

View file

@ -113,12 +113,9 @@ class UptimeKumaServer {
UptimeKumaServer.monitorTypeList["tailscale-ping"] = new TailscalePing();
UptimeKumaServer.monitorTypeList["dns"] = new DnsMonitorType();
UptimeKumaServer.monitorTypeList["mqtt"] = new MqttMonitorType();
UptimeKumaServer.monitorTypeList["smtp"] = new SMTPMonitorType();
UptimeKumaServer.monitorTypeList["group"] = new GroupMonitorType();
UptimeKumaServer.monitorTypeList["snmp"] = new SNMPMonitorType();
UptimeKumaServer.monitorTypeList["mongodb"] = new MongodbMonitorType();
UptimeKumaServer.monitorTypeList["rabbitmq"] = new RabbitMqMonitorType();
UptimeKumaServer.monitorTypeList["manual"] = new ManualMonitorType();
// Allow all CORS origins (polling) in development
let cors = undefined;
@ -554,10 +551,7 @@ const { RealBrowserMonitorType } = require("./monitor-types/real-browser-monitor
const { TailscalePing } = require("./monitor-types/tailscale-ping");
const { DnsMonitorType } = require("./monitor-types/dns");
const { MqttMonitorType } = require("./monitor-types/mqtt");
const { SMTPMonitorType } = require("./monitor-types/smtp");
const { GroupMonitorType } = require("./monitor-types/group");
const { SNMPMonitorType } = require("./monitor-types/snmp");
const { MongodbMonitorType } = require("./monitor-types/mongodb");
const { RabbitMqMonitorType } = require("./monitor-types/rabbitmq");
const { ManualMonitorType } = require("./monitor-types/manual");
const Monitor = require("./model/monitor");

View file

@ -1,11 +1,7 @@
const tcpp = require("tcp-ping");
const ping = require("@louislam/ping");
const { R } = require("redbean-node");
const {
log, genSecret, badgeConstants,
PING_PACKET_SIZE_DEFAULT, PING_GLOBAL_TIMEOUT_DEFAULT,
PING_COUNT_DEFAULT, PING_PER_REQUEST_TIMEOUT_DEFAULT
} = require("../src/util");
const { log, genSecret, badgeConstants } = require("../src/util");
const passwordHash = require("./password-hash");
const { Resolver } = require("dns");
const iconv = require("iconv-lite");
@ -23,7 +19,6 @@ const radiusClient = require("node-radius-client");
const redis = require("redis");
const oidc = require("openid-client");
const tls = require("tls");
const { exists } = require("fs");
const {
dictionaries: {
@ -52,13 +47,13 @@ exports.initJWTSecret = async () => {
jwtSecretBean.key = "jwtSecret";
}
jwtSecretBean.value = await passwordHash.generate(genSecret());
jwtSecretBean.value = passwordHash.generate(genSecret());
await R.store(jwtSecretBean);
return jwtSecretBean;
};
/**
* Decodes a jwt and returns the payload portion without verifying the jwt.
* Decodes a jwt and returns the payload portion without verifying the jqt.
* @param {string} jwt The input jwt as a string
* @returns {object} Decoded jwt payload object
*/
@ -67,16 +62,15 @@ exports.decodeJwt = (jwt) => {
};
/**
* Gets an Access Token from an oidc/oauth2 provider
* @param {string} tokenEndpoint The token URI from the auth service provider
* Gets a Access Token form a oidc/oauth2 provider
* @param {string} tokenEndpoint The token URI form the auth service provider
* @param {string} clientId The oidc/oauth application client id
* @param {string} clientSecret The oidc/oauth application client secret
* @param {string} scope The scope(s) for which the token should be issued for
* @param {string} audience The audience for which the token should be issued for
* @param {string} authMethod The method used to send the credentials. Default client_secret_basic
* @param {string} scope The scope the for which the token should be issued for
* @param {string} authMethod The method on how to sent the credentials. Default client_secret_basic
* @returns {Promise<oidc.TokenSet>} TokenSet promise if the token request was successful
*/
exports.getOidcTokenClientCredentials = async (tokenEndpoint, clientId, clientSecret, scope, audience, authMethod = "client_secret_basic") => {
exports.getOidcTokenClientCredentials = async (tokenEndpoint, clientId, clientSecret, scope, authMethod = "client_secret_basic") => {
const oauthProvider = new oidc.Issuer({ token_endpoint: tokenEndpoint });
let client = new oauthProvider.Client({
client_id: clientId,
@ -92,10 +86,6 @@ exports.getOidcTokenClientCredentials = async (tokenEndpoint, clientId, clientSe
if (scope) {
grantParams.scope = scope;
}
if (audience) {
grantParams.audience = audience;
}
return await client.grant(grantParams);
};
@ -128,33 +118,20 @@ exports.tcping = function (hostname, port) {
/**
* Ping the specified machine
* @param {string} destAddr Hostname / IP address of machine to ping
* @param {number} count Number of packets to send before stopping
* @param {string} sourceAddr Source address for sending/receiving echo requests
* @param {boolean} numeric If true, IP addresses will be output instead of symbolic hostnames
* @param {number} size Size (in bytes) of echo request to send
* @param {number} deadline Maximum time in seconds before ping stops, regardless of packets sent
* @param {number} timeout Maximum time in seconds to wait for each response
* @param {string} hostname Hostname / address of machine
* @param {number} size Size of packet to send
* @returns {Promise<number>} Time for ping in ms rounded to nearest integer
*/
exports.ping = async (
destAddr,
count = PING_COUNT_DEFAULT,
sourceAddr = "",
numeric = true,
size = PING_PACKET_SIZE_DEFAULT,
deadline = PING_GLOBAL_TIMEOUT_DEFAULT,
timeout = PING_PER_REQUEST_TIMEOUT_DEFAULT,
) => {
exports.ping = async (hostname, size = 56) => {
try {
return await exports.pingAsync(destAddr, false, count, sourceAddr, numeric, size, deadline, timeout);
return await exports.pingAsync(hostname, false, size);
} catch (e) {
// If the host cannot be resolved, try again with ipv6
log.debug("ping", "IPv6 error message: " + e.message);
// As node-ping does not report a specific error for this, try again if it is an empty message with ipv6 no matter what.
if (!e.message) {
return await exports.pingAsync(destAddr, true, count, sourceAddr, numeric, size, deadline, timeout);
return await exports.pingAsync(hostname, true, size);
} else {
throw e;
}
@ -163,35 +140,18 @@ exports.ping = async (
/**
* Ping the specified machine
* @param {string} destAddr Hostname / IP address of machine to ping
* @param {string} hostname Hostname / address of machine to ping
* @param {boolean} ipv6 Should IPv6 be used?
* @param {number} count Number of packets to send before stopping
* @param {string} sourceAddr Source address for sending/receiving echo requests
* @param {boolean} numeric If true, IP addresses will be output instead of symbolic hostnames
* @param {number} size Size (in bytes) of echo request to send
* @param {number} deadline Maximum time in seconds before ping stops, regardless of packets sent
* @param {number} timeout Maximum time in seconds to wait for each response
* @param {number} size Size of ping packet to send
* @returns {Promise<number>} Time for ping in ms rounded to nearest integer
*/
exports.pingAsync = function (
destAddr,
ipv6 = false,
count = PING_COUNT_DEFAULT,
sourceAddr = "",
numeric = true,
size = PING_PACKET_SIZE_DEFAULT,
deadline = PING_GLOBAL_TIMEOUT_DEFAULT,
timeout = PING_PER_REQUEST_TIMEOUT_DEFAULT,
) {
exports.pingAsync = function (hostname, ipv6 = false, size = 56) {
return new Promise((resolve, reject) => {
ping.promise.probe(destAddr, {
ping.promise.probe(hostname, {
v6: ipv6,
min_reply: count,
sourceAddr: sourceAddr,
numeric: numeric,
min_reply: 1,
deadline: 10,
packetSize: size,
deadline: deadline,
timeout: timeout
}).then((res) => {
// If ping failed, it will set field to unknown
if (res.alive) {
@ -1102,17 +1062,3 @@ module.exports.axiosAbortSignal = (timeoutMs) => {
}
}
};
/**
* Async version of fs.existsSync
* @param {PathLike} path File path
* @returns {Promise<boolean>} True if file exists, false otherwise
*/
function fsExists(path) {
return new Promise(function (resolve, reject) {
exists(path, function (exists) {
resolve(exists);
});
});
}
module.exports.fsExists = fsExists;

View file

@ -4,11 +4,9 @@
<script>
import { setPageLocale } from "./util-frontend";
import { polyfillCountryFlagEmojis } from "country-flag-emoji-polyfill";
export default {
created() {
setPageLocale();
},
};
polyfillCountryFlagEmojis();
</script>

View file

@ -3,7 +3,7 @@
@import "node_modules/bootstrap/scss/bootstrap";
#app {
font-family: "Twemoji Country Flags", BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
font-family: BlinkMacSystemFont, segoe ui, Roboto, helvetica neue, Arial, noto sans, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, noto color emoji;
}
h1 {

View file

@ -42,9 +42,6 @@ export default {
mounted() {
this.modal = new Modal(this.$refs.modal);
},
beforeUnmount() {
this.cleanupModal();
},
methods: {
/**
* Show the confirm dialog
@ -61,19 +58,6 @@ export default {
this.$emit("added", this.groupName);
this.modal.hide();
},
/**
* Clean up modal and restore scroll behavior
* @returns {void}
*/
cleanupModal() {
if (this.modal) {
try {
this.modal.hide();
} catch (e) {
console.warn("Modal hide failed:", e);
}
}
}
},
};
</script>

View file

@ -7,17 +7,11 @@
class="beat-hover-area"
:class="{ 'empty': (beat === 0) }"
:style="beatHoverAreaStyle"
:aria-label="getBeatAriaLabel(beat)"
role="status"
tabindex="0"
@mouseenter="showTooltip(beat, $event)"
@mouseleave="hideTooltip"
@focus="showTooltip(beat, $event)"
@blur="hideTooltip"
:title="getBeatTitle(beat)"
>
<div
class="beat"
:class="{ 'empty': (beat === 0 || beat === null || beat.status === null), 'down': (beat.status === DOWN), 'pending': (beat.status === PENDING), 'maintenance': (beat.status === MAINTENANCE) }"
:class="{ 'empty': (beat === 0), 'down': (beat.status === 0), 'pending': (beat.status === 2), 'maintenance': (beat.status === 3) }"
:style="beatStyle"
/>
</div>
@ -30,27 +24,13 @@
<div v-if="$root.styleElapsedTime === 'with-line'" class="connecting-line"></div>
<div>{{ timeSinceLastBeat }}</div>
</div>
<!-- Custom Tooltip -->
<Tooltip
:visible="tooltipVisible"
:content="tooltipContent"
:x="tooltipX"
:y="tooltipY"
:position="tooltipPosition"
/>
</div>
</template>
<script>
import dayjs from "dayjs";
import { DOWN, UP, PENDING, MAINTENANCE } from "../util.ts";
import Tooltip from "./Tooltip.vue";
export default {
components: {
Tooltip,
},
props: {
/** Size of the heartbeat bar */
size: {
@ -66,11 +46,6 @@ export default {
heartbeatList: {
type: Array,
default: null,
},
/** Heartbeat bar days */
heartbeatBarDays: {
type: Number,
default: 0
}
},
data() {
@ -81,25 +56,10 @@ export default {
beatHoverAreaPadding: 4,
move: false,
maxBeat: -1,
// Tooltip data
tooltipVisible: false,
tooltipContent: null,
tooltipX: 0,
tooltipY: 0,
tooltipPosition: "below",
tooltipTimeoutId: null,
};
},
computed: {
/**
* Normalized heartbeatBarDays as a number
* @returns {number} Number of days for heartbeat bar
*/
normalizedHeartbeatBarDays() {
return Math.max(0, Math.min(365, Math.floor(this.heartbeatBarDays || 0)));
},
/**
* If heartbeatList is null, get it from $root.heartbeatList
* @returns {object} Heartbeat list
@ -120,12 +80,6 @@ export default {
if (!this.beatList) {
return 0;
}
// For configured ranges, no padding needed since we show all beats
if (this.normalizedHeartbeatBarDays > 0) {
return 0;
}
let num = this.beatList.length - this.maxBeat;
if (this.move) {
@ -144,20 +98,8 @@ export default {
return [];
}
// If heartbeat days is configured (not auto), data is already aggregated from server
if (this.normalizedHeartbeatBarDays > 0 && this.beatList.length > 0) {
// Show all beats from server - they are already properly aggregated
return this.beatList;
}
// Original logic for auto mode (heartbeatBarDays = 0)
let placeholders = [];
// Handle case where maxBeat is -1 (no limit)
if (this.maxBeat <= 0) {
return this.beatList;
}
let start = this.beatList.length - this.maxBeat;
if (this.move) {
@ -230,17 +172,13 @@ export default {
* @returns {string} The time elapsed in minutes or hours.
*/
timeSinceFirstBeat() {
if (this.normalizedHeartbeatBarDays === 1) {
return (this.normalizedHeartbeatBarDays * 24) + "h";
}
if (this.normalizedHeartbeatBarDays >= 2) {
return this.normalizedHeartbeatBarDays + "d";
}
// Need to calculate from actual data
const firstValidBeat = this.shortBeatList.at(this.numPadding);
const minutes = dayjs().diff(dayjs.utc(firstValidBeat?.time), "minutes");
return minutes > 60 ? Math.floor(minutes / 60) + "h" : minutes + "m";
if (minutes > 60) {
return (minutes / 60).toFixed(0) + "h";
} else {
return minutes + "m";
}
},
/**
@ -267,7 +205,7 @@ export default {
},
watch: {
beatList: {
handler() {
handler(val, oldVal) {
this.move = true;
setTimeout(() => {
@ -279,10 +217,6 @@ export default {
},
unmounted() {
window.removeEventListener("resize", this.resize);
// Clean up tooltip timeout
if (this.tooltipTimeoutId) {
clearTimeout(this.tooltipTimeoutId);
}
},
beforeMount() {
if (this.heartbeatList === null) {
@ -322,23 +256,7 @@ export default {
*/
resize() {
if (this.$refs.wrap) {
const newMaxBeat = Math.floor(this.$refs.wrap.clientWidth / (this.beatWidth + this.beatHoverAreaPadding * 2));
// If maxBeat changed and we're in configured days mode, notify parent to reload data
if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
this.maxBeat = newMaxBeat;
// Find the closest parent with reloadHeartbeatData method (StatusPage)
let parent = this.$parent;
while (parent && !parent.reloadHeartbeatData) {
parent = parent.$parent;
}
if (parent && parent.reloadHeartbeatData) {
parent.reloadHeartbeatData(newMaxBeat);
}
} else {
this.maxBeat = newMaxBeat;
}
this.maxBeat = Math.floor(this.$refs.wrap.clientWidth / (this.beatWidth + this.beatHoverAreaPadding * 2));
}
},
@ -349,105 +267,7 @@ export default {
* @returns {string} Beat title
*/
getBeatTitle(beat) {
if (!beat) {
return "";
}
// Show timestamp for all beats (both individual and aggregated)
return `${this.$root.datetime(beat.time)}${beat.msg ? ` - ${beat.msg}` : ""}`;
},
/**
* Get the aria-label for accessibility
* @param {object} beat Beat to get aria-label from
* @returns {string} Aria label
*/
getBeatAriaLabel(beat) {
switch (beat?.status) {
case DOWN:
return `Down at ${this.$root.datetime(beat.time)}`;
case UP:
return `Up at ${this.$root.datetime(beat.time)}`;
case PENDING:
return `Pending at ${this.$root.datetime(beat.time)}`;
case MAINTENANCE:
return `Maintenance at ${this.$root.datetime(beat.time)}`;
default:
return "No data";
}
},
/**
* Show custom tooltip
* @param {object} beat Beat data
* @param {Event} event Mouse event
* @returns {void}
*/
showTooltip(beat, event) {
if (beat === 0 || !beat) {
this.hideTooltip();
return;
}
// Clear any existing timeout
if (this.tooltipTimeoutId) {
clearTimeout(this.tooltipTimeoutId);
}
// Small delay for better UX
this.tooltipTimeoutId = setTimeout(() => {
this.tooltipContent = beat;
// Calculate position relative to viewport
const rect = event.target.getBoundingClientRect();
// Position relative to viewport
const x = rect.left + (rect.width / 2);
const y = rect.top;
// Check if tooltip would go off-screen and adjust position
const tooltipHeight = 80; // Approximate tooltip height
const viewportHeight = window.innerHeight;
const spaceAbove = y;
const spaceBelow = viewportHeight - y - rect.height;
if (spaceAbove > tooltipHeight && spaceBelow < tooltipHeight) {
// Show above - arrow points down
this.tooltipPosition = "above";
this.tooltipY = y - 10;
} else {
// Show below - arrow points up
this.tooltipPosition = "below";
this.tooltipY = y + rect.height + 10;
}
// Ensure tooltip doesn't go off the left or right edge
const tooltipWidth = 120; // Approximate tooltip width
let adjustedX = x;
if ((x - tooltipWidth / 2) < 10) {
adjustedX = tooltipWidth / 2 + 10;
} else if ((x + tooltipWidth / 2) > (window.innerWidth - 10)) {
adjustedX = window.innerWidth - tooltipWidth / 2 - 10;
}
this.tooltipX = adjustedX;
this.tooltipVisible = true;
}, 150);
},
/**
* Hide custom tooltip
* @returns {void}
*/
hideTooltip() {
if (this.tooltipTimeoutId) {
clearTimeout(this.tooltipTimeoutId);
this.tooltipTimeoutId = null;
}
this.tooltipVisible = false;
this.tooltipContent = null;
return `${this.$root.datetime(beat.time)}` + ((beat.msg) ? ` - ${beat.msg}` : "");
},
},

View file

@ -14,7 +14,7 @@
<router-link :to="monitorURL(monitor.id)" class="item" :class="{ 'disabled': ! monitor.active }">
<div class="row">
<div class="col-6 small-padding" :class="{ 'monitor-item': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }">
<div class="col-9 col-md-8 small-padding" :class="{ 'monitor-item': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }">
<div class="info">
<Uptime :monitor="monitor" type="24" :pill="true" />
<span v-if="hasChildren" class="collapse-padding" @click.prevent="changeCollapsed">
@ -22,11 +22,11 @@
</span>
{{ monitor.name }}
</div>
<div v-if="monitor.tags.length > 0" class="tags gap-1">
<div v-if="monitor.tags.length > 0" class="tags">
<Tag v-for="tag in monitor.tags" :key="tag" :item="tag" :size="'sm'" />
</div>
</div>
<div v-show="$root.userHeartbeatBar == 'normal'" :key="$root.userHeartbeatBar" class="col-6">
<div v-show="$root.userHeartbeatBar == 'normal'" :key="$root.userHeartbeatBar" class="col-3 col-md-4">
<HeartbeatBar ref="heartbeatBar" size="small" :monitor-id="monitor.id" />
</div>
</div>

View file

@ -10,7 +10,7 @@
</div>
<div class="modal-body">
<div class="my-3 form-check">
<input id="show-clickable-link" v-model="monitor.isClickAble" class="form-check-input" type="checkbox" data-testid="show-clickable-link" @click="toggleLink(monitor.group_index, monitor.monitor_index)" />
<input id="show-clickable-link" v-model="monitor.isClickAble" class="form-check-input" type="checkbox" @click="toggleLink(monitor.group_index, monitor.monitor_index)" />
<label class="form-check-label" for="show-clickable-link">
{{ $t("Show Clickable Link") }}
</label>
@ -19,16 +19,6 @@
</div>
</div>
<!-- Custom URL -->
<template v-if="monitor.isClickAble">
<label for="customUrl" class="form-label">{{ $t("Custom URL") }}</label>
<input id="customUrl" :value="monitor.url" type="url" class="form-control" data-testid="custom-url-input" @input="e => changeUrl(monitor.group_index, monitor.monitor_index, e.target!.value)">
<div class="form-text mb-3">
{{ $t("customUrlDescription") }}
</div>
</template>
<button
class="btn btn-primary btn-add-group me-2"
@click="$refs.badgeGeneratorDialog.show(monitor.id, monitor.name)"
@ -39,7 +29,7 @@
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-danger" data-bs-dismiss="modal" data-testid="monitor-settings-close">
<button type="submit" class="btn btn-danger" data-bs-dismiss="modal">
{{ $t("Close") }}
</button>
</div>
@ -88,7 +78,6 @@ export default {
monitor_index: monitor.index,
group_index: group.index,
isClickAble: this.showLink(monitor),
url: monitor.element.url,
};
this.MonitorSettingDialog.show();
@ -121,17 +110,6 @@ export default {
}
return monitor.element.sendUrl && monitor.element.url && monitor.element.url !== "https://" && !this.editMode;
},
/**
* Toggle the value of sendUrl
* @param {number} groupIndex Index of group monitor is member of
* @param {number} index Index of monitor within group
* @param {string} value The new value of the url
* @returns {void}
*/
changeUrl(groupIndex, index, value) {
this.$root.publicGroupList[groupIndex].monitorList[index].url = value;
},
},
};
</script>

View file

@ -135,13 +135,11 @@ export default {
"nostr": "Nostr",
"ntfy": "Ntfy",
"octopush": "Octopush",
"OneChat": "OneChat",
"OneBot": "OneBot",
"Onesender": "Onesender",
"Opsgenie": "Opsgenie",
"PagerDuty": "PagerDuty",
"PagerTree": "PagerTree",
"pumble": "Pumble",
"pushbullet": "Pushbullet",
"PushByTechulus": "Push by Techulus",
"pushover": "Pushover",
@ -168,8 +166,7 @@ export default {
"waha": "WhatsApp (WAHA)",
"gtxmessaging": "GtxMessaging",
"Cellsynt": "Cellsynt",
"SendGrid": "SendGrid",
"notifery": "Notifery"
"SendGrid": "SendGrid"
};
// Put notifications here if it's not supported in most regions or its documentation is not in English
@ -186,11 +183,9 @@ export default {
"WeCom": "WeCom (企业微信群机器人)",
"ServerChan": "ServerChan (Server酱)",
"PushPlus": "PushPlus (推送加)",
"SpugPush": "SpugPushSpug推送助手",
"smsc": "SMSC",
"WPush": "WPush(wpush.cn)",
"YZJ": "YZJ (云之家自定义机器人)",
"SMSPlanet": "SMSPlanet.pl"
"YZJ": "YZJ (云之家自定义机器人)"
};
// Sort by notification name
@ -240,9 +235,6 @@ export default {
mounted() {
this.modal = new Modal(this.$refs.modal);
},
beforeUnmount() {
this.cleanupModal();
},
methods: {
/**
@ -347,20 +339,6 @@ export default {
});
} while (this.$root.notificationList.find(it => it.name === name));
return name;
},
/**
* Clean up modal and restore scroll behavior
* @returns {void}
*/
cleanupModal() {
if (this.modal) {
try {
this.modal.hide();
} catch (e) {
console.warn("Modal hide failed:", e);
}
}
}
},
};

View file

@ -125,12 +125,11 @@ export default {
}
};
},
mounted() {
this.modal = new Modal(this.$refs.modal);
},
beforeUnmount() {
this.cleanupModal();
},
methods: {
/**
* Show dialog to confirm deletion
@ -174,38 +173,6 @@ export default {
this.modal.show();
},
/**
* Show dialog to clone a proxy
* @param {number} proxyID ID of proxy to clone
* @returns {void}
*/
showClone(proxyID) {
if (proxyID) {
for (let proxy of this.$root.proxyList) {
if (proxy.id === proxyID) {
// Create a clone of the proxy data
this.proxy = {
protocol: proxy.protocol,
host: proxy.host,
port: proxy.port,
auth: proxy.auth,
username: proxy.username,
password: proxy.password,
active: proxy.active,
default: false, // Cloned proxy should not be default
applyExisting: false,
};
break;
}
}
}
// Set id to null to indicate this is a new proxy (clone)
this.id = null;
this.modal.show();
},
/**
* Submit form data for saving
* @returns {void}
@ -242,20 +209,6 @@ export default {
}
});
},
/**
* Clean up modal and restore scroll behavior
* @returns {void}
*/
cleanupModal() {
if (this.modal) {
try {
this.modal.hide();
} catch (e) {
console.warn("Modal hide failed:", e);
}
}
}
},
};
</script>

View file

@ -33,7 +33,7 @@
<template #item="monitor">
<div class="item" data-testid="monitor">
<div class="row">
<div class="col-6 small-padding">
<div class="col-9 col-md-8 small-padding">
<div class="info">
<font-awesome-icon v-if="editMode" icon="arrows-alt-v" class="action drag me-3" />
<font-awesome-icon v-if="editMode" icon="times" class="action remove me-3" @click="removeMonitor(group.index, monitor.index)" />
@ -58,7 +58,6 @@
v-if="editMode"
:class="{'link-active': true, 'btn-link': true}"
icon="cog" class="action me-3"
data-testid="monitor-settings"
@click="$refs.monitorSettingDialog.show(group, monitor)"
/>
</span>
@ -72,7 +71,7 @@
</div>
</div>
</div>
<div :key="$root.userHeartbeatBar" class="col-6">
<div :key="$root.userHeartbeatBar" class="col-3 col-md-4">
<HeartbeatBar size="mid" :monitor-id="monitor.element.id" />
</div>
</div>

View file

@ -6,6 +6,7 @@
'm-2': size == 'normal',
'px-2': size == 'sm',
'py-0': size == 'sm',
'mx-1': size == 'sm',
}"
:style="{ backgroundColor: item.color, fontSize: size == 'sm' ? '0.7em' : '1em' }"
>
@ -47,7 +48,7 @@ export default {
},
computed: {
displayText() {
if (this.item.value === "" || this.item.value === undefined || this.item.value === null) {
if (this.item.value === "" || this.item.value === undefined) {
return this.item.name;
} else {
return `${this.item.name}: ${this.item.value}`;

View file

@ -4,7 +4,7 @@
<div v-if="selectedTags.length > 0" class="mb-2 p-1">
<tag
v-for="item in selectedTags"
:key="`${item.tag_id || item.id}-${item.value || ''}`"
:key="item.id"
:item="item"
:remove="deleteTag"
/>
@ -20,20 +20,10 @@
<font-awesome-icon class="me-1" icon="plus" /> {{ $t("Add") }}
</button>
</div>
<div ref="modal" class="modal fade" tabindex="-1" data-bs-backdrop="static" data-bs-keyboard="false">
<div ref="modal" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<h4 v-if="stagedForBatchAdd.length > 0">{{ $t("Add Tags") }}</h4>
<div v-if="stagedForBatchAdd.length > 0" class="mb-3 staging-area" style="max-height: 150px; overflow-y: auto;">
<Tag
v-for="stagedTag in stagedForBatchAdd"
:key="stagedTag.keyForList"
:item="mapStagedTagToDisplayItem(stagedTag)"
:remove="() => unstageTag(stagedTag)"
/>
</div>
<vue-multiselect
v-model="newDraftTag.select"
class="mb-2"
@ -68,11 +58,14 @@
<div class="w-50 pe-2">
<input
v-model="newDraftTag.name" class="form-control"
:class="{'is-invalid': validateDraftTag.invalid && (validateDraftTag.messageKey === 'tagNameColorRequired' || validateDraftTag.messageKey === 'tagNameExists')}"
:class="{'is-invalid': validateDraftTag.nameInvalid}"
:placeholder="$t('Name')"
data-testid="tag-name-input"
@keydown.enter.prevent="onEnter"
/>
<div class="invalid-feedback">
{{ $t("Tag with this name already exist.") }}
</div>
</div>
<div class="w-50 ps-2">
<vue-multiselect
@ -111,23 +104,26 @@
<div class="mb-2">
<input
v-model="newDraftTag.value" class="form-control"
:class="{'is-invalid': validateDraftTag.invalid && validateDraftTag.messageKey === 'tagAlreadyOnMonitor'}"
:class="{'is-invalid': validateDraftTag.valueInvalid}"
:placeholder="$t('value (optional)')"
data-testid="tag-value-input"
@keydown.enter.prevent="onEnter"
/>
</div>
<div v-if="validateDraftTag.invalid && validateDraftTag.messageKey" class="form-text text-danger mb-2">
{{ $t(validateDraftTag.messageKey, validateDraftTag.messageParams) }}
<div class="invalid-feedback">
{{ $t("Tag with this value already exist.") }}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" @click.stop="clearStagingAndCloseModal">{{ $t("Cancel") }}</button>
<button type="button" class="btn btn-outline-primary me-2" :disabled="processing || validateDraftTag.invalid" @click.stop="stageCurrentTag">
{{ $t("Add Another Tag") }}
<div class="mb-2">
<button
type="button"
class="btn btn-secondary float-end"
:disabled="processing || validateDraftTag.invalid"
data-testid="tag-submit-button"
@click.stop="addDraftTag"
>
{{ $t("Add") }}
</button>
<button type="button" class="btn btn-primary" :disabled="processing || (stagedForBatchAdd.length === 0 && validateDraftTag.invalid)" data-testid="add-tags-final-button" @click.stop="confirmAndCommitStagedTags">{{ $t("Done") }}</button>
</div>
</div>
</div>
</div>
@ -180,146 +176,71 @@ export default {
newTags: [],
/** @type {Tag[]} */
deleteTags: [],
/**
* @type {Array<object>} Holds tag objects staged for addition.
* Each object: { name, color, value, isNewSystemTag, systemTagId, keyForList }
*/
stagedForBatchAdd: [],
newDraftTag: {
name: null,
select: null,
color: null,
value: "",
invalid: true,
nameInvalid: false,
},
};
},
computed: {
tagOptions() {
const tagOptions = [ ...this.existingTags ]; // Create a copy
// Add tags from newTags
const tagOptions = this.existingTags;
for (const tag of this.newTags) {
if (!tagOptions.find(t => t.name === tag.name && t.color === tag.color)) {
tagOptions.push(tag);
}
}
// Add newly created system tags from staging area
for (const stagedTag of this.stagedForBatchAdd) {
if (stagedTag.isNewSystemTag) {
// Check if this system tag is already in the options
if (!tagOptions.find(t => t.name === stagedTag.name && t.color === stagedTag.color)) {
// Create a tag option object for the dropdown
tagOptions.push({
id: null, // Will be assigned when actually created
name: stagedTag.name,
color: stagedTag.color
});
}
}
}
return tagOptions;
},
selectedTags() {
// Helper function to normalize tag values for comparison
const normalizeValue = (value) => {
if (value === null || value === undefined) {
return "";
}
return String(value).trim();
};
// Helper function to get tag ID from different structures
const getTagId = (tag) => tag.tag_id || tag.id;
return this.preSelectedTags.concat(this.newTags).filter(tag =>
!this.deleteTags.find(monitorTag => {
const tagIdMatch = getTagId(monitorTag) === getTagId(tag);
const valueMatch = normalizeValue(monitorTag.value) === normalizeValue(tag.value);
return tagIdMatch && valueMatch;
})
);
return this.preSelectedTags.concat(this.newTags).filter(tag => !this.deleteTags.find(monitorTag => monitorTag.tag_id === tag.tag_id));
},
/**
* @returns {boolean} True if more new system tags can be staged, false otherwise.
*/
canStageMoreNewSystemTags() {
return true; // Always allow adding more tags, no limit
},
/**
* Provides the color options for the tag color selector.
* @returns {Array<object>} Array of color options.
*/
colorOptions() {
return colorOptions(this);
},
/**
* Validates the current draft tag based on several conditions.
* @returns {{invalid: boolean, messageKey: string|null, messageParams: object|null}} Object indicating validity, and a message key/params if invalid.
*/
validateDraftTag() {
// If defining a new system tag (newDraftTag.select == null)
if (this.newDraftTag.select == null) {
if (!this.newDraftTag.name || this.newDraftTag.name.trim() === "" || !this.newDraftTag.color) {
// Keep button disabled, but don't show the explicit message for this case
return {
invalid: true,
messageKey: null,
messageParams: null,
};
let nameInvalid = false;
let valueInvalid = false;
let invalid = true;
if (this.deleteTags.find(tag => tag.name === this.newDraftTag.select?.name && tag.value === this.newDraftTag.value)) {
// Undo removing a Tag
nameInvalid = false;
valueInvalid = false;
invalid = false;
} else if (this.existingTags.filter(tag => tag.name === this.newDraftTag.name).length > 0 && this.newDraftTag.select == null) {
// Try to create new tag with existing name
nameInvalid = true;
invalid = true;
} else if (this.newTags.concat(this.preSelectedTags).filter(tag => (
tag.name === this.newDraftTag.select?.name && tag.value === this.newDraftTag.value
) || (
tag.name === this.newDraftTag.name && tag.value === this.newDraftTag.value
)).length > 0) {
// Try to add a tag with existing name and value
valueInvalid = true;
invalid = true;
} else if (this.newDraftTag.select != null) {
// Select an existing tag, no need to validate
invalid = false;
valueInvalid = false;
} else if (this.newDraftTag.color == null || this.newDraftTag.name === "") {
// Missing form inputs
nameInvalid = false;
invalid = true;
} else {
// Looks valid
invalid = false;
nameInvalid = false;
valueInvalid = false;
}
if (this.tagOptions.find(opt => opt.name.toLowerCase() === this.newDraftTag.name.trim().toLowerCase())) {
return {
invalid: true,
messageKey: "tagNameExists",
messageParams: null,
};
}
}
// For any tag definition (new or existing system tag + value)
const draftTagName = this.newDraftTag.select ? this.newDraftTag.select.name : this.newDraftTag.name.trim();
const draftTagValue = this.newDraftTag.value ? this.newDraftTag.value.trim() : ""; // Treat null/undefined value as empty string for comparison
// Check if (name + value) combination already exists in this.stagedForBatchAdd
if (this.stagedForBatchAdd.find(staged => staged.name === draftTagName && staged.value === draftTagValue)) {
return {
invalid: true,
messageKey: "tagAlreadyStaged",
messageParams: null,
};
}
// Check if (name + value) combination already exists in this.selectedTags (final list on monitor)
// AND it's NOT an "undo delete"
const isUndoDelete = this.deleteTags.find(dTag =>
dTag.tag_id === (this.newDraftTag.select ? this.newDraftTag.select.id : null) &&
dTag.value === draftTagValue
);
if (!isUndoDelete && this.selectedTags.find(sTag => sTag.name === draftTagName && sTag.value === draftTagValue)) {
return {
invalid: true,
messageKey: "tagAlreadyOnMonitor",
messageParams: null,
};
}
// If an existing tag is selected at this point, it has passed all relevant checks
if (this.newDraftTag.select != null) {
return {
invalid: false,
messageKey: null,
messageParams: null,
};
}
// If it's a new tag definition, and it passed its specific checks, it's valid.
// (This also serves as a final default to valid if other logic paths were missed, though ideally covered above)
return {
invalid: false,
messageKey: null,
messageParams: null,
invalid,
nameInvalid,
valueInvalid,
};
},
},
@ -327,18 +248,12 @@ export default {
this.modal = new Modal(this.$refs.modal);
this.getExistingTags();
},
beforeUnmount() {
this.cleanupModal();
},
methods: {
/**
* Show the add tag dialog
* @returns {void}
*/
showAddDialog() {
this.stagedForBatchAdd = [];
this.clearDraftTag();
this.getExistingTags();
this.modal.show();
},
/**
@ -382,6 +297,37 @@ export default {
return this.$root.theme === "light" ? "var(--bs-body-color)" : "inherit";
}
},
/**
* Add a draft tag
* @returns {void}
*/
addDraftTag() {
console.log("Adding Draft Tag: ", this.newDraftTag);
if (this.newDraftTag.select != null) {
if (this.deleteTags.find(tag => tag.name === this.newDraftTag.select.name && tag.value === this.newDraftTag.value)) {
// Undo removing a tag
this.deleteTags = this.deleteTags.filter(tag => !(tag.name === this.newDraftTag.select.name && tag.value === this.newDraftTag.value));
} else {
// Add an existing Tag
this.newTags.push({
id: this.newDraftTag.select.id,
color: this.newDraftTag.select.color,
name: this.newDraftTag.select.name,
value: this.newDraftTag.value,
new: true,
});
}
} else {
// Add new Tag
this.newTags.push({
color: this.newDraftTag.color.color,
name: this.newDraftTag.name.trim(),
value: this.newDraftTag.value,
new: true,
});
}
this.clearDraftTag();
},
/**
* Remove a draft tag
* @returns {void}
@ -392,8 +338,10 @@ export default {
select: null,
color: null,
value: "",
// invalid: true, // Initial validation will be handled by computed prop
invalid: true,
nameInvalid: false,
};
this.modal.hide();
},
/**
* Add a tag asynchronously
@ -435,7 +383,7 @@ export default {
*/
onEnter() {
if (!this.validateDraftTag.invalid) {
this.stageCurrentTag();
this.addDraftTag();
}
},
/**
@ -511,132 +459,7 @@ export default {
this.newTags = [];
this.deleteTags = [];
this.processing = false;
},
/**
* Clean up modal and restore scroll behavior
* @returns {void}
*/
cleanupModal() {
if (this.modal) {
try {
this.modal.hide();
} catch (e) {
console.warn("Modal hide failed:", e);
}
}
this.stagedForBatchAdd = [];
},
/**
* Stages the current draft tag for batch addition.
* @returns {void}
*/
stageCurrentTag() {
if (this.validateDraftTag.invalid) {
return;
}
const isNew = this.newDraftTag.select == null;
const name = isNew ? this.newDraftTag.name.trim() : this.newDraftTag.select.name;
const color = isNew ? this.newDraftTag.color.color : this.newDraftTag.select.color;
const value = this.newDraftTag.value ? this.newDraftTag.value.trim() : "";
const stagedTagObject = {
name: name,
color: color,
value: value,
isNewSystemTag: isNew,
systemTagId: isNew ? null : this.newDraftTag.select.id,
keyForList: `staged-${Date.now()}-${Math.random().toString(36).substring(2, 15)}` // Unique key
};
this.stagedForBatchAdd.push(stagedTagObject);
this.clearDraftTag(); // Reset input fields for the next tag
},
/**
* Removes a tag from the staged list.
* @param {object} tagToUnstage The tag object to remove from staging.
* @returns {void}
*/
unstageTag(tagToUnstage) {
this.stagedForBatchAdd = this.stagedForBatchAdd.filter(tag => tag.keyForList !== tagToUnstage.keyForList);
},
/**
* Maps a staged tag object to the structure expected by the Tag component.
* @param {object} stagedTag The staged tag object.
* @returns {object} Object with name, color, value for the Tag component.
*/
mapStagedTagToDisplayItem(stagedTag) {
return {
name: stagedTag.name,
color: stagedTag.color,
value: stagedTag.value,
// id: stagedTag.keyForList, // Pass keyForList as id for the Tag component if it expects an id for display/keying internally beyond v-for key
};
},
/**
* Clears the staging list, draft inputs, and closes the modal.
* @returns {void}
*/
clearStagingAndCloseModal() {
this.stagedForBatchAdd = [];
this.clearDraftTag(); // Clears input fields
this.modal.hide();
},
/**
* Processes all staged tags, adds them to the monitor, and closes the modal.
* @returns {void}
*/
confirmAndCommitStagedTags() {
// Phase 1: If there's a currently valid newDraftTag that hasn't been staged yet,
// (e.g. user typed a full tag and directly clicked the footer "Add"), then stage it now.
// stageCurrentTag has its own check for validateDraftTag.invalid and will clear the draft.
if (!this.validateDraftTag.invalid) {
// Check if newDraftTag actually has content, to avoid staging an empty cleared draft.
// A valid draft implies it has content, but double-checking select or name is safer.
if (this.newDraftTag.select || (this.newDraftTag.name && this.newDraftTag.color)) {
this.stageCurrentTag();
}
}
// Phase 2: Process everything that is now in stagedForBatchAdd.
if (this.stagedForBatchAdd.length === 0) {
this.clearDraftTag(); // Ensure draft is clear even if nothing was committed
this.modal.hide();
return;
}
for (const sTag of this.stagedForBatchAdd) {
let isAnUndo = false; // Flag to track if this was an undo
// Check if it's an "undo delete"
if (sTag.systemTagId) { // Only existing system tags can be an undo delete
const undoDeleteIndex = this.deleteTags.findIndex(
dTag => dTag.tag_id === sTag.systemTagId && dTag.value === sTag.value
);
if (undoDeleteIndex > -1) {
this.deleteTags.splice(undoDeleteIndex, 1);
isAnUndo = true;
}
}
// Only add to newTags if it's not an "undo delete" operation.
// An "undo delete" means the tag is now considered active again from its previous state.
if (!isAnUndo) {
const tagObjectForNewTags = {
id: sTag.systemTagId, // This will be null for brand new system tags
color: sTag.color,
name: sTag.name,
value: sTag.value,
new: true, // As per plan, signals new to this monitor transaction
};
this.newTags.push(tagObjectForNewTags);
}
}
// newDraftTag should have been cleared if stageCurrentTag ran in Phase 1, or earlier.
// Call clearDraftTag again to be certain the form is reset before closing.
this.clearDraftTag();
this.modal.hide();
},
},
};
</script>

View file

@ -1,276 +0,0 @@
<template>
<teleport to="body">
<div
v-if="content"
ref="tooltip"
class="tooltip-wrapper"
:style="tooltipStyle"
:class="{ 'tooltip-above': position === 'above' }"
>
<div class="tooltip-content">
<slot :content="content">
<!-- Default content if no slot provided -->
<div class="tooltip-status" :class="statusClass">
{{ statusText }}
</div>
<div class="tooltip-time">{{ timeText }}</div>
<div v-if="content?.msg" class="tooltip-message">{{ content.msg }}</div>
</slot>
</div>
<div class="tooltip-arrow" :class="{ 'arrow-above': position === 'above' }"></div>
</div>
</teleport>
</template>
<script>
import { DOWN, UP, PENDING, MAINTENANCE } from "../util.ts";
export default {
name: "Tooltip",
props: {
/** Whether tooltip is visible */
visible: {
type: Boolean,
default: false
},
/** Content object to display */
content: {
type: Object,
default: null
},
/** X position (viewport coordinates) */
x: {
type: Number,
default: 0
},
/** Y position (viewport coordinates) */
y: {
type: Number,
default: 0
},
/** Position relative to target element */
position: {
type: String,
default: "below",
validator: (value) => [ "above", "below" ].includes(value)
}
},
computed: {
tooltipStyle() {
return {
left: this.x + "px",
top: this.y + "px",
};
},
statusText() {
if (!this.content || this.content === 0) {
return this.$t("Unknown");
}
switch (this.content.status) {
case DOWN:
return this.$t("Down");
case UP:
return this.$t("Up");
case PENDING:
return this.$t("Pending");
case MAINTENANCE:
return this.$t("Maintenance");
default:
return this.$t("Unknown");
}
},
statusClass() {
if (!this.content || this.content === 0) {
return "status-empty";
}
switch (this.content.status) {
case DOWN:
return "status-down";
case UP:
return "status-up";
case PENDING:
return "status-pending";
case MAINTENANCE:
return "status-maintenance";
default:
return "status-unknown";
}
},
timeText() {
if (!this.content || this.content === 0) {
return "";
}
return this.$root.datetime(this.content.time);
},
}
};
</script>
<style lang="scss" scoped>
@import "../assets/vars.scss";
.tooltip-wrapper {
position: fixed;
z-index: 9999;
pointer-events: none;
transform: translateX(-50%);
.tooltip-content {
background: rgba(17, 24, 39, 0.95);
backdrop-filter: blur(8px);
border: 1px solid rgba(75, 85, 99, 0.3);
border-radius: 8px;
padding: 8px 12px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
min-width: 120px;
text-align: center;
position: relative;
&::before {
content: "";
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 14px;
height: 2px;
background: rgba(17, 24, 39, 0.95);
top: -1px;
}
.tooltip-status {
font-size: 16px;
font-weight: 600;
margin-bottom: 4px;
text-transform: uppercase;
letter-spacing: 0.5px;
&.status-up {
color: $primary;
}
&.status-down {
color: $danger;
}
&.status-pending {
color: $warning;
}
&.status-maintenance {
color: $maintenance;
}
&.status-empty {
color: $secondary-text;
}
}
.tooltip-time {
color: #d1d5db;
font-size: 13px;
margin-bottom: 2px;
}
.tooltip-message {
color: #f3f4f6;
font-size: 12px;
margin-top: 4px;
padding-top: 4px;
border-top: 1px solid rgba(75, 85, 99, 0.3);
}
}
.tooltip-arrow {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: 12px;
height: 6px;
overflow: hidden;
top: -6px;
&::before {
content: "";
position: absolute;
left: 50%;
top: 100%;
transform: translateX(-50%) translateY(-50%) rotate(45deg);
width: 8px;
height: 8px;
background: rgba(17, 24, 39, 0.95);
border: 1px solid rgba(75, 85, 99, 0.3);
border-bottom: none;
border-right: none;
}
&.arrow-above {
top: auto;
bottom: -6px;
&::before {
top: 0%;
transform: translateX(-50%) translateY(-50%) rotate(225deg);
border: 1px solid rgba(75, 85, 99, 0.3);
border-bottom: none;
border-right: none;
}
}
}
// Smooth entrance animation
animation: tooltip-fade-in 0.2s $easing-out;
&.tooltip-above {
transform: translateX(-50%) translateY(-8px);
.tooltip-content::before {
top: auto;
bottom: -1px;
}
}
}
// Dark theme adjustments
.dark .tooltip-wrapper {
.tooltip-content {
background: rgba(31, 41, 55, 0.95);
border-color: rgba(107, 114, 128, 0.3);
&::before {
background: rgba(31, 41, 55, 0.95);
}
}
.tooltip-arrow {
&::before {
background: rgba(31, 41, 55, 0.95);
border-color: rgba(107, 114, 128, 0.3);
}
}
}
@keyframes tooltip-fade-in {
from {
opacity: 0;
transform: translateX(-50%) translateY(4px);
}
to {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
}
// Accessibility improvements
@media (prefers-reduced-motion: reduce) {
.tooltip-wrapper {
animation: none !important;
}
}
</style>

View file

@ -53,13 +53,6 @@
</div>
</div>
</div>
<div class="mb-3">
<div class="form-check form-switch">
<input id="discord-disable-url" v-model="$parent.notification.disableUrl" class="form-check-input" type="checkbox" role="switch">
<label class="form-check-label" for="discord-disable-url">{{ $t("Disable URL in Notification") }}</label>
</div>
</div>
</template>
<script>
export default {
@ -67,9 +60,6 @@ export default {
if (!this.$parent.notification.discordChannelType) {
this.$parent.notification.discordChannelType = "channel";
}
if (this.$parent.notification.disableUrl === undefined) {
this.$parent.notification.disableUrl = false;
}
}
};
</script>

View file

@ -1,10 +1,7 @@
<template>
<div class="mb-3">
<label for="flashduty-integration-url" class="form-label">{{ $t("FlashDuty Push URL") }} <span style="color: red;"><sup>*</sup></span></label>
<HiddenInput id="flashduty-integration-url" v-model="$parent.notification.flashdutyIntegrationKey" autocomplete="false" :placeholder="$t('FlashDuty Push URL Placeholder')" />
<div class="form-text">
<p><span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}</p>
</div>
<label for="flashduty-integration-url" class="form-label">Integration Key</label>
<HiddenInput id="flashduty-integration-url" v-model="$parent.notification.flashdutyIntegrationKey" autocomplete="false"></HiddenInput>
<i18n-t tag="div" keypath="wayToGetFlashDutyKey" class="form-text">
<a href="https://flashcat.cloud/product/flashduty?from=kuma" target="_blank">{{ $t("here") }}</a>
</i18n-t>
@ -21,6 +18,7 @@
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,

View file

@ -18,7 +18,7 @@
{{ $t("matrixDesc1") }}
</p>
<i18n-t tag="p" keypath="matrixDesc2" style="margin-top: 8px;">
<code>curl -XPOST --json '{"type": "m.login.password", "identifier": {"user": "botusername", "type": "m.id.user"}, "password": "passwordforuser"}' "https://home.server/_matrix/client/v3/login"</code>.
<code>curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "botusername", "type": "m.id.user"}, "password": "passwordforuser"}' "https://home.server/_matrix/client/r0/login"</code>.
</i18n-t>
</div>
</template>

View file

@ -1,49 +0,0 @@
<template>
<div class="mb-3">
<label for="notifery-api-key" class="form-label">{{
$t("API Key")
}}</label>
<HiddenInput
id="notifery-api-key"
v-model="$parent.notification.notiferyApiKey"
:required="true"
autocomplete="new-password"
></HiddenInput>
</div>
<div class="mb-3">
<label for="notifery-title" class="form-label">{{ $t("Title") }}</label>
<input
id="notifery-title"
v-model="$parent.notification.notiferyTitle"
type="text"
class="form-control"
placeholder="Uptime Kuma Alert"
/>
</div>
<div class="mb-3">
<label for="notifery-group" class="form-label">{{ $t("Group") }}</label>
<input
id="notifery-group"
v-model="$parent.notification.notiferyGroup"
type="text"
class="form-control"
:placeholder="$t('Optional')"
/>
</div>
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
<a href="https://docs.notifery.com/api/event/" target="_blank">https://docs.notifery.com/api/event/</a>
</i18n-t>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -13,20 +13,13 @@
<div class="mb-3">
<label for="ntfy-priority" class="form-label">{{ $t("Priority") }}</label>
<input id="ntfy-priority" v-model="$parent.notification.ntfyPriority" type="number" class="form-control" required min="1" max="5" step="1">
<label for="ntfy-priority-down" class="form-label">{{ $t("ntfyPriorityDown") }}</label>
<input id="ntfy-priority-down" v-model="$parent.notification.ntfyPriorityDown" type="number" class="form-control" required min="1" max="5" step="1">
<div class="form-text">
<p v-if="$parent.notification.ntfyPriority == $parent.notification.ntfyPriorityDown && $parent.notification.ntfyPriority >= 5">
<p v-if="$parent.notification.ntfyPriority >= 5">
{{ $t("ntfyPriorityHelptextAllEvents") }}
</p>
<i18n-t v-else-if="$parent.notification.ntfyPriority > $parent.notification.ntfyPriorityDown" tag="p" keypath="ntfyPriorityHelptextPriorityHigherThanDown">
<code>DOWN</code>
<code>{{ $parent.notification.ntfyPriority }}</code>
<code>{{ $parent.notification.ntfyPriorityDown }}</code>
</i18n-t>
<i18n-t v-else tag="p" keypath="ntfyPriorityHelptextAllExceptDown">
<code>DOWN</code>
<code>{{ $parent.notification.ntfyPriorityDown }}</code>
<code>{{ $parent.notification.ntfyPriority + 1 }}</code>
</i18n-t>
</div>
</div>
@ -76,11 +69,6 @@ export default {
this.$parent.notification.ntfyPriority = 5;
}
// Setting down priority if it's undefined
if (typeof this.$parent.notification.ntfyPriorityDown === "undefined") {
this.$parent.notification.ntfyPriorityDown = 5;
}
// Handling notifications that added before 1.22.0
if (typeof this.$parent.notification.ntfyAuthenticationMethod === "undefined") {
if (!this.$parent.notification.ntfyusername) {

View file

@ -1,64 +0,0 @@
<template>
<div class="mb-3">
<!-- Access Token Input -->
<div class="mb-3">
<label for="onechat-access-token" class="form-label">
OneChat Access Token<span style="color: red;"><sup>*</sup></span>
</label>
<HiddenInput
id="onechat-access-token"
v-model="$parent.notification.accessToken"
:required="true"
>
</HiddenInput>
<div class="form-text">
<p>{{ $t("OneChatAccessToken") }}</p>
</div>
</div>
<!-- Receiver ID Input -->
<div class="mb-3">
<label for="onechat-receiver-id" class="form-label">
{{ $t("OneChatUserIdOrGroupId") }}<span style="color: red;"><sup>*</sup></span>
</label>
<input
id="onechat-receiver-id"
v-model="$parent.notification.recieverId"
type="text"
class="form-control"
required
/>
</div>
<!-- Bot ID Input -->
<div class="mb-3">
<label for="onechat-bot-id" class="form-label">
{{ $t("OneChatBotId") }}<span style="color: red;"><sup>*</sup></span>
</label>
<input
id="onechat-bot-id"
v-model="$parent.notification.botId"
type="text"
class="form-control"
required
/>
</div>
<!-- Document Link -->
<div class="form-text">
<i18n-t tag="p" keypath="Read more:">
<a href="https://chat-develop.one.th/docs" target="_blank">https://chat-develop.one.th/docs</a>
</i18n-t>
</div>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -1,9 +0,0 @@
<template>
<div class="mb-3">
<label for="pumble-webhook-url" class="form-label mb-2">{{ $t("Webhook URL") }}</label><span style="color: red;"><sup>*</sup></span>
<input id="pumble-webhook-url" v-model="$parent.notification.webhookURL" type="url" class="form-control" required>
</div>
<div class="mb-3">
<a href="https://pumble.com/help/integrations/add-pumble-apps/incoming-webhooks-for-pumble/" target="_blank">{{ $t("documentationOf", ["Pumble Webbhook"]) }}</a>
</div>
</template>

View file

@ -16,24 +16,34 @@
<option>1</option>
<option>2</option>
</select>
<label for="pushover-sound-down" class="form-label">{{ $t("Notification Sound") }} - Up</label>
<select id="pushover-sound-down" v-model="$parent.notification.pushoversounds" class="form-select">
<option v-for="sound in soundOptions" :key="sound" :value="sound">
{{ $t(`pushoversounds ${sound}`) }}
</option>
<label for="pushover-sound" class="form-label">{{ $t("Notification Sound") }}</label>
<select id="pushover-sound" v-model="$parent.notification.pushoversounds" class="form-select">
<option value="pushover">{{ $t("pushoversounds pushover") }}</option>
<option value="bike">{{ $t("pushoversounds bike") }}</option>
<option value="bugle">{{ $t("pushoversounds bugle") }}</option>
<option value="cashregister">{{ $t("pushoversounds cashregister") }}</option>
<option value="classical">{{ $t("pushoversounds classical") }}</option>
<option value="cosmic">{{ $t("pushoversounds cosmic") }}</option>
<option value="falling">{{ $t("pushoversounds falling") }}</option>
<option value="gamelan">{{ $t("pushoversounds gamelan") }}</option>
<option value="incoming">{{ $t("pushoversounds incoming") }}</option>
<option value="intermission">{{ $t("pushoversounds intermission") }}</option>
<option value="magic">{{ $t("pushoversounds magic") }}</option>
<option value="mechanical">{{ $t("pushoversounds mechanical") }}</option>
<option value="pianobar">{{ $t("pushoversounds pianobar") }}</option>
<option value="siren">{{ $t("pushoversounds siren") }}</option>
<option value="spacealarm">{{ $t("pushoversounds spacealarm") }}</option>
<option value="tugboat">{{ $t("pushoversounds tugboat") }}</option>
<option value="alien">{{ $t("pushoversounds alien") }}</option>
<option value="climb">{{ $t("pushoversounds climb") }}</option>
<option value="persistent">{{ $t("pushoversounds persistent") }}</option>
<option value="echo">{{ $t("pushoversounds echo") }}</option>
<option value="updown">{{ $t("pushoversounds updown") }}</option>
<option value="vibrate">{{ $t("pushoversounds vibrate") }}</option>
<option value="none">{{ $t("pushoversounds none") }}</option>
</select>
<label for="pushover-sound-up" class="form-label">{{ $t("Notification Sound") }} - Down</label>
<select id="pushover-sound-up" v-model="$parent.notification.pushoversounds_up" class="form-select">
<option v-for="sound in soundOptions" :key="sound" :value="sound">
{{ $t(`pushoversounds ${sound}`) }}
</option>
</select>
<label for="pushover-ttl" class="form-label">{{ $t("pushoverMessageTtl") }}</label>
<input id="pushover-ttl" v-model="$parent.notification.pushoverttl" type="number" min="0" step="1" class="form-control">
<div class="form-text">
<span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
@ -56,34 +66,5 @@ export default {
components: {
HiddenInput,
},
data() {
return {
soundOptions: [
"pushover",
"bike",
"bugle",
"cashregister",
"classical",
"cosmic",
"falling",
"gamelan",
"incoming",
"intermission",
"magic",
"mechanical",
"pianobar",
"siren",
"spacealarm",
"tugboat",
"alien",
"climb",
"persistent",
"echo",
"updown",
"vibrate",
"none",
],
};
},
};
</script>

View file

@ -1,33 +1,15 @@
<template>
<div class="mb-3">
<label for="smseagle-url" class="form-label">{{ $t("smseagleUrl") }}</label>
<input
id="smseagle-url" v-model="$parent.notification.smseagleUrl" type="text" minlength="7"
class="form-control" placeholder="http://127.0.0.1" required
>
<input id="smseagle-url" v-model="$parent.notification.smseagleUrl" type="text" minlength="7" class="form-control" placeholder="http://127.0.0.1" required>
</div>
<div class="mb-3">
<label for="smseagle-token" class="form-label">{{ $t("smseagleToken") }}</label>
<HiddenInput id="smseagle-token" v-model="$parent.notification.smseagleToken" :required="true"></HiddenInput>
</div>
<div class="mb-3">
<label for="smseagle-api-type" class="form-label">{{ $t("smseagleApiType") }} </label>
<select id="smseagle-api-type" v-model="$parent.notification.smseagleApiType" class="form-select">
<option value="smseagle-apiv1" selected>{{ $t("smseagleApiv1") }} </option>
<option value="smseagle-apiv2">{{ $t("smseagleApiv2") }} </option>
</select>
<i18n-t tag="div" keypath="smseagleDocs" class="form-text">
<a href="https://www.smseagle.eu/api/" target="_blank">https://www.smseagle.eu/api/</a>
</i18n-t>
</div>
<div v-if="$parent.notification.smseagleApiType === 'smseagle-apiv1'" class="mb-3">
<div class="mb-3">
<label for="smseagle-recipient-type" class="form-label">{{ $t("smseagleRecipientType") }}</label>
<select
id="smseagle-recipient-type" v-model="$parent.notification.smseagleRecipientType"
class="form-select"
>
<!-- phone number -->
<select id="smseagle-recipient-type" v-model="$parent.notification.smseagleRecipientType" class="form-select">
<option value="smseagle-to" selected>{{ $t("smseagleTo") }}</option>
<option value="smseagle-group">{{ $t("smseagleGroup") }}</option>
<option value="smseagle-contact">{{ $t("smseagleContact") }}</option>
@ -37,87 +19,13 @@
<label for="smseagle-recipient" class="form-label">{{ $t("smseagleRecipient") }}</label>
<input id="smseagle-recipient" v-model="$parent.notification.smseagleRecipient" type="text" class="form-control" required>
</div>
<div
v-if="$parent.notification.smseagleMsgType === 'smseagle-sms'
|| $parent.notification.smseagleRecipientType !== 'smseagle-to'" class="mb-3"
>
<div class="mb-3">
<label for="smseagle-priority" class="form-label">{{ $t("smseaglePriority") }}</label>
<input id="smseagle-priority" v-model="$parent.notification.smseaglePriority" type="number" class="form-control" min="0" max="9" step="1" placeholder="0" required>
</div>
<div
v-if="$parent.notification.smseagleMsgType === 'smseagle-sms'
|| $parent.notification.smseagleRecipientType !== 'smseagle-to'" class="mb-3 form-check form-switch"
>
<label for="smseagle-encoding" class="form-label">{{ $t("smseagleEncoding") }}</label>
<input id="smseagle-encoding" v-model="$parent.notification.smseagleEncoding" type="checkbox" class="form-check-input">
</div>
<div v-if="$parent.notification.smseagleRecipientType === 'smseagle-to'" class="mb-3">
<div class="mb-3">
<label for="smseagle-msg-type" class="form-label">{{ $t("smseagleMsgType") }} </label>
<select id="smseagle-msg-type" v-model="$parent.notification.smseagleMsgType" class="form-select">
<option value="smseagle-sms" selected>{{ $t("smseagleMsgSms") }} </option>
<option value="smseagle-ring">{{ $t("smseagleMsgRing") }} </option>
<option value="smseagle-tts">{{ $t("smseagleMsgTts") }} </option>
<option value="smseagle-tts-advanced">{{ $t("smseagleMsgTtsAdvanced") }} </option>
</select>
</div>
<div
v-if="$parent.notification.smseagleMsgType === 'smseagle-ring'
|| $parent.notification.smseagleMsgType === 'smseagle-tts'
|| $parent.notification.smseagleMsgType === 'smseagle-tts-advanced'" class="mb-3"
>
<label for="smseagle-duration" class="form-label">{{ $t("smseagleDuration") }}</label>
<input id="smseagle-duration" v-model="$parent.notification.smseagleDuration" type="number" class="form-control" min="0" max="30" step="1" placeholder="10">
</div>
<div v-if="$parent.notification.smseagleMsgType === 'smseagle-tts-advanced'" class="mb-3">
<label for="smseagle-tts-model" class="form-label">{{ $t("smseagleTtsModel") }} </label>
<input id="smseagle-tts-model" v-model="$parent.notification.smseagleTtsModel" type="number" class="form-control" placeholder="1" required>
</div>
</div>
</div>
<div v-if="$parent.notification.smseagleApiType === 'smseagle-apiv2'" class="mb-3">
<div class="mb-3">
<!-- phone number -->
<label for="smseagle-recipient-to" class="form-label">{{ $t("smseagleTo") }}</label>
<input id="smseagle-recipient-to" v-model="$parent.notification.smseagleRecipientTo" type="text" class="form-control">
<i18n-t tag="div" keypath="smseagleComma" class="form-text" />
</div>
<div class="mb-3">
<label for="smseagle-recipient-group" class="form-label">{{ $t("smseagleGroupV2") }}</label>
<input id="smseagle-recipient-group" v-model="$parent.notification.smseagleRecipientGroup" type="text" class="form-control">
<i18n-t tag="div" keypath="smseagleComma" class="form-text" />
</div>
<div class="mb-3">
<label for="smseagle-recipient-contact" class="form-label">{{ $t("smseagleContactV2") }}</label>
<input id="smseagle-recipient-contact" v-model="$parent.notification.smseagleRecipientContact" type="text" class="form-control">
<i18n-t tag="div" keypath="smseagleComma" class="form-text" />
</div>
<div class="mb-3">
<label for="smseagle-priority-v2" class="form-label">{{ $t("smseaglePriority") }}</label>
<input id="smseagle-priority-v2" v-model="$parent.notification.smseaglePriority" type="number" class="form-control" min="0" max="9" step="1" placeholder="0">
<input id="smseagle-priority" v-model="$parent.notification.smseaglePriority" type="number" class="form-control" min="0" max="9" step="1" placeholder="0">
</div>
<div class="mb-3 form-check form-switch">
<label for="smseagle-encoding-v2" class="form-label">{{ $t("smseagleEncoding") }}</label>
<input id="smseagle-encoding-v2" v-model="$parent.notification.smseagleEncoding" type="checkbox" class="form-check-input">
</div>
<div class="mb-3">
<label for="smseagle-msg-type-v2" class="form-label">{{ $t("smseagleMsgType") }} </label>
<select id="smseagle-msg-type-v2" v-model="$parent.notification.smseagleMsgType" class="form-select">
<option value="smseagle-sms" selected>{{ $t("smseagleMsgSms") }} </option>
<option value="smseagle-ring">{{ $t("smseagleMsgRing") }} </option>
<option value="smseagle-tts">{{ $t("smseagleMsgTts") }} </option>
<option value="smseagle-tts-advanced">{{ $t("smseagleMsgTtsAdvanced") }} </option>
</select>
</div>
<div v-if="$parent.notification.smseagleMsgType && $parent.notification.smseagleMsgType !== 'smseagle-sms'" class="mb-3">
<label for="smseagle-duration-v2" class="form-label">{{ $t("smseagleDuration") }}</label>
<input id="smseagle-duration-v2" v-model="$parent.notification.smseagleDuration" type="number" class="form-control" min="0" max="30" step="1" placeholder="10">
</div>
<div v-if="$parent.notification.smseagleMsgType === 'smseagle-tts-advanced'" class="mb-3">
<label for="smseagle-tts-model-v2" class="form-label">{{ $t("smseagleTtsModel") }} </label>
<input id="smseagle-tts-model-v2" v-model="$parent.notification.smseagleTtsModel" type="number" class="form-control" placeholder="1" required>
</div>
<label for="smseagle-encoding" class="form-label">{{ $t("smseagleEncoding") }}</label>
<input id="smseagle-encoding" v-model="$parent.notification.smseagleEncoding" type="checkbox" class="form-check-input">
</div>
</template>
@ -128,16 +36,5 @@ export default {
components: {
HiddenInput,
},
mounted() {
if (!this.$parent.notification.smseagleApiType) {
this.$parent.notification.smseagleApiType = "smseagle-apiv1";
}
if (!this.$parent.notification.smseagleMsgType) {
this.$parent.notification.smseagleMsgType = "smseagle-sms";
}
if (!this.$parent.notification.smseagleRecipientType) {
this.$parent.notification.smseagleRecipientType = "smseagle-to";
}
}
};
</script>

View file

@ -1,46 +0,0 @@
<template>
<div class="mb-3">
<label for="smsplanet-api-token" class="form-label">{{ $t('smsplanetApiToken') }}</label>
<HiddenInput id="smsplanet-api-token" v-model="$parent.notification.smsplanetApiToken" :required="true"></HiddenInput>
<i18n-t tag="div" keypath="smsplanetApiDocs" class="form-text">
<template #the_smsplanet_documentation>
<a
href="https://smsplanet.pl/doc/slate/index.html#introduction"
target="_blank"
>{{ $t("the smsplanet documentation") }}</a>
</template>
</i18n-t>
</div>
<div class="mb-3">
<label for="smsplanet-phone-numbers" class="form-label">{{ $t("Phone numbers") }}</label>
<textarea
id="smsplanet-phone-numbers"
v-model="$parent.notification.smsplanetPhoneNumbers"
class="form-control"
:placeholder="smsplanetPhoneNumbers"
required
></textarea>
</div>
<div class="mb-3">
<label for="smsplanet-sender-name" class="form-label">{{ $t("Sender name") }}</label>
<input id="smsplanet-sender-name" v-model="$parent.notification.smsplanetSenderName" type="text" minlength="3" maxlength="11" class="form-control">
<div class="form-text">{{ $t("smsplanetNeedToApproveName") }}</div>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
computed: {
smsplanetPhoneNumbers() {
return this.$t("Example:", [
"+48123456789,+48111222333",
]);
}
}
};
</script>

View file

@ -79,15 +79,6 @@
<div class="form-text">{{ $t("leave blank for default body") }}</div>
</div>
<div class="mb-3">
<div class="form-check">
<input id="use-html-body" v-model="$parent.notification.htmlBody" class="form-check-input" type="checkbox" value="">
<label class="form-check-label" for="use-html-body">
{{ $t("Use HTML for custom E-mail body") }}
</label>
</div>
</div>
<ToggleSection :heading="$t('smtpDkimSettings')">
<i18n-t tag="div" keypath="smtpDkimDesc" class="form-text mb-3">
<a href="https://nodemailer.com/dkim/" target="_blank">{{ $t("documentation") }}</a>

View file

@ -1,19 +0,0 @@
<template>
<div class="mb-3">
<label for="spugpush-templateKey" class="form-label">{{ $t("SpugPush Template Code") }}</label>
<HiddenInput id="spugpush-templateKey" v-model="$parent.notification.templateKey" :required="true" autocomplete="new-password"></HiddenInput>
</div>
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
<a href="https://push.spug.cc/guide/plugin/kuma" rel="noopener noreferrer" target="_blank">https://push.spug.cc</a>
</i18n-t>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -4,7 +4,6 @@ import AliyunSMS from "./AliyunSms.vue";
import Apprise from "./Apprise.vue";
import Bark from "./Bark.vue";
import Bitrix24 from "./Bitrix24.vue";
import Notifery from "./Notifery.vue";
import ClickSendSMS from "./ClickSendSMS.vue";
import CallMeBot from "./CallMeBot.vue";
import SMSC from "./SMSC.vue";
@ -30,7 +29,6 @@ import Mattermost from "./Mattermost.vue";
import Nostr from "./Nostr.vue";
import Ntfy from "./Ntfy.vue";
import Octopush from "./Octopush.vue";
import OneChat from "./OneChat.vue";
import OneBot from "./OneBot.vue";
import Onesender from "./Onesender.vue";
import Opsgenie from "./Opsgenie.vue";
@ -38,7 +36,6 @@ import PagerDuty from "./PagerDuty.vue";
import FlashDuty from "./FlashDuty.vue";
import PagerTree from "./PagerTree.vue";
import PromoSMS from "./PromoSMS.vue";
import Pumble from "./Pumble.vue";
import Pushbullet from "./Pushbullet.vue";
import PushDeer from "./PushDeer.vue";
import Pushover from "./Pushover.vue";
@ -65,7 +62,6 @@ import WeCom from "./WeCom.vue";
import GoAlert from "./GoAlert.vue";
import ZohoCliq from "./ZohoCliq.vue";
import Splunk from "./Splunk.vue";
import SpugPush from "./SpugPush.vue";
import SevenIO from "./SevenIO.vue";
import Whapi from "./Whapi.vue";
import WAHA from "./WAHA.vue";
@ -74,7 +70,6 @@ import WPush from "./WPush.vue";
import SIGNL4 from "./SIGNL4.vue";
import SendGrid from "./SendGrid.vue";
import YZJ from "./YZJ.vue";
import SMSPlanet from "./SMSPlanet.vue";
/**
* Manage all notification form.
@ -111,7 +106,6 @@ const NotificationFormList = {
"nostr": Nostr,
"ntfy": Ntfy,
"octopush": Octopush,
"OneChat": OneChat,
"OneBot": OneBot,
"Onesender": Onesender,
"Opsgenie": Opsgenie,
@ -119,7 +113,6 @@ const NotificationFormList = {
"FlashDuty": FlashDuty,
"PagerTree": PagerTree,
"promosms": PromoSMS,
"pumble": Pumble,
"pushbullet": Pushbullet,
"PushByTechulus": TechulusPush,
"PushDeer": PushDeer,
@ -142,7 +135,6 @@ const NotificationFormList = {
"threema": Threema,
"twilio": Twilio,
"Splunk": Splunk,
"SpugPush": SpugPush,
"webhook": Webhook,
"WeCom": WeCom,
"GoAlert": GoAlert,
@ -150,14 +142,12 @@ const NotificationFormList = {
"ZohoCliq": ZohoCliq,
"SevenIO": SevenIO,
"whapi": Whapi,
"notifery": Notifery,
"waha": WAHA,
"gtxmessaging": GtxMessaging,
"Cellsynt": Cellsynt,
"WPush": WPush,
"SendGrid": SendGrid,
"YZJ": YZJ,
"SMSPlanet": SMSPlanet,
};
export default NotificationFormList;

View file

@ -21,9 +21,6 @@
<label><input v-model="settings.checkBeta" type="checkbox" :disabled="!settings.checkUpdate" @change="saveSettings()" /> {{ $t("Also check beta release") }}</label>
</div>
</div>
<div class="mt-5">
<p>{{ $t("Font Twemoji by Twitter licensed under") }} <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY 4.0</a></p>
</div>
</div>
</div>
</template>

View file

@ -13,8 +13,7 @@
<li v-for="(proxy, index) in $root.proxyList" :key="index" class="list-group-item">
{{ proxy.host }}:{{ proxy.port }} ({{ proxy.protocol }})
<span v-if="proxy.default === true" class="badge bg-primary ms-2">{{ $t("Default") }}</span><br>
<a href="#" @click="$refs.proxyDialog.show(proxy.id)">{{ $t("Edit") }}</a> |
<a href="#" @click="$refs.proxyDialog.showClone(proxy.id)">{{ $t("Clone") }}</a>
<a href="#" @click="$refs.proxyDialog.show(proxy.id)">{{ $t("Edit") }}</a>
</li>
</ul>

View file

@ -75,22 +75,13 @@ export function currentLocale() {
if (locale in messages) {
return locale;
}
// If the locale is a 2-letter code, we can try to find a regional variant
// e.g. "fr" may not be in the messages, but "fr-FR" is
if (locale.length === 2) {
const regionalLocale = `${locale}-${locale.toUpperCase()}`;
if (regionalLocale in messages) {
return regionalLocale;
}
} else {
// Some locales are further specified such as "en-US".
// some locales are further specified such as "en-US".
// If we only have a generic locale for this, we can use it too
const genericLocale = locale.slice(0, 2);
const genericLocale = locale.split("-")[0];
if (genericLocale in messages) {
return genericLocale;
}
}
}
return "en";
}

Some files were not shown because too many files have changed in this diff Show more