diff --git a/.dockerignore b/.dockerignore index 47e82a105..00ee58159 100644 --- a/.dockerignore +++ b/.dockerignore @@ -33,7 +33,7 @@ tsconfig.json /ecosystem.config.js /extra/healthcheck.exe /extra/healthcheck - +extra/exe-builder ### .gitignore content (commented rules are duplicated) @@ -48,6 +48,4 @@ dist-ssr #!/data/.gitkeep #.vscode - - ### End of .gitignore content diff --git a/.github/ISSUE_TEMPLATE/security.md b/.github/ISSUE_TEMPLATE/security.md new file mode 100644 index 000000000..26450ed3a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/security.md @@ -0,0 +1,19 @@ +--- + +name: "Security Issue" +about: "Just for alerting @louislam, do not provide any details here" +title: "Security Issue" +ref: "main" +labels: + +- security + +--- + +DO NOT PROVIDE ANY DETAILS HERE. Please privately report to https://github.com/louislam/uptime-kuma/security/advisories/new. + + +Why need this issue? It is because GitHub Advisory do not send a notification to @louislam, it is a workaround to do so. + +Your GitHub Advisory URL: + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4d2105d49..87e7f5ff7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,7 +16,6 @@ Please delete any options that are not relevant. - User interface (UI) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) -- Translation update - Other - This change requires a documentation update diff --git a/.github/workflows/auto-test.yml b/.github/workflows/auto-test.yml index b49a253c3..944627127 100644 --- a/.github/workflows/auto-test.yml +++ b/.github/workflows/auto-test.yml @@ -6,8 +6,12 @@ name: Auto Test on: push: branches: [ master ] + paths-ignore: + - '*.md' pull_request: branches: [ master ] + paths-ignore: + - '*.md' jobs: auto-test: @@ -18,7 +22,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - node: [ 14, 16, 17, 18 ] + node: [ 14, 16, 18, 19 ] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -36,6 +40,7 @@ jobs: env: HEADLESS_TEST: 1 JUST_FOR_TEST: ${{ secrets.JUST_FOR_TEST }} + check-linters: runs-on: ubuntu-latest @@ -66,3 +71,19 @@ jobs: - run: npm install - run: npm run build - run: npm run cy:test + + frontend-unit-tests: + needs: [ check-linters ] + runs-on: ubuntu-latest + steps: + - run: git config --global core.autocrlf false # Mainly for Windows + - uses: actions/checkout@v3 + + - name: Use Node.js 14 + uses: actions/setup-node@v3 + with: + node-version: 14 + cache: 'npm' + - run: npm install + - run: npm run build + - run: npm run cy:run:unit diff --git a/.github/workflows/close-incorrect-issue.yml b/.github/workflows/close-incorrect-issue.yml index 026022dfa..762bc9688 100644 --- a/.github/workflows/close-incorrect-issue.yml +++ b/.github/workflows/close-incorrect-issue.yml @@ -1,4 +1,3 @@ - name: Close Incorrect Issue on: @@ -12,13 +11,13 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node-version: [16.x] + node-version: [16] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: 'npm' diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml index 5b4568e1d..b39f68fc1 100644 --- a/.github/workflows/stale-bot.yml +++ b/.github/workflows/stale-bot.yml @@ -3,13 +3,13 @@ on: workflow_dispatch: schedule: - cron: '0 */6 * * *' -#Run every 6 hours +#Run every 6 hours jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v5 + - uses: actions/stale@v7 with: stale-issue-message: 'We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.' close-issue-message: 'This issue was closed because it has been stalled for 2 days with no activity.' diff --git a/.gitignore b/.gitignore index 06dca04b4..9ed1e282b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ cypress/screenshots /extra/healthcheck.exe /extra/healthcheck /extra/healthcheck-armv7 + +extra/exe-builder/bin +extra/exe-builder/obj diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 12fd6ed41..4c6a5587b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Project Info -First of all, thank you everyone who made pull requests for Uptime Kuma, I never thought GitHub Community can be that nice! And also because of this, I also never thought other people actually read my code and edit my code. It is not structured and commented so well, lol. Sorry about that. +First of all, I want to thank everyone who made pull requests for Uptime Kuma. I never thought the GitHub Community would be so nice! Because of this, I also never thought that other people would actually read and edit my code. It is not very well structured or commented, sorry about that. The project was created with vite.js (vue3). Then I created a subdirectory called "server" for server part. Both frontend and backend share the same package.json. @@ -17,8 +17,11 @@ The frontend code build into "dist" directory. The server (express.js) exposes t ## Directories +- config (dev config files) - data (App data) +- db (Base database and migration scripts) - dist (Frontend build) +- docker (Dockerfiles) - extra (Extra useful scripts) - public (Frontend resources for dev only) - server (Server source code) @@ -27,20 +30,23 @@ The frontend code build into "dist" directory. The server (express.js) exposes t ## Can I create a pull request for Uptime Kuma? -Yes or no, it depends on what you will try to do. Since I don't want to waste your time, be sure to **create an empty draft pull request or open an issue, so we can discuss first**. Especially for a large pull request or you don't know it will be merged or not. +Yes or no, it depends on what you will try to do. Since I don't want to waste your time, be sure to **create an empty draft pull request or open an issue, so we can have a discussion first**. Especially for a large pull request or you don't know it will be merged or not. Here are some references: ✅ Usually Accept: -- Bug/Security fix -- Translations +- Bug fix +- Security fix - Adding notification providers +- Adding new language files (You should go to https://weblate.kuma.pet for existing languages) +- Adding new language keys: `$t("...")` ⚠️ Discussion First - Large pull requests - New features ❌ Won't Merge +- A dedicated pr for translating existing languages (You can now translate on https://weblate.kuma.pet) - Do not pass auto test - Any breaking changes - Duplicated pull request @@ -48,8 +54,13 @@ Here are some references: - UI/UX is not close to Uptime Kuma - Existing logic is completely modified or deleted for no reason - A function that is completely out of scope +- Convert existing code into other programming languages - Unnecessary large code changes (Hard to review, causes code conflicts to other pull requests) +The above cases cannot cover all situations. + +I (@louislam) have the final say. If your pull request does not meet my expectations, I will reject it, no matter how much time you spend on it. Therefore, it is essential to have a discussion beforehand. + I will mark your pull request in the [milestones](https://github.com/louislam/uptime-kuma/milestones), if I am plan to review and merge it. Also, please don't rush or ask for ETA, because I have to understand the pull request, make sure it is no breaking changes and stick to my vision of this project, especially for large pull requests. @@ -72,13 +83,13 @@ Before deep into coding, discussion first is preferred. Creating an empty pull r ## Project Styles -I personally do not like something need to learn so much and need to config so much before you can finally start the app. +I personally do not like something that requires so many configurations before you can finally start the app. I hope Uptime Kuma installation could be as easy as like installing a mobile app. -- Easy to install for non-Docker users, no native build dependency is needed (at least for x86_64), no extra config, no extra effort to get it run +- Easy to install for non-Docker users, no native build dependency is needed (for x86_64/armv7/arm64), no extra config, no extra effort required to get it running - Single container for Docker users, no very complex docker-compose file. Just map the volume and expose the port, then good to go -- Settings should be configurable in the frontend. Environment variable is not encouraged, unless it is related to startup such as `DATA_DIR`. +- Settings should be configurable in the frontend. Environment variable is not encouraged, unless it is related to startup such as `DATA_DIR` - Easy to use -- The web UI styling should be consistent and nice. +- The web UI styling should be consistent and nice ## Coding Styles @@ -87,7 +98,7 @@ I personally do not like something need to learn so much and need to config so m - Follow ESLint - Methods and functions should be documented with JSDoc -## Name convention +## Name Conventions - Javascript/Typescript: camelCaseType - SQLite: snake_case (Underscore) @@ -101,7 +112,7 @@ I personally do not like something need to learn so much and need to config so m - IDE that supports ESLint and EditorConfig (I am using IntelliJ IDEA) - A SQLite GUI tool (SQLite Expert Personal is suggested) -## Install dependencies +## Install Dependencies for Development ```bash npm ci @@ -119,6 +130,12 @@ Port `3000` and port `3001` will be used. npm run dev ``` +But sometimes, you would like to keep restart the server, but not the frontend, you can run these command in two terminals: +``` +npm run start-frontend-dev +npm run start-server-dev +``` + ## Backend Server It binds to `0.0.0.0:3001` by default. @@ -134,12 +151,15 @@ express.js is used for: ### Structure in /server/ +- jobs/ (Jobs that are running in another process) - model/ (Object model, auto mapping to the database table name) - modules/ (Modified 3rd-party modules) +- monitor_types (Monitor Types) - notification-providers/ (individual notification logic) - routers/ (Express Routers) - socket-handler (Socket.io Handlers) -- server.js (Server entry point and main logic) +- server.js (Server entry point) +- uptime-kuma-server.js (UptimeKumaServer class, main logic should be here, but some still in `server.js`) ## Frontend Dev Server @@ -172,15 +192,11 @@ The data and socket logic are in `src/mixins/socket.js`. ## Unit Test -It is an end-to-end testing. It is using Jest and Puppeteer. - ```bash npm run build npm test ``` -By default, the Chromium window will be shown up during the test. Specifying `HEADLESS_TEST=1` for terminal environments. - ## Dependencies Both frontend and backend share the same package.json. However, the frontend dependencies are eventually not used in the production environment, because it is usually also baked into dist files. So: @@ -194,18 +210,12 @@ Both frontend and backend share the same package.json. However, the frontend dep ### Update Dependencies -Install `ncu` -https://github.com/raineorshine/npm-check-updates - -```bash -ncu -u -t patch -npm install -``` - Since previously updating Vite 2.5.10 to 2.6.0 broke the application completely, from now on, it should update patch release version only. Patch release = the third digit ([Semantic Versioning](https://semver.org/)) +If for maybe security reasons, a library must be updated. Then you must need to check if there are any breaking changes. + ## Translations Please read: https://github.com/louislam/uptime-kuma/tree/master/src/languages @@ -225,12 +235,13 @@ https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc 1. Draft a release note 2. Make sure the repo is cleared +3. If the healthcheck is updated, remember to re-compile it: `npm run build-docker-builder-go` 3. `npm run release-final with env vars: `VERSION` and `GITHUB_TOKEN` 4. Wait until the `Press any key to continue` 5. `git push` 6. Publish the release note as 1.X.X 7. Press any key to continue -8. SSH to demo site server and update to 1.X.X +8. Deploy to the demo server: `npm run deploy-demo-server` Checking: diff --git a/README.md b/README.md index 55a6ec504..a67007ce6 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,39 @@ # Uptime Kuma -[![GitHub Sponsors](https://img.shields.io/github/sponsors/louislam?label=GitHub%20Sponsors)](https://github.com/sponsors/louislam) +[![GitHub Sponsors](https://img.shields.io/github/sponsors/louislam?label=GitHub%20Sponsors)](https://github.com/sponsors/louislam) + +
+ {{ $t("wayToGetKookGuildID") }} +
+{{ $t("telegramMessageThreadIDDescription") }}
+ +