Compare commits
2 Commits
master
...
copilot/su
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44afbc934b | ||
|
|
f183b75a07 |
163
.eslintrc.js
163
.eslintrc.js
@ -1,5 +1,9 @@
|
||||
module.exports = {
|
||||
ignorePatterns: ["test/*.js", "server/modules/*", "src/util.js"],
|
||||
ignorePatterns: [
|
||||
"test/*.js",
|
||||
"server/modules/*",
|
||||
"src/util.js"
|
||||
],
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
@ -11,7 +15,6 @@ module.exports = {
|
||||
"eslint:recommended",
|
||||
"plugin:vue/vue3-recommended",
|
||||
"plugin:jsdoc/recommended-error",
|
||||
"prettier", // Disables ESLint formatting rules that conflict with Prettier
|
||||
],
|
||||
parser: "vue-eslint-parser",
|
||||
parserOptions: {
|
||||
@ -19,93 +22,147 @@ module.exports = {
|
||||
sourceType: "module",
|
||||
requireConfigFile: false,
|
||||
},
|
||||
plugins: ["jsdoc", "@typescript-eslint"],
|
||||
plugins: [
|
||||
"jsdoc",
|
||||
"@typescript-eslint",
|
||||
],
|
||||
rules: {
|
||||
yoda: "error",
|
||||
eqeqeq: ["warn", "smart"],
|
||||
camelcase: [
|
||||
"warn",
|
||||
"yoda": "error",
|
||||
eqeqeq: [ "warn", "smart" ],
|
||||
"linebreak-style": [ "error", "unix" ],
|
||||
"camelcase": [ "warn", {
|
||||
"properties": "never",
|
||||
"ignoreImports": true
|
||||
}],
|
||||
"no-unused-vars": [ "warn", {
|
||||
"args": "none"
|
||||
}],
|
||||
indent: [
|
||||
"error",
|
||||
4,
|
||||
{
|
||||
properties: "never",
|
||||
ignoreImports: true,
|
||||
},
|
||||
],
|
||||
"no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
args: "none",
|
||||
ignoredNodes: [ "TemplateLiteral" ],
|
||||
SwitchCase: 1,
|
||||
},
|
||||
],
|
||||
quotes: [ "error", "double" ],
|
||||
semi: "error",
|
||||
"vue/html-indent": [ "error", 4 ], // default: 2
|
||||
"vue/max-attributes-per-line": "off",
|
||||
"vue/singleline-html-element-content-newline": "off",
|
||||
"vue/html-self-closing": "off",
|
||||
"vue/require-component-is": "off", // not allow is="style" https://github.com/vuejs/eslint-plugin-vue/issues/462#issuecomment-430234675
|
||||
"vue/attribute-hyphenation": "off", // This change noNL to "no-n-l" unexpectedly
|
||||
"vue/require-component-is": "off", // not allow is="style" https://github.com/vuejs/eslint-plugin-vue/issues/462#issuecomment-430234675
|
||||
"vue/attribute-hyphenation": "off", // This change noNL to "no-n-l" unexpectedly
|
||||
"vue/multi-word-component-names": "off",
|
||||
curly: "error",
|
||||
"no-multi-spaces": [ "error", {
|
||||
ignoreEOLComments: true,
|
||||
}],
|
||||
"array-bracket-spacing": [ "warn", "always", {
|
||||
"singleValue": true,
|
||||
"objectsInArrays": false,
|
||||
"arraysInArrays": false
|
||||
}],
|
||||
"space-before-function-paren": [ "error", {
|
||||
"anonymous": "always",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}],
|
||||
"curly": "error",
|
||||
"object-curly-spacing": [ "error", "always" ],
|
||||
"object-curly-newline": "off",
|
||||
"object-property-newline": "error",
|
||||
"comma-spacing": "error",
|
||||
"brace-style": "error",
|
||||
"no-var": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-constant-condition": [
|
||||
"error",
|
||||
{
|
||||
checkLoops: false,
|
||||
},
|
||||
],
|
||||
"key-spacing": "warn",
|
||||
"keyword-spacing": "warn",
|
||||
"space-infix-ops": "error",
|
||||
"arrow-spacing": "warn",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-constant-condition": [ "error", {
|
||||
"checkLoops": false,
|
||||
}],
|
||||
"space-before-blocks": "warn",
|
||||
//"no-console": "warn",
|
||||
"no-extra-boolean-cast": "off",
|
||||
"no-multiple-empty-lines": [ "warn", {
|
||||
"max": 1,
|
||||
"maxBOF": 0,
|
||||
}],
|
||||
"lines-between-class-members": [ "warn", "always", {
|
||||
exceptAfterSingleLine: true,
|
||||
}],
|
||||
"no-unneeded-ternary": "error",
|
||||
"array-bracket-newline": [ "error", "consistent" ],
|
||||
"eol-last": [ "error", "always" ],
|
||||
//"prefer-template": "error",
|
||||
"no-empty": [
|
||||
"error",
|
||||
{
|
||||
allowEmptyCatch: true,
|
||||
},
|
||||
],
|
||||
"template-curly-spacing": [ "warn", "never" ],
|
||||
"comma-dangle": [ "warn", "only-multiline" ],
|
||||
"no-empty": [ "error", {
|
||||
"allowEmptyCatch": true
|
||||
}],
|
||||
"no-control-regex": "off",
|
||||
"one-var": ["error", "never"],
|
||||
"max-statements-per-line": ["error", { max: 1 }],
|
||||
"one-var": [ "error", "never" ],
|
||||
"max-statements-per-line": [ "error", { "max": 1 }],
|
||||
"jsdoc/check-tag-names": [
|
||||
"error",
|
||||
{
|
||||
definedTags: ["link"],
|
||||
},
|
||||
"definedTags": [ "link" ]
|
||||
}
|
||||
],
|
||||
"jsdoc/no-undefined-types": "off",
|
||||
"jsdoc/no-defaults": ["error", { noOptionalParamNames: true }],
|
||||
"jsdoc/no-defaults": [
|
||||
"error",
|
||||
{ "noOptionalParamNames": true }
|
||||
],
|
||||
"jsdoc/require-throws": "warn",
|
||||
"jsdoc/require-jsdoc": [
|
||||
"error",
|
||||
{
|
||||
require: {
|
||||
FunctionDeclaration: true,
|
||||
MethodDefinition: true,
|
||||
},
|
||||
},
|
||||
"require": {
|
||||
"FunctionDeclaration": true,
|
||||
"MethodDefinition": true,
|
||||
}
|
||||
}
|
||||
],
|
||||
"jsdoc/no-blank-block-descriptions": "error",
|
||||
"jsdoc/require-returns-description": "warn",
|
||||
"jsdoc/require-returns-check": ["error", { reportMissingReturnForUndefinedTypes: false }],
|
||||
"jsdoc/require-returns-check": [
|
||||
"error",
|
||||
{ "reportMissingReturnForUndefinedTypes": false }
|
||||
],
|
||||
"jsdoc/require-returns": [
|
||||
"warn",
|
||||
{
|
||||
forceRequireReturn: true,
|
||||
forceReturnsWithAsync: true,
|
||||
},
|
||||
"forceRequireReturn": true,
|
||||
"forceReturnsWithAsync": true
|
||||
}
|
||||
],
|
||||
"jsdoc/require-param-type": "warn",
|
||||
"jsdoc/require-param-description": "warn",
|
||||
"jsdoc/require-param-description": "warn"
|
||||
},
|
||||
overrides: [
|
||||
"overrides": [
|
||||
{
|
||||
"files": [ "src/languages/*.js", "src/icon.js" ],
|
||||
"rules": {
|
||||
"comma-dangle": [ "error", "always-multiline" ],
|
||||
}
|
||||
},
|
||||
|
||||
// Override for TypeScript
|
||||
{
|
||||
files: ["**/*.ts"],
|
||||
extends: ["plugin:@typescript-eslint/recommended"],
|
||||
rules: {
|
||||
"files": [
|
||||
"**/*.ts",
|
||||
],
|
||||
extends: [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
],
|
||||
"rules": {
|
||||
"jsdoc/require-returns-type": "off",
|
||||
"jsdoc/require-param-type": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"prefer-const": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
17
.github/ISSUE_TEMPLATE/ask_for_help.yml
vendored
17
.github/ISSUE_TEMPLATE/ask_for_help.yml
vendored
@ -10,13 +10,14 @@ body:
|
||||
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)**.
|
||||
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.
|
||||
@ -27,8 +28,7 @@ body:
|
||||
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)**.
|
||||
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).
|
||||
@ -41,8 +41,7 @@ body:
|
||||
attributes:
|
||||
label: 📝 Describe your problem
|
||||
description: |
|
||||
Please walk us through it step by step.
|
||||
Include all important details and add screenshots where appropriate.
|
||||
Please walk us through it step by step. Include all important details and add screenshots where appropriate
|
||||
placeholder: |
|
||||
Describe what are you asking for ...
|
||||
|
||||
@ -51,8 +50,7 @@ body:
|
||||
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.
|
||||
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
|
||||
@ -62,8 +60,7 @@ body:
|
||||
attributes:
|
||||
label: 🐻 Uptime-Kuma Version
|
||||
description: |
|
||||
What version of Uptime-Kuma are you running?
|
||||
Please do not provide Docker tags like `latest` or `1`.
|
||||
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:
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -10,6 +10,8 @@ body:
|
||||
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:
|
||||
|
||||
23
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
23
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@ -25,6 +25,29 @@ body:
|
||||
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:
|
||||
|
||||
13
.github/ISSUE_TEMPLATE/security_issue.yml
vendored
13
.github/ISSUE_TEMPLATE/security_issue.yml
vendored
@ -11,13 +11,6 @@ body:
|
||||
value: |
|
||||
## ❗ IMPORTANT: DO NOT SHARE VULNERABILITY DETAILS HERE
|
||||
|
||||
## Please do not open issues for upstream dependency scan results.
|
||||
|
||||
Automated security tools often report false-positive issues that are not exploitable in the context of Uptime Kuma.
|
||||
Reviewing these without concrete impact does not scale for us.
|
||||
|
||||
If you can demonstrate that an upstream issue is actually exploitable in Uptime Kuma (e.g. with a PoC or reproducible steps), we’re happy to take a look.
|
||||
|
||||
### ⚠️ Report a Security Vulnerability
|
||||
|
||||
**If you have discovered a security vulnerability, please report it securely using the GitHub Security Advisory.**
|
||||
@ -33,15 +26,13 @@ body:
|
||||
|
||||
## **Step 1: Submit a GitHub Security Advisory**
|
||||
|
||||
Right-click the link below and select `Open link in new tab` to access the page.
|
||||
This will keep the security issue open, allowing you to easily return and paste the Advisory URL here later.
|
||||
Right-click the link below and select `Open link in new tab` to access the page. This will keep the security issue open, allowing you to easily return and paste the Advisory URL here later.
|
||||
|
||||
➡️ [Create a New Security Advisory](https://github.com/louislam/uptime-kuma/security/advisories/new)
|
||||
|
||||
## **Step 2: Share the Advisory URL**
|
||||
|
||||
Once you've created your advisory, please share the URL below.
|
||||
This will notify Louis Lam and enable them to take the appropriate action.
|
||||
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
|
||||
id: github-advisory-url
|
||||
|
||||
77
.github/PULL_REQUEST_TEMPLATE.md
vendored
77
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,37 +1,72 @@
|
||||
# Summary
|
||||
## ❗ Important Announcements
|
||||
|
||||
In this pull request, the following changes are made:
|
||||
<details><summary>Click here for more details:</summary>
|
||||
</p>
|
||||
|
||||
- Foobar was changed to FooFoo, because ...
|
||||
**⚠️ Please Note: We do not accept all types of pull requests, and we want to ensure we don’t 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)**
|
||||
|
||||
<!--Please link any GitHub issues or tasks that this pull request addresses-->
|
||||
### 🚫 Please Avoid Unnecessary Pinging of Maintainers
|
||||
|
||||
- Relates to #issue-number <!--this links related the issue-->
|
||||
- Resolves #issue-number <!--this auto-closes the issue-->
|
||||
|
||||
<details>
|
||||
<summary>Please follow this checklist to avoid unnecessary back and forth (click to expand)</summary>
|
||||
|
||||
- [ ] ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
|
||||
- [ ] 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
|
||||
I understand that I am responsible for and able to explain every line of code I submit.
|
||||
- [ ] 🔍 Any UI changes adhere to visual style of this project.
|
||||
- [ ] 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
|
||||
- [ ] 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
|
||||
- [ ] 🤖 I added or updated automated tests where appropriate.
|
||||
- [ ] 📄 Documentation updates are included (if applicable).
|
||||
- [ ] 🧰 Dependency updates are listed and explained.
|
||||
- [ ] ⚠️ CI passes and is green.
|
||||
We kindly ask you to refrain from pinging maintainers unless absolutely necessary. Pings are for critical/urgent pull requests that require immediate attention.
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
## Screenshots for Visual Changes
|
||||
## 📋 Overview
|
||||
|
||||
<!-- Provide a clear summary of the purpose and scope of this pull request:-->
|
||||
|
||||
- **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.
|
||||
|
||||
<!--
|
||||
Please link any GitHub issues or tasks that this pull request addresses.
|
||||
Use the appropriate issue numbers or links to enable auto-closing.
|
||||
-->
|
||||
|
||||
- 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.
|
||||
|
||||
12
.github/REVIEW_GUIDELINES.md
vendored
12
.github/REVIEW_GUIDELINES.md
vendored
@ -90,9 +90,9 @@ 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**.
|
||||
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.
|
||||
or **API tokens** are not hardcoded in the code.
|
||||
|
||||
## Performance
|
||||
|
||||
@ -105,7 +105,7 @@ like load times, memory usage, or other performance aspects.
|
||||
|
||||
- Have the right libraries been chosen?
|
||||
- Are there unnecessary dependencies that might reduce performance or increase
|
||||
code complexity?
|
||||
code complexity?
|
||||
- Are these dependencies actively maintained and free of known vulnerabilities?
|
||||
|
||||
### Performance Best Practices
|
||||
@ -113,7 +113,7 @@ like load times, memory usage, or other performance aspects.
|
||||
- **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).
|
||||
increasing load times or memory consumption).
|
||||
|
||||
## Compliance and Integration
|
||||
|
||||
@ -187,9 +187,9 @@ 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.
|
||||
plan.
|
||||
- Code that causes **major performance regressions** (e.g., high CPU/memory
|
||||
usage).
|
||||
usage).
|
||||
|
||||
## After the Review
|
||||
|
||||
|
||||
11
.github/copilot-instructions.md
vendored
11
.github/copilot-instructions.md
vendored
@ -18,26 +18,22 @@
|
||||
## Build & Validation Commands
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js >= 20.4.0, npm >= 9.3, Git
|
||||
|
||||
### Essential Command Sequence
|
||||
|
||||
1. **Install Dependencies**:
|
||||
|
||||
```bash
|
||||
npm ci # Use npm ci NOT npm install (~60-90 seconds)
|
||||
```
|
||||
|
||||
2. **Linting** (required before committing):
|
||||
|
||||
```bash
|
||||
npm run lint # Both linters (~15-30 seconds)
|
||||
npm run lint:prod # For production (zero warnings)
|
||||
```
|
||||
|
||||
3. **Build Frontend**:
|
||||
|
||||
```bash
|
||||
npm run build # Takes ~90-120 seconds, builds to dist/
|
||||
```
|
||||
@ -109,7 +105,6 @@ npm run dev # Starts frontend (port 3000) and backend (port 3001)
|
||||
## CI/CD Workflows
|
||||
|
||||
**auto-test.yml** (runs on PR/push to master/1.23.X):
|
||||
|
||||
- Linting, building, backend tests on multiple OS/Node versions (15 min timeout)
|
||||
- E2E Playwright tests
|
||||
|
||||
@ -134,7 +129,7 @@ npm run dev # Starts frontend (port 3000) and backend (port 3001)
|
||||
|
||||
## Database
|
||||
|
||||
- Primary: SQLite (also supports MariaDB/MySQL)
|
||||
- Primary: SQLite (also supports MariaDB/MySQL/PostgreSQL)
|
||||
- Migrations in `db/knex_migrations/` using Knex.js
|
||||
- Filename format validated by CI: `node ./extra/check-knex-filenames.mjs`
|
||||
|
||||
@ -147,9 +142,7 @@ npm run dev # Starts frontend (port 3000) and backend (port 3001)
|
||||
## Adding New Features
|
||||
|
||||
### New Notification Provider
|
||||
|
||||
Files to modify:
|
||||
|
||||
1. `server/notification-providers/PROVIDER_NAME.js` (backend logic)
|
||||
2. `server/notification.js` (register provider)
|
||||
3. `src/components/notifications/PROVIDER_NAME.vue` (frontend UI)
|
||||
@ -158,9 +151,7 @@ Files to modify:
|
||||
6. `src/lang/en.json` (add translation keys)
|
||||
|
||||
### New Monitor Type
|
||||
|
||||
Files to modify:
|
||||
|
||||
1. `server/monitor-types/MONITORING_TYPE.js` (backend logic)
|
||||
2. `server/uptime-kuma-server.js` (register monitor type)
|
||||
3. `src/pages/EditMonitor.vue` (frontend UI)
|
||||
|
||||
22
.github/dependabot.yml
vendored
22
.github/dependabot.yml
vendored
@ -1,22 +0,0 @@
|
||||
# Dependabot configuration for Uptime Kuma
|
||||
# See: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
# Enable version updates for GitHub Actions
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
# Group all GitHub Actions updates into a single PR
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
open-pull-requests-limit: 5
|
||||
commit-message:
|
||||
prefix: "chore"
|
||||
include: "scope"
|
||||
cooldown:
|
||||
default-days: 7
|
||||
161
.github/workflows/auto-test.yml
vendored
161
.github/workflows/auto-test.yml
vendored
@ -1,144 +1,97 @@
|
||||
name: Auto Test
|
||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-server
|
||||
cancel-in-progress: true
|
||||
name: Auto Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, 1.23.X, 3.0.0]
|
||||
branches: [ master, 1.23.X ]
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
pull_request:
|
||||
permissions: {}
|
||||
branches: [ master, 1.23.X ]
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
|
||||
jobs:
|
||||
auto-test:
|
||||
needs: [ check-linters ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
timeout-minutes: 15
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-22.04, windows-latest, ubuntu-22.04-arm]
|
||||
os: [macos-latest, ubuntu-22.04, windows-latest, ARM64]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
node: [20, 24]
|
||||
node: [ 20, 24 ]
|
||||
# Also test non-LTS, but only on Ubuntu.
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
node: 25
|
||||
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache/Restore node_modules
|
||||
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
||||
id: node-modules-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: npm clean-install --no-fund
|
||||
|
||||
- name: Rebuild native modules for ARM64
|
||||
if: matrix.os == 'ubuntu-22.04-arm'
|
||||
run: npm rebuild @louislam/sqlite3
|
||||
|
||||
- run: npm run build
|
||||
- run: npm run test-backend
|
||||
env:
|
||||
HEADLESS_TEST: 1
|
||||
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npm run test-backend
|
||||
env:
|
||||
HEADLESS_TEST: 1
|
||||
JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }}
|
||||
|
||||
# As a lot of dev dependencies are not supported on ARMv7, we have to test it separately and just test if `npm ci --production` works
|
||||
armv7-simple-test:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
needs: [ ]
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 15
|
||||
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node: [20, 22]
|
||||
os: [ ARMv7 ]
|
||||
node: [ 20, 22 ]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
platforms: linux/arm/v7
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
|
||||
|
||||
- name: Test on ARMv7 using Docker with QEMU
|
||||
run: |
|
||||
docker run --rm --platform linux/arm/v7 \
|
||||
-v $PWD:/workspace \
|
||||
-w /workspace \
|
||||
arm32v7/node:${{ matrix.node }} \
|
||||
npm clean-install --no-fund --production
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: npm ci --production
|
||||
|
||||
check-linters:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache/Restore node_modules
|
||||
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
||||
id: node-modules-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm clean-install --no-fund
|
||||
- run: npm run lint:prod
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm install
|
||||
- run: npm run lint:prod
|
||||
|
||||
e2e-test:
|
||||
runs-on: ubuntu-22.04-arm
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
PLAYWRIGHT_VERSION: ~1.39.0
|
||||
needs: [ ]
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- run: git config --global core.autocrlf false # Mainly for Windows
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache/Restore node_modules
|
||||
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
||||
id: node-modules-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: 22
|
||||
- run: npm clean-install --no-fund
|
||||
|
||||
- name: Rebuild native modules for ARM64
|
||||
run: npm rebuild @louislam/sqlite3
|
||||
|
||||
- name: Install Playwright ${{ env.PLAYWRIGHT_VERSION }}
|
||||
run: npx playwright@${{ env.PLAYWRIGHT_VERSION }} install
|
||||
|
||||
- run: npm run build
|
||||
- run: npm run test-e2e
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
- run: npm install
|
||||
- run: npx playwright install
|
||||
- run: npm run build
|
||||
- run: npm run test-e2e
|
||||
|
||||
53
.github/workflows/autofix.yml
vendored
53
.github/workflows/autofix.yml
vendored
@ -1,53 +0,0 @@
|
||||
name: autofix.ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master", "1.23.X"]
|
||||
pull_request:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
autofix:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
|
||||
- name: Cache/Restore node_modules
|
||||
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
||||
id: node-modules-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Update RDAP DNS data from IANA
|
||||
run: wget -O server/model/rdap-dns.json https://data.iana.org/rdap/dns.json
|
||||
continue-on-error: true
|
||||
|
||||
- name: Auto-fix JavaScript/Vue linting issues
|
||||
run: npm run lint-fix:js
|
||||
continue-on-error: true
|
||||
|
||||
- name: Auto-fix CSS/SCSS linting issues
|
||||
run: npm run lint-fix:style
|
||||
continue-on-error: true
|
||||
|
||||
- name: Auto-format code with Prettier
|
||||
run: npm run fmt
|
||||
continue-on-error: true
|
||||
|
||||
- name: Compile TypeScript
|
||||
run: npm run tsc
|
||||
continue-on-error: true
|
||||
|
||||
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27
|
||||
93
.github/workflows/beta-release.yml
vendored
93
.github/workflows/beta-release.yml
vendored
@ -1,93 +0,0 @@
|
||||
name: Beta Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Beta version number (e.g., 2.1.0-beta.2)"
|
||||
required: true
|
||||
type: string
|
||||
previous_version:
|
||||
description: "Previous version tag for changelog (e.g., 2.1.0-beta.1)"
|
||||
required: true
|
||||
type: string
|
||||
dry_run:
|
||||
description: "Dry Run (The docker image will not be pushed to registries. PR will still be created.)"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
beta-release:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
ref: master
|
||||
persist-credentials: true
|
||||
fetch-depth: 0 # Fetch all history for changelog generation
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: 24
|
||||
|
||||
- name: Create release branch
|
||||
env:
|
||||
VERSION: ${{ inputs.version }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git"
|
||||
# Delete remote branch if it exists
|
||||
git push origin --delete "release-${VERSION}" || true
|
||||
# Delete local branch if it exists
|
||||
git branch -D "release-${VERSION}" || true
|
||||
# For testing purpose
|
||||
# git checkout beta-workflow
|
||||
git checkout -b "release-${VERSION}"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm clean-install --no-fund
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
|
||||
- name: Run release-beta
|
||||
env:
|
||||
RELEASE_BETA_VERSION: ${{ inputs.version }}
|
||||
RELEASE_PREVIOUS_VERSION: ${{ inputs.previous_version }}
|
||||
DRY_RUN: ${{ inputs.dry_run }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||
run: npm run release-beta
|
||||
|
||||
- name: Upload dist.tar.gz as artifact
|
||||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
||||
with:
|
||||
name: dist-${{ inputs.version }}
|
||||
path: ./tmp/dist.tar.gz
|
||||
retention-days: 90
|
||||
48
.github/workflows/build-docker-base.yml
vendored
48
.github/workflows/build-docker-base.yml
vendored
@ -1,48 +0,0 @@
|
||||
name: Build Docker Base Images
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build-docker-base:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Build and push base2-slim image
|
||||
run: npm run build-docker-base-slim
|
||||
|
||||
- name: Build and push base2 image
|
||||
run: npm run build-docker-base
|
||||
22
.github/workflows/close-incorrect-issue.yml
vendored
22
.github/workflows/close-incorrect-issue.yml
vendored
@ -3,13 +3,10 @@ name: Close Incorrect Issue
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
close-incorrect-issue:
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
@ -17,15 +14,12 @@ jobs:
|
||||
node-version: [20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm ci
|
||||
- name: Close incorrect issue
|
||||
run: node extra/close-incorrect-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.issue.number }} "$ISSUE_USER_LOGIN"
|
||||
env:
|
||||
ISSUE_USER_LOGIN: ${{ github.event.issue.user.login }}
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- run: npm ci
|
||||
- run: node extra/close-incorrect-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.issue.number }} ${{ github.event.issue.user.login }}
|
||||
|
||||
46
.github/workflows/codeql-analysis.yml
vendored
46
.github/workflows/codeql-analysis.yml
vendored
@ -2,11 +2,11 @@ name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master", "1.23.X"]
|
||||
branches: [ "master", "1.23.X"]
|
||||
pull_request:
|
||||
branches: ["master", "1.23.X"]
|
||||
branches: [ "master", "1.23.X"]
|
||||
schedule:
|
||||
- cron: "16 22 * * 0"
|
||||
- cron: '16 22 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
@ -22,34 +22,22 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ["go", "javascript-typescript"]
|
||||
language: [ 'go', 'javascript-typescript' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
zizmor:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
actions: read
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- name: Run zizmor
|
||||
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
30
.github/workflows/conflict-labeler.yml
vendored
30
.github/workflows/conflict-labeler.yml
vendored
@ -1,30 +0,0 @@
|
||||
name: Merge Conflict Labeler
|
||||
|
||||
# pull_request_target is safe here because:
|
||||
# 1. Only uses a pinned trusted action (by SHA)
|
||||
# 2. Has minimal permissions (contents: read, pull-requests: write)
|
||||
# 3. Doesn't checkout or execute any untrusted code from PRs
|
||||
# 4. Only adds/removes labels based on merge conflict status
|
||||
on: # zizmor: ignore[dangerous-triggers]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
types: [synchronize]
|
||||
|
||||
jobs:
|
||||
label:
|
||||
name: Labeling
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Apply label
|
||||
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3
|
||||
with:
|
||||
dirtyLabel: "needs:resolve-merge-conflict"
|
||||
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
||||
25
.github/workflows/conflict_labeler.yml
vendored
Normal file
25
.github/workflows/conflict_labeler.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
name: Merge Conflict Labeler
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
types: [synchronize]
|
||||
|
||||
jobs:
|
||||
label:
|
||||
name: Labeling
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'louislam/uptime-kuma' }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Apply label
|
||||
uses: eps1lon/actions-label-merge-conflict@v3
|
||||
with:
|
||||
dirtyLabel: 'needs:resolve-merge-conflict'
|
||||
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
||||
@ -1,65 +0,0 @@
|
||||
name: Mark PR as draft when changes are requested
|
||||
|
||||
# pull_request_target is safe here because:
|
||||
# 1. Does not use any external actions; only uses the GitHub CLI via run commands
|
||||
# 2. Has minimal permissions
|
||||
# 3. Doesn't checkout or execute any untrusted code from PRs
|
||||
# 4. Only adds/removes labels or changes the draft status
|
||||
on: # zizmor: ignore[dangerous-triggers]
|
||||
pull_request_target:
|
||||
types:
|
||||
- review_submitted
|
||||
- labeled
|
||||
- ready_for_review
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
mark-draft:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
if: |
|
||||
(
|
||||
github.event.action == 'review_submitted' &&
|
||||
github.event.review.state == 'changes_requested'
|
||||
) || (
|
||||
github.event.action == 'labeled' &&
|
||||
github.event.label.name == 'pr:please address review comments'
|
||||
)
|
||||
steps:
|
||||
- name: Add label on requested changes
|
||||
if: github.event.review.state == 'changes_requested'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh issue edit "${{ github.event.pull_request.number }}" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--add-label "pr:please address review comments"
|
||||
|
||||
- name: Mark PR as draft
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh pr ready "${{ github.event.pull_request.number }}" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--undo || true
|
||||
# || true to ignore the case where the pr is already a draft
|
||||
|
||||
ready-for-review:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
if: github.event.action == 'ready_for_review'
|
||||
steps:
|
||||
- name: Update labels for review
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh issue edit "${{ github.event.pull_request.number }}" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--remove-label "pr:please address review comments" || true
|
||||
|
||||
gh issue edit "${{ github.event.pull_request.number }}" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--add-label "pr:needs review"
|
||||
40
.github/workflows/new-contributor-pr.yml
vendored
40
.github/workflows/new-contributor-pr.yml
vendored
@ -1,40 +0,0 @@
|
||||
name: New contributor message
|
||||
|
||||
on:
|
||||
# Safety
|
||||
# This workflow uses pull_request_target so it can run with write permissions on first-time contributor PRs.
|
||||
# It is safe because it does not check out or execute any code from the pull request and
|
||||
# only uses the pinned, trusted plbstl/first-contribution action
|
||||
pull_request_target: # zizmor: ignore[dangerous-triggers]
|
||||
types: [opened, closed]
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'louislam/uptime-kuma'
|
||||
name: Hello new contributor
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: plbstl/first-contribution@4b2b042fffa26792504a18e49aa9543a87bec077 # v4.1.0
|
||||
with:
|
||||
pr-reactions: rocket
|
||||
pr-opened-msg: >
|
||||
Hello and thanks for lending a paw to Uptime Kuma! 🐻👋
|
||||
|
||||
As this is your first contribution, please be sure to check out our [Pull Request guidelines](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma).
|
||||
|
||||
In particular:
|
||||
- Mark your PR as Draft while you’re still making changes
|
||||
- Mark it as Ready for review once it’s fully ready
|
||||
|
||||
If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.
|
||||
pr-merged-msg: >
|
||||
@{fc-author} congrats on your first contribution to Uptime Kuma! 🐻
|
||||
|
||||
We hope you enjoy contributing to our project and look forward to seeing more of your work in the future!
|
||||
If you want to see your contribution in action, please see our [nightly builds here](https://hub.docker.com/layers/louislam/uptime-kuma/nightly2).
|
||||
58
.github/workflows/nightly-release.yml
vendored
58
.github/workflows/nightly-release.yml
vendored
@ -1,58 +0,0 @@
|
||||
name: Nightly Release
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Runs at 2:00 AM UTC every day
|
||||
- cron: "0 2 * * *"
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
release-nightly:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
password: ${{ secrets.GHCR_TOKEN }}
|
||||
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Cache/Restore node_modules
|
||||
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
|
||||
id: node-modules-cache
|
||||
with:
|
||||
path: node_modules
|
||||
key: node-modules-${{ runner.os }}-node20-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm clean-install --no-fund
|
||||
|
||||
- name: Run release-nightly
|
||||
run: npm run release-nightly
|
||||
31
.github/workflows/pr-title.yml
vendored
31
.github/workflows/pr-title.yml
vendored
@ -1,31 +0,0 @@
|
||||
name: "PR Metadata"
|
||||
# if someone opens a PR, edits it, or reopens it we want to validate the title
|
||||
# This is separate from the rest of the CI as the title may change without code changes
|
||||
|
||||
on:
|
||||
# SECURITY: pull_request_target is used here to allow validation of PRs from forks.
|
||||
# This is safe because:
|
||||
# 1. No code from the PR is checked out
|
||||
# 2. Permissions are restricted to pull-requests: read
|
||||
# 3. Only a trusted third-party action is used to validate the PR title
|
||||
# 4. No user-controlled code is executed
|
||||
pull_request_target: # zizmor: ignore[dangerous-triggers]
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- reopened
|
||||
- synchronize
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
pr-title:
|
||||
name: Validate PR title follows https://conventionalcommits.org
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
6
.github/workflows/prevent-file-change.yml
vendored
6
.github/workflows/prevent-file-change.yml
vendored
@ -2,18 +2,16 @@ name: prevent-file-change
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
check-file-changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: Prevent file change
|
||||
uses: xalvarez/prevent-file-change-action@004d9f17c2e4a7afa037cda5f38dc55a5e9c9c06 # v1.9.1
|
||||
uses: xalvarez/prevent-file-change-action@v1
|
||||
with:
|
||||
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Regex, /src/lang/*.json is not allowed to be changed, except for /src/lang/en.json
|
||||
pattern: '^(?!src/lang/en\.json$)src/lang/.*\.json$'
|
||||
trustedAuthors: UptimeKumaBot
|
||||
|
||||
|
||||
21
.github/workflows/stale-bot.yml
vendored
21
.github/workflows/stale-bot.yml
vendored
@ -1,19 +1,15 @@
|
||||
name: "Automatically close stale issues"
|
||||
name: 'Automatically close stale issues'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 */6 * * *"
|
||||
- cron: '0 */6 * * *'
|
||||
#Run every 6 hours
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: write
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
stale-issue-message: |-
|
||||
We are clearing up our old `help`-issues and your issue has been open for 60 days with no activity.
|
||||
@ -22,16 +18,16 @@ jobs:
|
||||
days-before-close: 7
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
exempt-issue-labels: "News,discussion,bug,doc,feature-request"
|
||||
exempt-issue-assignees: "louislam"
|
||||
exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,feature-request'
|
||||
exempt-issue-assignees: 'louislam'
|
||||
operations-per-run: 200
|
||||
- uses: actions/stale@997185467fa4f803885201cee163a9f38240193d # v10.1.1
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
stale-issue-message: |-
|
||||
This issue was marked as `cannot-reproduce` by a maintainer.
|
||||
If an issue is non-reproducible, we cannot fix it, as we do not know what the underlying issue is.
|
||||
If you have any ideas how we can reproduce this issue, we would love to hear them.
|
||||
|
||||
|
||||
We don't have a good way to deal with truely unreproducible issues and are going to close this issue in a month.
|
||||
If think there might be other differences in our environment or in how we tried to reproduce this, we would appreciate any ideas.
|
||||
close-issue-message: |-
|
||||
@ -41,5 +37,6 @@ jobs:
|
||||
days-before-close: 30
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
any-of-issue-labels: "cannot-reproduce"
|
||||
any-of-issue-labels: 'cannot-reproduce'
|
||||
operations-per-run: 200
|
||||
|
||||
|
||||
20
.github/workflows/validate.yml
vendored
20
.github/workflows/validate.yml
vendored
@ -8,21 +8,20 @@ on:
|
||||
- master
|
||||
- 1.23.X
|
||||
workflow_dispatch:
|
||||
permissions: {}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write # enable write permissions for pull request comments
|
||||
|
||||
jobs:
|
||||
json-yaml-validate:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write # enable write permissions for pull request comments
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: json-yaml-validate
|
||||
id: json-yaml-validate
|
||||
uses: GrantBirki/json-yaml-validate@9bbaa8474e3af4e91f25eda8ac194fdc30564d96 # v4.0.0
|
||||
uses: GrantBirki/json-yaml-validate@v2.4.0
|
||||
with:
|
||||
comment: "true" # enable comment mode
|
||||
exclude_file: ".github/config/exclude.txt" # gitignore style file for exclusions
|
||||
@ -30,13 +29,10 @@ jobs:
|
||||
# General validations
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with: { persist-credentials: false }
|
||||
- uses: actions/checkout@v4
|
||||
- name: Use Node.js 20
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
# language files
|
||||
src/lang/*.json
|
||||
@ -1,65 +0,0 @@
|
||||
/**
|
||||
* Prettier Configuration for Uptime Kuma
|
||||
*
|
||||
* Usage:
|
||||
* npm run fmt - Format all files (auto-runs in CI via autofix workflow)
|
||||
* npm run fmt -- --check - Check formatting without making changes
|
||||
*
|
||||
* TIP: This formatter is automatically run in CI, so no need to worry about it
|
||||
*/
|
||||
module.exports = {
|
||||
// Core formatting options - matching original ESLint rules
|
||||
semi: true,
|
||||
singleQuote: false,
|
||||
trailingComma: "es5",
|
||||
printWidth: 120,
|
||||
tabWidth: 4,
|
||||
useTabs: false,
|
||||
endOfLine: "lf",
|
||||
arrowParens: "always",
|
||||
bracketSpacing: true,
|
||||
bracketSameLine: false,
|
||||
|
||||
// Vue-specific settings
|
||||
vueIndentScriptAndStyle: false,
|
||||
singleAttributePerLine: false,
|
||||
htmlWhitespaceSensitivity: "ignore", // More forgiving with whitespace in HTML
|
||||
|
||||
// Override settings for specific file types
|
||||
overrides: [
|
||||
{
|
||||
files: "*.vue",
|
||||
options: {
|
||||
parser: "vue",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["*.json"],
|
||||
options: {
|
||||
tabWidth: 4,
|
||||
trailingComma: "none",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["*.yml", "*.yaml"],
|
||||
options: {
|
||||
tabWidth: 2,
|
||||
trailingComma: "none",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["src/icon.js"],
|
||||
options: {
|
||||
trailingComma: "all",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["*.md"],
|
||||
options: {
|
||||
printWidth: 100,
|
||||
proseWrap: "preserve",
|
||||
tabWidth: 2,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@ -1,11 +1,10 @@
|
||||
{
|
||||
"extends": [
|
||||
"stylelint-config-standard",
|
||||
"stylelint-config-prettier"
|
||||
],
|
||||
"extends": "stylelint-config-standard",
|
||||
"customSyntax": "postcss-html",
|
||||
"rules": {
|
||||
"indentation": 4,
|
||||
"no-descending-specificity": null,
|
||||
"selector-list-comma-newline-after": null,
|
||||
"declaration-empty-line-before": null,
|
||||
"alpha-value-notation": "number",
|
||||
"color-function-notation": "legacy",
|
||||
|
||||
363
CONTRIBUTING.md
363
CONTRIBUTING.md
@ -6,11 +6,9 @@ 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.
|
||||
|
||||
Before you start, please read our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our community standards.
|
||||
|
||||
The project was created with `vite` 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
|
||||
@ -54,7 +52,8 @@ to review the appropriate one for your contribution.
|
||||
[**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
|
||||
[issue]:
|
||||
https://github.com/louislam/uptime-kuma/issues/new?template=security_issue.yml
|
||||
|
||||
</p>
|
||||
</details>
|
||||
@ -64,6 +63,7 @@ to review the appropriate one for your contribution.
|
||||
|
||||
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
|
||||
- test that your code does what you claim it does.
|
||||
@ -77,16 +77,23 @@ to review the appropriate one for your contribution.
|
||||
- <details><summary><b>Translations / Internationalisation (i18n)</b> (click to expand)</summary>
|
||||
<p>
|
||||
|
||||
Please add **all** strings that are translatable to `src/lang/en.json`. If translation keys are omitted, they cannot be translated. **Do not include any other languages in your initial pull request** (even if it is your mother tongue) to avoid merge conflicts between Weblate and `master`. Once your PR is merged into `master`, the strings can be translated by awesome people donating their language skills.
|
||||
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 want to help translate Uptime Kuma into your language, please see [these instructions on how to translate using Weblate](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:
|
||||
|
||||
There are some cases where a change cannot be done directly in Weblate and requires a PR:
|
||||
- A text may not yet be localisable. In this case, **adding a new language key** via `{{ $t("Translation key") }}` or [`<i18n-t keypath="Translation key">`](https://vue-i18n.intlify.dev/guide/advanced/component.html) might be necessary.
|
||||
- Language keys need to be **added to `en.json`** to appear in Weblate. If this has not been done, a PR is appreciated.
|
||||
- **Adding a new language** requires creating a new file. See [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md).
|
||||
- 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>
|
||||
<sub>Because maintainer time is precious, junior maintainers may merge
|
||||
uncontroversial PRs in this area.</sub>
|
||||
|
||||
</p>
|
||||
</details>
|
||||
@ -95,6 +102,7 @@ to review the appropriate one for your contribution.
|
||||
<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.
|
||||
|
||||
@ -131,6 +139,7 @@ to review the appropriate one for your contribution.
|
||||
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 ^^_
|
||||
@ -142,9 +151,9 @@ to review the appropriate one for your contribution.
|
||||
|
||||
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/>
|
||||
- Domain Expiry via <https://google.com/> and a larger time set
|
||||
- Testing (the test button on the notification provider setup page)
|
||||
|
||||
<br/>
|
||||
@ -157,7 +166,6 @@ to review the appropriate one for your contribution.
|
||||
| `UP` |  |  |
|
||||
| `DOWN` |  |  |
|
||||
| Certificate-expiry |  |  |
|
||||
| Domain-expiry |  |  |
|
||||
| Testing |  |  |
|
||||
```
|
||||
|
||||
@ -171,11 +179,14 @@ to review the appropriate one for your contribution.
|
||||
<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:
|
||||
- in the happy-path: set `heartbeat.msg` to a successful message and set `heartbeat.status = UP`
|
||||
- in the unhappy-path: throw an `Error` for each fault that is detected with an actionable error message.
|
||||
- NEVER set `heartbeat.status = DOWN` unless you want to explicitly ignore retries.
|
||||
|
||||
- `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
|
||||
@ -186,7 +197,7 @@ to review the appropriate one for your contribution.
|
||||
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))
|
||||
[`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
|
||||
@ -199,9 +210,8 @@ to review the appropriate one for your contribution.
|
||||
<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 large pull requests or when you don't know if it will be merged or not.
|
||||
When adding new features, please also add tests to ensure your changes work as expected and to prevent future regressions.
|
||||
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>
|
||||
@ -209,36 +219,105 @@ to review the appropriate one for your contribution.
|
||||
</p>
|
||||
</details>
|
||||
|
||||
- <details><summary><b>As a First-Time Contributor</b> (click to expand)</summary>
|
||||
- <details><summary><b>Pull Request Guidelines</b> (click to expand)</summary>
|
||||
<p>
|
||||
|
||||
Contributing is easy and fun. We will guide you through the process:
|
||||
1. **Fork** the [Uptime-Kuma repository](https://github.com/louislam/uptime-kuma/) and **clone** it to your local machine.
|
||||
2. **Create a new branch** for your changes (e.g., `signal-notification-provider`).
|
||||
3. **Make your changes** and **commit** them with a clear message.
|
||||
4. **Push** your changes to your forked repository.
|
||||
5. **Open a pull request** to the `master` branch of the Uptime Kuma repository.
|
||||
- For large changes, please open a **draft pull request** first to discuss the changes with the maintainers.
|
||||
6. **Provide a clear and concise description** of the changes you've made and link any related issues.
|
||||
7. **Complete the PR checklist** and make sure all CI checks pass.
|
||||
8. **Request a review** when your pull request is ready.
|
||||
## 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:
|
||||
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.
|
||||
- Your code is fully tested and ready for review.
|
||||
- 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 volunteer maintainer will review your PR as soon as possible.
|
||||
You can help us by reviewing other PRs or taking a look at open issues.
|
||||
<br />
|
||||
|
||||
## The following rules are essential for making your PR mergeable
|
||||
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
|
||||
|
||||
- (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**
|
||||
@ -256,22 +335,18 @@ to review the appropriate one for your contribution.
|
||||
- Don't modify or delete existing logic without a valid reason.
|
||||
- Don't convert existing code into other programming languages for no reason.
|
||||
|
||||
### Continuous Integration
|
||||
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.
|
||||
|
||||
All pull requests must pass our continuous integration checks. These checks include:
|
||||
I will assign your pull request to a [milestone], if I plan to review and merge
|
||||
it.
|
||||
|
||||
- **Linting**: We use ESLint and Stylelint for code quality checks. You can run the linter locally with `npm run lint`.
|
||||
- **Formatting**: We use Prettier for code formatting. You can format your code with `npm run fmt` (or CI will do this for you)
|
||||
- **Testing**: We use Playwright for end-to-end tests and have a suite of backend tests. You can run the tests locally with `npm test`.
|
||||
[milestone]: https://github.com/louislam/uptime-kuma/milestones
|
||||
|
||||
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.
|
||||
|
||||
We will assign your pull request to a [milestone](https://github.com/louislam/uptime-kuma/milestones), if we plan to review and merge it.
|
||||
|
||||
Please don't rush or ask for an ETA.
|
||||
We have to understand the pull request, make sure it has no breaking changes and stick to the vision of this project, especially for large pull requests.
|
||||
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?
|
||||
|
||||
@ -279,20 +354,105 @@ 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 are here to help.
|
||||
are stuck on.
|
||||
|
||||
## Project Style
|
||||
### 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.
|
||||
|
||||
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.
|
||||
|
||||
## 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.
|
||||
|
||||
- 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
|
||||
|
||||
@ -316,7 +476,7 @@ as easy as installing a mobile app.
|
||||
|
||||
## Tools
|
||||
|
||||
- [`Node.js`](https://nodejs.org/) >= 20.4.0
|
||||
- [`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
|
||||
@ -341,6 +501,8 @@ npm ci
|
||||
|
||||
## Dev Server
|
||||
|
||||
(2022-04-26 Update)
|
||||
|
||||
We can start the frontend dev server and the backend dev server in one command.
|
||||
|
||||
Port `3000` and port `3001` will be used.
|
||||
@ -387,10 +549,16 @@ in the `socket.io` handlers. `express.js` is also used to serve:
|
||||
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 via `npm run build`.
|
||||
For production, it is not used. It will be compiled to `dist` directory instead.
|
||||
|
||||
You can use Vue.js devtools Chrome extension for debugging.
|
||||
|
||||
### Build the frontend
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Frontend Details
|
||||
|
||||
Uptime Kuma Frontend is a single page application (SPA). Most paths are handled
|
||||
@ -398,7 +566,8 @@ by Vue Router.
|
||||
|
||||
The router is in `src/router.js`
|
||||
|
||||
Most data in the frontend is stored at the root level, even though the router can navigate to different 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`.
|
||||
|
||||
@ -408,8 +577,6 @@ See: <https://github.com/louislam/uptime-kuma/tree/master/db/knex_migrations>
|
||||
|
||||
## Unit Test
|
||||
|
||||
To run unit tests, use the following command:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npm test
|
||||
@ -417,8 +584,8 @@ 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
|
||||
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"
|
||||
@ -438,10 +605,26 @@ 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.
|
||||
|
||||
## Translations
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
## Spelling & Grammar
|
||||
|
||||
Feel free to correct the spelling and grammar in the documentation or code.
|
||||
English is not the native language of the maintainers.
|
||||
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
|
||||
|
||||
@ -450,8 +633,47 @@ repo to do that.
|
||||
|
||||
<https://github.com/louislam/uptime-kuma-wiki>
|
||||
|
||||
## Docker
|
||||
|
||||
### Arch
|
||||
|
||||
- amd64
|
||||
- arm64
|
||||
- armv7
|
||||
|
||||
### Docker Tags
|
||||
|
||||
#### v2
|
||||
|
||||
- `2`, `latest-2`: v2 with full features such as Chromium and bundled MariaDB
|
||||
- `2.x.x`
|
||||
- `2-slim`: v2 with basic features
|
||||
- `2.x.x-slim`
|
||||
- `beta2`: Latest beta build
|
||||
- `2.x.x-beta.x`
|
||||
- `nightly2`: Dev build
|
||||
- `base2`: Basic Debian setup without Uptime Kuma source code (Full features)
|
||||
- `base2-slim`: Basic Debian setup without Uptime Kuma source code
|
||||
- `pr-test2`: For testing pull request without setting up a local environment
|
||||
|
||||
#### v1
|
||||
|
||||
- `1`, `latest`, `1-debian`, `debian`: Latest version of v1
|
||||
- `1.x.x`, `1.x.x-debian`
|
||||
- `1.x.x-beta.x`: Beta build
|
||||
- `beta`: Latest beta build
|
||||
- `nightly`: Dev build
|
||||
- `base-debian`: Basic Debian setup without Uptime Kuma source code
|
||||
- `pr-test`: For testing pull request without setting up a local environment
|
||||
- `base-alpine`: (Deprecated) Basic Alpine setup without Uptime Kuma source code
|
||||
- `1-alpine`, `alpine`: (Deprecated)
|
||||
- `1.x.x-alpine`: (Deprecated)
|
||||
|
||||
## Maintainer
|
||||
|
||||
Check the latest issues and pull requests:
|
||||
<https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc>
|
||||
|
||||
### What is a maintainer and what are their roles?
|
||||
|
||||
This project has multiple maintainers who specialise in different areas.
|
||||
@ -469,16 +691,18 @@ We have a few procedures we follow. These are documented here:
|
||||
|
||||
- <details><summary><b>Set up a Docker Builder</b> (click to expand)</summary>
|
||||
<p>
|
||||
|
||||
- amd64, armv7 using local.
|
||||
- arm64 using remote arm64 cpu, as the emulator is too slow and can no longer
|
||||
pass the `npm ci` command.
|
||||
|
||||
1. Add the public key to the remote server.
|
||||
2. Add the remote context. The remote machine must be arm64 and installed
|
||||
Docker CE.
|
||||
|
||||
```bash
|
||||
docker context create oracle-arm64-jp --docker "host=ssh://root@100.107.174.88"
|
||||
```
|
||||
```bash
|
||||
docker context create oracle-arm64-jp --docker "host=ssh://root@100.107.174.88"
|
||||
```
|
||||
|
||||
3. Create a new builder.
|
||||
|
||||
@ -502,6 +726,7 @@ We have a few procedures we follow. These are documented here:
|
||||
|
||||
- <details><summary><b>Release</b> (click to expand)</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:
|
||||
@ -514,6 +739,7 @@ We have a few procedures we follow. These are documented here:
|
||||
9. Deploy to the demo server: `npm run deploy-demo-server`
|
||||
|
||||
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 /
|
||||
@ -525,6 +751,7 @@ We have a few procedures we follow. These are documented here:
|
||||
|
||||
- <details><summary><b>Release Beta</b> (click to expand)</summary>
|
||||
<p>
|
||||
|
||||
1. Draft a release note, check `This is a pre-release`
|
||||
2. Make sure the repo is cleared
|
||||
3. `npm run release-beta` with env vars: `VERSION` and `GITHUB_TOKEN`
|
||||
|
||||
27
README.md
27
README.md
@ -1,17 +1,17 @@
|
||||
<div align="center" width="100%">
|
||||
<img src="./public/icon.svg" width="128" alt="Uptime Kuma Logo" />
|
||||
<img src="./public/icon.svg" width="128" alt="" />
|
||||
</div>
|
||||
|
||||
# Uptime Kuma
|
||||
|
||||
Uptime Kuma is an easy-to-use self-hosted monitoring tool.
|
||||
|
||||
<a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/stars/louislam/uptime-kuma?style=flat" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/pulls/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/v/louislam/uptime-kuma/2?label=docker%20image%20ver." /></a> <a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/last-commit/louislam/uptime-kuma" /></a> <a target="_blank" href="https://opencollective.com/uptime-kuma"><img src="https://opencollective.com/uptime-kuma/total/badge.svg?label=Open%20Collective%20Backers&color=brightgreen" /></a>
|
||||
<a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/stars/louislam/uptime-kuma?style=flat" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/pulls/louislam/uptime-kuma" /></a> <a target="_blank" href="https://hub.docker.com/r/louislam/uptime-kuma"><img src="https://img.shields.io/docker/v/louislam/uptime-kuma/latest?label=docker%20image%20ver." /></a> <a target="_blank" href="https://github.com/louislam/uptime-kuma"><img src="https://img.shields.io/github/last-commit/louislam/uptime-kuma" /></a> <a target="_blank" href="https://opencollective.com/uptime-kuma"><img src="https://opencollective.com/uptime-kuma/total/badge.svg?label=Open%20Collective%20Backers&color=brightgreen" /></a>
|
||||
[](https://github.com/sponsors/louislam) <a href="https://weblate.kuma.pet/projects/uptime-kuma/uptime-kuma/">
|
||||
<img src="https://weblate.kuma.pet/widgets/uptime-kuma/-/svg-badge.svg" alt="Translation status" />
|
||||
</a>
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/1336778/212262296-e6205815-ad62-488c-83ec-a5b0d0689f7c.jpg" width="700" alt="Uptime Kuma Dashboard Screenshot" />
|
||||
<img src="https://user-images.githubusercontent.com/1336778/212262296-e6205815-ad62-488c-83ec-a5b0d0689f7c.jpg" width="700" alt="" />
|
||||
|
||||
## 🥔 Live Demo
|
||||
|
||||
@ -23,7 +23,7 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Sponsore
|
||||
|
||||
## ⭐ Features
|
||||
|
||||
- Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Websocket / Ping / DNS Record / Push / Steam Game Server / Docker Containers
|
||||
- Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers
|
||||
- Fancy, Reactive, Fast UI/UX
|
||||
- Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and [90+ notification services, click here for the full list](https://github.com/louislam/uptime-kuma/tree/master/src/components/notifications)
|
||||
- 20-second intervals
|
||||
@ -45,7 +45,6 @@ cd uptime-kuma
|
||||
curl -o compose.yaml https://raw.githubusercontent.com/louislam/uptime-kuma/master/compose.yaml
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Uptime Kuma is now running on all network interfaces (e.g. http://localhost:3001 or http://your-ip:3001).
|
||||
|
||||
> [!WARNING]
|
||||
@ -56,7 +55,6 @@ Uptime Kuma is now running on all network interfaces (e.g. http://localhost:3001
|
||||
```bash
|
||||
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:2
|
||||
```
|
||||
|
||||
Uptime Kuma is now running on all network interfaces (e.g. http://localhost:3001 or http://your-ip:3001).
|
||||
|
||||
If you want to limit exposure to localhost only:
|
||||
@ -65,6 +63,8 @@ If you want to limit exposure to localhost only:
|
||||
docker run ... -p 127.0.0.1:3001:3001 ...
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 💪🏻 Non-Docker
|
||||
|
||||
Requirements:
|
||||
@ -93,7 +93,6 @@ npm install pm2 -g && pm2 install pm2-logrotate
|
||||
# Start Server
|
||||
pm2 start server/server.js --name uptime-kuma
|
||||
```
|
||||
|
||||
Uptime Kuma is now running on all network interfaces (e.g. http://localhost:3001 or http://your-ip:3001).
|
||||
|
||||
More useful PM2 Commands
|
||||
@ -128,25 +127,25 @@ I will assign requests/issues to the next milestone.
|
||||
|
||||
Thank you so much! (GitHub Sponsors will be updated manually. OpenCollective sponsors will be updated automatically, the list will be cached by GitHub though. It may need some time to be updated)
|
||||
|
||||
<img src="https://uptime.kuma.pet/sponsors?v=6" alt="Uptime Kuma Sponsors" />
|
||||
<img src="https://uptime.kuma.pet/sponsors?v=6" alt />
|
||||
|
||||
## 🖼 More Screenshots
|
||||
|
||||
Light Mode:
|
||||
|
||||
<img src="https://uptime.kuma.pet/img/light.jpg" width="512" alt="Uptime Kuma Light Mode Screenshot of how the Dashboard looks" />
|
||||
<img src="https://uptime.kuma.pet/img/light.jpg" width="512" alt="" />
|
||||
|
||||
Status Page:
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/1336778/134628766-a3fe0981-0926-4285-ab46-891a21c3e4cb.png" width="512" alt="Uptime Kuma Status Page Screenshot" />
|
||||
<img src="https://user-images.githubusercontent.com/1336778/134628766-a3fe0981-0926-4285-ab46-891a21c3e4cb.png" width="512" alt="" />
|
||||
|
||||
Settings Page:
|
||||
|
||||
<img src="https://louislam.net/uptimekuma/2.jpg" width="400" alt="Uptime Kuma Settings Page Screenshot" />
|
||||
<img src="https://louislam.net/uptimekuma/2.jpg" width="400" alt="" />
|
||||
|
||||
Telegram Notification Sample:
|
||||
|
||||
<img src="https://louislam.net/uptimekuma/3.jpg" width="400" alt="Uptime Kuma Telegram Notification Sample Screenshot" />
|
||||
<img src="https://louislam.net/uptimekuma/3.jpg" width="400" alt="" />
|
||||
|
||||
## Motivation
|
||||
|
||||
@ -175,8 +174,8 @@ You can mention me if you ask a question on the subreddit.
|
||||
|
||||
### Create Pull Requests
|
||||
|
||||
Pull requests are awesome.
|
||||
To keep reviews fast and effective, please make sure you’ve [read our pull request guidelines](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma).
|
||||
We DO NOT accept all types of pull requests and do not want to waste your time. Please be sure that you have read and follow pull request rules:
|
||||
[CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma](https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma)
|
||||
|
||||
### Test Pull Requests
|
||||
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
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 report any upstream dependency issues / scan result by any tools. It will be closed immediately without explanations. Unless you have PoC to prove that the upstream issue affected Uptime Kuma.
|
||||
- Do not report any upstream dependency issues / scan result by any tools. It will be closed immediately without explainations. Unless you have PoC to prove that the upstream issue affected Uptime Kuma.
|
||||
- Do not use the public issue tracker or discuss it in public as it will cause
|
||||
more damage.
|
||||
more damage.
|
||||
|
||||
## Do you accept other 3rd-party bug bounty platforms?
|
||||
|
||||
|
||||
5
config/jest-backend.config.js
Normal file
5
config/jest-backend.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
"rootDir": "..",
|
||||
"testRegex": "./test/backend.spec.js",
|
||||
};
|
||||
|
||||
@ -22,11 +22,10 @@ export default defineConfig({
|
||||
// Reporter to use
|
||||
reporter: [
|
||||
[
|
||||
"html",
|
||||
{
|
||||
"html", {
|
||||
outputFolder: "../private/playwright-report",
|
||||
open: "never",
|
||||
},
|
||||
}
|
||||
],
|
||||
],
|
||||
|
||||
@ -48,7 +47,7 @@ export default defineConfig({
|
||||
{
|
||||
name: "specs",
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
dependencies: ["run-once setup"],
|
||||
dependencies: [ "run-once setup" ],
|
||||
},
|
||||
/*
|
||||
{
|
||||
|
||||
@ -2,7 +2,6 @@ import vue from "@vitejs/plugin-vue";
|
||||
import { defineConfig } from "vite";
|
||||
import visualizer from "rollup-plugin-visualizer";
|
||||
import viteCompression from "vite-plugin-compression";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
const postCssScss = require("postcss-scss");
|
||||
const postcssRTLCSS = require("postcss-rtlcss");
|
||||
@ -15,13 +14,13 @@ export default defineConfig({
|
||||
port: 3000,
|
||||
},
|
||||
define: {
|
||||
FRONTEND_VERSION: JSON.stringify(process.env.npm_package_version),
|
||||
"FRONTEND_VERSION": JSON.stringify(process.env.npm_package_version),
|
||||
"process.env": {},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
visualizer({
|
||||
filename: "tmp/dist-stats.html",
|
||||
filename: "tmp/dist-stats.html"
|
||||
}),
|
||||
viteCompression({
|
||||
algorithm: "gzip",
|
||||
@ -31,31 +30,24 @@ export default defineConfig({
|
||||
algorithm: "brotliCompress",
|
||||
filter: viteCompressionFilter,
|
||||
}),
|
||||
VitePWA({
|
||||
registerType: null,
|
||||
srcDir: "src",
|
||||
filename: "serviceWorker.ts",
|
||||
strategies: "injectManifest",
|
||||
injectManifest: {
|
||||
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024, // 3 MiB
|
||||
},
|
||||
}),
|
||||
],
|
||||
css: {
|
||||
postcss: {
|
||||
parser: postCssScss,
|
||||
map: false,
|
||||
plugins: [postcssRTLCSS],
|
||||
},
|
||||
"parser": postCssScss,
|
||||
"map": false,
|
||||
"plugins": [ postcssRTLCSS ]
|
||||
}
|
||||
},
|
||||
build: {
|
||||
commonjsOptions: {
|
||||
include: [/.js$/],
|
||||
include: [ /.js$/ ],
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id, { getModuleInfo, getModuleIds }) {},
|
||||
},
|
||||
manualChunks(id, { getModuleInfo, getModuleIds }) {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@ -39,7 +39,7 @@ async function createTables() {
|
||||
table.integer("user_id").unsigned().notNullable();
|
||||
table.string("protocol", 10).notNullable();
|
||||
table.string("host", 255).notNullable();
|
||||
table.smallint("port").notNullable(); // TODO: Maybe a issue with MariaDB, need migration to int
|
||||
table.smallint("port").notNullable(); // TODO: Maybe a issue with MariaDB, need migration to int
|
||||
table.boolean("auth").notNullable();
|
||||
table.string("username", 255).nullable();
|
||||
table.string("password", 255).nullable();
|
||||
@ -67,7 +67,10 @@ async function createTables() {
|
||||
table.increments("id");
|
||||
table.string("name", 150);
|
||||
table.boolean("active").notNullable().defaultTo(true);
|
||||
table.integer("user_id").unsigned().references("id").inTable("user").onDelete("SET NULL").onUpdate("CASCADE");
|
||||
table.integer("user_id").unsigned()
|
||||
.references("id").inTable("user")
|
||||
.onDelete("SET NULL")
|
||||
.onUpdate("CASCADE");
|
||||
table.integer("interval").notNullable().defaultTo(20);
|
||||
table.text("url");
|
||||
table.string("type", 20);
|
||||
@ -80,7 +83,7 @@ async function createTables() {
|
||||
table.boolean("ignore_tls").notNullable().defaultTo(false);
|
||||
table.boolean("upside_down").notNullable().defaultTo(false);
|
||||
table.integer("maxredirects").notNullable().defaultTo(10);
|
||||
table.text("accepted_statuscodes_json").notNullable().defaultTo('["200-299"]');
|
||||
table.text("accepted_statuscodes_json").notNullable().defaultTo("[\"200-299\"]");
|
||||
table.string("dns_resolve_type", 5);
|
||||
table.string("dns_resolve_server", 255);
|
||||
table.string("dns_last_result", 255);
|
||||
@ -91,9 +94,11 @@ async function createTables() {
|
||||
table.text("headers").defaultTo(null);
|
||||
table.text("basic_auth_user").defaultTo(null);
|
||||
table.text("basic_auth_pass").defaultTo(null);
|
||||
table.integer("docker_host").unsigned().references("id").inTable("docker_host");
|
||||
table.integer("docker_host").unsigned()
|
||||
.references("id").inTable("docker_host");
|
||||
table.string("docker_container", 255);
|
||||
table.integer("proxy_id").unsigned().references("id").inTable("proxy");
|
||||
table.integer("proxy_id").unsigned()
|
||||
.references("id").inTable("proxy");
|
||||
table.boolean("expiry_notification").defaultTo(true);
|
||||
table.text("mqtt_topic");
|
||||
table.string("mqtt_success_message", 255);
|
||||
@ -125,12 +130,8 @@ async function createTables() {
|
||||
await knex.schema.createTable("heartbeat", (table) => {
|
||||
table.increments("id");
|
||||
table.boolean("important").notNullable().defaultTo(false);
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.smallint("status").notNullable();
|
||||
@ -142,9 +143,9 @@ async function createTables() {
|
||||
table.integer("down_count").notNullable().defaultTo(0);
|
||||
|
||||
table.index("important");
|
||||
table.index(["monitor_id", "time"], "monitor_time_index");
|
||||
table.index([ "monitor_id", "time" ], "monitor_time_index");
|
||||
table.index("monitor_id");
|
||||
table.index(["monitor_id", "important", "time"], "monitor_important_time_index");
|
||||
table.index([ "monitor_id", "important", "time" ], "monitor_important_time_index");
|
||||
});
|
||||
|
||||
// incident
|
||||
@ -165,7 +166,10 @@ async function createTables() {
|
||||
table.increments("id");
|
||||
table.string("title", 150).notNullable();
|
||||
table.text("description").notNullable();
|
||||
table.integer("user_id").unsigned().references("id").inTable("user").onDelete("SET NULL").onUpdate("CASCADE");
|
||||
table.integer("user_id").unsigned()
|
||||
.references("id").inTable("user")
|
||||
.onDelete("SET NULL")
|
||||
.onUpdate("CASCADE");
|
||||
table.boolean("active").notNullable().defaultTo(true);
|
||||
table.string("strategy", 50).notNullable().defaultTo("single");
|
||||
table.datetime("start_date");
|
||||
@ -177,7 +181,7 @@ async function createTables() {
|
||||
table.integer("interval_day");
|
||||
|
||||
table.index("active");
|
||||
table.index(["strategy", "active"], "manual_active");
|
||||
table.index([ "strategy", "active" ], "manual_active");
|
||||
table.index("user_id", "maintenance_user_id");
|
||||
});
|
||||
|
||||
@ -205,21 +209,13 @@ async function createTables() {
|
||||
await knex.schema.createTable("maintenance_status_page", (table) => {
|
||||
table.increments("id");
|
||||
|
||||
table
|
||||
.integer("status_page_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("status_page")
|
||||
table.integer("status_page_id").unsigned().notNullable()
|
||||
.references("id").inTable("status_page")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
|
||||
table
|
||||
.integer("maintenance_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("maintenance")
|
||||
table.integer("maintenance_id").unsigned().notNullable()
|
||||
.references("id").inTable("maintenance")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
});
|
||||
@ -227,12 +223,8 @@ async function createTables() {
|
||||
// maintenance_timeslot
|
||||
await knex.schema.createTable("maintenance_timeslot", (table) => {
|
||||
table.increments("id");
|
||||
table
|
||||
.integer("maintenance_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("maintenance")
|
||||
table.integer("maintenance_id").unsigned().notNullable()
|
||||
.references("id").inTable("maintenance")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.datetime("start_date").notNullable();
|
||||
@ -240,51 +232,35 @@ async function createTables() {
|
||||
table.boolean("generated_next").defaultTo(false);
|
||||
|
||||
table.index("maintenance_id");
|
||||
table.index(["maintenance_id", "start_date", "end_date"], "active_timeslot_index");
|
||||
table.index([ "maintenance_id", "start_date", "end_date" ], "active_timeslot_index");
|
||||
table.index("generated_next", "generated_next_index");
|
||||
});
|
||||
|
||||
// monitor_group
|
||||
await knex.schema.createTable("monitor_group", (table) => {
|
||||
table.increments("id");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table
|
||||
.integer("group_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("group")
|
||||
table.integer("group_id").unsigned().notNullable()
|
||||
.references("id").inTable("group")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.integer("weight").notNullable().defaultTo(1000);
|
||||
table.boolean("send_url").notNullable().defaultTo(false);
|
||||
|
||||
table.index(["monitor_id", "group_id"], "fk");
|
||||
table.index([ "monitor_id", "group_id" ], "fk");
|
||||
});
|
||||
// monitor_maintenance
|
||||
await knex.schema.createTable("monitor_maintenance", (table) => {
|
||||
table.increments("id");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table
|
||||
.integer("maintenance_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("maintenance")
|
||||
table.integer("maintenance_id").unsigned().notNullable()
|
||||
.references("id").inTable("maintenance")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
|
||||
@ -304,25 +280,17 @@ async function createTables() {
|
||||
|
||||
// monitor_notification
|
||||
await knex.schema.createTable("monitor_notification", (table) => {
|
||||
table.increments("id").unsigned(); // TODO: no auto increment????
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.increments("id").unsigned(); // TODO: no auto increment????
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table
|
||||
.integer("notification_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("notification")
|
||||
table.integer("notification_id").unsigned().notNullable()
|
||||
.references("id").inTable("notification")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
|
||||
table.index(["monitor_id", "notification_id"], "monitor_notification_index");
|
||||
table.index([ "monitor_id", "notification_id" ], "monitor_notification_index");
|
||||
});
|
||||
|
||||
// tag
|
||||
@ -336,20 +304,12 @@ async function createTables() {
|
||||
// monitor_tag
|
||||
await knex.schema.createTable("monitor_tag", (table) => {
|
||||
table.increments("id");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table
|
||||
.integer("tag_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("tag")
|
||||
table.integer("tag_id").unsigned().notNullable()
|
||||
.references("id").inTable("tag")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.text("value");
|
||||
@ -358,12 +318,8 @@ async function createTables() {
|
||||
// monitor_tls_info
|
||||
await knex.schema.createTable("monitor_tls_info", (table) => {
|
||||
table.increments("id");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.text("info_json");
|
||||
@ -375,8 +331,8 @@ async function createTables() {
|
||||
table.string("type", 50).notNullable();
|
||||
table.integer("monitor_id").unsigned().notNullable();
|
||||
table.integer("days").notNullable();
|
||||
table.unique(["type", "monitor_id", "days"]);
|
||||
table.index(["type", "monitor_id", "days"], "good_index");
|
||||
table.unique([ "type", "monitor_id", "days" ]);
|
||||
table.index([ "type", "monitor_id", "days" ], "good_index");
|
||||
});
|
||||
|
||||
// setting
|
||||
@ -390,19 +346,16 @@ async function createTables() {
|
||||
// status_page_cname
|
||||
await knex.schema.createTable("status_page_cname", (table) => {
|
||||
table.increments("id");
|
||||
table
|
||||
.integer("status_page_id")
|
||||
.unsigned()
|
||||
.references("id")
|
||||
.inTable("status_page")
|
||||
table.integer("status_page_id").unsigned()
|
||||
.references("id").inTable("status_page")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.string("domain").notNullable().unique().collate("utf8_general_ci");
|
||||
});
|
||||
|
||||
/*********************
|
||||
* Converted Patch here
|
||||
*********************/
|
||||
* Converted Patch here
|
||||
*********************/
|
||||
|
||||
// 2023-06-30-1348-http-body-encoding.js
|
||||
// ALTER TABLE monitor ADD http_body_encoding VARCHAR(25);
|
||||
@ -443,12 +396,8 @@ async function createTables() {
|
||||
table.increments("id").primary();
|
||||
table.string("key", 255).notNullable();
|
||||
table.string("name", 255).notNullable();
|
||||
table
|
||||
.integer("user_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("user")
|
||||
table.integer("user_id").unsigned().notNullable()
|
||||
.references("id").inTable("user")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.dateTime("created_date").defaultTo(knex.fn.now()).notNullable();
|
||||
@ -481,11 +430,13 @@ async function createTables() {
|
||||
ALTER TABLE maintenance ADD timezone VARCHAR(255);
|
||||
ALTER TABLE maintenance ADD duration INTEGER;
|
||||
*/
|
||||
await knex.schema.dropTableIfExists("maintenance_timeslot").table("maintenance", function (table) {
|
||||
table.text("cron");
|
||||
table.string("timezone", 255);
|
||||
table.integer("duration");
|
||||
});
|
||||
await knex.schema
|
||||
.dropTableIfExists("maintenance_timeslot")
|
||||
.table("maintenance", function (table) {
|
||||
table.text("cron");
|
||||
table.string("timezone", 255);
|
||||
table.integer("duration");
|
||||
});
|
||||
|
||||
// 2023-06-30-1413-add-parent-monitor.js.
|
||||
/*
|
||||
@ -493,7 +444,10 @@ async function createTables() {
|
||||
ADD parent INTEGER REFERENCES [monitor] ([id]) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
*/
|
||||
await knex.schema.table("monitor", function (table) {
|
||||
table.integer("parent").unsigned().references("id").inTable("monitor").onDelete("SET NULL").onUpdate("CASCADE");
|
||||
table.integer("parent").unsigned()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("SET NULL")
|
||||
.onUpdate("CASCADE");
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@ -3,41 +3,39 @@ exports.up = function (knex) {
|
||||
.createTable("stat_minutely", function (table) {
|
||||
table.increments("id");
|
||||
table.comment("This table contains the minutely aggregate statistics for each monitor");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.integer("timestamp").notNullable().comment("Unix timestamp rounded down to the nearest minute");
|
||||
table.integer("timestamp")
|
||||
.notNullable()
|
||||
.comment("Unix timestamp rounded down to the nearest minute");
|
||||
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||
table.smallint("up").notNullable();
|
||||
table.smallint("down").notNullable();
|
||||
|
||||
table.unique(["monitor_id", "timestamp"]);
|
||||
table.unique([ "monitor_id", "timestamp" ]);
|
||||
})
|
||||
.createTable("stat_daily", function (table) {
|
||||
table.increments("id");
|
||||
table.comment("This table contains the daily aggregate statistics for each monitor");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.integer("timestamp").notNullable().comment("Unix timestamp rounded down to the nearest day");
|
||||
table.integer("timestamp")
|
||||
.notNullable()
|
||||
.comment("Unix timestamp rounded down to the nearest day");
|
||||
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||
table.smallint("up").notNullable();
|
||||
table.smallint("down").notNullable();
|
||||
|
||||
table.unique(["monitor_id", "timestamp"]);
|
||||
table.unique([ "monitor_id", "timestamp" ]);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTable("stat_minutely").dropTable("stat_daily");
|
||||
return knex.schema
|
||||
.dropTable("stat_minutely")
|
||||
.dropTable("stat_daily");
|
||||
};
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
exports.up = function (knex) {
|
||||
// Add new column heartbeat.end_time
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.datetime("end_time").nullable().defaultTo(null);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("heartbeat", function (table) {
|
||||
table.datetime("end_time").nullable().defaultTo(null);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
// Rename heartbeat.start_time to heartbeat.time
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.dropColumn("end_time");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("heartbeat", function (table) {
|
||||
table.dropColumn("end_time");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
exports.up = function (knex) {
|
||||
// Add new column heartbeat.retries
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.integer("retries").notNullable().defaultTo(0);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("heartbeat", function (table) {
|
||||
table.integer("retries").notNullable().defaultTo(0);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.dropColumn("retries");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("heartbeat", function (table) {
|
||||
table.dropColumn("retries");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
exports.up = function (knex) {
|
||||
// Add new column monitor.mqtt_check_type
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("mqtt_check_type", 255).notNullable().defaultTo("keyword");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("mqtt_check_type", 255).notNullable().defaultTo("keyword");
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
// Drop column monitor.mqtt_check_type
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("mqtt_check_type");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.dropColumn("mqtt_check_type");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
exports.up = function (knex) {
|
||||
// update monitor.push_token to 32 length
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("push_token", 32).alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("push_token", 32).alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("push_token", 20).alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("push_token", 20).alter();
|
||||
});
|
||||
};
|
||||
|
||||
@ -5,14 +5,9 @@ exports.up = function (knex) {
|
||||
table.string("name", 255).notNullable();
|
||||
table.string("url", 255).notNullable();
|
||||
table.integer("user_id").unsigned();
|
||||
})
|
||||
.alterTable("monitor", function (table) {
|
||||
}).alterTable("monitor", function (table) {
|
||||
// Add new column monitor.remote_browser
|
||||
table
|
||||
.integer("remote_browser")
|
||||
.nullable()
|
||||
.defaultTo(null)
|
||||
.unsigned()
|
||||
table.integer("remote_browser").nullable().defaultTo(null).unsigned()
|
||||
.index()
|
||||
.references("id")
|
||||
.inTable("remote_browser");
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("status_page", function (table) {
|
||||
table.integer("auto_refresh_interval").defaultTo(300).unsigned();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("status_page", function (table) {
|
||||
table.integer("auto_refresh_interval").defaultTo(300).unsigned();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,29 +1,14 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("stat_daily", function (table) {
|
||||
table
|
||||
.float("ping_min")
|
||||
.notNullable()
|
||||
.defaultTo(0)
|
||||
.comment("Minimum ping during this period in milliseconds");
|
||||
table
|
||||
.float("ping_max")
|
||||
.notNullable()
|
||||
.defaultTo(0)
|
||||
.comment("Maximum ping during this period in milliseconds");
|
||||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||
})
|
||||
.alterTable("stat_minutely", function (table) {
|
||||
table
|
||||
.float("ping_min")
|
||||
.notNullable()
|
||||
.defaultTo(0)
|
||||
.comment("Minimum ping during this period in milliseconds");
|
||||
table
|
||||
.float("ping_max")
|
||||
.notNullable()
|
||||
.defaultTo(0)
|
||||
.comment("Maximum ping during this period in milliseconds");
|
||||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.createTable("stat_hourly", function (table) {
|
||||
table.increments("id");
|
||||
table.comment("This table contains the hourly aggregate statistics for each monitor");
|
||||
table
|
||||
.integer("monitor_id")
|
||||
.unsigned()
|
||||
.notNullable()
|
||||
.references("id")
|
||||
.inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.integer("timestamp").notNullable().comment("Unix timestamp rounded down to the nearest hour");
|
||||
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||
table.smallint("up").notNullable();
|
||||
table.smallint("down").notNullable();
|
||||
return knex.schema
|
||||
.createTable("stat_hourly", function (table) {
|
||||
table.increments("id");
|
||||
table.comment("This table contains the hourly aggregate statistics for each monitor");
|
||||
table.integer("monitor_id").unsigned().notNullable()
|
||||
.references("id").inTable("monitor")
|
||||
.onDelete("CASCADE")
|
||||
.onUpdate("CASCADE");
|
||||
table.integer("timestamp")
|
||||
.notNullable()
|
||||
.comment("Unix timestamp rounded down to the nearest hour");
|
||||
table.float("ping").notNullable().comment("Average ping in milliseconds");
|
||||
table.float("ping_min").notNullable().defaultTo(0).comment("Minimum ping during this period in milliseconds");
|
||||
table.float("ping_max").notNullable().defaultTo(0).comment("Maximum ping during this period in milliseconds");
|
||||
table.smallint("up").notNullable();
|
||||
table.smallint("down").notNullable();
|
||||
|
||||
table.unique(["monitor_id", "timestamp"]);
|
||||
});
|
||||
table.unique([ "monitor_id", "timestamp" ]);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTable("stat_hourly");
|
||||
return knex.schema
|
||||
.dropTable("stat_hourly");
|
||||
};
|
||||
|
||||
@ -9,6 +9,7 @@ exports.up = function (knex) {
|
||||
.alterTable("stat_hourly", function (table) {
|
||||
table.text("extras").defaultTo(null).comment("Extra statistics during this time period");
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("snmp_oid").defaultTo(null);
|
||||
table.enum("snmp_version", ["1", "2c", "3"]).defaultTo("2c");
|
||||
table.string("json_path_operator").defaultTo(null);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("snmp_oid").defaultTo(null);
|
||||
table.enum("snmp_version", [ "1", "2c", "3" ]).defaultTo("2c");
|
||||
table.string("json_path_operator").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.boolean("cache_bust").notNullable().defaultTo(false);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.boolean("cache_bust").notNullable().defaultTo(false);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("cache_bust");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.dropColumn("cache_bust");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.text("conditions").notNullable().defaultTo("[]");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.text("conditions").notNullable().defaultTo("[]");
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -4,6 +4,7 @@ exports.up = function (knex) {
|
||||
table.string("rabbitmq_username");
|
||||
table.string("rabbitmq_password");
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
@ -12,4 +13,5 @@ exports.down = function (knex) {
|
||||
table.dropColumn("rabbitmq_username");
|
||||
table.dropColumn("rabbitmq_password");
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
// Update info_json column to LONGTEXT mainly for MariaDB
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor_tls_info", function (table) {
|
||||
table.text("info_json", "longtext").alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor_tls_info", function (table) {
|
||||
table.text("info_json", "longtext").alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("smtp_security").defaultTo(null);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("smtp_security").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
// Add websocket ignore headers and websocket subprotocol
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.boolean("ws_ignore_sec_websocket_accept_header").notNullable().defaultTo(false);
|
||||
table.string("ws_subprotocol", 255).notNullable().defaultTo("");
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("ws_ignore_sec_websocket_accept_header");
|
||||
table.dropColumn("ws_subprotocol");
|
||||
});
|
||||
};
|
||||
@ -1,23 +0,0 @@
|
||||
// Udpate status_page table to generalize analytics fields
|
||||
exports.up = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("status_page", function (table) {
|
||||
table.renameColumn("google_analytics_tag_id", "analytics_id");
|
||||
table.string("analytics_script_url");
|
||||
table.enu("analytics_type", ["google", "umami", "plausible", "matomo"]).defaultTo(null);
|
||||
})
|
||||
.then(() => {
|
||||
// After a succesful migration, add google as default for previous pages
|
||||
knex("status_page").whereNotNull("analytics_id").update({
|
||||
analytics_type: "google",
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("status_page", function (table) {
|
||||
table.renameColumn("analytics_id", "google_analytics_tag_id");
|
||||
table.dropColumn("analytics_script_url");
|
||||
table.dropColumn("analytics_type");
|
||||
});
|
||||
};
|
||||
@ -5,17 +5,20 @@ 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();
|
||||
});
|
||||
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");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.dropColumn("ping_count");
|
||||
table.dropColumn("ping_numeric");
|
||||
table.dropColumn("ping_per_request_timeout");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
// Fix #5721: Change proxy port column type to integer to support larger port numbers
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("proxy", function (table) {
|
||||
table.integer("port").alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("proxy", function (table) {
|
||||
table.integer("port").alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
// 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");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor_group", function (table) {
|
||||
table.text("custom_url", "text");
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.boolean("ip_family").defaultTo(null);
|
||||
});
|
||||
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");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.dropColumn("ip_family");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("manual_status").defaultTo(null);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("manual_status").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,27 +1,28 @@
|
||||
// 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");
|
||||
});
|
||||
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");
|
||||
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 [ 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 knex("maintenance")
|
||||
.where({ id })
|
||||
.update({ cron });
|
||||
});
|
||||
await Promise.all(maintenanceUpdates);
|
||||
};
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
// Fix: Change manual_status column type to smallint
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.smallint("manual_status").alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.smallint("manual_status").alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("oauth_audience").nullable().defaultTo(null);
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.string("oauth_audience").nullable().defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
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();
|
||||
});
|
||||
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");
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.dropColumn("mqtt_websocket_path");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.boolean("domain_expiry_notification").defaultTo(1);
|
||||
})
|
||||
.createTable("domain_expiry", (table) => {
|
||||
table.increments("id");
|
||||
table.datetime("last_check");
|
||||
// Use VARCHAR(255) for MySQL/MariaDB compatibility with unique constraint
|
||||
// Maximum domain name length is 253 characters (255 octets on the wire)
|
||||
table.string("domain", 255).unique().notNullable();
|
||||
table.datetime("expiry");
|
||||
table.integer("last_expiry_notification_sent").defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
table.boolean("domain_expiry_notification").alter();
|
||||
})
|
||||
.dropTable("domain_expiry");
|
||||
};
|
||||
@ -1,14 +1,16 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
// Fix ip_family, change to varchar instead of boolean
|
||||
// possible values are "ipv4" and "ipv6"
|
||||
table.string("ip_family", 4).defaultTo(null).alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
// Fix ip_family, change to varchar instead of boolean
|
||||
// possible values are "ipv4" and "ipv6"
|
||||
table.string("ip_family", 4).defaultTo(null).alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
// Rollback to boolean
|
||||
table.boolean("ip_family").defaultTo(null).alter();
|
||||
});
|
||||
return knex.schema
|
||||
.alterTable("monitor", function (table) {
|
||||
// Rollback to boolean
|
||||
table.boolean("ip_family").defaultTo(null).alter();
|
||||
});
|
||||
};
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.boolean("save_response").notNullable().defaultTo(false);
|
||||
table.boolean("save_error_response").notNullable().defaultTo(true);
|
||||
table.integer("response_max_length").notNullable().defaultTo(1024); // Default 1KB
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("save_response");
|
||||
table.dropColumn("save_error_response");
|
||||
table.dropColumn("response_max_length");
|
||||
});
|
||||
};
|
||||
@ -1,11 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.text("response").nullable().defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.dropColumn("response");
|
||||
});
|
||||
};
|
||||
@ -1,13 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
// Add new column status_page.show_only_last_heartbeat
|
||||
return knex.schema.alterTable("status_page", function (table) {
|
||||
table.boolean("show_only_last_heartbeat").notNullable().defaultTo(false);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
// Drop column status_page.show_only_last_heartbeat
|
||||
return knex.schema.alterTable("status_page", function (table) {
|
||||
table.dropColumn("show_only_last_heartbeat");
|
||||
});
|
||||
};
|
||||
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* @param {import("knex").Knex} knex The Knex.js instance for database interaction.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
exports.up = async (knex) => {
|
||||
await knex.schema.alterTable("monitor", (table) => {
|
||||
table.string("system_service_name");
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {import("knex").Knex} knex The Knex.js instance for database interaction.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
exports.down = async (knex) => {
|
||||
await knex.schema.alterTable("monitor", (table) => {
|
||||
table.dropColumn("system_service_name");
|
||||
});
|
||||
};
|
||||
@ -1,37 +0,0 @@
|
||||
exports.up = async function (knex) {
|
||||
const isSQLite = knex.client.dialect === "sqlite3";
|
||||
|
||||
if (isSQLite) {
|
||||
// For SQLite: Use partial indexes with WHERE important = 1
|
||||
// Drop existing indexes using IF EXISTS
|
||||
await knex.raw("DROP INDEX IF EXISTS monitor_important_time_index");
|
||||
await knex.raw("DROP INDEX IF EXISTS heartbeat_important_index");
|
||||
|
||||
// Create partial indexes with predicate
|
||||
await knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.index(["monitor_id", "time"], "monitor_important_time_index", {
|
||||
predicate: knex.whereRaw("important = 1"),
|
||||
});
|
||||
table.index(["important"], "heartbeat_important_index", {
|
||||
predicate: knex.whereRaw("important = 1"),
|
||||
});
|
||||
});
|
||||
}
|
||||
// For MariaDB/MySQL: No changes (partial indexes not supported)
|
||||
};
|
||||
|
||||
exports.down = async function (knex) {
|
||||
const isSQLite = knex.client.dialect === "sqlite3";
|
||||
|
||||
if (isSQLite) {
|
||||
// Restore original indexes
|
||||
await knex.raw("DROP INDEX IF EXISTS monitor_important_time_index");
|
||||
await knex.raw("DROP INDEX IF EXISTS heartbeat_important_index");
|
||||
|
||||
await knex.schema.alterTable("heartbeat", function (table) {
|
||||
table.index(["monitor_id", "important", "time"], "monitor_important_time_index");
|
||||
table.index(["important"]);
|
||||
});
|
||||
}
|
||||
// For MariaDB/MySQL: No changes
|
||||
};
|
||||
@ -1,30 +0,0 @@
|
||||
exports.up = async function (knex) {
|
||||
const notifications = await knex("notification").select("id", "config");
|
||||
const lineNotifyIDs = [];
|
||||
|
||||
for (const { id, config } of notifications) {
|
||||
try {
|
||||
const parsedConfig = JSON.parse(config || "{}");
|
||||
const type = typeof parsedConfig.type === "string" ? parsedConfig.type.toLowerCase() : "";
|
||||
|
||||
if (type === "linenotify" || type === "line-notify") {
|
||||
lineNotifyIDs.push(id);
|
||||
}
|
||||
} catch (error) {
|
||||
// Ignore invalid JSON blobs here; they are handled elsewhere in the app.
|
||||
}
|
||||
}
|
||||
|
||||
if (lineNotifyIDs.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
await knex.transaction(async (trx) => {
|
||||
await trx("monitor_notification").whereIn("notification_id", lineNotifyIDs).del();
|
||||
await trx("notification").whereIn("id", lineNotifyIDs).del();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async function () {
|
||||
// Removal of LINE Notify configs is not reversible.
|
||||
};
|
||||
@ -1,11 +0,0 @@
|
||||
exports.up = async function (knex) {
|
||||
await knex.schema.alterTable("monitor", (table) => {
|
||||
table.string("snmp_v3_username", 255);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async function (knex) {
|
||||
await knex.schema.alterTable("monitor", (table) => {
|
||||
table.dropColumn("snmp_v3_username");
|
||||
});
|
||||
};
|
||||
@ -1,12 +0,0 @@
|
||||
// Change dns_last_result column from VARCHAR(255) to TEXT to handle longer DNS TXT records
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.text("dns_last_result").alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("dns_last_result", 255).alter();
|
||||
});
|
||||
};
|
||||
@ -1,186 +0,0 @@
|
||||
// Migration to update monitor.game from GameDig v4 to v5 game IDs
|
||||
// Reference: https://github.com/gamedig/node-gamedig/blob/master/MIGRATE_IDS.md
|
||||
|
||||
// Lookup table mapping v4 game IDs to v5 game IDs
|
||||
const gameDig4to5IdMap = {
|
||||
americasarmypg: "aapg",
|
||||
"7d2d": "sdtd",
|
||||
as: "actionsource",
|
||||
ageofchivalry: "aoc",
|
||||
arkse: "ase",
|
||||
arcasimracing: "asr08",
|
||||
arma: "aaa",
|
||||
arma2oa: "a2oa",
|
||||
armacwa: "acwa",
|
||||
armar: "armaresistance",
|
||||
armare: "armareforger",
|
||||
armagetron: "armagetronadvanced",
|
||||
bat1944: "battalion1944",
|
||||
bf1942: "battlefield1942",
|
||||
bfv: "battlefieldvietnam",
|
||||
bf2: "battlefield2",
|
||||
bf2142: "battlefield2142",
|
||||
bfbc2: "bbc2",
|
||||
bf3: "battlefield3",
|
||||
bf4: "battlefield4",
|
||||
bfh: "battlefieldhardline",
|
||||
bd: "basedefense",
|
||||
bs: "bladesymphony",
|
||||
buildandshoot: "bas",
|
||||
cod4: "cod4mw",
|
||||
callofjuarez: "coj",
|
||||
chivalry: "cmw",
|
||||
commandos3: "c3db",
|
||||
cacrenegade: "cacr",
|
||||
contactjack: "contractjack",
|
||||
cs15: "counterstrike15",
|
||||
cs16: "counterstrike16",
|
||||
cs2: "counterstrike2",
|
||||
crossracing: "crce",
|
||||
darkesthour: "dhe4445",
|
||||
daysofwar: "dow",
|
||||
deadlydozenpt: "ddpt",
|
||||
dh2005: "deerhunter2005",
|
||||
dinodday: "ddd",
|
||||
dirttrackracing2: "dtr2",
|
||||
dmc: "deathmatchclassic",
|
||||
dnl: "dal",
|
||||
drakan: "dootf",
|
||||
dys: "dystopia",
|
||||
em: "empiresmod",
|
||||
empyrion: "egs",
|
||||
f12002: "formulaone2002",
|
||||
flashpointresistance: "ofr",
|
||||
fivem: "gta5f",
|
||||
forrest: "theforrest",
|
||||
graw: "tcgraw",
|
||||
graw2: "tcgraw2",
|
||||
giantscitizenkabuto: "gck",
|
||||
ges: "goldeneyesource",
|
||||
gore: "gus",
|
||||
hldm: "hld",
|
||||
hldms: "hlds",
|
||||
hlopfor: "hlof",
|
||||
hl2dm: "hl2d",
|
||||
hidden: "thehidden",
|
||||
had2: "hiddendangerous2",
|
||||
igi2: "i2cs",
|
||||
il2: "il2sturmovik",
|
||||
insurgencymic: "imic",
|
||||
isle: "theisle",
|
||||
jamesbondnightfire: "jb007n",
|
||||
jc2mp: "jc2m",
|
||||
jc3mp: "jc3m",
|
||||
kingpin: "kloc",
|
||||
kisspc: "kpctnc",
|
||||
kspdmp: "kspd",
|
||||
kzmod: "kreedzclimbing",
|
||||
left4dead: "l4d",
|
||||
left4dead2: "l4d2",
|
||||
m2mp: "m2m",
|
||||
mohsh: "mohaas",
|
||||
mohbt: "mohaab",
|
||||
mohab: "moha",
|
||||
moh2010: "moh",
|
||||
mohwf: "mohw",
|
||||
minecraftbe: "mbe",
|
||||
mtavc: "gtavcmta",
|
||||
mtasa: "gtasamta",
|
||||
ns: "naturalselection",
|
||||
ns2: "naturalselection2",
|
||||
nwn: "neverwinternights",
|
||||
nwn2: "neverwinternights2",
|
||||
nolf: "tonolf",
|
||||
nolf2: "nolf2asihw",
|
||||
pvkii: "pvak2",
|
||||
ps: "postscriptum",
|
||||
primalcarnage: "pce",
|
||||
pc: "projectcars",
|
||||
pc2: "projectcars2",
|
||||
prbf2: "prb2",
|
||||
przomboid: "projectzomboid",
|
||||
quake1: "quake",
|
||||
quake3: "q3a",
|
||||
ragdollkungfu: "rdkf",
|
||||
r6: "rainbowsix",
|
||||
r6roguespear: "rs2rs",
|
||||
r6ravenshield: "rs3rs",
|
||||
redorchestraost: "roo4145",
|
||||
redm: "rdr2r",
|
||||
riseofnations: "ron",
|
||||
rs2: "rs2v",
|
||||
samp: "gtasam",
|
||||
saomp: "gtasao",
|
||||
savage2: "s2ats",
|
||||
ss: "serioussam",
|
||||
ss2: "serioussam2",
|
||||
ship: "theship",
|
||||
sinep: "sinepisodes",
|
||||
sonsoftheforest: "sotf",
|
||||
swbf: "swb",
|
||||
swbf2: "swb2",
|
||||
swjk: "swjkja",
|
||||
swjk2: "swjk2jo",
|
||||
takeonhelicopters: "toh",
|
||||
tf2: "teamfortress2",
|
||||
terraria: "terrariatshock",
|
||||
tribes1: "t1s",
|
||||
ut: "unrealtournament",
|
||||
ut2003: "unrealtournament2003",
|
||||
ut2004: "unrealtournament2004",
|
||||
ut3: "unrealtournament3",
|
||||
v8supercar: "v8sc",
|
||||
vcmp: "vcm",
|
||||
vs: "vampireslayer",
|
||||
wheeloftime: "wot",
|
||||
wolfenstein2009: "wolfenstein",
|
||||
wolfensteinet: "wet",
|
||||
wurm: "wurmunlimited",
|
||||
};
|
||||
|
||||
/**
|
||||
* Migrate game IDs from v4 to v5
|
||||
* @param {import("knex").Knex} knex - Knex instance
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
exports.up = async function (knex) {
|
||||
await knex.transaction(async (trx) => {
|
||||
// Get all monitors that use the gamedig type
|
||||
const monitors = await trx("monitor").select("id", "game").where("type", "gamedig").whereNotNull("game");
|
||||
|
||||
// Update each monitor with the new game ID if it needs migration
|
||||
for (const monitor of monitors) {
|
||||
const oldGameId = monitor.game;
|
||||
const newGameId = gameDig4to5IdMap[oldGameId];
|
||||
|
||||
if (newGameId) {
|
||||
await trx("monitor").where("id", monitor.id).update({ game: newGameId });
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Revert game IDs from v5 back to v4
|
||||
* @param {import("knex").Knex} knex - Knex instance
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
exports.down = async function (knex) {
|
||||
// Create reverse mapping from the same LUT
|
||||
const gameDig5to4IdMap = Object.fromEntries(Object.entries(gameDig4to5IdMap).map(([v4, v5]) => [v5, v4]));
|
||||
|
||||
await knex.transaction(async (trx) => {
|
||||
// Get all monitors that use the gamedig type
|
||||
const monitors = await trx("monitor").select("id", "game").where("type", "gamedig").whereNotNull("game");
|
||||
|
||||
// Revert each monitor back to the old game ID if it was migrated
|
||||
for (const monitor of monitors) {
|
||||
const newGameId = monitor.game;
|
||||
const oldGameId = gameDig5to4IdMap[newGameId];
|
||||
|
||||
if (oldGameId) {
|
||||
await trx("monitor").where("id", monitor.id).update({ game: oldGameId });
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -1,11 +0,0 @@
|
||||
exports.up = async function (knex) {
|
||||
await knex.schema.alterTable("status_page", function (table) {
|
||||
table.string("rss_title", 255);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("status_page", function (table) {
|
||||
table.dropColumn("rss_title");
|
||||
});
|
||||
};
|
||||
@ -1,11 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.string("expected_tls_alert", 50).defaultTo(null);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("expected_tls_alert");
|
||||
});
|
||||
};
|
||||
@ -1,14 +0,0 @@
|
||||
// Ensure domain column is VARCHAR(255) across all database types.
|
||||
// This migration ensures MySQL, SQLite, and MariaDB have consistent column type,
|
||||
// even if a user installed 2.1.0-beta.0 or 2.1.0-beta.1 which had TEXT type for this column.
|
||||
// Maximum domain name length is 253 characters (255 octets on the wire).
|
||||
// Note: The unique constraint is already present from the original migration.
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("domain_expiry", function (table) {
|
||||
table.string("domain", 255).notNullable().alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
// No rollback needed - keeping VARCHAR(255) is the correct state
|
||||
};
|
||||
@ -1,43 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("heartbeat", function (table) {
|
||||
table.bigInteger("ping").alter();
|
||||
})
|
||||
.alterTable("stat_minutely", function (table) {
|
||||
table.float("ping", 20, 2).notNullable().alter();
|
||||
table.float("ping_min", 20, 2).notNullable().defaultTo(0).alter();
|
||||
table.float("ping_max", 20, 2).notNullable().defaultTo(0).alter();
|
||||
})
|
||||
.alterTable("stat_daily", function (table) {
|
||||
table.float("ping", 20, 2).notNullable().alter();
|
||||
table.float("ping_min", 20, 2).notNullable().defaultTo(0).alter();
|
||||
table.float("ping_max", 20, 2).notNullable().defaultTo(0).alter();
|
||||
})
|
||||
.alterTable("stat_hourly", function (table) {
|
||||
table.float("ping", 20, 2).notNullable().alter();
|
||||
table.float("ping_min", 20, 2).notNullable().defaultTo(0).alter();
|
||||
table.float("ping_max", 20, 2).notNullable().defaultTo(0).alter();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema
|
||||
.alterTable("heartbeat", function (table) {
|
||||
table.integer("ping").alter();
|
||||
})
|
||||
.alterTable("stat_minutely", function (table) {
|
||||
table.float("ping").notNullable().alter();
|
||||
table.float("ping_min").notNullable().defaultTo(0).alter();
|
||||
table.float("ping_max").notNullable().defaultTo(0).alter();
|
||||
})
|
||||
.alterTable("stat_daily", function (table) {
|
||||
table.float("ping").notNullable().alter();
|
||||
table.float("ping_min").notNullable().defaultTo(0).alter();
|
||||
table.float("ping_max").notNullable().defaultTo(0).alter();
|
||||
})
|
||||
.alterTable("stat_hourly", function (table) {
|
||||
table.float("ping").notNullable().alter();
|
||||
table.float("ping_min").notNullable().defaultTo(0).alter();
|
||||
table.float("ping_max").notNullable().defaultTo(0).alter();
|
||||
});
|
||||
};
|
||||
@ -1,12 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
// Add new column to table monitor for json-query retry behavior
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.boolean("retry_only_on_status_code_failure").defaultTo(false).notNullable();
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("retry_only_on_status_code_failure");
|
||||
});
|
||||
};
|
||||
@ -1,11 +0,0 @@
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.integer("screenshot_delay").notNullable().unsigned().defaultTo(0);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.alterTable("monitor", function (table) {
|
||||
table.dropColumn("screenshot_delay");
|
||||
});
|
||||
};
|
||||
@ -11,9 +11,13 @@ https://knexjs.org/guide/migrations.html#knexfile-in-other-languages
|
||||
## Template
|
||||
|
||||
```js
|
||||
exports.up = function (knex) {};
|
||||
exports.up = function(knex) {
|
||||
|
||||
exports.down = function (knex) {};
|
||||
};
|
||||
|
||||
exports.down = function(knex) {
|
||||
|
||||
};
|
||||
|
||||
// exports.config = { transaction: false };
|
||||
```
|
||||
@ -23,28 +27,29 @@ exports.down = function (knex) {};
|
||||
Filename: 2023-06-30-1348-create-user-and-product.js
|
||||
|
||||
```js
|
||||
exports.up = function (knex) {
|
||||
exports.up = function(knex) {
|
||||
return knex.schema
|
||||
.createTable("user", function (table) {
|
||||
table.increments("id");
|
||||
table.string("first_name", 255).notNullable();
|
||||
table.string("last_name", 255).notNullable();
|
||||
.createTable('user', function (table) {
|
||||
table.increments('id');
|
||||
table.string('first_name', 255).notNullable();
|
||||
table.string('last_name', 255).notNullable();
|
||||
})
|
||||
.createTable("product", function (table) {
|
||||
table.increments("id");
|
||||
table.decimal("price").notNullable();
|
||||
table.string("name", 1000).notNullable();
|
||||
})
|
||||
.then(() => {
|
||||
knex("products").insert([
|
||||
{ price: 10, name: "Apple" },
|
||||
{ price: 20, name: "Orange" },
|
||||
]);
|
||||
.createTable('product', function (table) {
|
||||
table.increments('id');
|
||||
table.decimal('price').notNullable();
|
||||
table.string('name', 1000).notNullable();
|
||||
}).then(() => {
|
||||
knex("products").insert([
|
||||
{ price: 10, name: "Apple" },
|
||||
{ price: 20, name: "Orange" },
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function (knex) {
|
||||
return knex.schema.dropTable("product").dropTable("user");
|
||||
exports.down = function(knex) {
|
||||
return knex.schema
|
||||
.dropTable("product")
|
||||
.dropTable("user");
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
version: "3.8"
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
uptime-kuma:
|
||||
@ -9,5 +9,6 @@ services:
|
||||
- ../server:/app/server
|
||||
- ../db:/app/db
|
||||
ports:
|
||||
- "3001:3001" # <Host Port>:<Container Port>
|
||||
- "3001:3001" # <Host Port>:<Container Port>
|
||||
- "3307:3306"
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "uptime-kuma",
|
||||
script: "./server/server.js",
|
||||
},
|
||||
],
|
||||
apps: [{
|
||||
name: "uptime-kuma",
|
||||
script: "./server/server.js",
|
||||
}]
|
||||
};
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
import { createRequire } from "module";
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
const pkg = require("../../package.json");
|
||||
const fs = require("fs");
|
||||
const childProcess = require("child_process");
|
||||
@ -19,26 +16,16 @@ if (!version || !version.includes("-beta.")) {
|
||||
|
||||
const exists = tagExists(version);
|
||||
|
||||
if (!exists) {
|
||||
if (! exists) {
|
||||
// Process package.json
|
||||
pkg.version = version;
|
||||
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 4) + "\n");
|
||||
|
||||
// Also update package-lock.json
|
||||
const npm = /^win/.test(process.platform) ? "npm.cmd" : "npm";
|
||||
const resultVersion = childProcess.spawnSync(npm, ["--no-git-tag-version", "version", version], { shell: true });
|
||||
if (resultVersion.error) {
|
||||
console.error(resultVersion.error);
|
||||
console.error("error npm version!");
|
||||
process.exit(1);
|
||||
}
|
||||
const resultInstall = childProcess.spawnSync(npm, ["install"], { shell: true });
|
||||
if (resultInstall.error) {
|
||||
console.error(resultInstall.error);
|
||||
console.error("error update package-lock!");
|
||||
process.exit(1);
|
||||
}
|
||||
childProcess.spawnSync(npm, [ "install" ]);
|
||||
commit(version);
|
||||
|
||||
} else {
|
||||
console.log("version tag exists, please delete the tag or use another tag");
|
||||
process.exit(1);
|
||||
@ -53,7 +40,7 @@ if (!exists) {
|
||||
function commit(version) {
|
||||
let msg = "Update to " + version;
|
||||
|
||||
let res = childProcess.spawnSync("git", ["commit", "-m", msg, "-a"]);
|
||||
let res = childProcess.spawnSync("git", [ "commit", "-m", msg, "-a" ]);
|
||||
let stdout = res.stdout.toString().trim();
|
||||
console.log(stdout);
|
||||
|
||||
@ -61,13 +48,8 @@ function commit(version) {
|
||||
throw new Error("commit error");
|
||||
}
|
||||
|
||||
// Get the current branch name
|
||||
res = childProcess.spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
||||
let branchName = res.stdout.toString().trim();
|
||||
console.log("Current branch:", branchName);
|
||||
|
||||
// Git push the branch
|
||||
childProcess.spawnSync("git", ["push", "origin", branchName, "--force"], { stdio: "inherit" });
|
||||
res = childProcess.spawnSync("git", [ "push", "origin", "master" ]);
|
||||
console.log(res.stdout.toString().trim());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,11 +59,11 @@ function commit(version) {
|
||||
* @throws Version is not valid
|
||||
*/
|
||||
function tagExists(version) {
|
||||
if (!version) {
|
||||
if (! version) {
|
||||
throw new Error("invalid version");
|
||||
}
|
||||
|
||||
let res = childProcess.spawnSync("git", ["tag", "-l", version]);
|
||||
let res = childProcess.spawnSync("git", [ "tag", "-l", version ]);
|
||||
|
||||
return res.stdout.toString().trim() === version;
|
||||
}
|
||||
@ -14,9 +14,7 @@ if (platform === "linux/arm/v7") {
|
||||
console.log("Already built in the host, skip.");
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log(
|
||||
"prebuilt not found, it will be slow! You should execute `npm run build-healthcheck-armv7` before build."
|
||||
);
|
||||
console.log("prebuilt not found, it will be slow! You should execute `npm run build-healthcheck-armv7` before build.");
|
||||
}
|
||||
} else {
|
||||
if (fs.existsSync("./extra/healthcheck-armv7")) {
|
||||
@ -26,3 +24,4 @@ if (platform === "linux/arm/v7") {
|
||||
|
||||
const output = childProcess.execSync("go build -x -o ./extra/healthcheck ./extra/healthcheck.go").toString("utf8");
|
||||
console.log(output);
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ const github = require("@actions/github");
|
||||
await client.issues.listLabelsOnIssue({
|
||||
owner: issue.owner,
|
||||
repo: issue.repo,
|
||||
issue_number: issue.number,
|
||||
issue_number: issue.number
|
||||
})
|
||||
).data.map(({ name }) => name);
|
||||
|
||||
@ -29,7 +29,7 @@ const github = require("@actions/github");
|
||||
owner: issue.owner,
|
||||
repo: issue.repo,
|
||||
issue_number: issue.number,
|
||||
labels: ["invalid-format"],
|
||||
labels: [ "invalid-format" ]
|
||||
});
|
||||
|
||||
// Add the issue closing comment
|
||||
@ -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 necessary for a good discussions.`
|
||||
});
|
||||
|
||||
// Close the issue
|
||||
@ -45,7 +45,7 @@ const github = require("@actions/github");
|
||||
owner: issue.owner,
|
||||
repo: issue.repo,
|
||||
issue_number: issue.number,
|
||||
state: "closed",
|
||||
state: "closed"
|
||||
});
|
||||
} else {
|
||||
console.log("Pass!");
|
||||
@ -53,4 +53,5 @@ const github = require("@actions/github");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
require("dotenv").config();
|
||||
const { NodeSSH } = require("node-ssh");
|
||||
const readline = require("readline");
|
||||
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
||||
const rl = readline.createInterface({ input: process.stdin,
|
||||
output: process.stdout });
|
||||
const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
|
||||
|
||||
(async () => {
|
||||
@ -12,7 +13,7 @@ const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
|
||||
host: process.env.UPTIME_KUMA_DEMO_HOST,
|
||||
port: process.env.UPTIME_KUMA_DEMO_PORT,
|
||||
username: process.env.UPTIME_KUMA_DEMO_USERNAME,
|
||||
privateKeyPath: process.env.UPTIME_KUMA_DEMO_PRIVATE_KEY_PATH,
|
||||
privateKeyPath: process.env.UPTIME_KUMA_DEMO_PRIVATE_KEY_PATH
|
||||
});
|
||||
|
||||
let cwd = process.env.UPTIME_KUMA_DEMO_CWD;
|
||||
@ -47,6 +48,7 @@ const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
|
||||
cwd,
|
||||
});
|
||||
console.log(result.stdout + result.stderr);*/
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
} finally {
|
||||
|
||||
@ -26,6 +26,7 @@ function download(url) {
|
||||
console.log("Extracting dist...");
|
||||
|
||||
if (fs.existsSync("./dist")) {
|
||||
|
||||
if (fs.existsSync("./dist-backup")) {
|
||||
fs.rmSync("./dist-backup", {
|
||||
recursive: true,
|
||||
|
||||
@ -4,13 +4,22 @@
|
||||
|
||||
import * as childProcess from "child_process";
|
||||
|
||||
const ignoreList = ["louislam", "CommanderStorm", "UptimeKumaBot", "weblate", "Copilot", "@autofix-ci[bot]"];
|
||||
const ignoreList = [
|
||||
"louislam",
|
||||
"CommanderStorm",
|
||||
"UptimeKumaBot",
|
||||
"weblate",
|
||||
"Copilot"
|
||||
];
|
||||
|
||||
const mergeList = ["Translations Update from Weblate", "Update dependencies"];
|
||||
const mergeList = [
|
||||
"Translations Update from Weblate",
|
||||
"Update dependencies",
|
||||
];
|
||||
|
||||
const template = `
|
||||
|
||||
LLM Task: Please help to put above PRs into the following sections based on their content. If a PR fits multiple sections, choose the most relevant one. If a PR doesn't fit any section, place it in "Others". If there are grammatical errors in the PR titles, please correct them. Don't change the PR numbers and authors, and keep the format. Output as markdown file format.
|
||||
LLM Task: Please help to put above PRs into the following sections based on their content. If a PR fits multiple sections, choose the most relevant one. If a PR doesn't fit any section, place it in "Others". If there are grammatical errors in the PR titles, please correct them. Don't change the PR numbers and authors, and keep the format. Output as markdown.
|
||||
|
||||
Changelog:
|
||||
|
||||
@ -28,9 +37,7 @@ Changelog:
|
||||
- Other small changes, code refactoring and comment/doc updates in this repo:
|
||||
`;
|
||||
|
||||
if (import.meta.main) {
|
||||
await main();
|
||||
}
|
||||
await main();
|
||||
|
||||
/**
|
||||
* Main Function
|
||||
@ -45,63 +52,60 @@ async function main() {
|
||||
}
|
||||
|
||||
console.log(`Generating changelog since version ${previousVersion}...`);
|
||||
console.log(await generateChangelog(previousVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Changelog
|
||||
* @param {string} previousVersion Previous Version Tag
|
||||
* @returns {Promise<string>} Changelog Content
|
||||
*/
|
||||
export async function generateChangelog(previousVersion) {
|
||||
const prList = await getPullRequestList(previousVersion);
|
||||
const list = [];
|
||||
let content = "";
|
||||
try {
|
||||
const prList = await getPullRequestList(previousVersion);
|
||||
const list = [];
|
||||
|
||||
let i = 1;
|
||||
for (const pr of prList) {
|
||||
console.log(`Progress: ${i++}/${prList.length}`);
|
||||
let authorSet = await getAuthorList(pr.number);
|
||||
authorSet = await mainAuthorToFront(pr.author.login, authorSet);
|
||||
let i = 1;
|
||||
for (const pr of prList) {
|
||||
console.log(`Progress: ${i++}/${prList.length}`);
|
||||
let authorSet = await getAuthorList(pr.number);
|
||||
authorSet = await mainAuthorToFront(pr.author.login, authorSet);
|
||||
|
||||
if (mergeList.includes(pr.title)) {
|
||||
// Check if it is already in the list
|
||||
const existingItem = list.find((item) => item.title === pr.title);
|
||||
if (existingItem) {
|
||||
existingItem.numbers.push(pr.number);
|
||||
for (const author of authorSet) {
|
||||
existingItem.authors.add(author);
|
||||
// Sort the authors
|
||||
existingItem.authors = new Set([...existingItem.authors].sort((a, b) => a.localeCompare(b)));
|
||||
if (mergeList.includes(pr.title)) {
|
||||
// Check if it is already in the list
|
||||
const existingItem = list.find(item => item.title === pr.title);
|
||||
if (existingItem) {
|
||||
existingItem.numbers.push(pr.number);
|
||||
for (const author of authorSet) {
|
||||
existingItem.authors.add(author);
|
||||
// Sort the authors
|
||||
existingItem.authors = new Set([ ...existingItem.authors ].sort((a, b) => a.localeCompare(b)));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const item = {
|
||||
numbers: [ pr.number ],
|
||||
title: pr.title,
|
||||
authors: authorSet,
|
||||
};
|
||||
|
||||
list.push(item);
|
||||
}
|
||||
|
||||
const item = {
|
||||
numbers: [pr.number],
|
||||
title: pr.title,
|
||||
authors: authorSet,
|
||||
};
|
||||
for (const item of list) {
|
||||
// Concat pr numbers into a string like #123 #456
|
||||
const prPart = item.numbers.map(num => `#${num}`).join(" ");
|
||||
|
||||
list.push(item);
|
||||
}
|
||||
// Concat authors into a string like @user1 @user2
|
||||
let authorPart = [ ...item.authors ].map(author => `@${author}`).join(" ");
|
||||
|
||||
for (const item of list) {
|
||||
// Concat pr numbers into a string like #123 #456
|
||||
const prPart = item.numbers.map((num) => `#${num}`).join(" ");
|
||||
if (authorPart) {
|
||||
authorPart = `(Thanks ${authorPart})`;
|
||||
}
|
||||
|
||||
// Concat authors into a string like @user1 @user2
|
||||
let authorPart = [...item.authors].map((author) => `@${author}`).join(" ");
|
||||
|
||||
if (authorPart) {
|
||||
authorPart = `(Thanks ${authorPart})`;
|
||||
console.log(`- ${prPart} ${item.title} ${authorPart}`);
|
||||
}
|
||||
|
||||
content += `- ${prPart} ${item.title} ${authorPart}\n`;
|
||||
}
|
||||
console.log(template);
|
||||
|
||||
return content + "\n" + template;
|
||||
} catch (e) {
|
||||
console.error("Failed to get pull request list:", e);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,37 +114,28 @@ export async function generateChangelog(previousVersion) {
|
||||
*/
|
||||
async function getPullRequestList(previousVersion) {
|
||||
// Get the date of previousVersion in YYYY-MM-DD format from git
|
||||
const previousVersionDate = childProcess
|
||||
.execSync(`git log -1 --format=%cd --date=short ${previousVersion}`)
|
||||
.toString()
|
||||
.trim();
|
||||
const previousVersionDate = childProcess.execSync(`git log -1 --format=%cd --date=short ${previousVersion}`).toString().trim();
|
||||
|
||||
if (!previousVersionDate) {
|
||||
throw new Error(
|
||||
`Unable to find the date of version ${previousVersion}. Please make sure the version tag exists.`
|
||||
);
|
||||
throw new Error(`Unable to find the date of version ${previousVersion}. Please make sure the version tag exists.`);
|
||||
}
|
||||
|
||||
const ghProcess = childProcess.spawnSync(
|
||||
"gh",
|
||||
[
|
||||
"pr",
|
||||
"list",
|
||||
"--state",
|
||||
"merged",
|
||||
"--base",
|
||||
"master",
|
||||
"--search",
|
||||
`merged:>=${previousVersionDate}`,
|
||||
"--json",
|
||||
"number,title,author",
|
||||
"--limit",
|
||||
"1000",
|
||||
],
|
||||
{
|
||||
encoding: "utf-8",
|
||||
}
|
||||
);
|
||||
const ghProcess = childProcess.spawnSync("gh", [
|
||||
"pr",
|
||||
"list",
|
||||
"--state",
|
||||
"merged",
|
||||
"--base",
|
||||
"master",
|
||||
"--search",
|
||||
`merged:>=${previousVersionDate}`,
|
||||
"--json",
|
||||
"number,title,author",
|
||||
"--limit",
|
||||
"1000"
|
||||
], {
|
||||
encoding: "utf-8"
|
||||
});
|
||||
|
||||
if (ghProcess.error) {
|
||||
throw ghProcess.error;
|
||||
@ -158,8 +153,14 @@ async function getPullRequestList(previousVersion) {
|
||||
* @returns {Promise<Set<string>>} Set of Authors' GitHub Usernames
|
||||
*/
|
||||
async function getAuthorList(prID) {
|
||||
const ghProcess = childProcess.spawnSync("gh", ["pr", "view", prID, "--json", "commits"], {
|
||||
encoding: "utf-8",
|
||||
const ghProcess = childProcess.spawnSync("gh", [
|
||||
"pr",
|
||||
"view",
|
||||
prID,
|
||||
"--json",
|
||||
"commits"
|
||||
], {
|
||||
encoding: "utf-8"
|
||||
});
|
||||
|
||||
if (ghProcess.error) {
|
||||
@ -184,7 +185,7 @@ async function getAuthorList(prID) {
|
||||
}
|
||||
|
||||
// Sort the set
|
||||
return new Set([...set].sort((a, b) => a.localeCompare(b)));
|
||||
return new Set([ ...set ].sort((a, b) => a.localeCompare(b)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,5 +197,5 @@ async function mainAuthorToFront(mainAuthor, authorSet) {
|
||||
if (ignoreList.includes(mainAuthor)) {
|
||||
return authorSet;
|
||||
}
|
||||
return new Set([mainAuthor, ...authorSet]);
|
||||
return new Set([ mainAuthor, ...authorSet ]);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Supports: Deno, Bun, Node.js >= 18 (ts-node)
|
||||
const pushURL: string = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||
const interval: number = 60;
|
||||
const pushURL : string = "https://example.com/api/push/key?status=up&msg=OK&ping=";
|
||||
const interval : number = 60;
|
||||
|
||||
const push = async () => {
|
||||
await fetch(pushURL);
|
||||
|
||||
@ -8,7 +8,7 @@ async function main() {
|
||||
const branch = process.argv[2];
|
||||
|
||||
// Use gh to get current branch's pr id
|
||||
let currentBranchPRID = execSync('gh pr view --json number --jq ".number"').toString().trim();
|
||||
let currentBranchPRID = execSync("gh pr view --json number --jq \".number\"").toString().trim();
|
||||
console.log("Pr ID: ", currentBranchPRID);
|
||||
|
||||
// Use gh commend to get pr commits
|
||||
|
||||
@ -7,28 +7,24 @@ import {
|
||||
checkTagExists,
|
||||
checkVersionFormat,
|
||||
getRepoNames,
|
||||
execSync,
|
||||
checkReleaseBranch,
|
||||
createDistTarGz,
|
||||
createReleasePR,
|
||||
pressAnyKey,
|
||||
execSync, uploadArtifacts, checkReleaseBranch,
|
||||
} from "./lib.mjs";
|
||||
import semver from "semver";
|
||||
|
||||
const repoNames = getRepoNames();
|
||||
const version = process.env.RELEASE_BETA_VERSION;
|
||||
const dryRun = process.env.DRY_RUN === "true";
|
||||
const previousVersion = process.env.RELEASE_PREVIOUS_VERSION;
|
||||
const branchName = `release-${version}`;
|
||||
const githubRunId = process.env.GITHUB_RUN_ID;
|
||||
|
||||
if (dryRun) {
|
||||
console.log("Dry run mode enabled. No images will be pushed.");
|
||||
}
|
||||
const githubToken = process.env.RELEASE_GITHUB_TOKEN;
|
||||
|
||||
console.log("RELEASE_BETA_VERSION:", version);
|
||||
|
||||
// Check if the current branch is "release-{version}"
|
||||
checkReleaseBranch(branchName);
|
||||
if (!githubToken) {
|
||||
console.error("GITHUB_TOKEN is required");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Check if the current branch is "release"
|
||||
checkReleaseBranch();
|
||||
|
||||
// Check if the version is a valid semver
|
||||
checkVersionFormat(version);
|
||||
@ -48,34 +44,24 @@ checkDocker();
|
||||
await checkTagExists(repoNames, version);
|
||||
|
||||
// node extra/beta/update-version.js
|
||||
await import("../beta/update-version.mjs");
|
||||
|
||||
// Create Pull Request (gh pr create will handle pushing the branch)
|
||||
await createReleasePR(version, previousVersion, dryRun, branchName, githubRunId);
|
||||
execSync("node ./extra/beta/update-version.js");
|
||||
|
||||
// Build frontend dist
|
||||
buildDist();
|
||||
|
||||
if (!dryRun) {
|
||||
// Build slim image (rootless)
|
||||
buildImage(
|
||||
repoNames,
|
||||
["beta-slim-rootless", ver(version, "slim-rootless")],
|
||||
"rootless",
|
||||
"BASE_IMAGE=louislam/uptime-kuma:base2-slim"
|
||||
);
|
||||
// Build slim image (rootless)
|
||||
buildImage(repoNames, [ "beta-slim-rootless", ver(version, "slim-rootless") ], "rootless", "BASE_IMAGE=louislam/uptime-kuma:base2-slim");
|
||||
|
||||
// Build full image (rootless)
|
||||
buildImage(repoNames, ["beta-rootless", ver(version, "rootless")], "rootless");
|
||||
// Build full image (rootless)
|
||||
buildImage(repoNames, [ "beta-rootless", ver(version, "rootless") ], "rootless");
|
||||
|
||||
// Build slim image
|
||||
buildImage(repoNames, ["beta-slim", ver(version, "slim")], "release", "BASE_IMAGE=louislam/uptime-kuma:base2-slim");
|
||||
// Build slim image
|
||||
buildImage(repoNames, [ "beta-slim", ver(version, "slim") ], "release", "BASE_IMAGE=louislam/uptime-kuma:base2-slim");
|
||||
|
||||
// Build full image
|
||||
buildImage(repoNames, ["beta", version], "release");
|
||||
} else {
|
||||
console.log("Dry run mode - skipping image build and push.");
|
||||
}
|
||||
// Build full image
|
||||
buildImage(repoNames, [ "beta", version ], "release");
|
||||
|
||||
// Create dist.tar.gz
|
||||
await createDistTarGz();
|
||||
await pressAnyKey();
|
||||
|
||||
// npm run upload-artifacts
|
||||
uploadArtifacts(version, githubToken);
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import "dotenv/config";
|
||||
import * as childProcess from "child_process";
|
||||
import semver from "semver";
|
||||
import { generateChangelog } from "../generate-changelog.mjs";
|
||||
import fs from "fs";
|
||||
import tar from "tar";
|
||||
|
||||
export const dryRun = process.env.RELEASE_DRY_RUN === "1";
|
||||
|
||||
@ -26,14 +23,16 @@ export function checkDocker() {
|
||||
|
||||
/**
|
||||
* Get Docker Hub repository name
|
||||
* @returns {string[]} List of repository names
|
||||
*/
|
||||
export function getRepoNames() {
|
||||
if (process.env.RELEASE_REPO_NAMES) {
|
||||
// Split by comma
|
||||
return process.env.RELEASE_REPO_NAMES.split(",").map((name) => name.trim());
|
||||
}
|
||||
return ["louislam/uptime-kuma", "ghcr.io/louislam/uptime-kuma"];
|
||||
return [
|
||||
"louislam/uptime-kuma",
|
||||
"ghcr.io/louislam/uptime-kuma",
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,15 +57,15 @@ export function buildDist() {
|
||||
* @param {string} platform Build platform
|
||||
* @returns {void}
|
||||
*/
|
||||
export function buildImage(
|
||||
repoNames,
|
||||
tags,
|
||||
target,
|
||||
buildArgs = "",
|
||||
dockerfile = "docker/dockerfile",
|
||||
platform = "linux/amd64,linux/arm64,linux/arm/v7"
|
||||
) {
|
||||
let args = ["buildx", "build", "-f", dockerfile, "--platform", platform];
|
||||
export function buildImage(repoNames, tags, target, buildArgs = "", dockerfile = "docker/dockerfile", platform = "linux/amd64,linux/arm64,linux/arm/v7") {
|
||||
let args = [
|
||||
"buildx",
|
||||
"build",
|
||||
"-f",
|
||||
dockerfile,
|
||||
"--platform",
|
||||
platform,
|
||||
];
|
||||
|
||||
for (let repoName of repoNames) {
|
||||
// Add tags
|
||||
@ -75,14 +74,22 @@ export function buildImage(
|
||||
}
|
||||
}
|
||||
|
||||
args = [...args, "--target", target];
|
||||
args = [
|
||||
...args,
|
||||
"--target",
|
||||
target,
|
||||
];
|
||||
|
||||
// Add build args
|
||||
if (buildArgs) {
|
||||
args.push("--build-arg", buildArgs);
|
||||
}
|
||||
|
||||
args = [...args, ".", "--push"];
|
||||
args = [
|
||||
...args,
|
||||
".",
|
||||
"--push",
|
||||
];
|
||||
|
||||
if (!dryRun) {
|
||||
childProcess.spawnSync("docker", args, { stdio: "inherit" });
|
||||
@ -165,13 +172,11 @@ export function pressAnyKey() {
|
||||
console.log("Git Push and Publish the release note on github, then press any key to continue");
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.resume();
|
||||
return new Promise((resolve) =>
|
||||
process.stdin.once("data", (data) => {
|
||||
process.stdin.setRawMode(false);
|
||||
process.stdin.pause();
|
||||
resolve();
|
||||
})
|
||||
);
|
||||
return new Promise(resolve => process.stdin.once("data", data => {
|
||||
process.stdin.setRawMode(false);
|
||||
process.stdin.pause();
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,9 +189,9 @@ export function ver(version, identifier) {
|
||||
const obj = semver.parse(version);
|
||||
|
||||
if (obj.prerelease.length === 0) {
|
||||
obj.prerelease = [identifier];
|
||||
obj.prerelease = [ identifier ];
|
||||
} else {
|
||||
obj.prerelease[0] = [obj.prerelease[0], identifier].join("-");
|
||||
obj.prerelease[0] = [ obj.prerelease[0], identifier ].join("-");
|
||||
}
|
||||
return obj.format();
|
||||
}
|
||||
@ -197,7 +202,6 @@ export function ver(version, identifier) {
|
||||
* @param {string} version Version
|
||||
* @param {string} githubToken GitHub token
|
||||
* @returns {void}
|
||||
* @deprecated
|
||||
*/
|
||||
export function uploadArtifacts(version, githubToken) {
|
||||
let args = [
|
||||
@ -247,117 +251,14 @@ export function execSync(cmd) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current branch matches the expected release branch pattern
|
||||
* @param {string} expectedBranch Expected branch name (can be "release" or "release-{version}")
|
||||
* Check if the current branch is "release"
|
||||
* @returns {void}
|
||||
*/
|
||||
export function checkReleaseBranch(expectedBranch = "release") {
|
||||
const res = childProcess.spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
|
||||
export function checkReleaseBranch() {
|
||||
const res = childProcess.spawnSync("git", [ "rev-parse", "--abbrev-ref", "HEAD" ]);
|
||||
const branch = res.stdout.toString().trim();
|
||||
if (branch !== expectedBranch) {
|
||||
console.error(`Current branch is ${branch}, please switch to "${expectedBranch}" branch`);
|
||||
if (branch !== "release") {
|
||||
console.error(`Current branch is ${branch}, please switch to "release" branch`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create dist.tar.gz from the dist directory
|
||||
* Similar to "tar -zcvf dist.tar.gz dist", but using nodejs
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function createDistTarGz() {
|
||||
const distPath = "dist";
|
||||
const outputPath = "./tmp/dist.tar.gz";
|
||||
const tmpDir = "./tmp";
|
||||
|
||||
// Ensure tmp directory exists
|
||||
if (!fs.existsSync(tmpDir)) {
|
||||
fs.mkdirSync(tmpDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Check if dist directory exists
|
||||
if (!fs.existsSync(distPath)) {
|
||||
console.error("Error: dist directory not found");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`Creating ${outputPath} from ${distPath}...`);
|
||||
|
||||
try {
|
||||
await tar.create(
|
||||
{
|
||||
gzip: true,
|
||||
file: outputPath,
|
||||
},
|
||||
[distPath]
|
||||
);
|
||||
console.log(`Successfully created ${outputPath}`);
|
||||
} catch (error) {
|
||||
console.error(`Failed to create tarball: ${error.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a draft release PR
|
||||
* @param {string} version Version
|
||||
* @param {string} previousVersion Previous version tag
|
||||
* @param {boolean} dryRun Still create the PR, but add "[DRY RUN]" to the title
|
||||
* @param {string} branchName The branch name to use for the PR head (defaults to "release")
|
||||
* @param {string} githubRunId The GitHub Actions run ID for linking to artifacts
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function createReleasePR(version, previousVersion, dryRun, branchName = "release", githubRunId = null) {
|
||||
const changelog = await generateChangelog(previousVersion);
|
||||
|
||||
const title = dryRun ? `chore: update to ${version} (dry run)` : `chore: update to ${version}`;
|
||||
|
||||
// Build the artifact link - use direct run link if available, otherwise link to workflow file
|
||||
const artifactLink = githubRunId
|
||||
? `https://github.com/louislam/uptime-kuma/actions/runs/${githubRunId}/workflow`
|
||||
: `https://github.com/louislam/uptime-kuma/actions/workflows/beta-release.yml`;
|
||||
|
||||
const body = `## Release ${version}
|
||||
|
||||
This PR prepares the release for version ${version}.
|
||||
|
||||
### Manual Steps Required
|
||||
- [ ] Merge this PR (squash and merge)
|
||||
- [ ] Create a new release on GitHub with the tag \`${version}\`.
|
||||
- [ ] Ask any LLM to categorize the changelog into sections.
|
||||
- [ ] Place the changelog in the release note.
|
||||
- [ ] Download the \`dist.tar.gz\` artifact from the [workflow run](${artifactLink}) and upload it to the release.
|
||||
- [ ] (Beta only) Set prerelease
|
||||
- [ ] Publish the release note on GitHub.
|
||||
|
||||
### Changelog
|
||||
|
||||
\`\`\`md
|
||||
${changelog}
|
||||
\`\`\`
|
||||
|
||||
### Release Artifacts
|
||||
The \`dist.tar.gz\` archive will be available as an artifact in the workflow run.
|
||||
`;
|
||||
|
||||
// Create the PR using gh CLI
|
||||
const args = ["pr", "create", "--title", title, "--body", body, "--base", "master", "--head", branchName, "--draft"];
|
||||
|
||||
console.log(`Creating draft PR: ${title}`);
|
||||
|
||||
const result = childProcess.spawnSync("gh", args, {
|
||||
encoding: "utf-8",
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
...process.env,
|
||||
GH_TOKEN: process.env.GH_TOKEN || process.env.GITHUB_TOKEN,
|
||||
},
|
||||
});
|
||||
|
||||
if (result.status !== 0) {
|
||||
console.error("Failed to create pull request");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("Successfully created draft pull request");
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ const TwoFA = require("../server/2fa");
|
||||
const args = require("args-parser")(process.argv);
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
const main = async () => {
|
||||
@ -19,7 +19,7 @@ const main = async () => {
|
||||
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
|
||||
if (!process.env.TEST_BACKEND) {
|
||||
const user = await R.findOne("user");
|
||||
if (!user) {
|
||||
if (! user) {
|
||||
throw new Error("user not found, have you installed?");
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ const main = async () => {
|
||||
await TwoFA.disable2FA(user.id);
|
||||
console.log("2FA has been removed successfully.");
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error: " + e.message);
|
||||
|
||||
@ -21,3 +21,4 @@ const main = async () => {
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ const args = require("args-parser")(process.argv);
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
const main = async () => {
|
||||
@ -28,7 +28,7 @@ const main = async () => {
|
||||
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
|
||||
if (!process.env.TEST_BACKEND) {
|
||||
const user = await R.findOne("user");
|
||||
if (!user) {
|
||||
if (! user) {
|
||||
throw new Error("user not found, have you installed?");
|
||||
}
|
||||
|
||||
@ -41,10 +41,7 @@ const main = async () => {
|
||||
// When called with "--new-password" argument for unattended modification (e.g. npm run reset-password -- --new_password=secret)
|
||||
if ("new-password" in args) {
|
||||
console.log("Using password from argument");
|
||||
console.warn(
|
||||
"\x1b[31m%s\x1b[0m",
|
||||
"Warning: the password might be stored, in plain text, in your shell's history"
|
||||
);
|
||||
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.");
|
||||
@ -74,6 +71,7 @@ const main = async () => {
|
||||
}
|
||||
}
|
||||
console.log("Password reset successfully.");
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error: " + e.message);
|
||||
@ -114,23 +112,19 @@ function disconnectAllSocketClients(username, password) {
|
||||
timeout: 5000,
|
||||
});
|
||||
socket.on("connect", () => {
|
||||
socket.emit(
|
||||
"login",
|
||||
{
|
||||
username,
|
||||
password,
|
||||
},
|
||||
(res) => {
|
||||
if (res.ok) {
|
||||
console.log("Logged in.");
|
||||
socket.emit("disconnectOtherSocketClients");
|
||||
} else {
|
||||
console.warn("Login failed.");
|
||||
console.warn("Please restart the server to disconnect all sessions.");
|
||||
}
|
||||
socket.close();
|
||||
socket.emit("login", {
|
||||
username,
|
||||
password,
|
||||
}, (res) => {
|
||||
if (res.ok) {
|
||||
console.log("Logged in.");
|
||||
socket.emit("disconnectOtherSocketClients");
|
||||
} else {
|
||||
console.warn("Login failed.");
|
||||
console.warn("Please restart the server to disconnect all sessions.");
|
||||
}
|
||||
);
|
||||
socket.close();
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("connect_error", function () {
|
||||
|
||||
@ -7,7 +7,7 @@ const dns2 = require("dns2");
|
||||
const { Packet } = dns2;
|
||||
|
||||
const server = dns2.createServer({
|
||||
udp: true,
|
||||
udp: true
|
||||
});
|
||||
|
||||
server.on("request", (request, send, rinfo) => {
|
||||
@ -17,13 +17,14 @@ server.on("request", (request, send, rinfo) => {
|
||||
const response = Packet.createResponseFromRequest(request);
|
||||
|
||||
if (question.name === "existing.com") {
|
||||
|
||||
if (question.type === Packet.TYPE.A) {
|
||||
response.answers.push({
|
||||
name: question.name,
|
||||
type: question.type,
|
||||
class: question.class,
|
||||
ttl: 300,
|
||||
address: "1.2.3.4",
|
||||
address: "1.2.3.4"
|
||||
});
|
||||
} else if (question.type === Packet.TYPE.AAAA) {
|
||||
response.answers.push({
|
||||
@ -48,7 +49,7 @@ server.on("request", (request, send, rinfo) => {
|
||||
class: question.class,
|
||||
ttl: 300,
|
||||
exchange: "mx1.existing.com",
|
||||
priority: 5,
|
||||
priority: 5
|
||||
});
|
||||
} else if (question.type === Packet.TYPE.NS) {
|
||||
response.answers.push({
|
||||
@ -102,6 +103,7 @@ server.on("request", (request, send, rinfo) => {
|
||||
value: "ca.existing.com",
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (question.name === "4.3.2.1.in-addr.arpa") {
|
||||
@ -130,7 +132,7 @@ server.on("close", () => {
|
||||
});
|
||||
|
||||
server.listen({
|
||||
udp: 5300,
|
||||
udp: 5300
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -41,19 +41,17 @@ server1.aedes.on("subscribe", (subscriptions, client) => {
|
||||
|
||||
for (let s of subscriptions) {
|
||||
if (s.topic === "test") {
|
||||
server1.aedes.publish(
|
||||
{
|
||||
topic: "test",
|
||||
payload: Buffer.from("ok"),
|
||||
},
|
||||
(error) => {
|
||||
if (error) {
|
||||
log.error("mqtt_server", error);
|
||||
}
|
||||
server1.aedes.publish({
|
||||
topic: "test",
|
||||
payload: Buffer.from("ok"),
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
log.error("mqtt_server", error);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
server1.start();
|
||||
|
||||
@ -10,7 +10,7 @@ let lines = file.split("\n");
|
||||
lines = lines.filter((line) => line !== "");
|
||||
|
||||
// Remove duplicates
|
||||
lines = [...new Set(lines)];
|
||||
lines = [ ...new Set(lines) ];
|
||||
|
||||
// Remove @weblate and @UptimeKumaBot
|
||||
lines = lines.filter((line) => line !== "@weblate" && line !== "@UptimeKumaBot" && line !== "@louislam");
|
||||
|
||||
@ -54,13 +54,13 @@ async function updateLanguage(langCode, baseLangCode) {
|
||||
} else {
|
||||
console.log("Empty file");
|
||||
obj = {
|
||||
languageName: "<Your Language name in your language (not in English)>",
|
||||
languageName: "<Your Language name in your language (not in English)>"
|
||||
};
|
||||
}
|
||||
|
||||
// En first
|
||||
for (const key in en) {
|
||||
if (!obj[key]) {
|
||||
if (! obj[key]) {
|
||||
obj[key] = en[key];
|
||||
}
|
||||
}
|
||||
@ -68,17 +68,15 @@ async function updateLanguage(langCode, baseLangCode) {
|
||||
if (baseLang !== en) {
|
||||
// Base second
|
||||
for (const key in baseLang) {
|
||||
if (!obj[key]) {
|
||||
if (! obj[key]) {
|
||||
obj[key] = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const code =
|
||||
"export default " +
|
||||
util.inspect(obj, {
|
||||
depth: null,
|
||||
});
|
||||
const code = "export default " + util.inspect(obj, {
|
||||
depth: null,
|
||||
});
|
||||
|
||||
fs.writeFileSync(`../../src/languages/${file}`, code);
|
||||
}
|
||||
|
||||
@ -9,14 +9,15 @@ const newVersion = process.env.RELEASE_VERSION;
|
||||
|
||||
console.log("New Version: " + newVersion);
|
||||
|
||||
if (!newVersion) {
|
||||
if (! newVersion) {
|
||||
console.error("invalid version");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const exists = tagExists(newVersion);
|
||||
|
||||
if (!exists) {
|
||||
if (! exists) {
|
||||
|
||||
// Process package.json
|
||||
pkg.version = newVersion;
|
||||
|
||||
@ -26,19 +27,20 @@ if (!exists) {
|
||||
|
||||
// Also update package-lock.json
|
||||
const npm = /^win/.test(process.platform) ? "npm.cmd" : "npm";
|
||||
const resultVersion = childProcess.spawnSync(npm, ["--no-git-tag-version", "version", newVersion], { shell: true });
|
||||
const resultVersion = childProcess.spawnSync(npm, [ "--no-git-tag-version", "version", newVersion ], { shell: true });
|
||||
if (resultVersion.error) {
|
||||
console.error(resultVersion.error);
|
||||
console.error("error npm version!");
|
||||
process.exit(1);
|
||||
}
|
||||
const resultInstall = childProcess.spawnSync(npm, ["install"], { shell: true });
|
||||
const resultInstall = childProcess.spawnSync(npm, [ "install" ], { shell: true });
|
||||
if (resultInstall.error) {
|
||||
console.error(resultInstall.error);
|
||||
console.error("error update package-lock!");
|
||||
process.exit(1);
|
||||
}
|
||||
commit(newVersion);
|
||||
|
||||
} else {
|
||||
console.log("version exists");
|
||||
}
|
||||
@ -52,7 +54,7 @@ if (!exists) {
|
||||
function commit(version) {
|
||||
let msg = "Update to " + version;
|
||||
|
||||
let res = childProcess.spawnSync("git", ["commit", "-m", msg, "-a"]);
|
||||
let res = childProcess.spawnSync("git", [ "commit", "-m", msg, "-a" ]);
|
||||
let stdout = res.stdout.toString().trim();
|
||||
console.log(stdout);
|
||||
|
||||
@ -68,11 +70,11 @@ function commit(version) {
|
||||
* @throws Version is not valid
|
||||
*/
|
||||
function tagExists(version) {
|
||||
if (!version) {
|
||||
if (! version) {
|
||||
throw new Error("invalid version");
|
||||
}
|
||||
|
||||
let res = childProcess.spawnSync("git", ["tag", "-l", version]);
|
||||
let res = childProcess.spawnSync("git", [ "tag", "-l", version ]);
|
||||
|
||||
return res.stdout.toString().trim() === version;
|
||||
}
|
||||
|
||||
@ -21,23 +21,23 @@ function updateWiki(newVersion) {
|
||||
|
||||
safeDelete(wikiDir);
|
||||
|
||||
childProcess.spawnSync("git", ["clone", "https://github.com/louislam/uptime-kuma.wiki.git", wikiDir]);
|
||||
childProcess.spawnSync("git", [ "clone", "https://github.com/louislam/uptime-kuma.wiki.git", wikiDir ]);
|
||||
let content = fs.readFileSync(howToUpdateFilename).toString();
|
||||
|
||||
// Replace the version: https://regex101.com/r/hmj2Bc/1
|
||||
content = content.replace(/(git checkout )([^\s]+)/, `$1${newVersion}`);
|
||||
fs.writeFileSync(howToUpdateFilename, content);
|
||||
|
||||
childProcess.spawnSync("git", ["add", "-A"], {
|
||||
childProcess.spawnSync("git", [ "add", "-A" ], {
|
||||
cwd: wikiDir,
|
||||
});
|
||||
|
||||
childProcess.spawnSync("git", ["commit", "-m", `Update to ${newVersion}`], {
|
||||
childProcess.spawnSync("git", [ "commit", "-m", `Update to ${newVersion}` ], {
|
||||
cwd: wikiDir,
|
||||
});
|
||||
|
||||
console.log("Pushing to Github");
|
||||
childProcess.spawnSync("git", ["push"], {
|
||||
childProcess.spawnSync("git", [ "push" ], {
|
||||
cwd: wikiDir,
|
||||
});
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user