Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .dockerignore +37 -0
- .gitattributes +34 -35
- .github/FUNDING.yml +2 -0
- .github/ISSUE_TEMPLATE/bug_report.yml +111 -0
- .github/ISSUE_TEMPLATE/config.yml +11 -0
- .github/PULL_REQUEST_TEMPLATE.md +21 -0
- .github/workflows/close-stale-invalid-titles.yml +71 -0
- .github/workflows/close-stale-wrong-branch.yml +93 -0
- .github/workflows/close-untitled-issues.yml +92 -0
- .github/workflows/docker-dev.yml +183 -0
- .github/workflows/docker.yml +219 -0
- .github/workflows/enforce-target-branch.yml +137 -0
- .github/workflows/lint-prettier.yml +53 -0
- .github/workflows/security.yml +38 -0
- .github/workflows/test.yml +137 -0
- .github/workflows/wiki.yml +26 -0
- .gitignore +68 -0
- .hfignore +22 -0
- Agent.md +101 -0
- CONTRIBUTING.md +46 -0
- Dockerfile +112 -0
- LICENSE +661 -0
- MCP.md +577 -0
- NOTICE.md +33 -0
- README.md +460 -6
- SECURITY.md +26 -0
- TRADEMARKS.md +121 -0
- build-from-sources +25 -0
- charts/README.md +50 -0
- charts/trek/Chart.yaml +5 -0
- charts/trek/templates/NOTES.txt +23 -0
- charts/trek/templates/_helpers.tpl +18 -0
- charts/trek/templates/configmap.yaml +72 -0
- charts/trek/templates/deployment.yaml +89 -0
- charts/trek/templates/ingress.yaml +35 -0
- charts/trek/templates/pvc.yaml +27 -0
- charts/trek/templates/secret.yaml +47 -0
- charts/trek/templates/service.yaml +15 -0
- charts/trek/values.yaml +123 -0
- client/.gitignore +5 -0
- client/.prettierrc +27 -0
- client/e2e/auth.setup.ts +42 -0
- client/e2e/create-trip.spec.ts +25 -0
- client/e2e/dashboard.spec.ts +10 -0
- client/e2e/login.public.spec.ts +8 -0
- client/e2e/server-launch.mjs +43 -0
- client/e2e/trip-planner.spec.ts +23 -0
- client/eslint.config.mjs +78 -0
- client/index.html +32 -0
- client/package.json +88 -0
.dockerignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules
|
| 2 |
+
client/node_modules
|
| 3 |
+
server/node_modules
|
| 4 |
+
client/dist
|
| 5 |
+
shared/dist
|
| 6 |
+
data
|
| 7 |
+
uploads
|
| 8 |
+
.git
|
| 9 |
+
.github
|
| 10 |
+
**/.env
|
| 11 |
+
**/.env.*
|
| 12 |
+
*.log
|
| 13 |
+
*.md
|
| 14 |
+
!client/**/*.md
|
| 15 |
+
chart/
|
| 16 |
+
docs/
|
| 17 |
+
docker-compose.yml
|
| 18 |
+
unraid-template.xml
|
| 19 |
+
*.sqlite
|
| 20 |
+
*.sqlite-shm
|
| 21 |
+
*.sqlite-wal
|
| 22 |
+
*.db
|
| 23 |
+
*.db-shm
|
| 24 |
+
*.db-wal
|
| 25 |
+
**/coverage
|
| 26 |
+
.DS_Store
|
| 27 |
+
Thumbs.db
|
| 28 |
+
.vscode
|
| 29 |
+
.idea
|
| 30 |
+
sonar-project.properties
|
| 31 |
+
server/tests/
|
| 32 |
+
server/vitest.config.ts
|
| 33 |
+
server/reset-admin.js
|
| 34 |
+
**/*.test.ts
|
| 35 |
+
wiki/
|
| 36 |
+
scripts/
|
| 37 |
+
charts/
|
.gitattributes
CHANGED
|
@@ -1,35 +1,34 @@
|
|
| 1 |
-
|
| 2 |
-
*
|
| 3 |
-
|
| 4 |
-
*.
|
| 5 |
-
*.
|
| 6 |
-
*.
|
| 7 |
-
*.
|
| 8 |
-
*.
|
| 9 |
-
*.
|
| 10 |
-
*.
|
| 11 |
-
*.
|
| 12 |
-
*.
|
| 13 |
-
*.
|
| 14 |
-
*.
|
| 15 |
-
*.
|
| 16 |
-
|
| 17 |
-
*.
|
| 18 |
-
*.
|
| 19 |
-
*.
|
| 20 |
-
*.
|
| 21 |
-
*.
|
| 22 |
-
*.
|
| 23 |
-
*.
|
| 24 |
-
*.
|
| 25 |
-
*.
|
| 26 |
-
|
| 27 |
-
*.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
# Normalize line endings to LF on commit
|
| 2 |
+
* text=auto eol=lf
|
| 3 |
+
# Explicitly enforce LF for source files
|
| 4 |
+
*.ts text eol=lf
|
| 5 |
+
*.tsx text eol=lf
|
| 6 |
+
*.js text eol=lf
|
| 7 |
+
*.jsx text eol=lf
|
| 8 |
+
*.json text eol=lf
|
| 9 |
+
*.css text eol=lf
|
| 10 |
+
*.html text eol=lf
|
| 11 |
+
*.md text eol=lf
|
| 12 |
+
*.yml text eol=lf
|
| 13 |
+
*.yaml text eol=lf
|
| 14 |
+
*.py text eol=lf
|
| 15 |
+
*.sh text eol=lf
|
| 16 |
+
# Binary files — no line ending conversion
|
| 17 |
+
*.png binary
|
| 18 |
+
*.jpg binary
|
| 19 |
+
*.jpeg binary
|
| 20 |
+
*.gif binary
|
| 21 |
+
*.ico binary
|
| 22 |
+
*.woff binary
|
| 23 |
+
*.woff2 binary
|
| 24 |
+
*.ttf binary
|
| 25 |
+
*.eot binary
|
| 26 |
+
*.pdf binary
|
| 27 |
+
*.zip binary
|
| 28 |
+
client/public/fonts/Poppins-Bold.ttf filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
client/public/fonts/Poppins-Italic.ttf filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
client/public/fonts/Poppins-Medium.ttf filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
client/public/fonts/Poppins-Regular.ttf filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
client/public/fonts/Poppins-SemiBold.ttf filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
client/public/icons/trek-loading-dark.gif filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
client/public/icons/trek-loading-light.gif filter=lfs diff=lfs merge=lfs -text
|
|
|
.github/FUNDING.yml
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ko_fi: mauriceboe
|
| 2 |
+
buy_me_a_coffee: mauriceboe
|
.github/ISSUE_TEMPLATE/bug_report.yml
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Bug Report
|
| 2 |
+
description: Create a report to help us improve TREK
|
| 3 |
+
title: "[BUG] "
|
| 4 |
+
labels: []
|
| 5 |
+
body:
|
| 6 |
+
- type: checkboxes
|
| 7 |
+
id: preflight
|
| 8 |
+
attributes:
|
| 9 |
+
label: Pre-flight checklist
|
| 10 |
+
options:
|
| 11 |
+
- label: I have searched [existing issues](https://github.com/mauriceboe/TREK/issues) and this bug has not been reported yet
|
| 12 |
+
required: true
|
| 13 |
+
- label: I am running the latest available version of TREK
|
| 14 |
+
required: true
|
| 15 |
+
- label: I have read the [Troubleshooting guide](https://github.com/mauriceboe/TREK/wiki/Troubleshooting) and my issue is not covered there
|
| 16 |
+
required: true
|
| 17 |
+
|
| 18 |
+
- type: input
|
| 19 |
+
id: version
|
| 20 |
+
attributes:
|
| 21 |
+
label: TREK version
|
| 22 |
+
description: Found in the Settings → About, or in the Docker image tag
|
| 23 |
+
placeholder: "e.g. 2.8.0"
|
| 24 |
+
validations:
|
| 25 |
+
required: true
|
| 26 |
+
|
| 27 |
+
- type: textarea
|
| 28 |
+
id: description
|
| 29 |
+
attributes:
|
| 30 |
+
label: Describe the bug
|
| 31 |
+
description: A clear and concise description of what the bug is.
|
| 32 |
+
placeholder: When I do X, Y happens instead of Z…
|
| 33 |
+
validations:
|
| 34 |
+
required: true
|
| 35 |
+
|
| 36 |
+
- type: textarea
|
| 37 |
+
id: steps
|
| 38 |
+
attributes:
|
| 39 |
+
label: Steps to reproduce
|
| 40 |
+
description: Step-by-step instructions to reliably trigger the bug.
|
| 41 |
+
placeholder: |
|
| 42 |
+
1. Go to '...'
|
| 43 |
+
2. Click on '...'
|
| 44 |
+
3. See error
|
| 45 |
+
validations:
|
| 46 |
+
required: true
|
| 47 |
+
|
| 48 |
+
- type: textarea
|
| 49 |
+
id: expected
|
| 50 |
+
attributes:
|
| 51 |
+
label: Expected behavior
|
| 52 |
+
description: What did you expect to happen?
|
| 53 |
+
validations:
|
| 54 |
+
required: true
|
| 55 |
+
|
| 56 |
+
- type: dropdown
|
| 57 |
+
id: deployment
|
| 58 |
+
attributes:
|
| 59 |
+
label: Deployment method
|
| 60 |
+
options:
|
| 61 |
+
- Docker Compose
|
| 62 |
+
- Docker (standalone)
|
| 63 |
+
- Kubernetes / Helm
|
| 64 |
+
- Unraid template
|
| 65 |
+
- Proxmox Community Script
|
| 66 |
+
- Sources
|
| 67 |
+
- Other
|
| 68 |
+
validations:
|
| 69 |
+
required: true
|
| 70 |
+
|
| 71 |
+
- type: input
|
| 72 |
+
id: os
|
| 73 |
+
attributes:
|
| 74 |
+
label: Host OS
|
| 75 |
+
placeholder: "e.g. Ubuntu 24.04, Unraid 6.12, Synology DSM 7"
|
| 76 |
+
|
| 77 |
+
- type: dropdown
|
| 78 |
+
id: user_os
|
| 79 |
+
attributes:
|
| 80 |
+
label: Accessing TREK from
|
| 81 |
+
options:
|
| 82 |
+
- Desktop browser
|
| 83 |
+
- Mobile browser
|
| 84 |
+
- Mobile app (PWA)
|
| 85 |
+
validations:
|
| 86 |
+
required: true
|
| 87 |
+
|
| 88 |
+
- type: input
|
| 89 |
+
id: browser
|
| 90 |
+
attributes:
|
| 91 |
+
label: Browser (if applicable)
|
| 92 |
+
placeholder: "e.g. Chrome 124, Firefox 125, Safari 17"
|
| 93 |
+
|
| 94 |
+
- type: textarea
|
| 95 |
+
id: logs
|
| 96 |
+
attributes:
|
| 97 |
+
label: Relevant logs or error output
|
| 98 |
+
description: Paste any relevant server or browser console output here.
|
| 99 |
+
render: shell
|
| 100 |
+
|
| 101 |
+
- type: textarea
|
| 102 |
+
id: screenshots
|
| 103 |
+
attributes:
|
| 104 |
+
label: Screenshots
|
| 105 |
+
description: Drag and drop screenshots here if applicable.
|
| 106 |
+
|
| 107 |
+
- type: textarea
|
| 108 |
+
id: context
|
| 109 |
+
attributes:
|
| 110 |
+
label: Additional context
|
| 111 |
+
description: Anything else that might help us understand the issue.
|
.github/ISSUE_TEMPLATE/config.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
blank_issues_enabled: false
|
| 2 |
+
contact_links:
|
| 3 |
+
- name: Documentation
|
| 4 |
+
url: https://github.com/mauriceboe/TREK/wiki
|
| 5 |
+
about: Check the docs before opening an issue
|
| 6 |
+
- name: Feature Request
|
| 7 |
+
url: https://github.com/mauriceboe/TREK/discussions/new?category=feature-requests
|
| 8 |
+
about: Suggest a new feature or improvement in Discussions
|
| 9 |
+
- name: Questions & Help
|
| 10 |
+
url: https://github.com/mauriceboe/TREK/discussions
|
| 11 |
+
about: For questions and general help, use Discussions instead
|
.github/PULL_REQUEST_TEMPLATE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Description
|
| 2 |
+
<!-- What does this PR do? Why? -->
|
| 3 |
+
|
| 4 |
+
## Related Issue or Discussion
|
| 5 |
+
<!-- This project requires an issue or an approved feature request before submitting a PR. -->
|
| 6 |
+
<!-- For bug fixes: Closes #ISSUE_NUMBER -->
|
| 7 |
+
<!-- For features: Addresses discussion #DISCUSSION_NUMBER -->
|
| 8 |
+
|
| 9 |
+
## Type of Change
|
| 10 |
+
- [ ] Bug fix
|
| 11 |
+
- [ ] New feature
|
| 12 |
+
- [ ] Breaking change
|
| 13 |
+
- [ ] Documentation update
|
| 14 |
+
|
| 15 |
+
## Checklist
|
| 16 |
+
- [ ] I have read the [Contributing Guidelines](https://github.com/mauriceboe/TREK/wiki/Contributing)
|
| 17 |
+
- [ ] My branch is [up to date with `dev`](https://github.com/mauriceboe/TREK/wiki/Development-environment#3-keep-your-fork-up-to-date)
|
| 18 |
+
- [ ] This PR targets the `dev` branch, not `main` *(wiki-only PRs are exempt)*
|
| 19 |
+
- [ ] I have tested my changes locally
|
| 20 |
+
- [ ] I have added/updated tests that prove my fix is effective or that my feature works
|
| 21 |
+
- [ ] I have updated documentation if needed
|
.github/workflows/close-stale-invalid-titles.yml
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Close issues with unchanged bad titles
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule:
|
| 5 |
+
- cron: '0 */6 * * *' # Every 6 hours
|
| 6 |
+
|
| 7 |
+
permissions:
|
| 8 |
+
issues: write
|
| 9 |
+
|
| 10 |
+
jobs:
|
| 11 |
+
close-stale:
|
| 12 |
+
runs-on: ubuntu-latest
|
| 13 |
+
steps:
|
| 14 |
+
- name: Close stale invalid-title issues
|
| 15 |
+
uses: actions/github-script@v7
|
| 16 |
+
with:
|
| 17 |
+
script: |
|
| 18 |
+
const badTitles = [
|
| 19 |
+
"[bug]", "bug report", "bug", "issue",
|
| 20 |
+
"help", "question", "test", "...", "untitled"
|
| 21 |
+
];
|
| 22 |
+
|
| 23 |
+
const { data: issues } = await github.rest.issues.listForRepo({
|
| 24 |
+
owner: context.repo.owner,
|
| 25 |
+
repo: context.repo.repo,
|
| 26 |
+
labels: 'invalid-title',
|
| 27 |
+
state: 'open',
|
| 28 |
+
per_page: 100,
|
| 29 |
+
});
|
| 30 |
+
|
| 31 |
+
const twentyFourHoursAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
| 32 |
+
|
| 33 |
+
for (const issue of issues) {
|
| 34 |
+
const createdAt = new Date(issue.created_at);
|
| 35 |
+
if (createdAt > twentyFourHoursAgo) continue; // grace period not over yet
|
| 36 |
+
|
| 37 |
+
const titleLower = issue.title.trim().toLowerCase();
|
| 38 |
+
|
| 39 |
+
if (!badTitles.includes(titleLower)) {
|
| 40 |
+
// Title was fixed — remove the label and move on
|
| 41 |
+
await github.rest.issues.removeLabel({
|
| 42 |
+
owner: context.repo.owner,
|
| 43 |
+
repo: context.repo.repo,
|
| 44 |
+
issue_number: issue.number,
|
| 45 |
+
name: 'invalid-title',
|
| 46 |
+
});
|
| 47 |
+
continue;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
// Still a bad title after 24h — close it
|
| 51 |
+
await github.rest.issues.createComment({
|
| 52 |
+
owner: context.repo.owner,
|
| 53 |
+
repo: context.repo.repo,
|
| 54 |
+
issue_number: issue.number,
|
| 55 |
+
body: [
|
| 56 |
+
'## Issue closed',
|
| 57 |
+
'',
|
| 58 |
+
'This issue has been automatically closed because the title was not updated within 24 hours.',
|
| 59 |
+
'',
|
| 60 |
+
'Feel free to open a new issue with a descriptive title that summarizes the problem.',
|
| 61 |
+
].join('\n'),
|
| 62 |
+
});
|
| 63 |
+
|
| 64 |
+
await github.rest.issues.update({
|
| 65 |
+
owner: context.repo.owner,
|
| 66 |
+
repo: context.repo.repo,
|
| 67 |
+
issue_number: issue.number,
|
| 68 |
+
state: 'closed',
|
| 69 |
+
state_reason: 'not_planned',
|
| 70 |
+
});
|
| 71 |
+
}
|
.github/workflows/close-stale-wrong-branch.yml
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Close PRs with unchanged wrong base branch
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
schedule:
|
| 5 |
+
- cron: '0 */6 * * *' # Every 6 hours
|
| 6 |
+
|
| 7 |
+
permissions:
|
| 8 |
+
pull-requests: write
|
| 9 |
+
issues: write
|
| 10 |
+
|
| 11 |
+
jobs:
|
| 12 |
+
close-stale:
|
| 13 |
+
runs-on: ubuntu-latest
|
| 14 |
+
steps:
|
| 15 |
+
- name: Close stale wrong-base-branch PRs
|
| 16 |
+
uses: actions/github-script@v7
|
| 17 |
+
with:
|
| 18 |
+
script: |
|
| 19 |
+
const { data: pulls } = await github.rest.pulls.list({
|
| 20 |
+
owner: context.repo.owner,
|
| 21 |
+
repo: context.repo.repo,
|
| 22 |
+
state: 'open',
|
| 23 |
+
per_page: 100,
|
| 24 |
+
});
|
| 25 |
+
|
| 26 |
+
const twentyFourHoursAgo = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
| 27 |
+
|
| 28 |
+
for (const pull of pulls) {
|
| 29 |
+
const hasBypass = pull.labels.some(l => l.name === 'bypass-branch-check');
|
| 30 |
+
if (hasBypass) continue;
|
| 31 |
+
|
| 32 |
+
const hasLabel = pull.labels.some(l => l.name === 'wrong-base-branch');
|
| 33 |
+
if (!hasLabel) continue;
|
| 34 |
+
|
| 35 |
+
// Wiki-only PRs are exempt — clear label and skip
|
| 36 |
+
const files = [];
|
| 37 |
+
for (let page = 1; ; page++) {
|
| 38 |
+
const { data } = await github.rest.pulls.listFiles({
|
| 39 |
+
owner: context.repo.owner,
|
| 40 |
+
repo: context.repo.repo,
|
| 41 |
+
pull_number: pull.number,
|
| 42 |
+
per_page: 100,
|
| 43 |
+
page,
|
| 44 |
+
});
|
| 45 |
+
files.push(...data);
|
| 46 |
+
if (data.length < 100) break;
|
| 47 |
+
}
|
| 48 |
+
const allWiki = files.length > 0 && files.every(f => f.filename.startsWith('wiki/'));
|
| 49 |
+
if (allWiki) {
|
| 50 |
+
await github.rest.issues.removeLabel({
|
| 51 |
+
owner: context.repo.owner,
|
| 52 |
+
repo: context.repo.repo,
|
| 53 |
+
issue_number: pull.number,
|
| 54 |
+
name: 'wrong-base-branch',
|
| 55 |
+
});
|
| 56 |
+
continue;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
const createdAt = new Date(pull.created_at);
|
| 60 |
+
if (createdAt > twentyFourHoursAgo) continue; // grace period not over yet
|
| 61 |
+
|
| 62 |
+
// Base was fixed — remove label and move on
|
| 63 |
+
if (pull.base.ref !== 'main') {
|
| 64 |
+
await github.rest.issues.removeLabel({
|
| 65 |
+
owner: context.repo.owner,
|
| 66 |
+
repo: context.repo.repo,
|
| 67 |
+
issue_number: pull.number,
|
| 68 |
+
name: 'wrong-base-branch',
|
| 69 |
+
});
|
| 70 |
+
continue;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
// Still targeting main after 24h — close it
|
| 74 |
+
await github.rest.issues.createComment({
|
| 75 |
+
owner: context.repo.owner,
|
| 76 |
+
repo: context.repo.repo,
|
| 77 |
+
issue_number: pull.number,
|
| 78 |
+
body: [
|
| 79 |
+
'## PR closed',
|
| 80 |
+
'',
|
| 81 |
+
'This PR has been automatically closed because the base branch was not updated to `dev` within 24 hours.',
|
| 82 |
+
'',
|
| 83 |
+
'Feel free to open a new PR targeting `dev`.',
|
| 84 |
+
].join('\n'),
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
await github.rest.pulls.update({
|
| 88 |
+
owner: context.repo.owner,
|
| 89 |
+
repo: context.repo.repo,
|
| 90 |
+
pull_number: pull.number,
|
| 91 |
+
state: 'closed',
|
| 92 |
+
});
|
| 93 |
+
}
|
.github/workflows/close-untitled-issues.yml
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Flag issues with bad titles
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
issues:
|
| 5 |
+
types: [opened]
|
| 6 |
+
|
| 7 |
+
permissions:
|
| 8 |
+
issues: write
|
| 9 |
+
|
| 10 |
+
jobs:
|
| 11 |
+
check-title:
|
| 12 |
+
runs-on: ubuntu-latest
|
| 13 |
+
steps:
|
| 14 |
+
- name: Flag or redirect issue
|
| 15 |
+
uses: actions/github-script@v7
|
| 16 |
+
with:
|
| 17 |
+
script: |
|
| 18 |
+
const title = context.payload.issue.title.trim();
|
| 19 |
+
const titleLower = title.toLowerCase();
|
| 20 |
+
|
| 21 |
+
const badTitles = [
|
| 22 |
+
"[bug]", "bug report", "bug", "issue",
|
| 23 |
+
"help", "question", "test", "...", "untitled"
|
| 24 |
+
];
|
| 25 |
+
|
| 26 |
+
const featureRequestTitles = [
|
| 27 |
+
"feature request", "[feature]", "[feature request]", "[enhancement]"
|
| 28 |
+
];
|
| 29 |
+
|
| 30 |
+
if (badTitles.includes(titleLower)) {
|
| 31 |
+
// Ensure the label exists
|
| 32 |
+
try {
|
| 33 |
+
await github.rest.issues.getLabel({
|
| 34 |
+
owner: context.repo.owner,
|
| 35 |
+
repo: context.repo.repo,
|
| 36 |
+
name: 'invalid-title',
|
| 37 |
+
});
|
| 38 |
+
} catch {
|
| 39 |
+
await github.rest.issues.createLabel({
|
| 40 |
+
owner: context.repo.owner,
|
| 41 |
+
repo: context.repo.repo,
|
| 42 |
+
name: 'invalid-title',
|
| 43 |
+
color: 'e4e669',
|
| 44 |
+
description: 'Issue title does not meet quality standards',
|
| 45 |
+
});
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
await github.rest.issues.addLabels({
|
| 49 |
+
owner: context.repo.owner,
|
| 50 |
+
repo: context.repo.repo,
|
| 51 |
+
issue_number: context.payload.issue.number,
|
| 52 |
+
labels: ['invalid-title'],
|
| 53 |
+
});
|
| 54 |
+
|
| 55 |
+
await github.rest.issues.createComment({
|
| 56 |
+
owner: context.repo.owner,
|
| 57 |
+
repo: context.repo.repo,
|
| 58 |
+
issue_number: context.payload.issue.number,
|
| 59 |
+
body: [
|
| 60 |
+
'## Invalid title',
|
| 61 |
+
'',
|
| 62 |
+
`Your issue title \`${title}\` is too generic to be actionable.`,
|
| 63 |
+
'',
|
| 64 |
+
'Please edit the title to something descriptive that summarizes the problem — for example:',
|
| 65 |
+
'> _Map view crashes when zooming in on Safari 17_',
|
| 66 |
+
'',
|
| 67 |
+
'**This issue will be automatically closed in 24 hours if the title has not been updated.**',
|
| 68 |
+
].join('\n'),
|
| 69 |
+
});
|
| 70 |
+
|
| 71 |
+
} else if (featureRequestTitles.some(t => titleLower.startsWith(t))) {
|
| 72 |
+
await github.rest.issues.createComment({
|
| 73 |
+
owner: context.repo.owner,
|
| 74 |
+
repo: context.repo.repo,
|
| 75 |
+
issue_number: context.payload.issue.number,
|
| 76 |
+
body: [
|
| 77 |
+
'## Wrong place for feature requests',
|
| 78 |
+
'',
|
| 79 |
+
'Feature requests should be submitted in [Discussions](https://github.com/mauriceboe/TREK/discussions/new?category=feature-requests), not as issues.',
|
| 80 |
+
'',
|
| 81 |
+
'This issue has been closed. Feel free to re-submit your idea in the right place!',
|
| 82 |
+
].join('\n'),
|
| 83 |
+
});
|
| 84 |
+
|
| 85 |
+
await github.rest.issues.update({
|
| 86 |
+
owner: context.repo.owner,
|
| 87 |
+
repo: context.repo.repo,
|
| 88 |
+
issue_number: context.payload.issue.number,
|
| 89 |
+
state: 'closed',
|
| 90 |
+
state_reason: 'not_planned',
|
| 91 |
+
});
|
| 92 |
+
}
|
.github/workflows/docker-dev.yml
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build & Push Docker Image (Prerelease)
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
inputs:
|
| 6 |
+
bump:
|
| 7 |
+
description: 'Bump line for next prerelease (auto detects in-flight major)'
|
| 8 |
+
type: choice
|
| 9 |
+
options: [auto, minor, major]
|
| 10 |
+
default: auto
|
| 11 |
+
|
| 12 |
+
permissions:
|
| 13 |
+
contents: write
|
| 14 |
+
|
| 15 |
+
concurrency:
|
| 16 |
+
group: prerelease-build
|
| 17 |
+
cancel-in-progress: false
|
| 18 |
+
|
| 19 |
+
jobs:
|
| 20 |
+
version-bump:
|
| 21 |
+
runs-on: ubuntu-latest
|
| 22 |
+
outputs:
|
| 23 |
+
version: ${{ steps.bump.outputs.VERSION }}
|
| 24 |
+
sha: ${{ steps.bump.outputs.SHA }}
|
| 25 |
+
steps:
|
| 26 |
+
- uses: actions/checkout@v4
|
| 27 |
+
with:
|
| 28 |
+
fetch-depth: 0
|
| 29 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
| 30 |
+
|
| 31 |
+
- name: Determine prerelease version
|
| 32 |
+
id: bump
|
| 33 |
+
run: |
|
| 34 |
+
git fetch --tags
|
| 35 |
+
|
| 36 |
+
# Capture the exact commit we're building so build/merge jobs are pinned to it
|
| 37 |
+
echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
| 38 |
+
|
| 39 |
+
# Get latest stable tag (exclude prerelease tags)
|
| 40 |
+
STABLE_TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | grep -v '\-pre\.' | sort -V | tail -1)
|
| 41 |
+
STABLE="${STABLE_TAG#v}"
|
| 42 |
+
STABLE="${STABLE:-0.0.0}"
|
| 43 |
+
echo "Latest stable: $STABLE"
|
| 44 |
+
|
| 45 |
+
IFS='.' read -r MAJOR MINOR PATCH <<< "$STABLE"
|
| 46 |
+
|
| 47 |
+
# Detect any in-flight major prerelease (v(MAJOR+1).0.0-pre.*). Stay on that line if found.
|
| 48 |
+
NEXT_MAJOR="$((MAJOR + 1)).0.0"
|
| 49 |
+
MAJOR_PRE_EXISTS=$(git tag -l "v${NEXT_MAJOR}-pre.*" | head -1)
|
| 50 |
+
|
| 51 |
+
BUMP_INPUT="${{ github.event.inputs.bump || 'auto' }}"
|
| 52 |
+
|
| 53 |
+
if [ "$BUMP_INPUT" = "major" ] || { [ "$BUMP_INPUT" = "auto" ] && [ -n "$MAJOR_PRE_EXISTS" ]; }; then
|
| 54 |
+
TARGET="$NEXT_MAJOR"
|
| 55 |
+
else
|
| 56 |
+
TARGET="${MAJOR}.$((MINOR + 1)).0"
|
| 57 |
+
fi
|
| 58 |
+
echo "Target: $TARGET"
|
| 59 |
+
|
| 60 |
+
# Find the highest existing prerelease N for this target and increment
|
| 61 |
+
LAST_N=$(git tag -l "v${TARGET}-pre.*" | sed 's/.*-pre\.//' | sort -n | tail -1)
|
| 62 |
+
N=$(( ${LAST_N:-0} + 1 ))
|
| 63 |
+
|
| 64 |
+
NEW_VERSION="${TARGET}-pre.${N}"
|
| 65 |
+
echo "VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
|
| 66 |
+
echo "$STABLE → $NEW_VERSION"
|
| 67 |
+
|
| 68 |
+
build:
|
| 69 |
+
runs-on: ${{ matrix.runner }}
|
| 70 |
+
needs: version-bump
|
| 71 |
+
strategy:
|
| 72 |
+
fail-fast: false
|
| 73 |
+
matrix:
|
| 74 |
+
include:
|
| 75 |
+
- platform: linux/amd64
|
| 76 |
+
runner: ubuntu-latest
|
| 77 |
+
- platform: linux/arm64
|
| 78 |
+
runner: ubuntu-24.04-arm
|
| 79 |
+
steps:
|
| 80 |
+
- name: Prepare platform tag-safe name
|
| 81 |
+
run: echo "PLATFORM_PAIR=$(echo ${{ matrix.platform }} | sed 's|/|-|g')" >> $GITHUB_ENV
|
| 82 |
+
|
| 83 |
+
- uses: actions/checkout@v4
|
| 84 |
+
with:
|
| 85 |
+
ref: ${{ needs.version-bump.outputs.sha }}
|
| 86 |
+
|
| 87 |
+
- uses: docker/setup-buildx-action@v3
|
| 88 |
+
|
| 89 |
+
- uses: docker/login-action@v3
|
| 90 |
+
with:
|
| 91 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 92 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 93 |
+
|
| 94 |
+
- name: Build and push by digest
|
| 95 |
+
id: build
|
| 96 |
+
uses: docker/build-push-action@v6
|
| 97 |
+
with:
|
| 98 |
+
context: .
|
| 99 |
+
platforms: ${{ matrix.platform }}
|
| 100 |
+
outputs: type=image,name=mauriceboe/trek,push-by-digest=true,name-canonical=true,push=true
|
| 101 |
+
no-cache: true
|
| 102 |
+
build-args: |
|
| 103 |
+
APP_VERSION=${{ needs.version-bump.outputs.version }}
|
| 104 |
+
|
| 105 |
+
- name: Export digest
|
| 106 |
+
run: |
|
| 107 |
+
mkdir -p /tmp/digests
|
| 108 |
+
digest="${{ steps.build.outputs.digest }}"
|
| 109 |
+
touch "/tmp/digests/${digest#sha256:}"
|
| 110 |
+
|
| 111 |
+
- name: Upload digest artifact
|
| 112 |
+
uses: actions/upload-artifact@v4
|
| 113 |
+
with:
|
| 114 |
+
name: digests-${{ env.PLATFORM_PAIR }}
|
| 115 |
+
path: /tmp/digests/*
|
| 116 |
+
if-no-files-found: error
|
| 117 |
+
retention-days: 1
|
| 118 |
+
|
| 119 |
+
merge:
|
| 120 |
+
runs-on: ubuntu-latest
|
| 121 |
+
needs: [version-bump, build]
|
| 122 |
+
steps:
|
| 123 |
+
- uses: actions/checkout@v4
|
| 124 |
+
with:
|
| 125 |
+
ref: ${{ needs.version-bump.outputs.sha }}
|
| 126 |
+
fetch-depth: 0
|
| 127 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
| 128 |
+
|
| 129 |
+
- name: Download build digests
|
| 130 |
+
uses: actions/download-artifact@v4
|
| 131 |
+
with:
|
| 132 |
+
path: /tmp/digests
|
| 133 |
+
pattern: digests-*
|
| 134 |
+
merge-multiple: true
|
| 135 |
+
|
| 136 |
+
- uses: docker/setup-buildx-action@v3
|
| 137 |
+
|
| 138 |
+
- uses: docker/login-action@v3
|
| 139 |
+
with:
|
| 140 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 141 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 142 |
+
|
| 143 |
+
- name: Create and push multi-arch manifest
|
| 144 |
+
working-directory: /tmp/digests
|
| 145 |
+
run: |
|
| 146 |
+
VERSION="${{ needs.version-bump.outputs.version }}"
|
| 147 |
+
mapfile -t digests < <(printf 'mauriceboe/trek@sha256:%s\n' *)
|
| 148 |
+
MAJOR_TAG="$(echo "$VERSION" | cut -d. -f1)-pre"
|
| 149 |
+
docker buildx imagetools create \
|
| 150 |
+
-t "mauriceboe/trek:latest-pre" \
|
| 151 |
+
-t "mauriceboe/trek:$MAJOR_TAG" \
|
| 152 |
+
-t "mauriceboe/trek:$VERSION" \
|
| 153 |
+
"${digests[@]}"
|
| 154 |
+
|
| 155 |
+
- name: Inspect manifest
|
| 156 |
+
run: docker buildx imagetools inspect mauriceboe/trek:latest-pre
|
| 157 |
+
|
| 158 |
+
- name: Push git tag
|
| 159 |
+
run: |
|
| 160 |
+
VERSION="${{ needs.version-bump.outputs.version }}"
|
| 161 |
+
git config user.name "github-actions[bot]"
|
| 162 |
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
| 163 |
+
git tag "v$VERSION"
|
| 164 |
+
git push origin "v$VERSION"
|
| 165 |
+
|
| 166 |
+
- name: Clean up old prerelease tags
|
| 167 |
+
env:
|
| 168 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 169 |
+
run: |
|
| 170 |
+
KEEP=20
|
| 171 |
+
VERSION="${{ needs.version-bump.outputs.version }}"
|
| 172 |
+
BASE_VERSION="$(echo "$VERSION" | sed 's/-pre\..*//')"
|
| 173 |
+
git fetch --tags
|
| 174 |
+
# Sort by numeric prerelease N (field after -pre.) to get correct ascending order
|
| 175 |
+
mapfile -t ALL_TAGS < <(git tag -l "v${BASE_VERSION}-pre.*" | awk -F'-pre\\.' '{print $2" "$0}' | sort -n | awk '{print $2}')
|
| 176 |
+
TOTAL=${#ALL_TAGS[@]}
|
| 177 |
+
DELETE_COUNT=$((TOTAL - KEEP))
|
| 178 |
+
if [ "$DELETE_COUNT" -gt 0 ]; then
|
| 179 |
+
for TAG in "${ALL_TAGS[@]:0:$DELETE_COUNT}"; do
|
| 180 |
+
echo "Deleting old prerelease tag: $TAG"
|
| 181 |
+
git push origin --delete "$TAG"
|
| 182 |
+
done
|
| 183 |
+
fi
|
.github/workflows/docker.yml
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build & Push Docker Image
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
paths-ignore:
|
| 7 |
+
- 'docs/**'
|
| 8 |
+
- '**/*.md'
|
| 9 |
+
- 'wiki/**'
|
| 10 |
+
- '.github/workflows/**'
|
| 11 |
+
- '.github/ISSUE_TEMPLATE/**'
|
| 12 |
+
- '.github/FUNDING.yml'
|
| 13 |
+
- '.github/PULL_REQUEST_TEMPLATE.md'
|
| 14 |
+
workflow_dispatch:
|
| 15 |
+
inputs:
|
| 16 |
+
bump:
|
| 17 |
+
description: 'Force bump line (auto = patch/finalize as today)'
|
| 18 |
+
type: choice
|
| 19 |
+
options: [auto, patch, minor, major]
|
| 20 |
+
default: auto
|
| 21 |
+
confirm_major:
|
| 22 |
+
description: "Type MAJOR (all caps) to confirm a major release"
|
| 23 |
+
type: string
|
| 24 |
+
default: ''
|
| 25 |
+
|
| 26 |
+
permissions:
|
| 27 |
+
contents: write
|
| 28 |
+
|
| 29 |
+
concurrency:
|
| 30 |
+
group: stable-build
|
| 31 |
+
cancel-in-progress: false
|
| 32 |
+
|
| 33 |
+
jobs:
|
| 34 |
+
version-bump:
|
| 35 |
+
runs-on: ubuntu-latest
|
| 36 |
+
outputs:
|
| 37 |
+
version: ${{ steps.bump.outputs.VERSION }}
|
| 38 |
+
steps:
|
| 39 |
+
- uses: actions/checkout@v4
|
| 40 |
+
with:
|
| 41 |
+
fetch-depth: 0
|
| 42 |
+
fetch-tags: true
|
| 43 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
| 44 |
+
|
| 45 |
+
- name: Determine bump type and update version
|
| 46 |
+
id: bump
|
| 47 |
+
run: |
|
| 48 |
+
git fetch --tags
|
| 49 |
+
|
| 50 |
+
# Derive version from git tags — no package.json dependency
|
| 51 |
+
STABLE_TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | grep -v '\-pre\.' | sort -V | tail -1)
|
| 52 |
+
STABLE="${STABLE_TAG#v}"
|
| 53 |
+
STABLE="${STABLE:-0.0.0}"
|
| 54 |
+
|
| 55 |
+
PRE_TAG=$(git tag -l 'v*-pre.*' | sort -V | tail -1)
|
| 56 |
+
|
| 57 |
+
BUMP_INPUT="${{ github.event.inputs.bump || 'auto' }}"
|
| 58 |
+
IFS='.' read -r MAJOR MINOR PATCH <<< "$STABLE"
|
| 59 |
+
|
| 60 |
+
if [ "$BUMP_INPUT" = "major" ]; then
|
| 61 |
+
if [ "${{ github.event.inputs.confirm_major }}" != "MAJOR" ]; then
|
| 62 |
+
echo "::error::confirm_major must equal 'MAJOR' to cut a major release"
|
| 63 |
+
exit 1
|
| 64 |
+
fi
|
| 65 |
+
NEW_VERSION="$((MAJOR + 1)).0.0"
|
| 66 |
+
BUMP="major"
|
| 67 |
+
elif [ "$BUMP_INPUT" = "minor" ]; then
|
| 68 |
+
NEW_VERSION="${MAJOR}.$((MINOR + 1)).0"
|
| 69 |
+
BUMP="minor"
|
| 70 |
+
elif [ "$BUMP_INPUT" = "patch" ]; then
|
| 71 |
+
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
|
| 72 |
+
BUMP="patch"
|
| 73 |
+
else
|
| 74 |
+
# auto: finalize in-flight prerelease if one exists, else patch
|
| 75 |
+
if [ -n "$PRE_TAG" ]; then
|
| 76 |
+
PRE_BASE="${PRE_TAG#v}"
|
| 77 |
+
PRE_BASE="${PRE_BASE%-pre.*}"
|
| 78 |
+
PRE_MAJOR="$(echo "$PRE_BASE" | cut -d. -f1)"
|
| 79 |
+
# Refuse to auto-finalize a major bump — it bypasses confirm_major
|
| 80 |
+
if [ "$PRE_MAJOR" -gt "$MAJOR" ]; then
|
| 81 |
+
echo "::error::In-flight prerelease $PRE_TAG is a major bump ($STABLE → $PRE_BASE). Use bump=major with confirm_major=MAJOR to finalize."
|
| 82 |
+
exit 1
|
| 83 |
+
fi
|
| 84 |
+
# If prerelease base is strictly greater than stable, finalize it
|
| 85 |
+
HIGHEST=$(printf '%s\n' "$PRE_BASE" "$STABLE" | sort -V | tail -1)
|
| 86 |
+
if [ "$HIGHEST" = "$PRE_BASE" ] && [ "$PRE_BASE" != "$STABLE" ]; then
|
| 87 |
+
NEW_VERSION="$PRE_BASE"
|
| 88 |
+
BUMP="finalize"
|
| 89 |
+
else
|
| 90 |
+
PATCH=$((PATCH + 1))
|
| 91 |
+
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
| 92 |
+
BUMP="patch"
|
| 93 |
+
fi
|
| 94 |
+
else
|
| 95 |
+
PATCH=$((PATCH + 1))
|
| 96 |
+
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
| 97 |
+
BUMP="patch"
|
| 98 |
+
fi
|
| 99 |
+
fi
|
| 100 |
+
|
| 101 |
+
echo "Bump type: $BUMP"
|
| 102 |
+
echo "VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
|
| 103 |
+
echo "$STABLE → $NEW_VERSION ($BUMP)"
|
| 104 |
+
|
| 105 |
+
# Update all workspace + root package.json files and the root lockfile in one shot
|
| 106 |
+
npm version "$NEW_VERSION" --workspaces --include-workspace-root --no-git-tag-version
|
| 107 |
+
sed -i "s/^version: .*/version: $NEW_VERSION/" charts/trek/Chart.yaml
|
| 108 |
+
sed -i "s/^appVersion: .*/appVersion: \"$NEW_VERSION\"/" charts/trek/Chart.yaml
|
| 109 |
+
|
| 110 |
+
# Commit and tag
|
| 111 |
+
git config user.name "github-actions[bot]"
|
| 112 |
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
| 113 |
+
git add package.json package-lock.json server/package.json client/package.json shared/package.json charts/trek/Chart.yaml
|
| 114 |
+
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
|
| 115 |
+
git tag "v$NEW_VERSION"
|
| 116 |
+
git push origin main --follow-tags
|
| 117 |
+
|
| 118 |
+
build:
|
| 119 |
+
runs-on: ${{ matrix.runner }}
|
| 120 |
+
needs: version-bump
|
| 121 |
+
strategy:
|
| 122 |
+
fail-fast: false
|
| 123 |
+
matrix:
|
| 124 |
+
include:
|
| 125 |
+
- platform: linux/amd64
|
| 126 |
+
runner: ubuntu-latest
|
| 127 |
+
- platform: linux/arm64
|
| 128 |
+
runner: ubuntu-24.04-arm
|
| 129 |
+
steps:
|
| 130 |
+
- name: Prepare platform tag-safe name
|
| 131 |
+
run: echo "PLATFORM_PAIR=$(echo ${{ matrix.platform }} | sed 's|/|-|g')" >> $GITHUB_ENV
|
| 132 |
+
|
| 133 |
+
- uses: actions/checkout@v4
|
| 134 |
+
with:
|
| 135 |
+
ref: main
|
| 136 |
+
|
| 137 |
+
- uses: docker/setup-buildx-action@v3
|
| 138 |
+
|
| 139 |
+
- uses: docker/login-action@v3
|
| 140 |
+
with:
|
| 141 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 142 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 143 |
+
|
| 144 |
+
- name: Build and push by digest
|
| 145 |
+
id: build
|
| 146 |
+
uses: docker/build-push-action@v6
|
| 147 |
+
with:
|
| 148 |
+
context: .
|
| 149 |
+
platforms: ${{ matrix.platform }}
|
| 150 |
+
outputs: type=image,name=mauriceboe/trek,push-by-digest=true,name-canonical=true,push=true
|
| 151 |
+
no-cache: true
|
| 152 |
+
build-args: |
|
| 153 |
+
APP_VERSION=${{ needs.version-bump.outputs.version }}
|
| 154 |
+
|
| 155 |
+
- name: Export digest
|
| 156 |
+
run: |
|
| 157 |
+
mkdir -p /tmp/digests
|
| 158 |
+
digest="${{ steps.build.outputs.digest }}"
|
| 159 |
+
touch "/tmp/digests/${digest#sha256:}"
|
| 160 |
+
|
| 161 |
+
- name: Upload digest artifact
|
| 162 |
+
uses: actions/upload-artifact@v4
|
| 163 |
+
with:
|
| 164 |
+
name: digests-${{ env.PLATFORM_PAIR }}
|
| 165 |
+
path: /tmp/digests/*
|
| 166 |
+
if-no-files-found: error
|
| 167 |
+
retention-days: 1
|
| 168 |
+
|
| 169 |
+
merge:
|
| 170 |
+
runs-on: ubuntu-latest
|
| 171 |
+
needs: [version-bump, build]
|
| 172 |
+
steps:
|
| 173 |
+
- uses: actions/checkout@v4
|
| 174 |
+
with:
|
| 175 |
+
ref: main
|
| 176 |
+
|
| 177 |
+
- name: Download build digests
|
| 178 |
+
uses: actions/download-artifact@v4
|
| 179 |
+
with:
|
| 180 |
+
path: /tmp/digests
|
| 181 |
+
pattern: digests-*
|
| 182 |
+
merge-multiple: true
|
| 183 |
+
|
| 184 |
+
- uses: docker/setup-buildx-action@v3
|
| 185 |
+
|
| 186 |
+
- uses: docker/login-action@v3
|
| 187 |
+
with:
|
| 188 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 189 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 190 |
+
|
| 191 |
+
- name: Create and push multi-arch manifest
|
| 192 |
+
working-directory: /tmp/digests
|
| 193 |
+
run: |
|
| 194 |
+
VERSION="${{ needs.version-bump.outputs.version }}"
|
| 195 |
+
mapfile -t digests < <(printf 'mauriceboe/trek@sha256:%s\n' *)
|
| 196 |
+
MAJOR_TAG="$(echo "$VERSION" | cut -d. -f1)"
|
| 197 |
+
docker buildx imagetools create \
|
| 198 |
+
-t "mauriceboe/trek:latest" \
|
| 199 |
+
-t "mauriceboe/trek:$MAJOR_TAG" \
|
| 200 |
+
-t "mauriceboe/trek:$VERSION" \
|
| 201 |
+
"${digests[@]}"
|
| 202 |
+
|
| 203 |
+
- name: Inspect manifest
|
| 204 |
+
run: docker buildx imagetools inspect mauriceboe/trek:latest
|
| 205 |
+
|
| 206 |
+
release-helm:
|
| 207 |
+
runs-on: ubuntu-latest
|
| 208 |
+
needs: version-bump
|
| 209 |
+
steps:
|
| 210 |
+
- name: Checkout
|
| 211 |
+
uses: actions/checkout@v4
|
| 212 |
+
with:
|
| 213 |
+
ref: main
|
| 214 |
+
|
| 215 |
+
- name: Publish Helm chart
|
| 216 |
+
uses: stefanprodan/helm-gh-pages@v1.7.0
|
| 217 |
+
with:
|
| 218 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
| 219 |
+
charts_dir: charts
|
.github/workflows/enforce-target-branch.yml
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Enforce PR Target Branch
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request_target:
|
| 5 |
+
types: [opened, reopened, edited, synchronize]
|
| 6 |
+
|
| 7 |
+
jobs:
|
| 8 |
+
check-target:
|
| 9 |
+
runs-on: ubuntu-latest
|
| 10 |
+
permissions:
|
| 11 |
+
pull-requests: write
|
| 12 |
+
issues: write
|
| 13 |
+
contents: read
|
| 14 |
+
|
| 15 |
+
steps:
|
| 16 |
+
- name: Flag or clear wrong base branch
|
| 17 |
+
uses: actions/github-script@v7
|
| 18 |
+
with:
|
| 19 |
+
script: |
|
| 20 |
+
const base = context.payload.pull_request.base.ref;
|
| 21 |
+
const labels = context.payload.pull_request.labels.map(l => l.name);
|
| 22 |
+
const prNumber = context.payload.pull_request.number;
|
| 23 |
+
|
| 24 |
+
// bypass-branch-check label skips all enforcement
|
| 25 |
+
if (labels.includes('bypass-branch-check')) {
|
| 26 |
+
console.log('bypass-branch-check label present, skipping enforcement.');
|
| 27 |
+
return;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
// Wiki-only PRs are exempt from branch enforcement
|
| 31 |
+
const files = [];
|
| 32 |
+
for (let page = 1; ; page++) {
|
| 33 |
+
const { data } = await github.rest.pulls.listFiles({
|
| 34 |
+
owner: context.repo.owner,
|
| 35 |
+
repo: context.repo.repo,
|
| 36 |
+
pull_number: prNumber,
|
| 37 |
+
per_page: 100,
|
| 38 |
+
page,
|
| 39 |
+
});
|
| 40 |
+
files.push(...data);
|
| 41 |
+
if (data.length < 100) break;
|
| 42 |
+
}
|
| 43 |
+
const allWiki = files.length > 0 && files.every(f => f.filename.startsWith('wiki/'));
|
| 44 |
+
if (allWiki) {
|
| 45 |
+
console.log('All changed files are under wiki/ — skipping enforcement.');
|
| 46 |
+
if (labels.includes('wrong-base-branch')) {
|
| 47 |
+
await github.rest.issues.removeLabel({
|
| 48 |
+
owner: context.repo.owner,
|
| 49 |
+
repo: context.repo.repo,
|
| 50 |
+
issue_number: prNumber,
|
| 51 |
+
name: 'wrong-base-branch',
|
| 52 |
+
});
|
| 53 |
+
}
|
| 54 |
+
return;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
// If the base was fixed, remove the label and let it through
|
| 58 |
+
if (base !== 'main') {
|
| 59 |
+
if (labels.includes('wrong-base-branch')) {
|
| 60 |
+
await github.rest.issues.removeLabel({
|
| 61 |
+
owner: context.repo.owner,
|
| 62 |
+
repo: context.repo.repo,
|
| 63 |
+
issue_number: prNumber,
|
| 64 |
+
name: 'wrong-base-branch',
|
| 65 |
+
});
|
| 66 |
+
}
|
| 67 |
+
return;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// Base is main — check if this user is a maintainer
|
| 71 |
+
let permission = 'none';
|
| 72 |
+
try {
|
| 73 |
+
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
|
| 74 |
+
owner: context.repo.owner,
|
| 75 |
+
repo: context.repo.repo,
|
| 76 |
+
username: context.payload.pull_request.user.login,
|
| 77 |
+
});
|
| 78 |
+
permission = data.permission;
|
| 79 |
+
} catch (_) {
|
| 80 |
+
// User is not a collaborator — treat as 'none'
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
if (['admin', 'write'].includes(permission)) {
|
| 84 |
+
console.log(`User has '${permission}' permission, skipping.`);
|
| 85 |
+
return;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
// Already labeled — avoid spamming on every push
|
| 89 |
+
if (labels.includes('wrong-base-branch')) {
|
| 90 |
+
core.setFailed("PR must target `dev`, not `main`.");
|
| 91 |
+
return;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// Ensure the label exists
|
| 95 |
+
try {
|
| 96 |
+
await github.rest.issues.getLabel({
|
| 97 |
+
owner: context.repo.owner,
|
| 98 |
+
repo: context.repo.repo,
|
| 99 |
+
name: 'wrong-base-branch',
|
| 100 |
+
});
|
| 101 |
+
} catch (err) {
|
| 102 |
+
if (err.status === 404) {
|
| 103 |
+
await github.rest.issues.createLabel({
|
| 104 |
+
owner: context.repo.owner,
|
| 105 |
+
repo: context.repo.repo,
|
| 106 |
+
name: 'wrong-base-branch',
|
| 107 |
+
color: 'd73a4a',
|
| 108 |
+
description: 'PR is targeting the wrong base branch',
|
| 109 |
+
});
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
await github.rest.issues.addLabels({
|
| 114 |
+
owner: context.repo.owner,
|
| 115 |
+
repo: context.repo.repo,
|
| 116 |
+
issue_number: prNumber,
|
| 117 |
+
labels: ['wrong-base-branch'],
|
| 118 |
+
});
|
| 119 |
+
|
| 120 |
+
await github.rest.issues.createComment({
|
| 121 |
+
owner: context.repo.owner,
|
| 122 |
+
repo: context.repo.repo,
|
| 123 |
+
issue_number: prNumber,
|
| 124 |
+
body: [
|
| 125 |
+
'## Wrong target branch',
|
| 126 |
+
'',
|
| 127 |
+
'This PR targets `main`, but contributions must go through `dev` first.',
|
| 128 |
+
'',
|
| 129 |
+
'To fix this, click **Edit** next to the PR title and change the base branch to `dev`.',
|
| 130 |
+
'',
|
| 131 |
+
'**This PR will be automatically closed in 24 hours if the base branch has not been updated.**',
|
| 132 |
+
'',
|
| 133 |
+
'> _If you need to merge directly to `main`, contact a maintainer._',
|
| 134 |
+
].join('\n'),
|
| 135 |
+
});
|
| 136 |
+
|
| 137 |
+
core.setFailed("PR must target `dev`, not `main`.");
|
.github/workflows/lint-prettier.yml
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Lint & Prettier
|
| 2 |
+
on:
|
| 3 |
+
pull_request:
|
| 4 |
+
branches: [main, dev]
|
| 5 |
+
jobs:
|
| 6 |
+
lint:
|
| 7 |
+
runs-on: ubuntu-latest
|
| 8 |
+
permissions:
|
| 9 |
+
pull-requests: write
|
| 10 |
+
steps:
|
| 11 |
+
- uses: actions/checkout@v4
|
| 12 |
+
- uses: actions/setup-node@v4
|
| 13 |
+
with:
|
| 14 |
+
node-version: '24'
|
| 15 |
+
|
| 16 |
+
- name: Install dependencies
|
| 17 |
+
run: npm install
|
| 18 |
+
|
| 19 |
+
- name: Run lint & format check
|
| 20 |
+
id: checks
|
| 21 |
+
continue-on-error: true
|
| 22 |
+
run: |
|
| 23 |
+
cd shared
|
| 24 |
+
npm run lint
|
| 25 |
+
npm run format:check
|
| 26 |
+
|
| 27 |
+
- name: Comment on PR if checks failed
|
| 28 |
+
if: steps.checks.outcome == 'failure'
|
| 29 |
+
uses: actions/github-script@v7
|
| 30 |
+
with:
|
| 31 |
+
script: |
|
| 32 |
+
await github.rest.issues.createComment({
|
| 33 |
+
owner: context.repo.owner,
|
| 34 |
+
repo: context.repo.repo,
|
| 35 |
+
issue_number: context.issue.number,
|
| 36 |
+
body: [
|
| 37 |
+
'## ❌ Lint & Prettier check failed',
|
| 38 |
+
'',
|
| 39 |
+
'Please fix the issues locally by running the following commands inside the `shared` package:',
|
| 40 |
+
'',
|
| 41 |
+
'```bash',
|
| 42 |
+
'cd shared',
|
| 43 |
+
'npm run lint',
|
| 44 |
+
'npm run format',
|
| 45 |
+
'```',
|
| 46 |
+
'',
|
| 47 |
+
'Then commit and push the changes.',
|
| 48 |
+
].join('\n'),
|
| 49 |
+
});
|
| 50 |
+
|
| 51 |
+
- name: Fail the job if checks failed
|
| 52 |
+
if: steps.checks.outcome == 'failure'
|
| 53 |
+
run: exit 1
|
.github/workflows/security.yml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Security Scan
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
branches: [main]
|
| 6 |
+
push:
|
| 7 |
+
branches: [main]
|
| 8 |
+
|
| 9 |
+
permissions:
|
| 10 |
+
pull-requests: write
|
| 11 |
+
|
| 12 |
+
jobs:
|
| 13 |
+
scout:
|
| 14 |
+
runs-on: ubuntu-latest
|
| 15 |
+
steps:
|
| 16 |
+
- uses: actions/checkout@v4
|
| 17 |
+
|
| 18 |
+
- uses: docker/setup-buildx-action@v3
|
| 19 |
+
|
| 20 |
+
- uses: docker/build-push-action@v5
|
| 21 |
+
with:
|
| 22 |
+
context: .
|
| 23 |
+
push: false
|
| 24 |
+
load: true
|
| 25 |
+
tags: trek:scan
|
| 26 |
+
|
| 27 |
+
- uses: docker/login-action@v3
|
| 28 |
+
with:
|
| 29 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 30 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 31 |
+
|
| 32 |
+
- uses: docker/scout-action@v1
|
| 33 |
+
with:
|
| 34 |
+
command: cves
|
| 35 |
+
image: trek:scan
|
| 36 |
+
only-severities: critical,high
|
| 37 |
+
only-fixed: true
|
| 38 |
+
exit-code: true
|
.github/workflows/test.yml
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Tests
|
| 2 |
+
|
| 3 |
+
permissions:
|
| 4 |
+
contents: read
|
| 5 |
+
|
| 6 |
+
on:
|
| 7 |
+
pull_request:
|
| 8 |
+
branches: [main, dev]
|
| 9 |
+
paths:
|
| 10 |
+
- 'server/**'
|
| 11 |
+
- 'client/**'
|
| 12 |
+
- 'shared/**'
|
| 13 |
+
- '.github/workflows/test.yml'
|
| 14 |
+
|
| 15 |
+
jobs:
|
| 16 |
+
i18n-parity:
|
| 17 |
+
name: i18n Key Parity
|
| 18 |
+
runs-on: ubuntu-latest
|
| 19 |
+
|
| 20 |
+
steps:
|
| 21 |
+
- uses: actions/checkout@v6
|
| 22 |
+
|
| 23 |
+
- uses: actions/setup-node@v6
|
| 24 |
+
with:
|
| 25 |
+
node-version: 24
|
| 26 |
+
|
| 27 |
+
- name: Check i18n key parity
|
| 28 |
+
run: node shared/scripts/i18n-parity.mjs --strict
|
| 29 |
+
|
| 30 |
+
shared-contracts:
|
| 31 |
+
name: Shared Contracts (Zod)
|
| 32 |
+
runs-on: ubuntu-latest
|
| 33 |
+
|
| 34 |
+
steps:
|
| 35 |
+
- uses: actions/checkout@v6
|
| 36 |
+
|
| 37 |
+
- uses: actions/setup-node@v6
|
| 38 |
+
with:
|
| 39 |
+
node-version: 24
|
| 40 |
+
cache: npm
|
| 41 |
+
cache-dependency-path: package-lock.json
|
| 42 |
+
|
| 43 |
+
- name: Install dependencies
|
| 44 |
+
run: npm ci --workspace shared
|
| 45 |
+
|
| 46 |
+
- name: Typecheck
|
| 47 |
+
run: cd shared && npm run typecheck
|
| 48 |
+
|
| 49 |
+
- name: Run tests
|
| 50 |
+
run: cd shared && npm test
|
| 51 |
+
|
| 52 |
+
server-tests:
|
| 53 |
+
name: Server Tests
|
| 54 |
+
runs-on: ubuntu-latest
|
| 55 |
+
|
| 56 |
+
steps:
|
| 57 |
+
- uses: actions/checkout@v6
|
| 58 |
+
|
| 59 |
+
- uses: actions/setup-node@v6
|
| 60 |
+
with:
|
| 61 |
+
node-version: 24
|
| 62 |
+
cache: npm
|
| 63 |
+
cache-dependency-path: package-lock.json
|
| 64 |
+
|
| 65 |
+
- name: Install dependencies
|
| 66 |
+
run: npm ci
|
| 67 |
+
|
| 68 |
+
- name: Ensure @swc/core's Linux binary for unplugin-swc
|
| 69 |
+
# The lockfile was generated on Windows and omits @swc/core's Linux
|
| 70 |
+
# optional native binary, so npm ci/install skips it on the runner.
|
| 71 |
+
# Install the matching version explicitly so the server's SWC transform
|
| 72 |
+
# (server/vitest.config.ts) can load.
|
| 73 |
+
run: |
|
| 74 |
+
SWC_VERSION=$(node -p "require('@swc/core/package.json').version")
|
| 75 |
+
npm install --no-save --legacy-peer-deps "@swc/core-linux-x64-gnu@$SWC_VERSION"
|
| 76 |
+
|
| 77 |
+
- name: Build shared
|
| 78 |
+
run: npm run build --workspace=shared
|
| 79 |
+
|
| 80 |
+
- name: Build server (tsc -> dist)
|
| 81 |
+
run: cd server && npm run build
|
| 82 |
+
|
| 83 |
+
- name: Typecheck
|
| 84 |
+
run: cd server && npm run typecheck
|
| 85 |
+
|
| 86 |
+
- name: Lint
|
| 87 |
+
run: cd server && npm run lint:check
|
| 88 |
+
|
| 89 |
+
- name: Run tests
|
| 90 |
+
run: cd server && npm run test:coverage
|
| 91 |
+
|
| 92 |
+
- name: Upload coverage
|
| 93 |
+
if: success()
|
| 94 |
+
uses: actions/upload-artifact@v6
|
| 95 |
+
with:
|
| 96 |
+
name: backend-coverage
|
| 97 |
+
path: server/coverage/
|
| 98 |
+
retention-days: 7
|
| 99 |
+
|
| 100 |
+
client-tests:
|
| 101 |
+
name: Client Tests
|
| 102 |
+
runs-on: ubuntu-latest
|
| 103 |
+
|
| 104 |
+
steps:
|
| 105 |
+
- uses: actions/checkout@v6
|
| 106 |
+
|
| 107 |
+
- uses: actions/setup-node@v6
|
| 108 |
+
with:
|
| 109 |
+
node-version: 24
|
| 110 |
+
cache: npm
|
| 111 |
+
cache-dependency-path: package-lock.json
|
| 112 |
+
|
| 113 |
+
- name: Install dependencies
|
| 114 |
+
run: npm ci --workspace shared && npm ci --workspace client
|
| 115 |
+
|
| 116 |
+
- name: Build shared
|
| 117 |
+
run: npm run build --workspace=shared
|
| 118 |
+
|
| 119 |
+
- name: Typecheck
|
| 120 |
+
run: cd client && npm run typecheck
|
| 121 |
+
|
| 122 |
+
- name: Lint
|
| 123 |
+
run: cd client && npm run lint:check
|
| 124 |
+
|
| 125 |
+
- name: Page pattern check
|
| 126 |
+
run: cd client && npm run lint:pages
|
| 127 |
+
|
| 128 |
+
- name: Run tests
|
| 129 |
+
run: cd client && npm run test:coverage
|
| 130 |
+
|
| 131 |
+
- name: Upload coverage
|
| 132 |
+
if: success()
|
| 133 |
+
uses: actions/upload-artifact@v6
|
| 134 |
+
with:
|
| 135 |
+
name: frontend-coverage
|
| 136 |
+
path: client/coverage/
|
| 137 |
+
retention-days: 7
|
.github/workflows/wiki.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Deploy Wiki
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
paths:
|
| 7 |
+
- 'wiki/**'
|
| 8 |
+
- '.github/workflows/wiki.yml'
|
| 9 |
+
workflow_dispatch:
|
| 10 |
+
|
| 11 |
+
permissions:
|
| 12 |
+
contents: write
|
| 13 |
+
|
| 14 |
+
concurrency:
|
| 15 |
+
group: wiki-deploy
|
| 16 |
+
cancel-in-progress: true
|
| 17 |
+
|
| 18 |
+
jobs:
|
| 19 |
+
deploy:
|
| 20 |
+
runs-on: ubuntu-latest
|
| 21 |
+
steps:
|
| 22 |
+
- uses: actions/checkout@v4
|
| 23 |
+
- name: Publish to GitHub wiki
|
| 24 |
+
uses: Andrew-Chen-Wang/github-wiki-action@v5
|
| 25 |
+
with:
|
| 26 |
+
strategy: clone
|
.gitignore
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dependencies
|
| 2 |
+
node_modules/
|
| 3 |
+
|
| 4 |
+
# Build output
|
| 5 |
+
client/dist/
|
| 6 |
+
server/dist/
|
| 7 |
+
shared/dist/
|
| 8 |
+
server/public/*
|
| 9 |
+
!server/public/.gitkeep
|
| 10 |
+
|
| 11 |
+
# Generated PWA icons (built from SVG via prebuild)
|
| 12 |
+
client/public/icons/*.png
|
| 13 |
+
|
| 14 |
+
# Database
|
| 15 |
+
*.db
|
| 16 |
+
*.db-shm
|
| 17 |
+
*.db-wal
|
| 18 |
+
*.sqlite
|
| 19 |
+
*.sqlite-shm
|
| 20 |
+
*.sqlite-wal
|
| 21 |
+
|
| 22 |
+
# User data
|
| 23 |
+
server/data/*
|
| 24 |
+
server/uploads/
|
| 25 |
+
|
| 26 |
+
# Environment
|
| 27 |
+
.env
|
| 28 |
+
.env.*
|
| 29 |
+
!.env.example
|
| 30 |
+
|
| 31 |
+
# OS files
|
| 32 |
+
.DS_Store
|
| 33 |
+
Thumbs.db
|
| 34 |
+
|
| 35 |
+
# IDE
|
| 36 |
+
.vscode/
|
| 37 |
+
.idea/
|
| 38 |
+
.claude/
|
| 39 |
+
|
| 40 |
+
# Logs
|
| 41 |
+
logs
|
| 42 |
+
*.log
|
| 43 |
+
npm-debug.log*
|
| 44 |
+
yarn-debug.log*
|
| 45 |
+
yarn-error.log*
|
| 46 |
+
|
| 47 |
+
# Runtime data
|
| 48 |
+
*.pid
|
| 49 |
+
*.seed
|
| 50 |
+
*.pid.lock
|
| 51 |
+
|
| 52 |
+
# Coverage
|
| 53 |
+
coverage
|
| 54 |
+
*.lcov
|
| 55 |
+
.nyc_output
|
| 56 |
+
|
| 57 |
+
# Cache
|
| 58 |
+
.npm
|
| 59 |
+
.eslintcache
|
| 60 |
+
.cache
|
| 61 |
+
*.tsbuildinfo
|
| 62 |
+
*.tgz
|
| 63 |
+
|
| 64 |
+
.scannerwork
|
| 65 |
+
test-data
|
| 66 |
+
|
| 67 |
+
.run
|
| 68 |
+
.full-review
|
.hfignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git/
|
| 2 |
+
node_modules/
|
| 3 |
+
dist/
|
| 4 |
+
.github/
|
| 5 |
+
charts/
|
| 6 |
+
docs/
|
| 7 |
+
scripts/
|
| 8 |
+
wiki/
|
| 9 |
+
.dockerignore
|
| 10 |
+
.gitattributes
|
| 11 |
+
.gitignore
|
| 12 |
+
package-lock.json
|
| 13 |
+
sonar-project.properties
|
| 14 |
+
unraid-template.xml
|
| 15 |
+
build-from-sources
|
| 16 |
+
docker-compose.yml
|
| 17 |
+
CONTRIBUTING.md
|
| 18 |
+
LICENSE
|
| 19 |
+
MCP.md
|
| 20 |
+
NOTICE.md
|
| 21 |
+
SECURITY.md
|
| 22 |
+
TRADEMARKS.md
|
Agent.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Agent.md
|
| 2 |
+
|
| 3 |
+
## 1. Deployment Configuration
|
| 4 |
+
|
| 5 |
+
### Target Space
|
| 6 |
+
- **Profile:** `Leon4gr45`
|
| 7 |
+
- **Space:** `augmenttoolkit`
|
| 8 |
+
- **Full Identifier:** `Leon4gr45/augmenttoolkit`
|
| 9 |
+
- **Frontend Port:** `7860` (mandatory for all Hugging Face Spaces)
|
| 10 |
+
|
| 11 |
+
### Deployment Method
|
| 12 |
+
Choose the correct SDK based on the app type based on the codebase language:
|
| 13 |
+
|
| 14 |
+
- **Gradio SDK** — for Gradio applications
|
| 15 |
+
- **Streamlit SDK** — for Streamlit applications
|
| 16 |
+
- **Docker SDK** — for all other applications (recommended default for flexibility)
|
| 17 |
+
|
| 18 |
+
### HF Token
|
| 19 |
+
- The environment variable **`HF_TOKEN` will always be provided at execution time**.
|
| 20 |
+
- Never hardcode the token. Always read it from the environment.
|
| 21 |
+
- All monitoring and log‑streaming commands rely on `HF_TOKEN`.
|
| 22 |
+
|
| 23 |
+
### Required Files
|
| 24 |
+
- `Dockerfile` (or `app.py` for Gradio/Streamlit SDKs)
|
| 25 |
+
- `README.md` with Hugging Face YAML frontmatter:
|
| 26 |
+
```yaml
|
| 27 |
+
---
|
| 28 |
+
title: <APP NAME>
|
| 29 |
+
sdk: docker | gradio | streamlit
|
| 30 |
+
app_port: 7860
|
| 31 |
+
---
|
| 32 |
+
```
|
| 33 |
+
- `.hfignore` to exclude unnecessary files
|
| 34 |
+
- This `Agent.md` file (must be committed before deployment)
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## 2. API Exposure and Documentation
|
| 39 |
+
|
| 40 |
+
### Mandatory Endpoints
|
| 41 |
+
Every deployment **must** expose:
|
| 42 |
+
|
| 43 |
+
- **`/health`**
|
| 44 |
+
- Returns HTTP 200 when the app is ready.
|
| 45 |
+
- Required for Hugging Face to transition the Space from *starting* → *running*.
|
| 46 |
+
|
| 47 |
+
- **`/api-docs`**
|
| 48 |
+
- Documents **all** available API endpoints.
|
| 49 |
+
- Must be reachable at:
|
| 50 |
+
`https://HF_PROFILE-augmenttoolkit.hf.space/api-docs`
|
| 51 |
+
|
| 52 |
+
### Functional Endpoints
|
| 53 |
+
Document each endpoint here. For every endpoint, include:
|
| 54 |
+
|
| 55 |
+
- **Method:** GET/POST/PUT/DELETE
|
| 56 |
+
- **Path:** `/predict`, `/generate`, `/upload`, etc.
|
| 57 |
+
- **Purpose:** What the endpoint does
|
| 58 |
+
- **Request Example:** JSON or query parameters
|
| 59 |
+
- **Response Example:** JSON schema or example payload
|
| 60 |
+
|
| 61 |
+
Example format:
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
### /predict
|
| 65 |
+
- Method: POST
|
| 66 |
+
- Purpose: Run model inference
|
| 67 |
+
- Request:
|
| 68 |
+
{
|
| 69 |
+
"text": "hello world"
|
| 70 |
+
}
|
| 71 |
+
- Response:
|
| 72 |
+
{
|
| 73 |
+
"prediction": "…"
|
| 74 |
+
}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
All endpoints listed here **must** appear in `/api-docs`.
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## 3. Deployment Workflow
|
| 82 |
+
|
| 83 |
+
Precondition: Use the huggingface hub cli hf to check that the space is empty of files nd delete any which are still in there and not belonging to the project to be uploaded
|
| 84 |
+
|
| 85 |
+
### Standard Deployment Command
|
| 86 |
+
After any code change, run:
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
hf upload Leon4gr45/augmenttoolkit --repo-type=space
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
Scan build and run logs # Get build logs (SSE) curl -N
|
| 93 |
+
-H "Authorization: Bearer $HF_TOKEN"
|
| 94 |
+
"https://huggingface.co/api/spaces/Leon4gr45/augmenttoolkit/logs/build"
|
| 95 |
+
|
| 96 |
+
Get run logs (SSE) once the build logs succeed
|
| 97 |
+
curl -N
|
| 98 |
+
-H "Authorization: Bearer $HF_TOKEN"
|
| 99 |
+
"https://huggingface.co/api/spaces/Leon4gr45/augmenttoolkit/logs/run"
|
| 100 |
+
|
| 101 |
+
after 300 seconds to see if the deployment has been successful, and if not, fix the errors of deployment, and redeploy and monitor in a cycle until the space is running and reacts to the api endpoints you created.
|
CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributing to TREK
|
| 2 |
+
|
| 3 |
+
Thanks for your interest in contributing! Please read these guidelines before opening a pull request.
|
| 4 |
+
|
| 5 |
+
## Ground Rules
|
| 6 |
+
|
| 7 |
+
1. **Ask in Discord first** — Before writing any code, pitch your idea in the `#github-pr` channel on our [Discord server](https://discord.gg/NhZBDSd4qW). We'll let you know if the PR is wanted and give direction. PRs that show up without prior discussion will be closed
|
| 8 |
+
2. **One change per PR** — Keep it focused. Don't bundle unrelated fixes or refactors
|
| 9 |
+
3. **No breaking changes** — Backwards compatibility is non-negotiable
|
| 10 |
+
4. **Target the `dev` branch** — All PRs must be opened against `dev`, not `main`. Exception: PRs that only modify files under `wiki/` may target any branch
|
| 11 |
+
5. **Match the existing style** — No reformatting, no linter config changes, no "while I'm here" cleanups
|
| 12 |
+
6. **Tests** — Your changes must include tests. The project maintains 80%+ coverage; PRs that drop it will be closed
|
| 13 |
+
7. **Branch up to date** — Your branch must be [up to date with `dev`](https://github.com/mauriceboe/TREK/wiki/Development-environment#3-keep-your-fork-up-to-date) before submitting a PR
|
| 14 |
+
|
| 15 |
+
## Pull Requests
|
| 16 |
+
|
| 17 |
+
### Your PR should include:
|
| 18 |
+
|
| 19 |
+
- **Summary** — What does this change and why? (1-3 bullet points)
|
| 20 |
+
- **Test plan** — How did you verify it works?
|
| 21 |
+
- **Linked issue** — Reference the issue (e.g. `Fixes #123`)
|
| 22 |
+
|
| 23 |
+
### Your PR will be closed if it:
|
| 24 |
+
|
| 25 |
+
- Wasn't discussed and approved in `#github-pr` on Discord first
|
| 26 |
+
- Introduces breaking changes
|
| 27 |
+
- Adds unnecessary complexity or features beyond scope
|
| 28 |
+
- Reformats or refactors unrelated code
|
| 29 |
+
- Adds dependencies without clear justification
|
| 30 |
+
|
| 31 |
+
### Commit messages
|
| 32 |
+
|
| 33 |
+
Use [conventional commits](https://www.conventionalcommits.org/):
|
| 34 |
+
|
| 35 |
+
```
|
| 36 |
+
fix(maps): correct zoom level on Safari
|
| 37 |
+
feat(budget): add CSV export for expenses
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Development Environment
|
| 41 |
+
|
| 42 |
+
See the [Developer Environment page](https://github.com/mauriceboe/TREK/wiki/Development-environment) for more information on setting up your development environment.
|
| 43 |
+
|
| 44 |
+
## More Details
|
| 45 |
+
|
| 46 |
+
See the [Contributing wiki page](https://github.com/mauriceboe/TREK/wiki/Contributing) for the full tech stack, architecture overview, and detailed guidelines.
|
Dockerfile
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ── Stage 0: gosu ────────────────────────────────────────────────────────────
|
| 2 |
+
# Rebuild gosu with a current Go toolchain so the runtime image ships no stale
|
| 3 |
+
# Go stdlib (Debian's apt gosu is built with an old Go that trips CVE scanners).
|
| 4 |
+
# The binary and its runtime behaviour are identical to the apt package.
|
| 5 |
+
FROM golang:1.25-alpine AS gosu-build
|
| 6 |
+
RUN CGO_ENABLED=0 GOBIN=/out go install github.com/tianon/gosu@latest
|
| 7 |
+
|
| 8 |
+
# ── Stage 1: shared ──────────────────────────────────────────────────────────
|
| 9 |
+
FROM node:24-alpine AS shared-builder
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
COPY package.json package-lock.json ./
|
| 12 |
+
COPY shared/package.json ./shared/
|
| 13 |
+
RUN npm ci --workspace=shared
|
| 14 |
+
COPY shared/ ./shared/
|
| 15 |
+
RUN npm run build --workspace=shared
|
| 16 |
+
|
| 17 |
+
# ── Stage 2: client ──────────────────────────────────────────────────────────
|
| 18 |
+
FROM node:24-alpine AS client-builder
|
| 19 |
+
WORKDIR /app
|
| 20 |
+
COPY package.json package-lock.json ./
|
| 21 |
+
COPY shared/package.json ./shared/
|
| 22 |
+
COPY client/package.json ./client/
|
| 23 |
+
RUN npm ci --workspace=client
|
| 24 |
+
COPY --from=shared-builder /app/shared/dist ./shared/dist
|
| 25 |
+
COPY client/ ./client/
|
| 26 |
+
RUN npm run build --workspace=client
|
| 27 |
+
|
| 28 |
+
# ── Stage 3: server ──────────────────────────────────────────────────────────
|
| 29 |
+
# --ignore-scripts skips native builds (better-sqlite3); they happen in the production stage.
|
| 30 |
+
FROM node:24-alpine AS server-builder
|
| 31 |
+
WORKDIR /app
|
| 32 |
+
COPY package.json package-lock.json ./
|
| 33 |
+
COPY shared/package.json ./shared/
|
| 34 |
+
COPY server/package.json ./server/
|
| 35 |
+
RUN npm ci --workspace=server --ignore-scripts
|
| 36 |
+
COPY --from=shared-builder /app/shared/dist ./shared/dist
|
| 37 |
+
COPY server/ ./server/
|
| 38 |
+
RUN npm run build --workspace=server
|
| 39 |
+
|
| 40 |
+
# ── Stage 4: production runtime ──────────────────────────────────────────────
|
| 41 |
+
FROM node:24-trixie-slim
|
| 42 |
+
WORKDIR /app
|
| 43 |
+
|
| 44 |
+
# Workspace manifests only — source never enters this stage.
|
| 45 |
+
COPY package.json package-lock.json ./
|
| 46 |
+
COPY shared/package.json ./shared/
|
| 47 |
+
COPY server/package.json ./server/
|
| 48 |
+
|
| 49 |
+
# better-sqlite3 native addon requires build tools (purged after compile).
|
| 50 |
+
# kitinerary-extractor for booking-confirmation import:
|
| 51 |
+
# amd64 — static binary from KDE CDN (glibc 2.17+; wget stays for healthcheck)
|
| 52 |
+
# arm64 — apt package (KDE publishes no arm64 static binary)
|
| 53 |
+
RUN apt-get update && \
|
| 54 |
+
apt-get install -y --no-install-recommends tzdata dumb-init wget ca-certificates python3 build-essential && \
|
| 55 |
+
npm ci --workspace=server --omit=dev && \
|
| 56 |
+
ARCH=$(dpkg --print-architecture) && \
|
| 57 |
+
if [ "$ARCH" = "amd64" ]; then \
|
| 58 |
+
wget -qO /tmp/ki.tgz https://cdn.kde.org/ci-builds/pim/kitinerary/release-26.04/linux/kitinerary-extractor-x86_64-26.04.2.tgz && \
|
| 59 |
+
echo "ba5cfb4a2353157c8f54cbeaea0097c5bf2c3a810e0342f63d6e524826176628 /tmp/ki.tgz" | sha256sum -c && \
|
| 60 |
+
tar -xz -C /usr/local -f /tmp/ki.tgz bin/kitinerary-extractor share/locale && \
|
| 61 |
+
rm /tmp/ki.tgz; \
|
| 62 |
+
else \
|
| 63 |
+
apt-get install -y --no-install-recommends libkitinerary-bin && \
|
| 64 |
+
ln -sf "$(find /usr/lib -name kitinerary-extractor -type f | head -1)" /usr/local/bin/kitinerary-extractor; \
|
| 65 |
+
fi && \
|
| 66 |
+
apt-get purge -y python3 build-essential && \
|
| 67 |
+
apt-get autoremove -y && \
|
| 68 |
+
rm -rf /var/lib/apt/lists/* /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx
|
| 69 |
+
|
| 70 |
+
# gosu rebuilt with a current Go toolchain (stage 0) — used by CMD to drop to node.
|
| 71 |
+
COPY --from=gosu-build /out/gosu /usr/local/bin/gosu
|
| 72 |
+
|
| 73 |
+
ENV XDG_CACHE_HOME=/tmp/kf6-cache
|
| 74 |
+
# Prevent Qt from probing for a display in headless containers.
|
| 75 |
+
ENV QT_QPA_PLATFORM=offscreen
|
| 76 |
+
# Fixed path for both amd64 (static binary) and arm64 (symlink to apt binary).
|
| 77 |
+
# Override with KITINERARY_EXTRACTOR_PATH if you install it elsewhere.
|
| 78 |
+
ENV KITINERARY_EXTRACTOR_PATH=/usr/local/bin/kitinerary-extractor
|
| 79 |
+
|
| 80 |
+
COPY --from=server-builder /app/server/dist ./server/dist
|
| 81 |
+
# Runtime data assets read from server/assets at runtime: airports.json (flight
|
| 82 |
+
# transport search) and atlas/*.geojson.gz (Atlas country/region map). The build
|
| 83 |
+
# only emits dist, so these must be copied explicitly or the features silently
|
| 84 |
+
# degrade to empty in the image.
|
| 85 |
+
COPY --from=server-builder /app/server/assets ./server/assets
|
| 86 |
+
# tsconfig-paths/register reads this at runtime to resolve MCP SDK paths.
|
| 87 |
+
COPY server/tsconfig.json ./server/
|
| 88 |
+
COPY --from=shared-builder /app/shared/dist ./shared/dist
|
| 89 |
+
COPY --from=client-builder /app/client/dist ./server/public
|
| 90 |
+
COPY --from=client-builder /app/client/public/fonts ./server/public/fonts
|
| 91 |
+
|
| 92 |
+
RUN mkdir -p /app/data/logs /app/uploads/files /app/uploads/covers /app/uploads/avatars /app/uploads/photos && \
|
| 93 |
+
ln -s /app/uploads /app/server/uploads && \
|
| 94 |
+
ln -s /app/data /app/server/data && \
|
| 95 |
+
chown -R node:node /app
|
| 96 |
+
|
| 97 |
+
ENV NODE_ENV=production
|
| 98 |
+
ENV PORT=7860
|
| 99 |
+
ARG APP_VERSION=dev
|
| 100 |
+
ENV APP_VERSION=${APP_VERSION}
|
| 101 |
+
|
| 102 |
+
EXPOSE 7860
|
| 103 |
+
|
| 104 |
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
| 105 |
+
CMD wget -qO- http://localhost:7860/api/health || exit 1
|
| 106 |
+
|
| 107 |
+
ENTRYPOINT ["dumb-init", "--"]
|
| 108 |
+
# Preflight: if the app code is missing, a volume was almost certainly mounted
|
| 109 |
+
# over /app (it hides the image's node_modules + dist). Fail with actionable
|
| 110 |
+
# guidance instead of a cryptic "Cannot find module 'tsconfig-paths/register'".
|
| 111 |
+
# cd into server/ so tsconfig-paths/register finds tsconfig.json and ../node_modules resolves correctly.
|
| 112 |
+
CMD ["sh", "-c", "if [ ! -f /app/server/dist/index.js ] || [ ! -d /app/node_modules/tsconfig-paths ]; then echo 'FATAL: TREK application files are missing from the image.'; echo 'A volume is likely mounted over /app, which hides the app code.'; echo 'Mount ONLY your data and uploads dirs: -v ./data:/app/data -v ./uploads:/app/uploads'; echo 'Do NOT mount a volume at /app. See the Troubleshooting section of the README.'; exit 1; fi; chown -R node:node /app/data /app/uploads 2>/dev/null || true; cd /app/server && exec gosu node node --require tsconfig-paths/register dist/index.js"]
|
LICENSE
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 19 November 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU Affero General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works, specifically designed to ensure
|
| 12 |
+
cooperation with the community in the case of network server software.
|
| 13 |
+
|
| 14 |
+
The licenses for most software and other practical works are designed
|
| 15 |
+
to take away your freedom to share and change the works. By contrast,
|
| 16 |
+
our General Public Licenses are intended to guarantee your freedom to
|
| 17 |
+
share and change all versions of a program--to make sure it remains free
|
| 18 |
+
software for all its users.
|
| 19 |
+
|
| 20 |
+
When we speak of free software, we are referring to freedom, not
|
| 21 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 22 |
+
have the freedom to distribute copies of free software (and charge for
|
| 23 |
+
them if you wish), that you receive source code or can get it if you
|
| 24 |
+
want it, that you can change the software or use pieces of it in new
|
| 25 |
+
free programs, and that you know you can do these things.
|
| 26 |
+
|
| 27 |
+
Developers that use our General Public Licenses protect your rights
|
| 28 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
| 29 |
+
you this License which gives you legal permission to copy, distribute
|
| 30 |
+
and/or modify the software.
|
| 31 |
+
|
| 32 |
+
A secondary benefit of defending all users' freedom is that
|
| 33 |
+
improvements made in alternate versions of the program, if they
|
| 34 |
+
receive widespread use, become available for other developers to
|
| 35 |
+
incorporate. Many developers of free software are heartened and
|
| 36 |
+
encouraged by the resulting cooperation. However, in the case of
|
| 37 |
+
software used on network servers, this result may fail to come about.
|
| 38 |
+
The GNU General Public License permits making a modified version and
|
| 39 |
+
letting the public access it on a server without ever releasing its
|
| 40 |
+
source code to the public.
|
| 41 |
+
|
| 42 |
+
The GNU Affero General Public License is designed specifically to
|
| 43 |
+
ensure that, in such cases, the modified source code becomes available
|
| 44 |
+
to the community. It requires the operator of a network server to
|
| 45 |
+
provide the source code of the modified version running there to the
|
| 46 |
+
users of that server. Therefore, public use of a modified version, on
|
| 47 |
+
a publicly accessible server, gives the public access to the source
|
| 48 |
+
code of the modified version.
|
| 49 |
+
|
| 50 |
+
An older license, called the Affero General Public License and
|
| 51 |
+
published by Affero, was designed to accomplish similar goals. This is
|
| 52 |
+
a different license, not a version of the Affero GPL, but Affero has
|
| 53 |
+
released a new version of the Affero GPL which permits relicensing under
|
| 54 |
+
this license.
|
| 55 |
+
|
| 56 |
+
The precise terms and conditions for copying, distribution and
|
| 57 |
+
modification follow.
|
| 58 |
+
|
| 59 |
+
TERMS AND CONDITIONS
|
| 60 |
+
|
| 61 |
+
0. Definitions.
|
| 62 |
+
|
| 63 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
| 64 |
+
|
| 65 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 66 |
+
works, such as semiconductor masks.
|
| 67 |
+
|
| 68 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 69 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 70 |
+
"recipients" may be individuals or organizations.
|
| 71 |
+
|
| 72 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 73 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 74 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 75 |
+
earlier work or a work "based on" the earlier work.
|
| 76 |
+
|
| 77 |
+
A "covered work" means either the unmodified Program or a work based
|
| 78 |
+
on the Program.
|
| 79 |
+
|
| 80 |
+
To "propagate" a work means to do anything with it that, without
|
| 81 |
+
permission, would make you directly or secondarily liable for
|
| 82 |
+
infringement under applicable copyright law, except executing it on a
|
| 83 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 84 |
+
distribution (with or without modification), making available to the
|
| 85 |
+
public, and in some countries other activities as well.
|
| 86 |
+
|
| 87 |
+
To "convey" a work means any kind of propagation that enables other
|
| 88 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 89 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 90 |
+
|
| 91 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 92 |
+
to the extent that it includes a convenient and prominently visible
|
| 93 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 94 |
+
tells the user that there is no warranty for the work (except to the
|
| 95 |
+
extent that warranties are provided), that licensees may convey the
|
| 96 |
+
work under this License, and how to view a copy of this License. If
|
| 97 |
+
the interface presents a list of user commands or options, such as a
|
| 98 |
+
menu, a prominent item in the list meets this criterion.
|
| 99 |
+
|
| 100 |
+
1. Source Code.
|
| 101 |
+
|
| 102 |
+
The "source code" for a work means the preferred form of the work
|
| 103 |
+
for making modifications to it. "Object code" means any non-source
|
| 104 |
+
form of a work.
|
| 105 |
+
|
| 106 |
+
A "Standard Interface" means an interface that either is an official
|
| 107 |
+
standard defined by a recognized standards body, or, in the case of
|
| 108 |
+
interfaces specified for a particular programming language, one that
|
| 109 |
+
is widely used among developers working in that language.
|
| 110 |
+
|
| 111 |
+
The "System Libraries" of an executable work include anything, other
|
| 112 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 113 |
+
packaging a Major Component, but which is not part of that Major
|
| 114 |
+
Component, and (b) serves only to enable use of the work with that
|
| 115 |
+
Major Component, or to implement a Standard Interface for which an
|
| 116 |
+
implementation is available to the public in source code form. A
|
| 117 |
+
"Major Component", in this context, means a major essential component
|
| 118 |
+
(kernel, window system, and so on) of the specific operating system
|
| 119 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 120 |
+
produce the work, or an object code interpreter used to run it.
|
| 121 |
+
|
| 122 |
+
The "Corresponding Source" for a work in object code form means all
|
| 123 |
+
the source code needed to generate, install, and (for an executable
|
| 124 |
+
work) run the object code and to modify the work, including scripts to
|
| 125 |
+
control those activities. However, it does not include the work's
|
| 126 |
+
System Libraries, or general-purpose tools or generally available free
|
| 127 |
+
programs which are used unmodified in performing those activities but
|
| 128 |
+
which are not part of the work. For example, Corresponding Source
|
| 129 |
+
includes interface definition files associated with source files for
|
| 130 |
+
the work, and the source code for shared libraries and dynamically
|
| 131 |
+
linked subprograms that the work is specifically designed to require,
|
| 132 |
+
such as by intimate data communication or control flow between those
|
| 133 |
+
subprograms and other parts of the work.
|
| 134 |
+
|
| 135 |
+
The Corresponding Source need not include anything that users
|
| 136 |
+
can regenerate automatically from other parts of the Corresponding
|
| 137 |
+
Source.
|
| 138 |
+
|
| 139 |
+
The Corresponding Source for a work in source code form is that
|
| 140 |
+
same work.
|
| 141 |
+
|
| 142 |
+
2. Basic Permissions.
|
| 143 |
+
|
| 144 |
+
All rights granted under this License are granted for the term of
|
| 145 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 146 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 147 |
+
permission to run the unmodified Program. The output from running a
|
| 148 |
+
covered work is covered by this License only if the output, given its
|
| 149 |
+
content, constitutes a covered work. This License acknowledges your
|
| 150 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 151 |
+
|
| 152 |
+
You may make, run and propagate covered works that you do not
|
| 153 |
+
convey, without conditions so long as your license otherwise remains
|
| 154 |
+
in force. You may convey covered works to others for the sole purpose
|
| 155 |
+
of having them make modifications exclusively for you, or provide you
|
| 156 |
+
with facilities for running those works, provided that you comply with
|
| 157 |
+
the terms of this License in conveying all material for which you do
|
| 158 |
+
not control copyright. Those thus making or running the covered works
|
| 159 |
+
for you must do so exclusively on your behalf, under your direction
|
| 160 |
+
and control, on terms that prohibit them from making any copies of
|
| 161 |
+
your copyrighted material outside their relationship with you.
|
| 162 |
+
|
| 163 |
+
Conveying under any other circumstances is permitted solely under
|
| 164 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 165 |
+
makes it unnecessary.
|
| 166 |
+
|
| 167 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 168 |
+
|
| 169 |
+
No covered work shall be deemed part of an effective technological
|
| 170 |
+
measure under any applicable law fulfilling obligations under article
|
| 171 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 172 |
+
similar laws prohibiting or restricting circumvention of such
|
| 173 |
+
measures.
|
| 174 |
+
|
| 175 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 176 |
+
circumvention of technological measures to the extent such circumvention
|
| 177 |
+
is effected by exercising rights under this License with respect to
|
| 178 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 179 |
+
modification of the work as a means of enforcing, against the work's
|
| 180 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 181 |
+
technological measures.
|
| 182 |
+
|
| 183 |
+
4. Conveying Verbatim Copies.
|
| 184 |
+
|
| 185 |
+
You may convey verbatim copies of the Program's source code as you
|
| 186 |
+
receive it, in any medium, provided that you conspicuously and
|
| 187 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 188 |
+
keep intact all notices stating that this License and any
|
| 189 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 190 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 191 |
+
recipients a copy of this License along with the Program.
|
| 192 |
+
|
| 193 |
+
You may charge any price or no price for each copy that you convey,
|
| 194 |
+
and you may offer support or warranty protection for a fee.
|
| 195 |
+
|
| 196 |
+
5. Conveying Modified Source Versions.
|
| 197 |
+
|
| 198 |
+
You may convey a work based on the Program, or the modifications to
|
| 199 |
+
produce it from the Program, in the form of source code under the
|
| 200 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 201 |
+
|
| 202 |
+
a) The work must carry prominent notices stating that you modified
|
| 203 |
+
it, and giving a relevant date.
|
| 204 |
+
|
| 205 |
+
b) The work must carry prominent notices stating that it is
|
| 206 |
+
released under this License and any conditions added under section
|
| 207 |
+
7. This requirement modifies the requirement in section 4 to
|
| 208 |
+
"keep intact all notices".
|
| 209 |
+
|
| 210 |
+
c) You must license the entire work, as a whole, under this
|
| 211 |
+
License to anyone who comes into possession of a copy. This
|
| 212 |
+
License will therefore apply, along with any applicable section 7
|
| 213 |
+
additional terms, to the whole of the work, and all its parts,
|
| 214 |
+
regardless of how they are packaged. This License gives no
|
| 215 |
+
permission to license the work in any other way, but it does not
|
| 216 |
+
invalidate such permission if you have separately received it.
|
| 217 |
+
|
| 218 |
+
d) If the work has interactive user interfaces, each must display
|
| 219 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 220 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 221 |
+
work need not make them do so.
|
| 222 |
+
|
| 223 |
+
A compilation of a covered work with other separate and independent
|
| 224 |
+
works, which are not by their nature extensions of the covered work,
|
| 225 |
+
and which are not combined with it such as to form a larger program,
|
| 226 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 227 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 228 |
+
used to limit the access or legal rights of the compilation's users
|
| 229 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 230 |
+
in an aggregate does not cause this License to apply to the other
|
| 231 |
+
parts of the aggregate.
|
| 232 |
+
|
| 233 |
+
6. Conveying Non-Source Forms.
|
| 234 |
+
|
| 235 |
+
You may convey a covered work in object code form under the terms
|
| 236 |
+
of sections 4 and 5, provided that you also convey the
|
| 237 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 238 |
+
in one of these ways:
|
| 239 |
+
|
| 240 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 241 |
+
(including a physical distribution medium), accompanied by the
|
| 242 |
+
Corresponding Source fixed on a durable physical medium
|
| 243 |
+
customarily used for software interchange.
|
| 244 |
+
|
| 245 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 246 |
+
(including a physical distribution medium), accompanied by a
|
| 247 |
+
written offer, valid for at least three years and valid for as
|
| 248 |
+
long as you offer spare parts or customer support for that product
|
| 249 |
+
model, to give anyone who possesses the object code either (1) a
|
| 250 |
+
copy of the Corresponding Source for all the software in the
|
| 251 |
+
product that is covered by this License, on a durable physical
|
| 252 |
+
medium customarily used for software interchange, for a price no
|
| 253 |
+
more than your reasonable cost of physically performing this
|
| 254 |
+
conveying of source, or (2) access to copy the
|
| 255 |
+
Corresponding Source from a network server at no charge.
|
| 256 |
+
|
| 257 |
+
c) Convey individual copies of the object code with a copy of the
|
| 258 |
+
written offer to provide the Corresponding Source. This
|
| 259 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 260 |
+
only if you received the object code with such an offer, in accord
|
| 261 |
+
with subsection 6b.
|
| 262 |
+
|
| 263 |
+
d) Convey the object code by offering access from a designated
|
| 264 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 265 |
+
Corresponding Source in the same way through the same place at no
|
| 266 |
+
further charge. You need not require recipients to copy the
|
| 267 |
+
Corresponding Source along with the object code. If the place to
|
| 268 |
+
copy the object code is a network server, the Corresponding Source
|
| 269 |
+
may be on a different server (operated by you or a third party)
|
| 270 |
+
that supports equivalent copying facilities, provided you maintain
|
| 271 |
+
clear directions next to the object code saying where to find the
|
| 272 |
+
Corresponding Source. Regardless of what server hosts the
|
| 273 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 274 |
+
available for as long as needed to satisfy these requirements.
|
| 275 |
+
|
| 276 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 277 |
+
you inform other peers where the object code and Corresponding
|
| 278 |
+
Source of the work are being offered to the general public at no
|
| 279 |
+
charge under subsection 6d.
|
| 280 |
+
|
| 281 |
+
A separable portion of the object code, whose source code is excluded
|
| 282 |
+
from the Corresponding Source as a System Library, need not be
|
| 283 |
+
included in conveying the object code work.
|
| 284 |
+
|
| 285 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 286 |
+
tangible personal property which is normally used for personal, family,
|
| 287 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 288 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 289 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 290 |
+
product received by a particular user, "normally used" refers to a
|
| 291 |
+
typical or common use of that class of product, regardless of the status
|
| 292 |
+
of the particular user or of the way in which the particular user
|
| 293 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 294 |
+
is a consumer product regardless of whether the product has substantial
|
| 295 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 296 |
+
the only significant mode of use of the product.
|
| 297 |
+
|
| 298 |
+
"Installation Information" for a User Product means any methods,
|
| 299 |
+
procedures, authorization keys, or other information required to install
|
| 300 |
+
and execute modified versions of a covered work in that User Product from
|
| 301 |
+
a modified version of its Corresponding Source. The information must
|
| 302 |
+
suffice to ensure that the continued functioning of the modified object
|
| 303 |
+
code is in no case prevented or interfered with solely because
|
| 304 |
+
modification has been made.
|
| 305 |
+
|
| 306 |
+
If you convey an object code work under this section in, or with, or
|
| 307 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 308 |
+
part of a transaction in which the right of possession and use of the
|
| 309 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 310 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 311 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 312 |
+
by the Installation Information. But this requirement does not apply
|
| 313 |
+
if neither you nor any third party retains the ability to install
|
| 314 |
+
modified object code on the User Product (for example, the work has
|
| 315 |
+
been installed in ROM).
|
| 316 |
+
|
| 317 |
+
The requirement to provide Installation Information does not include a
|
| 318 |
+
requirement to continue to provide support service, warranty, or updates
|
| 319 |
+
for a work that has been modified or installed by the recipient, or for
|
| 320 |
+
the User Product in which it has been modified or installed. Access to a
|
| 321 |
+
network may be denied when the modification itself materially and
|
| 322 |
+
adversely affects the operation of the network or violates the rules and
|
| 323 |
+
protocols for communication across the network.
|
| 324 |
+
|
| 325 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 326 |
+
in accord with this section must be in a format that is publicly
|
| 327 |
+
documented (and with an implementation available to the public in
|
| 328 |
+
source code form), and must require no special password or key for
|
| 329 |
+
unpacking, reading or copying.
|
| 330 |
+
|
| 331 |
+
7. Additional Terms.
|
| 332 |
+
|
| 333 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 334 |
+
License by making exceptions from one or more of its conditions.
|
| 335 |
+
Additional permissions that are applicable to the entire Program shall
|
| 336 |
+
be treated as though they were included in this License, to the extent
|
| 337 |
+
that they are valid under applicable law. If additional permissions
|
| 338 |
+
apply only to part of the Program, that part may be used separately
|
| 339 |
+
under those permissions, but the entire Program remains governed by
|
| 340 |
+
this License without regard to the additional permissions.
|
| 341 |
+
|
| 342 |
+
When you convey a copy of a covered work, you may at your option
|
| 343 |
+
remove any additional permissions from that copy, or from any part of
|
| 344 |
+
it. (Additional permissions may be written to require their own
|
| 345 |
+
removal in certain cases when you modify the work.) You may place
|
| 346 |
+
additional permissions on material, added by you to a covered work,
|
| 347 |
+
for which you have or can give appropriate copyright permission.
|
| 348 |
+
|
| 349 |
+
Notwithstanding any other provision of this License, for material you
|
| 350 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 351 |
+
that material) supplement the terms of this License with terms:
|
| 352 |
+
|
| 353 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 354 |
+
terms of sections 15 and 16 of this License; or
|
| 355 |
+
|
| 356 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 357 |
+
author attributions in that material or in the Appropriate Legal
|
| 358 |
+
Notices displayed by works containing it; or
|
| 359 |
+
|
| 360 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 361 |
+
requiring that modified versions of such material be marked in
|
| 362 |
+
reasonable ways as different from the original version; or
|
| 363 |
+
|
| 364 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 365 |
+
authors of the material; or
|
| 366 |
+
|
| 367 |
+
e) Declining to grant rights under trademark law for use of some
|
| 368 |
+
trade names, trademarks, or service marks; or
|
| 369 |
+
|
| 370 |
+
f) Requiring indemnification of licensors and authors of that
|
| 371 |
+
material by anyone who conveys the material (or modified versions of
|
| 372 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 373 |
+
any liability that these contractual assumptions directly impose on
|
| 374 |
+
those licensors and authors.
|
| 375 |
+
|
| 376 |
+
All other non-permissive additional terms are considered "further
|
| 377 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 378 |
+
received it, or any part of it, contains a notice stating that it is
|
| 379 |
+
governed by this License along with a term that is a further
|
| 380 |
+
restriction, you may remove that term. If a license document contains
|
| 381 |
+
a further restriction but permits relicensing or conveying under this
|
| 382 |
+
License, you may add to a covered work material governed by the terms
|
| 383 |
+
of that license document, provided that the further restriction does
|
| 384 |
+
not survive such relicensing or conveying.
|
| 385 |
+
|
| 386 |
+
If you add terms to a covered work in accord with this section, you
|
| 387 |
+
must place, in the relevant source files, a statement of the
|
| 388 |
+
additional terms that apply to those files, or a notice indicating
|
| 389 |
+
where to find the applicable terms.
|
| 390 |
+
|
| 391 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 392 |
+
form of a separately written license, or stated as exceptions;
|
| 393 |
+
the above requirements apply either way.
|
| 394 |
+
|
| 395 |
+
8. Termination.
|
| 396 |
+
|
| 397 |
+
You may not propagate or modify a covered work except as expressly
|
| 398 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 399 |
+
modify it is void, and will automatically terminate your rights under
|
| 400 |
+
this License (including any patent licenses granted under the third
|
| 401 |
+
paragraph of section 11).
|
| 402 |
+
|
| 403 |
+
However, if you cease all violation of this License, then your
|
| 404 |
+
license from a particular copyright holder is reinstated (a)
|
| 405 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 406 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 407 |
+
holder fails to notify you of the violation by some reasonable means
|
| 408 |
+
prior to 60 days after the cessation.
|
| 409 |
+
|
| 410 |
+
Moreover, your license from a particular copyright holder is
|
| 411 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 412 |
+
violation by some reasonable means, this is the first time you have
|
| 413 |
+
received notice of violation of this License (for any work) from that
|
| 414 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 415 |
+
your receipt of the notice.
|
| 416 |
+
|
| 417 |
+
Termination of your rights under this section does not terminate the
|
| 418 |
+
licenses of parties who have received copies or rights from you under
|
| 419 |
+
this License. If your rights have been terminated and not permanently
|
| 420 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 421 |
+
material under section 10.
|
| 422 |
+
|
| 423 |
+
9. Acceptance Not Required for Having Copies.
|
| 424 |
+
|
| 425 |
+
You are not required to accept this License in order to receive or
|
| 426 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 427 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 428 |
+
to receive a copy likewise does not require acceptance. However,
|
| 429 |
+
nothing other than this License grants you permission to propagate or
|
| 430 |
+
modify any covered work. These actions infringe copyright if you do
|
| 431 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 432 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 433 |
+
|
| 434 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 435 |
+
|
| 436 |
+
Each time you convey a covered work, the recipient automatically
|
| 437 |
+
receives a license from the original licensors, to run, modify and
|
| 438 |
+
propagate that work, subject to this License. You are not responsible
|
| 439 |
+
for enforcing compliance by third parties with this License.
|
| 440 |
+
|
| 441 |
+
An "entity transaction" is a transaction transferring control of an
|
| 442 |
+
organization, or substantially all assets of one, or subdividing an
|
| 443 |
+
organization, or merging organizations. If propagation of a covered
|
| 444 |
+
work results from an entity transaction, each party to that
|
| 445 |
+
transaction who receives a copy of the work also receives whatever
|
| 446 |
+
licenses to the work the party's predecessor in interest had or could
|
| 447 |
+
give under the previous paragraph, plus a right to possession of the
|
| 448 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 449 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 450 |
+
|
| 451 |
+
You may not impose any further restrictions on the exercise of the
|
| 452 |
+
rights granted or affirmed under this License. For example, you may
|
| 453 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 454 |
+
rights granted under this License, and you may not initiate litigation
|
| 455 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 456 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 457 |
+
sale, or importing the Program or any portion of it.
|
| 458 |
+
|
| 459 |
+
11. Patents.
|
| 460 |
+
|
| 461 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 462 |
+
License of the Program or a work on which the Program is based. The
|
| 463 |
+
work thus licensed is called the contributor's "contributor version".
|
| 464 |
+
|
| 465 |
+
A contributor's "essential patent claims" are all patent claims
|
| 466 |
+
owned or controlled by the contributor, whether already acquired or
|
| 467 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 468 |
+
by this License, of making, using, or selling its contributor version,
|
| 469 |
+
but do not include claims that would be infringed only as a
|
| 470 |
+
consequence of further modification of the contributor version. For
|
| 471 |
+
purposes of this definition, "control" includes the right to grant
|
| 472 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 473 |
+
this License.
|
| 474 |
+
|
| 475 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 476 |
+
patent license under the contributor's essential patent claims, to
|
| 477 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 478 |
+
propagate the contents of its contributor version.
|
| 479 |
+
|
| 480 |
+
In the following three paragraphs, a "patent license" is any express
|
| 481 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 482 |
+
(such as an express permission to practice a patent or covenant not to
|
| 483 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 484 |
+
party means to make such an agreement or commitment not to enforce a
|
| 485 |
+
patent against the party.
|
| 486 |
+
|
| 487 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 488 |
+
and the Corresponding Source of the work is not available for anyone
|
| 489 |
+
to copy, free of charge and under the terms of this License, through a
|
| 490 |
+
publicly available network server or other readily accessible means,
|
| 491 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 492 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 493 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 494 |
+
consistent with the requirements of this License, to extend the patent
|
| 495 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 496 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 497 |
+
covered work in a country, or your recipient's use of the covered work
|
| 498 |
+
in a country, would infringe one or more identifiable patents in that
|
| 499 |
+
country that you have reason to believe are valid.
|
| 500 |
+
|
| 501 |
+
If, pursuant to or in connection with a single transaction or
|
| 502 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 503 |
+
covered work, and grant a patent license to some of the parties
|
| 504 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 505 |
+
or convey a specific copy of the covered work, then the patent license
|
| 506 |
+
you grant is automatically extended to all recipients of the covered
|
| 507 |
+
work and works based on it.
|
| 508 |
+
|
| 509 |
+
A patent license is "discriminatory" if it does not include within
|
| 510 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 511 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 512 |
+
specifically granted under this License. You may not convey a covered
|
| 513 |
+
work if you are a party to an arrangement with a third party that is
|
| 514 |
+
in the business of distributing software, under which you make payment
|
| 515 |
+
to the third party based on the extent of your activity of conveying
|
| 516 |
+
the work, and under which the third party grants, to any of the
|
| 517 |
+
parties who would receive the covered work from you, a discriminatory
|
| 518 |
+
patent license (a) in connection with copies of the covered work
|
| 519 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 520 |
+
for and in connection with specific products or compilations that
|
| 521 |
+
contain the covered work, unless you entered into that arrangement,
|
| 522 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 523 |
+
|
| 524 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 525 |
+
any implied license or other defenses to infringement that may
|
| 526 |
+
otherwise be available to you under applicable patent law.
|
| 527 |
+
|
| 528 |
+
12. No Surrender of Others' Freedom.
|
| 529 |
+
|
| 530 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 531 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 532 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 533 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 534 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 535 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 536 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 537 |
+
the Program, the only way you could satisfy both those terms and this
|
| 538 |
+
License would be to refrain entirely from conveying the Program.
|
| 539 |
+
|
| 540 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
| 541 |
+
|
| 542 |
+
Notwithstanding any other provision of this License, if you modify the
|
| 543 |
+
Program, your modified version must prominently offer all users
|
| 544 |
+
interacting with it remotely through a computer network (if your version
|
| 545 |
+
supports such interaction) an opportunity to receive the Corresponding
|
| 546 |
+
Source of your version by providing access to the Corresponding Source
|
| 547 |
+
from a network server at no charge, through some standard or customary
|
| 548 |
+
means of facilitating copying of software. This Corresponding Source
|
| 549 |
+
shall include the Corresponding Source for any work covered by version 3
|
| 550 |
+
of the GNU General Public License that is incorporated pursuant to the
|
| 551 |
+
following paragraph.
|
| 552 |
+
|
| 553 |
+
Notwithstanding any other provision of this License, you have
|
| 554 |
+
permission to link or combine any covered work with a work licensed
|
| 555 |
+
under version 3 of the GNU General Public License into a single
|
| 556 |
+
combined work, and to convey the resulting work. The terms of this
|
| 557 |
+
License will continue to apply to the part which is the covered work,
|
| 558 |
+
but the work with which it is combined will remain governed by version
|
| 559 |
+
3 of the GNU General Public License.
|
| 560 |
+
|
| 561 |
+
14. Revised Versions of this License.
|
| 562 |
+
|
| 563 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 564 |
+
the GNU Affero General Public License from time to time. Such new versions
|
| 565 |
+
will be similar in spirit to the present version, but may differ in detail to
|
| 566 |
+
address new problems or concerns.
|
| 567 |
+
|
| 568 |
+
Each version is given a distinguishing version number. If the
|
| 569 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
| 570 |
+
Public License "or any later version" applies to it, you have the
|
| 571 |
+
option of following the terms and conditions either of that numbered
|
| 572 |
+
version or of any later version published by the Free Software
|
| 573 |
+
Foundation. If the Program does not specify a version number of the
|
| 574 |
+
GNU Affero General Public License, you may choose any version ever published
|
| 575 |
+
by the Free Software Foundation.
|
| 576 |
+
|
| 577 |
+
If the Program specifies that a proxy can decide which future
|
| 578 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
| 579 |
+
public statement of acceptance of a version permanently authorizes you
|
| 580 |
+
to choose that version for the Program.
|
| 581 |
+
|
| 582 |
+
Later license versions may give you additional or different
|
| 583 |
+
permissions. However, no additional obligations are imposed on any
|
| 584 |
+
author or copyright holder as a result of your choosing to follow a
|
| 585 |
+
later version.
|
| 586 |
+
|
| 587 |
+
15. Disclaimer of Warranty.
|
| 588 |
+
|
| 589 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 590 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 591 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 592 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 593 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 594 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 595 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 596 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 597 |
+
|
| 598 |
+
16. Limitation of Liability.
|
| 599 |
+
|
| 600 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 601 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 602 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 603 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 604 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 605 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 606 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 607 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 608 |
+
SUCH DAMAGES.
|
| 609 |
+
|
| 610 |
+
17. Interpretation of Sections 15 and 16.
|
| 611 |
+
|
| 612 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 613 |
+
above cannot be given local legal effect according to their terms,
|
| 614 |
+
reviewing courts shall apply local law that most closely approximates
|
| 615 |
+
an absolute waiver of all civil liability in connection with the
|
| 616 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 617 |
+
copy of the Program in return for a fee.
|
| 618 |
+
|
| 619 |
+
END OF TERMS AND CONDITIONS
|
| 620 |
+
|
| 621 |
+
How to Apply These Terms to Your New Programs
|
| 622 |
+
|
| 623 |
+
If you develop a new program, and you want it to be of the greatest
|
| 624 |
+
possible use to the public, the best way to achieve this is to make it
|
| 625 |
+
free software which everyone can redistribute and change under these terms.
|
| 626 |
+
|
| 627 |
+
To do so, attach the following notices to the program. It is safest
|
| 628 |
+
to attach them to the start of each source file to most effectively
|
| 629 |
+
state the exclusion of warranty; and each file should have at least
|
| 630 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 631 |
+
|
| 632 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 633 |
+
Copyright (C) <year> <name of author>
|
| 634 |
+
|
| 635 |
+
This program is free software: you can redistribute it and/or modify
|
| 636 |
+
it under the terms of the GNU Affero General Public License as published by
|
| 637 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 638 |
+
(at your option) any later version.
|
| 639 |
+
|
| 640 |
+
This program is distributed in the hope that it will be useful,
|
| 641 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 642 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 643 |
+
GNU Affero General Public License for more details.
|
| 644 |
+
|
| 645 |
+
You should have received a copy of the GNU Affero General Public License
|
| 646 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 647 |
+
|
| 648 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 649 |
+
|
| 650 |
+
If your software can interact with users remotely through a computer
|
| 651 |
+
network, you should also make sure that it provides a way for users to
|
| 652 |
+
get its source. For example, if your program is a web application, its
|
| 653 |
+
interface could display a "Source" link that leads users to an archive
|
| 654 |
+
of the code. There are many ways you could offer source, and different
|
| 655 |
+
solutions will be better for different programs; see section 13 for the
|
| 656 |
+
specific requirements.
|
| 657 |
+
|
| 658 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 659 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 660 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
| 661 |
+
<https://www.gnu.org/licenses/>.
|
MCP.md
ADDED
|
@@ -0,0 +1,577 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MCP Integration
|
| 2 |
+
|
| 3 |
+
TREK includes a built-in [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server that lets AI
|
| 4 |
+
assistants — such as Claude Desktop, Cursor, or any MCP-compatible client — read and modify your trip data through a
|
| 5 |
+
structured API.
|
| 6 |
+
|
| 7 |
+
> **Note:** MCP is an addon that must be enabled by your TREK administrator before it becomes available.
|
| 8 |
+
|
| 9 |
+
## Table of Contents
|
| 10 |
+
|
| 11 |
+
- [Setup](#setup)
|
| 12 |
+
- [Option A: OAuth 2.1 (recommended)](#option-a-oauth-21-recommended)
|
| 13 |
+
- [Option B: Static API Token (deprecated)](#option-b-static-api-token-deprecated)
|
| 14 |
+
- [Authentication](#authentication)
|
| 15 |
+
- [OAuth Scopes](#oauth-scopes)
|
| 16 |
+
- [Limitations & Important Notes](#limitations--important-notes)
|
| 17 |
+
- [Resources (read-only)](#resources-read-only)
|
| 18 |
+
- [Tools (read-write)](#tools-read-write)
|
| 19 |
+
- [Compound Tools](#compound-tools)
|
| 20 |
+
- [Prompts](#prompts)
|
| 21 |
+
- [Example](#example)
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Setup
|
| 26 |
+
|
| 27 |
+
### 1. Enable the MCP addon (admin)
|
| 28 |
+
|
| 29 |
+
An administrator must first enable the MCP addon from the **Admin Panel > Addons** page. Until enabled, the `/mcp`
|
| 30 |
+
endpoint returns `404` and the MCP section does not appear in user settings.
|
| 31 |
+
|
| 32 |
+
### 2. Connect your MCP client
|
| 33 |
+
|
| 34 |
+
#### Option A: OAuth 2.1 (recommended)
|
| 35 |
+
|
| 36 |
+
MCP clients that support OAuth 2.1 (such as Claude Desktop via `mcp-remote`) authenticate automatically. No token
|
| 37 |
+
management required — just provide the server URL:
|
| 38 |
+
|
| 39 |
+
```json
|
| 40 |
+
{
|
| 41 |
+
"mcpServers": {
|
| 42 |
+
"trek": {
|
| 43 |
+
"command": "npx",
|
| 44 |
+
"args": [
|
| 45 |
+
"mcp-remote",
|
| 46 |
+
"https://your-trek-instance.com/mcp"
|
| 47 |
+
]
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
> The path to `npx` may need to be adjusted for your system (e.g. `C:\PROGRA~1\nodejs\npx.cmd` on Windows).
|
| 54 |
+
|
| 55 |
+
**What happens automatically:**
|
| 56 |
+
1. The client fetches `/.well-known/oauth-protected-resource` (RFC 9728) to discover the authorization server and bind the `/mcp` endpoint.
|
| 57 |
+
2. The client fetches `/.well-known/oauth-authorization-server` for the full AS metadata.
|
| 58 |
+
3. The client registers itself via [Dynamic Client Registration (RFC 7591)](https://www.rfc-editor.org/rfc/rfc7591).
|
| 59 |
+
4. Your browser opens TREK's consent screen, where you choose which scopes (permissions) to grant.
|
| 60 |
+
5. The client receives a short-lived access token audience-bound to `/mcp` (RFC 8707) and a rotating refresh token — no re-authorization needed.
|
| 61 |
+
|
| 62 |
+
> **Requirement:** The `APP_URL` environment variable must be set to your TREK instance's public URL for OAuth
|
| 63 |
+
> discovery to work correctly.
|
| 64 |
+
|
| 65 |
+
**For more control over scopes or to use confidential client mode**, pre-create an OAuth client in
|
| 66 |
+
**Settings > Integrations > MCP > OAuth Clients** before connecting. Clients created there have a client secret
|
| 67 |
+
(`trekcs_` prefix) and fixed scopes that you define up front.
|
| 68 |
+
|
| 69 |
+
#### Option B: Static API Token (deprecated)
|
| 70 |
+
|
| 71 |
+
> **Deprecated:** Static API tokens will stop working in a future version. Migrate to OAuth 2.1 above.
|
| 72 |
+
|
| 73 |
+
1. Go to **Settings > Integrations > MCP** and create an API token.
|
| 74 |
+
2. Click **Create New Token**, give it a name, and **copy the token immediately** — it is shown only once.
|
| 75 |
+
3. Add it to your `claude_desktop_config.json`:
|
| 76 |
+
|
| 77 |
+
```json
|
| 78 |
+
{
|
| 79 |
+
"mcpServers": {
|
| 80 |
+
"trek": {
|
| 81 |
+
"command": "npx",
|
| 82 |
+
"args": [
|
| 83 |
+
"mcp-remote",
|
| 84 |
+
"https://your-trek-instance.com/mcp",
|
| 85 |
+
"--header",
|
| 86 |
+
"Authorization: Bearer trek_your_token_here"
|
| 87 |
+
]
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
Static tokens grant full access to all tools and resources (no scope restrictions). Sessions authenticated with a
|
| 94 |
+
static token will receive deprecation warnings in the AI client via server instructions and tool results.
|
| 95 |
+
|
| 96 |
+
Each user can create up to **10 static tokens**.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Authentication
|
| 101 |
+
|
| 102 |
+
TREK's MCP server supports three authentication methods. OAuth 2.1 is the recommended path for all external clients.
|
| 103 |
+
|
| 104 |
+
| Method | Token prefix | Access level | TTL | Notes |
|
| 105 |
+
|--------|-------------|-------------|-----|-------|
|
| 106 |
+
| **OAuth 2.1** | `trekoa_` | Scoped (per-consent) | 1 hour | Recommended. Automatically refreshed via 30-day rolling refresh tokens (`trekrf_` prefix). Replay-detected rotation — replayed tokens cascade-revoke the entire chain. |
|
| 107 |
+
| **Static API token** | `trek_` | Full access | No expiry | **Deprecated.** Triggers deprecation warnings in AI clients. Will be removed in a future release. |
|
| 108 |
+
| **Web session JWT** | — | Full access | Session-based | Used internally by the TREK web UI. Not intended for external clients. |
|
| 109 |
+
|
| 110 |
+
All methods require the `Authorization: Bearer <token>` header (strict scheme enforcement — `Bearer` required).
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## OAuth Scopes
|
| 115 |
+
|
| 116 |
+
When connecting via OAuth 2.1, you grant specific scopes during the consent step. TREK registers only the MCP tools
|
| 117 |
+
that match your granted scopes for that session.
|
| 118 |
+
|
| 119 |
+
| Scope | Permission | Group |
|
| 120 |
+
|-------|-----------|-------|
|
| 121 |
+
| `trips:read` | View trips & itineraries | Trips |
|
| 122 |
+
| `trips:write` | Edit trips & itineraries | Trips |
|
| 123 |
+
| `trips:delete` | Delete trips (irreversible) | Trips |
|
| 124 |
+
| `trips:share` | Manage share links | Trips |
|
| 125 |
+
| `places:read` | View places & map data | Places |
|
| 126 |
+
| `places:write` | Manage places | Places |
|
| 127 |
+
| `atlas:read` | View Atlas | Atlas |
|
| 128 |
+
| `atlas:write` | Manage Atlas | Atlas |
|
| 129 |
+
| `packing:read` | View packing lists | Packing |
|
| 130 |
+
| `packing:write` | Manage packing lists | Packing |
|
| 131 |
+
| `todos:read` | View to-do lists | To-dos |
|
| 132 |
+
| `todos:write` | Manage to-do lists | To-dos |
|
| 133 |
+
| `budget:read` | View budget | Budget |
|
| 134 |
+
| `budget:write` | Manage budget | Budget |
|
| 135 |
+
| `reservations:read` | View reservations | Reservations |
|
| 136 |
+
| `reservations:write` | Manage reservations | Reservations |
|
| 137 |
+
| `collab:read` | View collaboration | Collaboration |
|
| 138 |
+
| `collab:write` | Manage collaboration | Collaboration |
|
| 139 |
+
| `notifications:read` | View notifications | Notifications |
|
| 140 |
+
| `notifications:write` | Manage notifications | Notifications |
|
| 141 |
+
| `vacay:read` | View vacation plans | Vacation |
|
| 142 |
+
| `vacay:write` | Manage vacation plans | Vacation |
|
| 143 |
+
| `geo:read` | Maps & geocoding | Geo |
|
| 144 |
+
| `weather:read` | Weather forecasts | Weather |
|
| 145 |
+
| `journey:read` | View journeys | Journey |
|
| 146 |
+
| `journey:write` | Manage journeys | Journey |
|
| 147 |
+
| `journey:share` | Manage journey share links | Journey |
|
| 148 |
+
|
| 149 |
+
**Scope rules:**
|
| 150 |
+
- A `:write` scope implies `:read` access for the same group (e.g. `budget:write` also grants budget read access).
|
| 151 |
+
- Any `trips:*` scope (`trips:read`, `trips:write`, `trips:delete`, or `trips:share`) grants trip read access.
|
| 152 |
+
- Any `journey:*` scope (`journey:read`, `journey:write`, or `journey:share`) grants journey read access.
|
| 153 |
+
- `list_trips` and `get_trip_summary` are **always available** regardless of scopes — they are navigation tools.
|
| 154 |
+
- Static tokens and web session JWTs have full access to all tools (equivalent to all scopes).
|
| 155 |
+
- Addon-gated tools (Atlas, Collab, Vacay, Journey) require both the relevant scope **and** the addon to be enabled.
|
| 156 |
+
|
| 157 |
+
---
|
| 158 |
+
|
| 159 |
+
## Limitations & Important Notes
|
| 160 |
+
|
| 161 |
+
| Limitation | Details |
|
| 162 |
+
|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 163 |
+
| **Admin activation required** | The MCP addon must be enabled by an admin before any user can access it. |
|
| 164 |
+
| **Per-user scoping** | Each MCP session is scoped to the authenticated user. You can only access trips you own or are a member of. |
|
| 165 |
+
| **No image uploads** | Cover images cannot be set through MCP. Use the web UI to upload trip covers. |
|
| 166 |
+
| **Reservations are created as pending** | When the AI creates a reservation, it starts with `pending` status. You must confirm it manually or ask the AI to set the status to `confirmed`. |
|
| 167 |
+
| **Demo mode restrictions** | If TREK is running in demo mode, all write operations through MCP are blocked. |
|
| 168 |
+
| **Rate limiting** | 300 requests per minute per user (configurable via `MCP_RATE_LIMIT`). Exceeding this returns a `429` error. |
|
| 169 |
+
| **Per-client rate limiting** | Rate limits are tracked per user-client pair, so each OAuth client has its own independent rate limit window. |
|
| 170 |
+
| **Session limits** | Maximum 20 concurrent MCP sessions per user (configurable via `MCP_MAX_SESSION_PER_USER`). Sessions expire after 1 hour of inactivity. |
|
| 171 |
+
| **Token limits** | Maximum 10 static API tokens per user. Maximum 10 OAuth clients per user. |
|
| 172 |
+
| **Token revocation** | Deleting a static token or revoking an OAuth session immediately terminates all active MCP sessions for that token/client. |
|
| 173 |
+
| **OAuth scope enforcement** | Only tools matching your granted OAuth scopes are registered in the session. Calling an out-of-scope tool returns an error. |
|
| 174 |
+
| **Addon toggle invalidation** | When an admin enables or disables an addon, all active MCP sessions are invalidated and must be re-established. |
|
| 175 |
+
| **Real-time sync** | Changes made through MCP are broadcast to all connected clients in real-time via WebSocket, just like changes made through the web UI. |
|
| 176 |
+
| **Addon-gated features** | Some resources and tools are only available when the corresponding addon (Atlas, Collab, Vacay, Journey) is enabled by an admin. |
|
| 177 |
+
|
| 178 |
+
---
|
| 179 |
+
|
| 180 |
+
## Resources (read-only)
|
| 181 |
+
|
| 182 |
+
Resources provide read-only access to your TREK data. MCP clients can read these to understand the current state before
|
| 183 |
+
making changes.
|
| 184 |
+
|
| 185 |
+
### Core Resources
|
| 186 |
+
|
| 187 |
+
| Resource | URI | Description |
|
| 188 |
+
|-----------------------|-------------------------------------------------|---------------------------------------------------------------------------------------|
|
| 189 |
+
| Trips | `trek://trips` | All trips you own or are a member of |
|
| 190 |
+
| Trip Detail | `trek://trips/{tripId}` | Single trip with metadata and member count |
|
| 191 |
+
| Days | `trek://trips/{tripId}/days` | Days of a trip with their assigned places |
|
| 192 |
+
| Places | `trek://trips/{tripId}/places` | All places/POIs saved in a trip. Supports `?assignment=all\|unassigned\|assigned` |
|
| 193 |
+
| Budget | `trek://trips/{tripId}/budget` | Budget and expense items |
|
| 194 |
+
| Budget Per-Person | `trek://trips/{tripId}/budget/per-person` | Per-person totals and split breakdown |
|
| 195 |
+
| Budget Settlement | `trek://trips/{tripId}/budget/settlement` | Suggested transactions to settle who owes whom |
|
| 196 |
+
| Packing | `trek://trips/{tripId}/packing` | Packing checklist |
|
| 197 |
+
| Packing Bags | `trek://trips/{tripId}/packing/bags` | Packing bags with their assigned members |
|
| 198 |
+
| Reservations | `trek://trips/{tripId}/reservations` | Flights, hotels, restaurants, etc. |
|
| 199 |
+
| Day Notes | `trek://trips/{tripId}/days/{dayId}/notes` | Notes for a specific day |
|
| 200 |
+
| Accommodations | `trek://trips/{tripId}/accommodations` | Hotels/rentals with check-in/out details |
|
| 201 |
+
| Members | `trek://trips/{tripId}/members` | Owner and collaborators |
|
| 202 |
+
| Collab Notes | `trek://trips/{tripId}/collab-notes` | Shared collaborative notes |
|
| 203 |
+
| To-Dos | `trek://trips/{tripId}/todos` | To-do items ordered by position |
|
| 204 |
+
| Categories | `trek://categories` | Available place categories (for use when creating places) |
|
| 205 |
+
| Bucket List | `trek://bucket-list` | Your personal travel bucket list |
|
| 206 |
+
| Visited Countries | `trek://visited-countries` | Countries marked as visited in Atlas |
|
| 207 |
+
| Notifications | `trek://notifications/in-app` | Your in-app notifications (most recent 50, unread first) |
|
| 208 |
+
|
| 209 |
+
### Addon-Gated Resources
|
| 210 |
+
|
| 211 |
+
These resources are only available when the corresponding addon is enabled by an admin.
|
| 212 |
+
|
| 213 |
+
| Resource | URI | Addon | Description |
|
| 214 |
+
|-----------------------|-------------------------------------------------|----------|---------------------------------------------------------------------|
|
| 215 |
+
| Atlas Stats | `trek://atlas/stats` | Atlas | Visited country counts and continent breakdown |
|
| 216 |
+
| Atlas Regions | `trek://atlas/regions` | Atlas | Manually visited sub-country regions |
|
| 217 |
+
| Collab Polls | `trek://trips/{tripId}/collab/polls` | Collab | All polls for a trip with vote counts per option |
|
| 218 |
+
| Collab Messages | `trek://trips/{tripId}/collab/messages` | Collab | Most recent 100 chat messages for a trip |
|
| 219 |
+
| Vacay Plan | `trek://vacay/plan` | Vacay | Full snapshot of your active vacation plan (members, years, config) |
|
| 220 |
+
| Vacay Entries | `trek://vacay/entries/{year}` | Vacay | All vacation day entries for the active plan and a specific year |
|
| 221 |
+
| Vacay Holidays | `trek://vacay/holidays/{year}` | Vacay | Public holidays for the plan's configured region and year |
|
| 222 |
+
| Journeys | `trek://journeys` | Journey | All journeys owned or contributed to by the current user |
|
| 223 |
+
| Journey Detail | `trek://journeys/{journeyId}` | Journey | Single journey with entries, contributors, and linked trips |
|
| 224 |
+
| Journey Entries | `trek://journeys/{journeyId}/entries` | Journey | All entries in a journey (date, text, mood, linked trip) |
|
| 225 |
+
| Journey Contributors | `trek://journeys/{journeyId}/contributors` | Journey | Contributors (owner and collaborators) of a journey |
|
| 226 |
+
|
| 227 |
+
---
|
| 228 |
+
|
| 229 |
+
## Tools (read-write)
|
| 230 |
+
|
| 231 |
+
TREK exposes tools organized by feature area. Use `get_trip_summary` as a starting point — it returns everything about a
|
| 232 |
+
trip in a single call.
|
| 233 |
+
|
| 234 |
+
### Trip Summary
|
| 235 |
+
|
| 236 |
+
| Tool | Description |
|
| 237 |
+
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 238 |
+
| `get_trip_summary` | Full denormalized snapshot of a trip: metadata, members, days with assignments and notes, accommodations, budget, packing, reservations, collab notes, to-dos, and poll/message counts. Use this as your context loader. |
|
| 239 |
+
|
| 240 |
+
### Compound Tools
|
| 241 |
+
|
| 242 |
+
Compound tools collapse common multi-step workflows into a single atomic call. Each one wraps two sequential operations in a database transaction — if the second step fails, the first is rolled back automatically.
|
| 243 |
+
|
| 244 |
+
> **When to use:** Only use compound tools when the place or item does not yet exist. If it already exists, call the individual tools (`assign_place_to_day`, `create_accommodation`, `set_budget_item_members`) directly.
|
| 245 |
+
|
| 246 |
+
| Tool | Wraps | Description |
|
| 247 |
+
|---|---|---|
|
| 248 |
+
| `create_and_assign_place` | `create_place` + `assign_place_to_day` | Create a new place and immediately assign it to a specific day. Accepts all `create_place` fields (`place_notes` instead of `notes`) plus `dayId` and optional `assignment_notes`. Returns `{ place, assignment }`. |
|
| 249 |
+
| `create_place_accommodation` | `create_place` + `create_accommodation` | Create a new place and immediately book it as an accommodation for a date range. Accepts all `create_place` fields (`place_notes` instead of `notes`) plus `start_day_id`, `end_day_id`, `check_in`, `check_out`, `confirmation`, and `accommodation_notes`. Also auto-creates a linked hotel reservation. Returns `{ place, accommodation }`. |
|
| 250 |
+
| `create_budget_item_with_members` | `create_budget_item` + `set_budget_item_members` | Create a budget item and optionally set which members are splitting it. Accepts all `create_budget_item` fields plus an optional `userIds` array. If `userIds` is omitted or empty, behaves identically to `create_budget_item`. Returns `{ item }` with members populated. |
|
| 251 |
+
|
| 252 |
+
**Scope requirements** match the underlying tools: `places:write` for `create_and_assign_place`, `trips:write` for `create_place_accommodation`, `budget:write` for `create_budget_item_with_members` (Budget addon required).
|
| 253 |
+
|
| 254 |
+
---
|
| 255 |
+
|
| 256 |
+
### Trips
|
| 257 |
+
|
| 258 |
+
| Tool | Description |
|
| 259 |
+
|----------------------|---------------------------------------------------------------------------------------------|
|
| 260 |
+
| `list_trips` | List all trips you own or are a member of. Supports `include_archived` flag. |
|
| 261 |
+
| `create_trip` | Create a new trip with title, dates, currency. Days are auto-generated from the date range. |
|
| 262 |
+
| `update_trip` | Update a trip's title, description, dates, or currency. |
|
| 263 |
+
| `delete_trip` | Delete a trip. **Owner only.** |
|
| 264 |
+
| `list_trip_members` | List the owner and all collaborators of a trip. |
|
| 265 |
+
| `add_trip_member` | Add a user to a trip by username or email. **Owner only.** |
|
| 266 |
+
| `remove_trip_member` | Remove a collaborator from a trip. **Owner only.** |
|
| 267 |
+
| `copy_trip` | Duplicate a trip (days, places, itinerary, packing, budget, reservations). Packing items are reset to unchecked. |
|
| 268 |
+
| `export_trip_ics` | Export the trip itinerary and reservations as iCalendar (`.ics`) text for calendar apps. |
|
| 269 |
+
| `get_share_link` | Get the current public share link for a trip and its permission flags. |
|
| 270 |
+
| `create_share_link` | Create or update the public share link with configurable visibility flags (map, bookings, packing, budget, collab). |
|
| 271 |
+
| `delete_share_link` | Revoke the public share link for a trip. |
|
| 272 |
+
|
| 273 |
+
### Places
|
| 274 |
+
|
| 275 |
+
> To create a place and assign it to a day in one call, use [`create_and_assign_place`](#compound-tools).
|
| 276 |
+
|
| 277 |
+
| Tool | Description |
|
| 278 |
+
|------------------|--------------------------------------------------------------------------------------------------|
|
| 279 |
+
| `list_places` | List places/POIs in a trip, optionally filtered by assignment status, category, tag, or search. |
|
| 280 |
+
| `create_place` | Add a place/POI with name, coordinates, address, category, notes, website, phone, and optional `google_place_id` / `osm_id` for opening hours. |
|
| 281 |
+
| `update_place` | Update any field of an existing place including transport mode, timing, and price. |
|
| 282 |
+
| `delete_place` | Remove a place from a trip. |
|
| 283 |
+
| `bulk_delete_places` | Delete multiple places at once by ID. Removes all day assignments as well. **Cannot be undone.** |
|
| 284 |
+
| `import_places_from_url` | Import all places from a publicly shared Google Maps or Naver Maps list URL. |
|
| 285 |
+
| `list_categories` | List all available place categories with id, name, icon and color. |
|
| 286 |
+
| `search_place` | Search for a real-world place by name or address. Returns `osm_id` and `google_place_id` for use in `create_place`. |
|
| 287 |
+
|
| 288 |
+
### Day Planning
|
| 289 |
+
|
| 290 |
+
| Tool | Description |
|
| 291 |
+
|-----------------------------|--------------------------------------------------------------------------------------|
|
| 292 |
+
| `update_day` | Set or clear a day's title (e.g. "Arrival in Paris", "Free day"). |
|
| 293 |
+
| `create_day` | Add a new day to a trip with optional date and notes. |
|
| 294 |
+
| `delete_day` | Delete a day from a trip. |
|
| 295 |
+
| `assign_place_to_day` | Pin a place to a specific day in the itinerary. |
|
| 296 |
+
| `unassign_place` | Remove a place assignment from a day. |
|
| 297 |
+
| `reorder_day_assignments` | Reorder places within a day by providing assignment IDs in the desired order. |
|
| 298 |
+
| `update_assignment_time` | Set start/end times for a place assignment (e.g. "09:00" – "11:30"). Pass `null` to clear. |
|
| 299 |
+
| `move_assignment` | Move a place assignment to a different day. |
|
| 300 |
+
| `get_assignment_participants`| Get the list of users participating in a specific place assignment. |
|
| 301 |
+
| `set_assignment_participants`| Set participants for a place assignment (replaces current list). |
|
| 302 |
+
|
| 303 |
+
### Accommodations
|
| 304 |
+
|
| 305 |
+
> To create a place and book it as an accommodation in one call, use [`create_place_accommodation`](#compound-tools).
|
| 306 |
+
|
| 307 |
+
| Tool | Description |
|
| 308 |
+
|------------------------|------------------------------------------------------------------------------------------|
|
| 309 |
+
| `create_accommodation` | Add an accommodation (hotel, Airbnb, etc.) linked to a place and a check-in/out date range. |
|
| 310 |
+
| `update_accommodation` | Update fields on an existing accommodation (dates, times, confirmation, notes). |
|
| 311 |
+
| `delete_accommodation` | Delete an accommodation record from a trip. |
|
| 312 |
+
|
| 313 |
+
### Transport
|
| 314 |
+
|
| 315 |
+
Transport bookings (flights, trains, cars, cruises) support multi-stop `endpoints[]` — each endpoint has a `role` (`from`/`to`/`stop`), name, optional IATA `code` (for flights), coordinates, timezone, and local time. Use `search_airports` to resolve airport names to IATA codes before creating a flight.
|
| 316 |
+
|
| 317 |
+
| Tool | Description |
|
| 318 |
+
|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 319 |
+
| `create_transport` | Create a transport booking (`flight`, `train`, `car`, `cruise`) with optional endpoints, departure/arrival times, and confirmation details. Created as pending. |
|
| 320 |
+
| `update_transport` | Update an existing transport booking. Pass `endpoints[]` to replace the full stop list. Use `status: "confirmed"` to confirm. |
|
| 321 |
+
| `delete_transport` | Delete a transport booking from a trip. |
|
| 322 |
+
|
| 323 |
+
### Reservations
|
| 324 |
+
|
| 325 |
+
For flights, trains, cars, and cruises, use the **Transport** tools above. Reservations cover all other booking types.
|
| 326 |
+
|
| 327 |
+
| Tool | Description |
|
| 328 |
+
|----------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
|
| 329 |
+
| `create_reservation` | Create a pending reservation. Supports hotels, restaurants, events, tours, activities, and other types. Hotels can be linked to places and check-in/out days. |
|
| 330 |
+
| `update_reservation` | Update any field including status (`pending` / `confirmed` / `cancelled`). |
|
| 331 |
+
| `delete_reservation` | Delete a reservation and its linked accommodation record if applicable. |
|
| 332 |
+
| `reorder_reservations` | Update the display order of reservations (and transports) within a day. |
|
| 333 |
+
| `link_hotel_accommodation` | Set or update a hotel reservation's check-in/out day links and associated place. |
|
| 334 |
+
|
| 335 |
+
### Budget
|
| 336 |
+
|
| 337 |
+
> To create a budget item and set its members in one call, use [`create_budget_item_with_members`](#compound-tools).
|
| 338 |
+
|
| 339 |
+
| Tool | Description |
|
| 340 |
+
|----------------------------|---------------------------------------------------------------------------------------|
|
| 341 |
+
| `create_budget_item` | Add an expense with name, category, and price. |
|
| 342 |
+
| `update_budget_item` | Update an expense's details, split (persons/days), or notes. |
|
| 343 |
+
| `delete_budget_item` | Remove a budget item. |
|
| 344 |
+
| `set_budget_item_members` | Set which trip members are splitting a budget item (replaces current member list). |
|
| 345 |
+
| `toggle_budget_member_paid`| Mark or unmark a member as having paid their share of a budget item. |
|
| 346 |
+
|
| 347 |
+
### Packing
|
| 348 |
+
|
| 349 |
+
| Tool | Description |
|
| 350 |
+
|-------------------------------|-----------------------------------------------------------------------------------|
|
| 351 |
+
| `create_packing_item` | Add an item to the packing checklist with optional category. |
|
| 352 |
+
| `update_packing_item` | Rename an item or change its category. |
|
| 353 |
+
| `toggle_packing_item` | Check or uncheck a packing item. |
|
| 354 |
+
| `delete_packing_item` | Remove a packing item. |
|
| 355 |
+
| `reorder_packing_items` | Set the display order of packing items within a trip. |
|
| 356 |
+
| `bulk_import_packing` | Import multiple packing items at once from a list (with optional quantity). |
|
| 357 |
+
| `apply_packing_template` | Apply a saved packing template to a trip (adds items from the template). |
|
| 358 |
+
| `save_packing_template` | Save the current packing list as a reusable template. |
|
| 359 |
+
| `list_packing_bags` | List all packing bags for a trip. |
|
| 360 |
+
| `create_packing_bag` | Create a new packing bag (e.g. "Carry-on", "Checked bag"). |
|
| 361 |
+
| `update_packing_bag` | Rename or recolor a packing bag. |
|
| 362 |
+
| `delete_packing_bag` | Delete a packing bag (items are unassigned, not deleted). |
|
| 363 |
+
| `set_bag_members` | Assign trip members to a packing bag. |
|
| 364 |
+
| `get_packing_category_assignees` | Get which trip members are assigned to each packing category. |
|
| 365 |
+
| `set_packing_category_assignees` | Assign trip members to a packing category. |
|
| 366 |
+
|
| 367 |
+
### Day Notes
|
| 368 |
+
|
| 369 |
+
| Tool | Description |
|
| 370 |
+
|-------------------|------------------------------------------------------------------------|
|
| 371 |
+
| `create_day_note` | Add a note to a specific day with optional time label and emoji icon. |
|
| 372 |
+
| `update_day_note` | Edit a day note's text, time, or icon. |
|
| 373 |
+
| `delete_day_note` | Remove a note from a day. |
|
| 374 |
+
|
| 375 |
+
### To-Dos
|
| 376 |
+
|
| 377 |
+
| Tool | Description |
|
| 378 |
+
|-------------------------------|---------------------------------------------------------------------------------------------------|
|
| 379 |
+
| `list_todos` | List all to-do items for a trip, ordered by position. |
|
| 380 |
+
| `create_todo` | Create a to-do item with name, category, due date, description, assignee, and priority. |
|
| 381 |
+
| `update_todo` | Update an existing to-do item. Pass `null` to clear nullable fields. |
|
| 382 |
+
| `toggle_todo` | Mark a to-do item as done or undone. |
|
| 383 |
+
| `delete_todo` | Delete a to-do item. |
|
| 384 |
+
| `reorder_todos` | Reorder to-do items within a trip by providing a new ordered list of IDs. |
|
| 385 |
+
| `get_todo_category_assignees` | Get the default assignees configured per to-do category for a trip. |
|
| 386 |
+
| `set_todo_category_assignees` | Set default assignees for a to-do category. Pass an empty array to clear. |
|
| 387 |
+
|
| 388 |
+
### Tags
|
| 389 |
+
|
| 390 |
+
| Tool | Description |
|
| 391 |
+
|--------------|--------------------------------------------------------------------------|
|
| 392 |
+
| `list_tags` | List all tags belonging to the current user. |
|
| 393 |
+
| `create_tag` | Create a new tag (user-scoped label for places) with optional hex color. |
|
| 394 |
+
| `update_tag` | Update the name or color of an existing tag. |
|
| 395 |
+
| `delete_tag` | Delete a tag (removes it from all places it was attached to). |
|
| 396 |
+
|
| 397 |
+
### Notifications
|
| 398 |
+
|
| 399 |
+
| Tool | Description |
|
| 400 |
+
|---------------------------------|------------------------------------------------------|
|
| 401 |
+
| `list_notifications` | List in-app notifications with pagination and unread filter. |
|
| 402 |
+
| `get_unread_notification_count` | Get the count of unread in-app notifications. |
|
| 403 |
+
| `mark_notification_read` | Mark a single notification as read. |
|
| 404 |
+
| `mark_notification_unread` | Mark a single notification as unread. |
|
| 405 |
+
| `mark_all_notifications_read` | Mark all notifications as read. |
|
| 406 |
+
|
| 407 |
+
### Maps & Weather
|
| 408 |
+
|
| 409 |
+
| Tool | Description |
|
| 410 |
+
|-----------------------|-----------------------------------------------------------------------------------------------------|
|
| 411 |
+
| `search_place` | Search for a real-world place by name/address and get coordinates, `osm_id`, and `google_place_id`. |
|
| 412 |
+
| `get_place_details` | Fetch detailed information (hours, photos, ratings) about a place by its Google Place ID. |
|
| 413 |
+
| `reverse_geocode` | Get a human-readable address for given coordinates. |
|
| 414 |
+
| `resolve_maps_url` | Resolve a Google Maps share URL to coordinates and place name. |
|
| 415 |
+
| `get_weather` | Get weather forecast for a location and date. |
|
| 416 |
+
| `get_detailed_weather`| Get hourly/detailed weather forecast for a location and date. |
|
| 417 |
+
|
| 418 |
+
### Airports
|
| 419 |
+
|
| 420 |
+
| Tool | Description |
|
| 421 |
+
|-------------------|-------------------------------------------------------------------------------------------------------------------|
|
| 422 |
+
| `search_airports` | Search for airports by name, city, or IATA code. Returns IATA code, name, city, country, coordinates, timezone. |
|
| 423 |
+
| `get_airport` | Look up a single airport by IATA code (e.g. `"ZRH"`, `"AMS"`, `"CDG"`). |
|
| 424 |
+
|
| 425 |
+
### Collab Notes _(Collab addon required)_
|
| 426 |
+
|
| 427 |
+
| Tool | Description |
|
| 428 |
+
|----------------------|-------------------------------------------------------------------------------------------------|
|
| 429 |
+
| `create_collab_note` | Create a shared note visible to all trip members. Supports title, content, category, and color. |
|
| 430 |
+
| `update_collab_note` | Edit a collab note's content, category, color, or pin status. |
|
| 431 |
+
| `delete_collab_note` | Delete a collab note. |
|
| 432 |
+
|
| 433 |
+
### Collab Polls & Chat _(Collab addon required)_
|
| 434 |
+
|
| 435 |
+
| Tool | Description |
|
| 436 |
+
|-----------------------|------------------------------------------------------------------------------------------|
|
| 437 |
+
| `list_collab_polls` | List all polls for a trip. |
|
| 438 |
+
| `create_collab_poll` | Create a new poll with a question, options, optional multiple choice, and deadline. |
|
| 439 |
+
| `vote_collab_poll` | Vote on a poll option (or remove vote if already voted). |
|
| 440 |
+
| `close_collab_poll` | Close a poll so no more votes can be cast. |
|
| 441 |
+
| `delete_collab_poll` | Delete a poll and all its votes. |
|
| 442 |
+
| `list_collab_messages`| List chat messages for a trip (most recent 100, supports pagination via `before`). |
|
| 443 |
+
| `send_collab_message` | Send a chat message to a trip's collab channel, with optional reply threading. |
|
| 444 |
+
| `delete_collab_message`| Delete a chat message (own messages only). |
|
| 445 |
+
| `react_collab_message`| Toggle a reaction emoji on a chat message. |
|
| 446 |
+
|
| 447 |
+
### Bucket List _(Atlas addon required)_
|
| 448 |
+
|
| 449 |
+
| Tool | Description |
|
| 450 |
+
|---------------------------|--------------------------------------------------------------------------------------------|
|
| 451 |
+
| `create_bucket_list_item` | Add a destination to your personal bucket list with optional coordinates and country code. |
|
| 452 |
+
| `delete_bucket_list_item` | Remove an item from your bucket list. |
|
| 453 |
+
|
| 454 |
+
### Atlas _(Atlas addon required)_
|
| 455 |
+
|
| 456 |
+
| Tool | Description |
|
| 457 |
+
|--------------------------|---------------------------------------------------------------------------------|
|
| 458 |
+
| `mark_country_visited` | Mark a country as visited using its ISO 3166-1 alpha-2 code (e.g. "FR", "JP"). |
|
| 459 |
+
| `unmark_country_visited` | Remove a country from your visited list. |
|
| 460 |
+
|
| 461 |
+
### Atlas Extended _(Atlas addon required)_
|
| 462 |
+
|
| 463 |
+
| Tool | Description |
|
| 464 |
+
|----------------------------|------------------------------------------------------------------------------|
|
| 465 |
+
| `get_atlas_stats` | Get atlas statistics — visited country counts, region counts, continent breakdown. |
|
| 466 |
+
| `list_visited_regions` | List all manually visited sub-country regions for the current user. |
|
| 467 |
+
| `mark_region_visited` | Mark a sub-country region as visited (e.g. ISO code "US-CA"). |
|
| 468 |
+
| `unmark_region_visited` | Remove a region from the visited list. |
|
| 469 |
+
| `get_country_atlas_places` | Get places saved in the user's atlas for a specific country. |
|
| 470 |
+
| `update_bucket_list_item` | Update a bucket list item (name, notes, coordinates, target date). |
|
| 471 |
+
|
| 472 |
+
### Vacay _(Vacay addon required)_
|
| 473 |
+
|
| 474 |
+
| Tool | Description |
|
| 475 |
+
|----------------------------|---------------------------------------------------------------------------------------|
|
| 476 |
+
| `get_vacay_plan` | Get the current user's active vacation plan (own or joined). |
|
| 477 |
+
| `update_vacay_plan` | Update vacation plan settings (weekend blocking, holidays, carry-over). |
|
| 478 |
+
| `set_vacay_color` | Set the current user's color in the vacation plan calendar. |
|
| 479 |
+
| `get_available_vacay_users`| List users who can be invited to the current vacation plan. |
|
| 480 |
+
| `send_vacay_invite` | Invite a user to join the vacation plan by their user ID. |
|
| 481 |
+
| `accept_vacay_invite` | Accept a pending invitation to join another user's vacation plan. |
|
| 482 |
+
| `decline_vacay_invite` | Decline a pending vacation plan invitation. |
|
| 483 |
+
| `cancel_vacay_invite` | Cancel an outgoing invitation (owner cancels an invite they sent). |
|
| 484 |
+
| `dissolve_vacay_plan` | Dissolve the shared plan — all members return to their own individual plan. |
|
| 485 |
+
| `list_vacay_years` | List calendar years tracked in the current vacation plan. |
|
| 486 |
+
| `add_vacay_year` | Add a calendar year to the vacation plan. |
|
| 487 |
+
| `delete_vacay_year` | Remove a calendar year from the vacation plan. |
|
| 488 |
+
| `get_vacay_entries` | Get all vacation day entries for the active plan and a specific year. |
|
| 489 |
+
| `toggle_vacay_entry` | Toggle a day on or off as a vacation day for the current user. |
|
| 490 |
+
| `toggle_company_holiday` | Toggle a date as a company holiday for the whole plan. |
|
| 491 |
+
| `get_vacay_stats` | Get vacation statistics for a specific year (days used, remaining, carried over). |
|
| 492 |
+
| `update_vacay_stats` | Update the vacation day allowance for a specific user and year. |
|
| 493 |
+
| `add_holiday_calendar` | Add a public holiday calendar (by region code) to the vacation plan. |
|
| 494 |
+
| `update_holiday_calendar` | Update label or color for a holiday calendar. |
|
| 495 |
+
| `delete_holiday_calendar` | Remove a holiday calendar from the vacation plan. |
|
| 496 |
+
| `list_holiday_countries` | List countries available for public holiday calendars. |
|
| 497 |
+
| `list_holidays` | List public holidays for a country and year. |
|
| 498 |
+
|
| 499 |
+
### Journey _(Journey addon required)_
|
| 500 |
+
|
| 501 |
+
| Tool | Description |
|
| 502 |
+
|-----------------------------------|------------------------------------------------------------------------------------------------------------|
|
| 503 |
+
| `list_journeys` | List all journeys owned or contributed to by the current user. |
|
| 504 |
+
| `get_journey` | Get a full snapshot of a journey: metadata, entries, contributors, and linked trips. |
|
| 505 |
+
| `create_journey` | Create a new journey with title, optional subtitle, and an initial list of trip IDs. |
|
| 506 |
+
| `update_journey` | Update a journey's title, subtitle, or status. |
|
| 507 |
+
| `delete_journey` | Delete a journey. |
|
| 508 |
+
| `add_journey_trip` | Link an existing trip to a journey. |
|
| 509 |
+
| `remove_journey_trip` | Remove a trip from a journey. |
|
| 510 |
+
| `list_journey_entries` | List all entries in a journey (date, text, mood, linked trip). |
|
| 511 |
+
| `create_journey_entry` | Add an entry to a journey with optional title, body text, date, linked trip, and sort order. |
|
| 512 |
+
| `update_journey_entry` | Edit a journey entry's title, body, date, or mood. |
|
| 513 |
+
| `delete_journey_entry` | Remove an entry from a journey. |
|
| 514 |
+
| `reorder_journey_entries` | Reorder entries in a journey by providing the new ordered list of entry IDs. |
|
| 515 |
+
| `list_journey_contributors` | List the contributors of a journey (owner and invited editors/viewers). |
|
| 516 |
+
| `add_journey_contributor` | Invite a user to a journey with `editor` or `viewer` role. |
|
| 517 |
+
| `update_journey_contributor_role` | Change a contributor's role between `editor` and `viewer`. |
|
| 518 |
+
| `remove_journey_contributor` | Remove a contributor from a journey. |
|
| 519 |
+
| `update_journey_preferences` | Update display preferences for a journey (e.g. hide skeleton entries). |
|
| 520 |
+
| `get_journey_suggestions` | Get suggested trips to add to journeys (based on recent trip history). |
|
| 521 |
+
| `list_journey_available_trips` | List all trips available to the current user for linking to a journey. |
|
| 522 |
+
| `get_journey_share_link` | Get the current public share link for a journey. |
|
| 523 |
+
| `create_journey_share_link` | Create or update the public share link for a journey. |
|
| 524 |
+
| `delete_journey_share_link` | Revoke the public share link for a journey. |
|
| 525 |
+
|
| 526 |
+
---
|
| 527 |
+
|
| 528 |
+
## Prompts
|
| 529 |
+
|
| 530 |
+
MCP prompts are pre-built context loaders your AI client can invoke to get a structured starting point for common tasks.
|
| 531 |
+
|
| 532 |
+
| Prompt | Description |
|
| 533 |
+
|----------------------|---------------------------------------------------------------------------------|
|
| 534 |
+
| `trip-summary` | Load a formatted summary of a trip (dates, members, days, budget, packing, reservations) before planning or modifying it. |
|
| 535 |
+
| `packing-list` | Get a formatted packing checklist for a trip, grouped by category. |
|
| 536 |
+
| `budget-overview` | Get a formatted budget summary with totals by category and per-person cost. |
|
| 537 |
+
| `token_auth_notice` | Static token deprecation notice and migration guide. Only available in sessions authenticated with a legacy `trek_` token. |
|
| 538 |
+
|
| 539 |
+
---
|
| 540 |
+
|
| 541 |
+
## Example
|
| 542 |
+
|
| 543 |
+
Conversation with Claude: https://claude.ai/share/51572203-6a4d-40f8-a6bd-eba09d4b009d
|
| 544 |
+
|
| 545 |
+
Initial prompt (1st message):
|
| 546 |
+
|
| 547 |
+
```
|
| 548 |
+
I'd like to plan a week-long trip to Kyoto, Japan, arriving April 5 2027
|
| 549 |
+
and leaving April 11 2027. It's cherry blossom season so please keep that
|
| 550 |
+
in mind when picking spots.
|
| 551 |
+
|
| 552 |
+
Before writing anything to TREK, do some research: look up what's worth
|
| 553 |
+
visiting, figure out a logical day-by-day flow (group nearby spots together
|
| 554 |
+
to avoid unnecessary travel), find a well-reviewed hotel in a central
|
| 555 |
+
neighbourhood, and think about what kind of food and restaurant experiences
|
| 556 |
+
are worth including.
|
| 557 |
+
|
| 558 |
+
Once you have a solid plan, write the whole thing to TREK:
|
| 559 |
+
- Create the trip
|
| 560 |
+
- Add all the places you've researched with their real coordinates
|
| 561 |
+
- Build out the daily itinerary with sensible visiting times
|
| 562 |
+
- Book the hotel as a reservation and link it properly to the accommodation days
|
| 563 |
+
- Add any notable restaurant reservations
|
| 564 |
+
- Put together a realistic budget in EUR
|
| 565 |
+
- Build a packing list suited to April in Kyoto
|
| 566 |
+
- Leave a pinned collab note with practical tips (transport, etiquette, money, etc.)
|
| 567 |
+
- Add a day note for each day with any important heads-up (early start, crowd
|
| 568 |
+
tips, booking requirements, etc.)
|
| 569 |
+
- Mark Japan as visited in my Atlas
|
| 570 |
+
|
| 571 |
+
Currency: CHF. Use get_trip_summary at the end and give me a quick recap
|
| 572 |
+
of everything that was added.
|
| 573 |
+
```
|
| 574 |
+
|
| 575 |
+
PDF of the generated trip: [./docs/TREK-Generated-by-MCP.pdf](./docs/TREK-Generated-by-MCP.pdf)
|
| 576 |
+
|
| 577 |
+

|
NOTICE.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Third-party data & attributions
|
| 2 |
+
|
| 3 |
+
TREK bundles and uses third-party data that requires attribution.
|
| 4 |
+
|
| 5 |
+
## geoBoundaries — country & sub-national boundaries
|
| 6 |
+
|
| 7 |
+
The Atlas map's administrative boundaries (admin-0 countries and admin-1
|
| 8 |
+
provinces/counties), shipped at `server/assets/atlas/admin0.geojson.gz` and
|
| 9 |
+
`server/assets/atlas/admin1.geojson.gz` and generated by
|
| 10 |
+
`server/scripts/build-atlas-geo.mjs`, are derived from **geoBoundaries**.
|
| 11 |
+
|
| 12 |
+
> Runfola, D. et al. (2020) geoBoundaries: A global database of political
|
| 13 |
+
> administrative boundaries. PLoS ONE 15(4): e0231866.
|
| 14 |
+
> https://doi.org/10.1371/journal.pone.0231866
|
| 15 |
+
|
| 16 |
+
geoBoundaries is licensed under **CC BY 4.0**
|
| 17 |
+
(https://creativecommons.org/licenses/by/4.0/). Source: https://www.geoboundaries.org/
|
| 18 |
+
|
| 19 |
+
The bundled files are simplified (coordinate-quantized) and re-tagged with the
|
| 20 |
+
property names TREK consumes. Country borders (`admin0`) derive from the geoBoundaries
|
| 21 |
+
CGAZ composite; sub-national regions (`admin1`) derive from the per-country open
|
| 22 |
+
(gbOpen) release.
|
| 23 |
+
|
| 24 |
+
## OpenStreetMap — geocoding
|
| 25 |
+
|
| 26 |
+
Atlas reverse-geocodes places via the **Nominatim** service. Geocoding data is
|
| 27 |
+
© OpenStreetMap contributors, licensed under the Open Database License (ODbL).
|
| 28 |
+
https://www.openstreetmap.org/copyright
|
| 29 |
+
|
| 30 |
+
## OurAirports — airport reference data
|
| 31 |
+
|
| 32 |
+
`server/assets/airports.json` is built from **OurAirports**
|
| 33 |
+
(https://ourairports.com/data/), released into the public domain.
|
README.md
CHANGED
|
@@ -1,10 +1,464 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji: 💻
|
| 4 |
-
colorFrom: indigo
|
| 5 |
-
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
-
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: trek
|
|
|
|
|
|
|
|
|
|
| 3 |
sdk: docker
|
| 4 |
+
app_port: 7860
|
| 5 |
---
|
| 6 |
|
| 7 |
+
<div align="center">
|
| 8 |
+
|
| 9 |
+
<picture>
|
| 10 |
+
<source media="(prefers-color-scheme: dark)" srcset="docs/logo-trek-light.gif" />
|
| 11 |
+
<source media="(prefers-color-scheme: light)" srcset="docs/logo-trek-dark.gif" />
|
| 12 |
+
<img src="docs/logo-trek-dark.gif" alt="TREK" height="96" />
|
| 13 |
+
</picture>
|
| 14 |
+
|
| 15 |
+
<br />
|
| 16 |
+
|
| 17 |
+
<picture>
|
| 18 |
+
<source media="(prefers-color-scheme: dark)" srcset="docs/subtitle-light.png" />
|
| 19 |
+
<source media="(prefers-color-scheme: light)" srcset="docs/subtitle-dark.png" />
|
| 20 |
+
<img src="docs/subtitle-dark.png" alt="Your trips. Your plan. Your server." height="28" />
|
| 21 |
+
</picture>
|
| 22 |
+
|
| 23 |
+
A self-hosted, real-time collaborative travel planner — with maps, budgets, packing lists, a journal, and AI built in.
|
| 24 |
+
|
| 25 |
+
<br />
|
| 26 |
+
|
| 27 |
+
<a href="https://demo.liketrek.com"><img alt="Demo" src="https://img.shields.io/badge/Demo-try-111827?style=for-the-badge" /></a>
|
| 28 |
+
|
| 29 |
+
<a href="https://hub.docker.com/r/mauriceboe/trek"><img alt="Docker" src="https://img.shields.io/badge/Docker-ready-2496ED?style=for-the-badge" /></a>
|
| 30 |
+
|
| 31 |
+
<a href="https://discord.gg/NhZBDSd4qW"><img alt="Discord" src="https://img.shields.io/badge/Discord-join-5865F2?style=for-the-badge" /></a>
|
| 32 |
+
|
| 33 |
+
<a href="https://kanban.pakulat.org/shared/I4wxF6inOOMB0C6hH6kQm3efyNxFjwyI"><img alt="Roadmap" src="https://img.shields.io/badge/Roadmap-view-0EA5E9?style=for-the-badge" /></a>
|
| 34 |
+
<br />
|
| 35 |
+
<a href="https://ko-fi.com/mauriceboe"><img alt="Ko-fi" src="https://img.shields.io/badge/Ko--fi-support-FF5E5B?style=for-the-badge" /></a>
|
| 36 |
+
|
| 37 |
+
<a href="https://www.buymeacoffee.com/mauriceboe"><img alt="BMAC" src="https://img.shields.io/badge/BMAC-support-FFDD00?style=for-the-badge" /></a>
|
| 38 |
+
<br />
|
| 39 |
+
<a href="LICENSE"><img alt="License" src="https://img.shields.io/badge/license-AGPL_v3-6B7280?style=flat-square" /></a>
|
| 40 |
+
<a href="https://github.com/mauriceboe/TREK/releases"><img alt="Latest Release" src="https://img.shields.io/github/v/release/mauriceboe/TREK?include_prereleases&style=flat-square&color=6B7280" /></a>
|
| 41 |
+
<a href="https://hub.docker.com/r/mauriceboe/trek"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/mauriceboe/trek?style=flat-square&color=6B7280" /></a>
|
| 42 |
+
<a href="https://github.com/mauriceboe/TREK"><img alt="Stars" src="https://img.shields.io/github/stars/mauriceboe/TREK?style=flat-square&color=6B7280" /></a>
|
| 43 |
+
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
<div align="center">
|
| 49 |
+
|
| 50 |
+
<img src="https://github.com/mauriceboe/trek-media/releases/download/readme-assets/TREK1.gif" alt="TREK — 60-second tour" width="100%" />
|
| 51 |
+
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<br />
|
| 55 |
+
|
| 56 |
+
<div align="center">
|
| 57 |
+
<a href="docs/screenshots/dashboard.png"><img src="docs/screenshots/dashboard.png" alt="Dashboard" width="49%" /></a>
|
| 58 |
+
<a href="docs/screenshots/trip-planner.png"><img src="docs/screenshots/trip-planner.png" alt="Trip planner with 3D map" width="49%" /></a>
|
| 59 |
+
<a href="docs/screenshots/journey.png"><img src="docs/screenshots/journey.png" alt="Journey journal" width="49%" /></a>
|
| 60 |
+
<a href="docs/screenshots/budget.png"><img src="docs/screenshots/budget.png" alt="Costs · expense splitting" width="49%" /></a>
|
| 61 |
+
<a href="docs/screenshots/atlas.png"><img src="docs/screenshots/atlas.png" alt="Atlas · visited countries" width="49%" /></a>
|
| 62 |
+
<a href="docs/screenshots/vacay.png"><img src="docs/screenshots/vacay.png" alt="Vacay planner" width="49%" /></a>
|
| 63 |
+
<a href="docs/screenshots/trip-iceland.png"><img src="docs/screenshots/trip-iceland.png" alt="Trip planner · day plan and route" width="49%" /></a>
|
| 64 |
+
<a href="docs/screenshots/admin.png"><img src="docs/screenshots/admin.png" alt="Admin panel" width="49%" /></a>
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
---
|
| 68 |
+
|
| 69 |
+
## What you get
|
| 70 |
+
|
| 71 |
+
<picture>
|
| 72 |
+
<source media="(max-width: 700px)" srcset="docs/tiles/grid-mobile.svg" />
|
| 73 |
+
<img src="docs/tiles/grid-desktop.svg" alt="TREK feature tiles" width="100%" />
|
| 74 |
+
</picture>
|
| 75 |
+
|
| 76 |
+
<details>
|
| 77 |
+
<summary><b>See all features</b></summary>
|
| 78 |
+
|
| 79 |
+
<table>
|
| 80 |
+
<tr>
|
| 81 |
+
<td width="50%" valign="top">
|
| 82 |
+
|
| 83 |
+
#### 🧭 Trip planning
|
| 84 |
+
|
| 85 |
+
- **Drag & drop planner** — organise places into day plans with reordering and cross-day moves
|
| 86 |
+
- **Interactive map** — Leaflet or Mapbox GL with 3D buildings, terrain, photo markers, clustering, route visualization
|
| 87 |
+
- **Place search** — Google Places (photos, ratings, hours) or OpenStreetMap (free, no API key)
|
| 88 |
+
- **Place import** — shared Google Maps / Naver Maps lists, plus GPX and KML/KMZ/GeoJSON map files
|
| 89 |
+
- **Day notes** — timestamped, icon-tagged notes with drag-and-drop reordering
|
| 90 |
+
- **Route optimisation** — auto-sort places and export to Google Maps
|
| 91 |
+
- **Weather forecasts** — 16-day via Open-Meteo (no key) + historical climate fallback
|
| 92 |
+
- **Category filter** — show only matching pins on the map
|
| 93 |
+
|
| 94 |
+
</td>
|
| 95 |
+
<td width="50%" valign="top">
|
| 96 |
+
|
| 97 |
+
#### 🧳 Travel management
|
| 98 |
+
|
| 99 |
+
- **Reservations** — flights, accommodations, restaurants with status, confirmation numbers, files; import from booking confirmation emails and PDFs ([KDE Itinerary](https://invent.kde.org/pim/kitinerary))
|
| 100 |
+
- **Costs** — track and split trip expenses (Splitwise-style): per-person / per-day breakdowns, settle-up, multi-currency
|
| 101 |
+
- **Packing lists** — categories, templates, user assignment, progress tracking
|
| 102 |
+
- **Bag tracking** — optional weight tracking with iOS-style distribution
|
| 103 |
+
- **Document manager** — attach docs, tickets, PDFs to trips / places / reservations (≤ 50 MB each)
|
| 104 |
+
- **PDF export** — full trip plan as PDF with cover page, images, notes
|
| 105 |
+
|
| 106 |
+
</td>
|
| 107 |
+
</tr>
|
| 108 |
+
<tr>
|
| 109 |
+
<td width="50%" valign="top">
|
| 110 |
+
|
| 111 |
+
#### 👥 Collaboration
|
| 112 |
+
|
| 113 |
+
- **Real-time sync** — WebSocket. Changes appear instantly across all connected users
|
| 114 |
+
- **Multi-user trips** — invite members with role-based access
|
| 115 |
+
- **Invite links** — one-time or reusable links with expiry
|
| 116 |
+
- **SSO (OIDC)** — Google, Apple, Authentik, Keycloak, or any OIDC provider
|
| 117 |
+
- **2FA** — TOTP + backup codes
|
| 118 |
+
- **Passkeys** — passwordless WebAuthn login (fingerprint / face / PIN / security key), admin-toggleable
|
| 119 |
+
- **Collab suite** — group chat, shared notes, polls, day check-ins
|
| 120 |
+
|
| 121 |
+
</td>
|
| 122 |
+
<td width="50%" valign="top">
|
| 123 |
+
|
| 124 |
+
#### 📱 Mobile & PWA
|
| 125 |
+
|
| 126 |
+
- **Installable** — iOS and Android, straight from the browser, no App Store needed
|
| 127 |
+
- **Offline support** — Service Worker caches tiles, API, uploads via Workbox
|
| 128 |
+
- **Native feel** — fullscreen standalone, themed status bar, splash screen
|
| 129 |
+
- **Touch optimised** — mobile-specific layouts with safe-area handling
|
| 130 |
+
|
| 131 |
+
</td>
|
| 132 |
+
</tr>
|
| 133 |
+
<tr>
|
| 134 |
+
<td width="50%" valign="top">
|
| 135 |
+
|
| 136 |
+
#### 🧩 Addons (admin-toggleable)
|
| 137 |
+
|
| 138 |
+
- **Lists** — packing lists + to-dos with templates, member assignments, optional bag tracking
|
| 139 |
+
- **Costs** — expense tracker with splits and settle-up (who owes whom), multi-currency
|
| 140 |
+
- **Documents** — file attachments on trips, places, and reservations
|
| 141 |
+
- **Collab** — chat, notes, polls, day-by-day attendance
|
| 142 |
+
- **Vacay** — personal vacation planner with calendar, 100+ country holidays, carry-over tracking
|
| 143 |
+
- **Atlas** — world map of visited countries, bucket list, travel stats, streak tracking, liquid-glass UI
|
| 144 |
+
- **Journey** — magazine-style travel journal with entries, photos (Immich/Synology), maps, moods
|
| 145 |
+
- **AirTrail** — connect a self-hosted AirTrail instance to import and sync flights into reservations
|
| 146 |
+
- **MCP** — expose TREK to AI assistants via OAuth 2.1
|
| 147 |
+
|
| 148 |
+
</td>
|
| 149 |
+
<td width="50%" valign="top">
|
| 150 |
+
|
| 151 |
+
#### 🤖 AI / MCP
|
| 152 |
+
|
| 153 |
+
- **Built-in MCP server** — OAuth 2.1 authenticated. 150+ tools, 30 resources
|
| 154 |
+
- **Granular scopes** — 27 OAuth scopes across 13 permission groups
|
| 155 |
+
- **Full automation** — AI can create trips, plan days, build packing lists, manage budgets, mark countries visited
|
| 156 |
+
- **Pre-built prompts** — `trip-summary`, `packing-list`, `budget-overview`
|
| 157 |
+
- **Addon-aware** — exposes Atlas, Collab, Vacay when those addons are on
|
| 158 |
+
|
| 159 |
+
</td>
|
| 160 |
+
</tr>
|
| 161 |
+
<tr>
|
| 162 |
+
<td colspan="2" valign="top">
|
| 163 |
+
|
| 164 |
+
#### ⚙️ Admin & customisation
|
| 165 |
+
|
| 166 |
+
- **Dashboard views** — card grid or compact list · **Dark mode** — full theme with matching status bar
|
| 167 |
+
- **20 languages** — EN, DE, ES, FR, IT, NL, HU, RU, ZH, ZH-TW, PL, CS, AR (RTL), BR, ID, TR, JA, KO, UK, GR
|
| 168 |
+
- **Admin panel** — users, invites, packing templates, categories, addons, API keys, backups, GitHub history
|
| 169 |
+
- **Notifications** — per-user preferences across email (SMTP), webhook, ntfy, and an in-app notification center
|
| 170 |
+
- **Auto-backups** — scheduled with configurable retention · **Units** — °C/°F, 12h/24h, map tile sources, default coordinates
|
| 171 |
+
|
| 172 |
+
</td>
|
| 173 |
+
</tr>
|
| 174 |
+
</table>
|
| 175 |
+
|
| 176 |
+
</details>
|
| 177 |
+
|
| 178 |
+
<br />
|
| 179 |
+
|
| 180 |
+
## Get started in 30 seconds
|
| 181 |
+
|
| 182 |
+
```bash
|
| 183 |
+
ENCRYPTION_KEY=$(openssl rand -hex 32) docker run -d -p 3000:3000 \
|
| 184 |
+
-e ENCRYPTION_KEY=$ENCRYPTION_KEY \
|
| 185 |
+
-v ./data:/app/data -v ./uploads:/app/uploads mauriceboe/trek
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
Open `http://localhost:3000`. On first boot TREK seeds an admin account — if you set `ADMIN_EMAIL`/`ADMIN_PASSWORD` those are used, otherwise the credentials are printed to the container log (`docker logs trek`).
|
| 189 |
+
|
| 190 |
+
<div align="center">
|
| 191 |
+
|
| 192 |
+
· <a href="#docker-compose-production">Docker Compose</a> · <a href="#helm-kubernetes">Helm / Kubernetes</a> · <a href="#install-as-app-pwa">Install as PWA</a> · <a href="#reverse-proxy">Reverse Proxy</a> ·
|
| 193 |
+
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<br />
|
| 197 |
+
|
| 198 |
+
## Tech stack
|
| 199 |
+
|
| 200 |
+
<div align="center">
|
| 201 |
+
|
| 202 |
+

|
| 203 |
+

|
| 204 |
+

|
| 205 |
+

|
| 206 |
+

|
| 207 |
+

|
| 208 |
+

|
| 209 |
+

|
| 210 |
+

|
| 211 |
+
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
Real-time sync via WebSocket (`ws`). Backend on NestJS 11. State with Zustand. Auth via JWT + OAuth 2.1 + OIDC + Passkeys (WebAuthn) + TOTP MFA. Weather via Open-Meteo (no key required). Maps with Leaflet and Mapbox GL.
|
| 215 |
+
|
| 216 |
+
<br />
|
| 217 |
+
|
| 218 |
+
<h2 id="docker-compose-production">Docker Compose (production)</h2>
|
| 219 |
+
|
| 220 |
+
<details>
|
| 221 |
+
<summary>Full compose example with secure defaults</summary>
|
| 222 |
+
|
| 223 |
+
```yaml
|
| 224 |
+
services:
|
| 225 |
+
app:
|
| 226 |
+
image: mauriceboe/trek:latest
|
| 227 |
+
container_name: trek
|
| 228 |
+
read_only: true
|
| 229 |
+
security_opt:
|
| 230 |
+
- no-new-privileges:true
|
| 231 |
+
cap_drop:
|
| 232 |
+
- ALL
|
| 233 |
+
cap_add:
|
| 234 |
+
- CHOWN
|
| 235 |
+
- SETUID
|
| 236 |
+
- SETGID
|
| 237 |
+
tmpfs:
|
| 238 |
+
- /tmp:noexec,nosuid,size=64m
|
| 239 |
+
ports:
|
| 240 |
+
- "3000:3000"
|
| 241 |
+
environment:
|
| 242 |
+
- NODE_ENV=production
|
| 243 |
+
- PORT=3000
|
| 244 |
+
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-} # generate with: openssl rand -hex 32
|
| 245 |
+
- TZ=${TZ:-UTC}
|
| 246 |
+
- LOG_LEVEL=${LOG_LEVEL:-info}
|
| 247 |
+
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-}
|
| 248 |
+
- APP_URL=${APP_URL:-} # required for OIDC + email links
|
| 249 |
+
# - FORCE_HTTPS=true # behind a TLS-terminating proxy
|
| 250 |
+
# - TRUST_PROXY=1
|
| 251 |
+
# - OIDC_ISSUER=https://auth.example.com
|
| 252 |
+
# - OIDC_CLIENT_ID=trek
|
| 253 |
+
# - OIDC_CLIENT_SECRET=supersecret
|
| 254 |
+
# - OIDC_DISPLAY_NAME=SSO
|
| 255 |
+
# - OIDC_ADMIN_CLAIM=groups
|
| 256 |
+
# - OIDC_ADMIN_VALUE=app-trek-admins
|
| 257 |
+
volumes:
|
| 258 |
+
- ./data:/app/data
|
| 259 |
+
- ./uploads:/app/uploads
|
| 260 |
+
restart: unless-stopped
|
| 261 |
+
healthcheck:
|
| 262 |
+
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
|
| 263 |
+
interval: 30s
|
| 264 |
+
timeout: 10s
|
| 265 |
+
retries: 3
|
| 266 |
+
start_period: 15s
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
Then:
|
| 270 |
+
|
| 271 |
+
```bash
|
| 272 |
+
docker compose up -d
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
**HTTPS notes:** `FORCE_HTTPS=true` is optional — it adds a 301 redirect, HSTS, CSP upgrade-insecure-requests, and forces the `secure` cookie flag. Only use it behind a TLS-terminating reverse proxy. `TRUST_PROXY=1` tells the server how many proxies sit in front so real client IPs and `X-Forwarded-Proto` work.
|
| 276 |
+
|
| 277 |
+
</details>
|
| 278 |
+
|
| 279 |
+
<br />
|
| 280 |
+
|
| 281 |
+
<h2 id="helm-kubernetes">Helm (Kubernetes)</h2>
|
| 282 |
+
|
| 283 |
+
```bash
|
| 284 |
+
helm repo add trek https://mauriceboe.github.io/TREK
|
| 285 |
+
helm repo update
|
| 286 |
+
helm install trek trek/trek
|
| 287 |
+
```
|
| 288 |
+
|
| 289 |
+
See [`charts/README.md`](https://github.com/mauriceboe/TREK/blob/main/charts/README.md) for values.
|
| 290 |
+
|
| 291 |
+
<h2 id="install-as-app-pwa">Install as App (PWA)</h2>
|
| 292 |
+
|
| 293 |
+
TREK works as a Progressive Web App — no App Store needed.
|
| 294 |
+
|
| 295 |
+
1. Open TREK in the browser (HTTPS required)
|
| 296 |
+
2. **iOS**: Share ▸ *Add to Home Screen*
|
| 297 |
+
3. **Android**: Menu ▸ *Install app* (or *Add to Home Screen*)
|
| 298 |
+
|
| 299 |
+
TREK then launches fullscreen with its own icon, just like a native app.
|
| 300 |
+
|
| 301 |
+
<br />
|
| 302 |
+
|
| 303 |
+
## Updating
|
| 304 |
+
|
| 305 |
+
**Docker Compose:**
|
| 306 |
+
|
| 307 |
+
```bash
|
| 308 |
+
docker compose pull && docker compose up -d
|
| 309 |
+
```
|
| 310 |
+
|
| 311 |
+
**Docker run** — reuse the original volume paths:
|
| 312 |
+
|
| 313 |
+
```bash
|
| 314 |
+
docker pull mauriceboe/trek
|
| 315 |
+
docker rm -f trek
|
| 316 |
+
docker run -d --name trek -p 3000:3000 -v ./data:/app/data -v ./uploads:/app/uploads --restart unless-stopped mauriceboe/trek
|
| 317 |
+
```
|
| 318 |
+
|
| 319 |
+
> Not sure which paths you used? `docker inspect trek --format '{{json .Mounts}}'` before removing the container.
|
| 320 |
+
|
| 321 |
+
Your data stays in the mounted `data` and `uploads` volumes — updates never touch it.
|
| 322 |
+
|
| 323 |
+
> [!IMPORTANT]
|
| 324 |
+
> Mount **only** the data and uploads directories — `-v ./data:/app/data -v ./uploads:/app/uploads`. **Never mount a volume at `/app`.** Doing so hides the application code shipped in the image and the container fails to start with `Cannot find module 'tsconfig-paths/register'`. If you previously mounted `/app`, switch to the two mounts above; your data in `data/` and `uploads/` is preserved.
|
| 325 |
+
|
| 326 |
+
<h3>Rotating the Encryption Key</h3>
|
| 327 |
+
|
| 328 |
+
If you need to rotate `ENCRYPTION_KEY` (e.g. upgrading from a version that derived encryption from `JWT_SECRET`):
|
| 329 |
+
|
| 330 |
+
```bash
|
| 331 |
+
docker exec -it trek node --import tsx scripts/migrate-encryption.ts
|
| 332 |
+
```
|
| 333 |
+
|
| 334 |
+
The script creates a timestamped DB backup before making changes and prompts for old + new keys (input is not echoed).
|
| 335 |
+
|
| 336 |
+
<h2 id="reverse-proxy">Reverse Proxy</h2>
|
| 337 |
+
|
| 338 |
+
For production, put TREK behind a TLS-terminating reverse proxy. TREK uses WebSockets for real-time sync, so the proxy **must** support WebSocket upgrades on `/ws`.
|
| 339 |
+
|
| 340 |
+
<details>
|
| 341 |
+
<summary>Nginx</summary>
|
| 342 |
+
|
| 343 |
+
```nginx
|
| 344 |
+
server {
|
| 345 |
+
listen 80;
|
| 346 |
+
server_name trek.yourdomain.com;
|
| 347 |
+
return 301 https://$host$request_uri;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
server {
|
| 351 |
+
listen 443 ssl http2;
|
| 352 |
+
server_name trek.yourdomain.com;
|
| 353 |
+
|
| 354 |
+
ssl_certificate /etc/ssl/fullchain.pem;
|
| 355 |
+
ssl_certificate_key /etc/ssl/privkey.pem;
|
| 356 |
+
|
| 357 |
+
# 500 MB covers backup-restore uploads (capped at 500 MB server-side).
|
| 358 |
+
client_max_body_size 500m;
|
| 359 |
+
|
| 360 |
+
location / {
|
| 361 |
+
proxy_pass http://localhost:3000;
|
| 362 |
+
proxy_http_version 1.1;
|
| 363 |
+
proxy_set_header Host $host;
|
| 364 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 365 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 366 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
location /ws {
|
| 370 |
+
proxy_pass http://localhost:3000;
|
| 371 |
+
proxy_http_version 1.1;
|
| 372 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 373 |
+
proxy_set_header Connection "upgrade";
|
| 374 |
+
proxy_set_header Host $host;
|
| 375 |
+
proxy_read_timeout 86400;
|
| 376 |
+
}
|
| 377 |
+
}
|
| 378 |
+
```
|
| 379 |
+
|
| 380 |
+
</details>
|
| 381 |
+
|
| 382 |
+
<details>
|
| 383 |
+
<summary>Caddy</summary>
|
| 384 |
+
|
| 385 |
+
```caddy
|
| 386 |
+
trek.yourdomain.com {
|
| 387 |
+
reverse_proxy localhost:3000
|
| 388 |
+
}
|
| 389 |
+
```
|
| 390 |
+
|
| 391 |
+
Caddy handles TLS and WebSockets automatically.
|
| 392 |
+
|
| 393 |
+
</details>
|
| 394 |
+
|
| 395 |
+
<br />
|
| 396 |
+
|
| 397 |
+
## Environment variables
|
| 398 |
+
|
| 399 |
+
<details>
|
| 400 |
+
<summary><b>Full reference</b></summary>
|
| 401 |
+
|
| 402 |
+
<br />
|
| 403 |
+
|
| 404 |
+
| Variable | Description | Default |
|
| 405 |
+
|----------|-------------|---------|
|
| 406 |
+
| **Core** | | |
|
| 407 |
+
| `PORT` | Server port | `3000` |
|
| 408 |
+
| `NODE_ENV` | Environment (`production` / `development`) | `production` |
|
| 409 |
+
| `ENCRYPTION_KEY` | At-rest encryption key for stored secrets (API keys, MFA, SMTP, OIDC). Recommended: generate with `openssl rand -hex 32`. If unset, falls back to `data/.jwt_secret` (existing installs) or auto-generates a key (fresh installs). | Auto |
|
| 410 |
+
| `TZ` | Timezone for logs, reminders and cron jobs (e.g. `Europe/Berlin`) | `UTC` |
|
| 411 |
+
| `LOG_LEVEL` | `info` = concise user actions, `debug` = verbose details | `info` |
|
| 412 |
+
| `DEFAULT_LANGUAGE` | Default language on the login page for users with no saved preference. Browser/OS language is auto-detected first; this is the fallback. Supported: `de`, `en`, `es`, `fr`, `hu`, `nl`, `br`, `cs`, `pl`, `ru`, `zh`, `zh-TW`, `it`, `ar`, `id`, `tr`, `ja`, `ko`, `uk`, `gr` | `en` |
|
| 413 |
+
| `ALLOWED_ORIGINS` | Comma-separated origins for CORS and email links | same-origin |
|
| 414 |
+
| `FORCE_HTTPS` | Optional. When `true`: 301-redirects HTTP to HTTPS, sends HSTS, adds CSP `upgrade-insecure-requests`, forces the session cookie `secure` flag. Useful behind a TLS-terminating reverse proxy. Requires `TRUST_PROXY`. | `false` |
|
| 415 |
+
| `HSTS_INCLUDE_SUBDOMAINS` | When `true`: adds the `includeSubDomains` directive to the HSTS header, extending HTTPS enforcement to all subdomains. Only effective when HSTS is active (`FORCE_HTTPS=true` or `NODE_ENV=production`). Leave `false` if you run other services on sibling subdomains over plain HTTP. | `false` |
|
| 416 |
+
| `COOKIE_SECURE` | Controls the `secure` flag on the `trek_session` cookie. Auto-derived: on when `NODE_ENV=production` or `FORCE_HTTPS=true`. Escape hatch: set `false` to allow session cookies over plain HTTP. Not recommended in production. | auto |
|
| 417 |
+
| `SESSION_DURATION` | How long a login session stays valid when **"Remember me" is unchecked** (the default): sets the `trek_session` JWT `exp` and issues a browser-session cookie (cleared when the browser closes). Accepts `ms`-style strings: `1h`, `12h`, `7d`, `30d`, `90d`. Invalid values warn at startup and fall back to the default. | `24h` |
|
| 418 |
+
| `SESSION_DURATION_REMEMBER` | Session length when **"Remember me" is ticked** at login: a longer-lived JWT plus a persistent `trek_session` cookie that survives browser restarts. Same format and startup-fallback behaviour as `SESSION_DURATION`. | `30d` |
|
| 419 |
+
| `TRUST_PROXY` | Number of trusted reverse proxies. Tells the server to read client IP from `X-Forwarded-For` and protocol from `X-Forwarded-Proto`. Defaults to `1` in production; off in dev unless set. | `1` |
|
| 420 |
+
| `ALLOW_INTERNAL_NETWORK` | Allow outbound requests to private/RFC-1918 IPs (e.g. Immich on your LAN). Loopback and link-local addresses remain blocked. | `false` |
|
| 421 |
+
| `APP_URL` | Public base URL of this instance (e.g. `https://trek.example.com`). Required when OIDC is enabled; used as base for email notification links. | — |
|
| 422 |
+
| **OIDC / SSO** | | |
|
| 423 |
+
| `OIDC_ISSUER` | OpenID Connect provider URL | — |
|
| 424 |
+
| `OIDC_CLIENT_ID` | OIDC client ID | — |
|
| 425 |
+
| `OIDC_CLIENT_SECRET` | OIDC client secret | — |
|
| 426 |
+
| `OIDC_DISPLAY_NAME` | Label shown on the SSO login button | `SSO` |
|
| 427 |
+
| `OIDC_ONLY` | Force SSO-only mode: disables password login + registration, regardless of Admin > Settings. The first SSO login becomes admin. | `false` |
|
| 428 |
+
| `OIDC_ADMIN_CLAIM` | OIDC claim used to identify admin users | — |
|
| 429 |
+
| `OIDC_ADMIN_VALUE` | Value of the OIDC claim that grants admin role | — |
|
| 430 |
+
| `OIDC_SCOPE` | Space-separated OIDC scopes. **Fully replaces** the default — always include `openid email profile`. | `openid email profile` |
|
| 431 |
+
| `OIDC_DISCOVERY_URL` | Override the auto-constructed OIDC discovery endpoint (e.g. Authentik: `.../application/o/trek/.well-known/openid-configuration`) | — |
|
| 432 |
+
| **Initial setup** | | |
|
| 433 |
+
| `ADMIN_EMAIL` | Email for the first admin on initial boot. Must be set together with `ADMIN_PASSWORD`. If either is omitted a random password is printed to the server log. No effect once a user exists. | `admin@trek.local` |
|
| 434 |
+
| `ADMIN_PASSWORD` | Password for the first admin on initial boot. Pairs with `ADMIN_EMAIL`. | random |
|
| 435 |
+
| **Other** | | |
|
| 436 |
+
| `DEMO_MODE` | Enable demo mode (hourly data resets) | `false` |
|
| 437 |
+
| `MCP_RATE_LIMIT` | Max MCP API requests per user per minute | `300` |
|
| 438 |
+
| `MCP_MAX_SESSION_PER_USER` | Max concurrent MCP sessions per user | `20` |
|
| 439 |
+
|
| 440 |
+
</details>
|
| 441 |
+
|
| 442 |
+
<br />
|
| 443 |
+
|
| 444 |
+
## Data & Backups
|
| 445 |
+
|
| 446 |
+
- **Database** — SQLite, stored in `./data/travel.db`
|
| 447 |
+
- **Uploads** — stored in `./uploads/`
|
| 448 |
+
- **Logs** — `./data/logs/trek.log` (auto-rotated)
|
| 449 |
+
- **Backups** — create and restore via Admin Panel
|
| 450 |
+
- **Auto-Backups** — configurable schedule and retention in Admin Panel
|
| 451 |
+
|
| 452 |
+
<br />
|
| 453 |
+
|
| 454 |
+
## Data sources
|
| 455 |
+
|
| 456 |
+
The Atlas map's country and sub-national (province/county) boundaries come from
|
| 457 |
+
[**geoBoundaries**](https://www.geoboundaries.org/) (Runfola et al., 2020), licensed
|
| 458 |
+
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). See [NOTICE.md](NOTICE.md)
|
| 459 |
+
for full third-party attributions.
|
| 460 |
+
|
| 461 |
+
## License
|
| 462 |
+
|
| 463 |
+
TREK is [AGPL v3](LICENSE). Self-host freely for personal or internal company use. If you modify and offer TREK as a network service to third parties, your modifications must be open-sourced under the same licence.
|
| 464 |
+
|
SECURITY.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Security Policy
|
| 2 |
+
|
| 3 |
+
## Supported Versions
|
| 4 |
+
|
| 5 |
+
| Version | Supported |
|
| 6 |
+
|---|---|
|
| 7 |
+
| Latest | Yes |
|
| 8 |
+
| Older | No |
|
| 9 |
+
|
| 10 |
+
Only the latest version receives security updates. Please update to the latest release.
|
| 11 |
+
|
| 12 |
+
## Reporting a Vulnerability
|
| 13 |
+
|
| 14 |
+
If you discover a security vulnerability, please report it responsibly:
|
| 15 |
+
|
| 16 |
+
1. **Do not** open a public issue
|
| 17 |
+
2. Email: **report@liketrek.com**
|
| 18 |
+
3. Include a description of the vulnerability and steps to reproduce
|
| 19 |
+
|
| 20 |
+
You will receive a response within 48 hours. Once confirmed, a fix will be released as soon as possible.
|
| 21 |
+
|
| 22 |
+
## Scope
|
| 23 |
+
|
| 24 |
+
This policy covers the TREK application and its Docker image (`mauriceboe/trek`).
|
| 25 |
+
|
| 26 |
+
Third-party dependencies are monitored via GitHub Dependabot.
|
TRADEMARKS.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Trademark Policy
|
| 2 |
+
|
| 3 |
+
## Introduction
|
| 4 |
+
|
| 5 |
+
This is the TREK project's policy for the use of our trademarks. While TREK is
|
| 6 |
+
available under the GNU Affero General Public License v3.0 (AGPL-3.0), that
|
| 7 |
+
license does not include a license to use our trademarks.
|
| 8 |
+
|
| 9 |
+
This policy describes how you may use our trademarks. Our goal is to strike a
|
| 10 |
+
balance between: 1) our need to ensure that our trademarks remain reliable
|
| 11 |
+
indicators of the software we release; and 2) our community members' desire to
|
| 12 |
+
be full participants in the TREK project.
|
| 13 |
+
|
| 14 |
+
## Our trademarks
|
| 15 |
+
|
| 16 |
+
This policy covers the name "TREK" as well as any associated logos, trade dress,
|
| 17 |
+
goodwill, or designs (our "Marks").
|
| 18 |
+
|
| 19 |
+
## In general
|
| 20 |
+
|
| 21 |
+
Whenever you use our Marks, you must always do so in a way that does not mislead
|
| 22 |
+
anyone about exactly who is the source of the software. For example, you cannot
|
| 23 |
+
say you are distributing TREK when you're distributing a modified version of it,
|
| 24 |
+
because people would think they would be getting the same software that they
|
| 25 |
+
can get directly from us when they aren't. You also cannot use our Marks on
|
| 26 |
+
your website in a way that suggests that your website is an official TREK
|
| 27 |
+
website or that we endorse your website. But, if true, you can say you like
|
| 28 |
+
TREK, that you participate in the TREK community, that you are providing an
|
| 29 |
+
unmodified version of TREK, or that you wrote a guide describing how to use
|
| 30 |
+
TREK.
|
| 31 |
+
|
| 32 |
+
This fundamental requirement, that it is always clear to people what they are
|
| 33 |
+
getting and from whom, is reflected throughout this policy. It should also
|
| 34 |
+
serve as your guide if you are not sure about how you are using the Marks.
|
| 35 |
+
|
| 36 |
+
In addition:
|
| 37 |
+
|
| 38 |
+
* You may not use or register, in whole or in part, the Marks as part of your
|
| 39 |
+
own trademark, service mark, domain name, company name, trade name, product
|
| 40 |
+
name or service name.
|
| 41 |
+
* Trademark law does not allow your use of names or trademarks that are too
|
| 42 |
+
similar to ours. You therefore may not use an obvious variation of any of our
|
| 43 |
+
Marks or any phonetic equivalent, foreign language equivalent, takeoff, or
|
| 44 |
+
abbreviation for a similar or compatible product or service.
|
| 45 |
+
* You agree that you will not acquire any rights in the Marks and that any
|
| 46 |
+
goodwill generated by your use of the Marks and participation in our
|
| 47 |
+
community inures solely to our benefit.
|
| 48 |
+
|
| 49 |
+
## Distribution of unmodified source code or unmodified executable code we have compiled
|
| 50 |
+
|
| 51 |
+
When you redistribute an unmodified copy of TREK, you are not changing the
|
| 52 |
+
quality or nature of it. Therefore, you may retain the Marks we have placed on
|
| 53 |
+
the software to identify your redistribution. This kind of use only applies if
|
| 54 |
+
you are redistributing an official TREK distribution that has not been changed
|
| 55 |
+
in any way.
|
| 56 |
+
|
| 57 |
+
## Distribution of executable code that you have compiled, or modified code
|
| 58 |
+
|
| 59 |
+
You may use the word mark "TREK", but not any TREK logos, to truthfully
|
| 60 |
+
describe the origin of the software that you are providing, that is, that the
|
| 61 |
+
code you are distributing is a modification of TREK. You may say, for example,
|
| 62 |
+
that "this software is derived from the source code for TREK."
|
| 63 |
+
|
| 64 |
+
Of course, you can place your own trademarks or logos on versions of the
|
| 65 |
+
software to which you have made substantive modifications, because by modifying
|
| 66 |
+
the software, you have become the origin of that exact version. In that case,
|
| 67 |
+
you should not use our Marks.
|
| 68 |
+
|
| 69 |
+
However, you may use our Marks for the distribution of code (source or
|
| 70 |
+
executable) on the condition that any executable is built from an official TREK
|
| 71 |
+
source code release and that any modifications are limited to switching on or
|
| 72 |
+
off features already included in the software, translations into other
|
| 73 |
+
languages, and incorporating minor bug-fix patches. Use of our Marks on any
|
| 74 |
+
further modification is not permitted.
|
| 75 |
+
|
| 76 |
+
## Mobile wrappers, hosted instances, and forks
|
| 77 |
+
|
| 78 |
+
The following clarifications apply specifically to common ways TREK is
|
| 79 |
+
redistributed:
|
| 80 |
+
|
| 81 |
+
* **Self-hosted instances of unmodified TREK.** You may refer to your instance
|
| 82 |
+
as "a TREK instance" or "running TREK." You may not name the service itself
|
| 83 |
+
in a way that suggests it is the official TREK ("TREK Cloud," "TREK
|
| 84 |
+
Official," etc.).
|
| 85 |
+
* **Mobile wrappers (WebView shells, Capacitor apps, native apps) pointing at
|
| 86 |
+
TREK.** You may describe your app as "a mobile client for TREK" or "for use
|
| 87 |
+
with TREK." You may not publish it on app stores under the name "TREK" or a
|
| 88 |
+
confusingly similar name, and you may not use the TREK logo as the app icon
|
| 89 |
+
unless your wrapper distributes only an unmodified, official TREK instance
|
| 90 |
+
and you have obtained permission.
|
| 91 |
+
* **Forks of the TREK source code.** Forks that diverge from upstream must use
|
| 92 |
+
a different name. You may state that your fork is "based on TREK" or "a fork
|
| 93 |
+
of TREK," but the project name itself must be your own.
|
| 94 |
+
|
| 95 |
+
## Statements about your software's relation to TREK
|
| 96 |
+
|
| 97 |
+
You may use the word mark, but not TREK logos, to truthfully describe the
|
| 98 |
+
relationship between your software and ours. The word mark "TREK" should be
|
| 99 |
+
used after a verb or preposition that describes the relationship between your
|
| 100 |
+
software and ours. So you may say, for example, "Bob's app for TREK" but may
|
| 101 |
+
not say "Bob's TREK app." Some other examples that may work for you are:
|
| 102 |
+
|
| 103 |
+
* [Your software] uses TREK
|
| 104 |
+
* [Your software] is powered by TREK
|
| 105 |
+
* [Your software] runs on TREK
|
| 106 |
+
* [Your software] for use with TREK
|
| 107 |
+
* [Your software] for TREK
|
| 108 |
+
|
| 109 |
+
## Questions and permission requests
|
| 110 |
+
|
| 111 |
+
If you are not sure whether your intended use of the Marks is permitted under
|
| 112 |
+
this policy, or if you would like to request explicit permission for a use that
|
| 113 |
+
is not covered, please open an issue on the TREK GitHub repository or contact
|
| 114 |
+
the maintainers directly.
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
These guidelines are based on the
|
| 119 |
+
[Model Trademark Guidelines](http://www.modeltrademarkguidelines.org), used
|
| 120 |
+
under a
|
| 121 |
+
[Creative Commons Attribution 3.0 Unported license](https://creativecommons.org/licenses/by/3.0/deed.en_US).
|
build-from-sources
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
|
| 5 |
+
CLIENT_DIR="$REPO_ROOT/client"
|
| 6 |
+
SERVER_DIR="$REPO_ROOT/server"
|
| 7 |
+
PUBLIC_DIR="$REPO_ROOT/server/public"
|
| 8 |
+
|
| 9 |
+
echo "==> Installing client dependencies"
|
| 10 |
+
cd "$CLIENT_DIR"
|
| 11 |
+
npm ci
|
| 12 |
+
|
| 13 |
+
echo "==> Building client"
|
| 14 |
+
npm run build
|
| 15 |
+
|
| 16 |
+
echo "==> Installing server dependencies"
|
| 17 |
+
cd "$SERVER_DIR"
|
| 18 |
+
npm ci
|
| 19 |
+
|
| 20 |
+
echo "==> Populating server/public"
|
| 21 |
+
find "$PUBLIC_DIR" -mindepth 1 ! -name '.gitkeep' -delete
|
| 22 |
+
cp -r "$CLIENT_DIR/dist/." "$PUBLIC_DIR/"
|
| 23 |
+
cp -r "$CLIENT_DIR/public/fonts" "$PUBLIC_DIR/fonts"
|
| 24 |
+
|
| 25 |
+
echo "==> Done — server/public is ready"
|
charts/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TREK Helm Chart
|
| 2 |
+
|
| 3 |
+
This is a minimal Helm chart for deploying the TREK app.
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
- Deploys the TREK container
|
| 7 |
+
- Exposes port 3000 via Service
|
| 8 |
+
- Optional persistent storage for `/app/data` and `/app/uploads`
|
| 9 |
+
- Configurable environment variables and secrets
|
| 10 |
+
- Optional generic Ingress support
|
| 11 |
+
- Health checks on `/api/health`
|
| 12 |
+
|
| 13 |
+
## Helm Repository
|
| 14 |
+
|
| 15 |
+
A hosted Helm repository is available:
|
| 16 |
+
|
| 17 |
+
```sh
|
| 18 |
+
helm repo add trek https://mauriceboe.github.io/TREK
|
| 19 |
+
helm repo update
|
| 20 |
+
helm install trek trek/trek
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
## Usage
|
| 24 |
+
|
| 25 |
+
Or install directly from the local chart:
|
| 26 |
+
|
| 27 |
+
```sh
|
| 28 |
+
helm install trek ./chart \
|
| 29 |
+
--set ingress.enabled=true \
|
| 30 |
+
--set ingress.hosts[0].host=yourdomain.com
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
See `values.yaml` for more options.
|
| 34 |
+
|
| 35 |
+
## Files
|
| 36 |
+
- `Chart.yaml` — chart metadata
|
| 37 |
+
- `values.yaml` — configuration values
|
| 38 |
+
- `templates/` — Kubernetes manifests
|
| 39 |
+
|
| 40 |
+
## Notes
|
| 41 |
+
- Ingress is off by default. Enable and configure hosts for your domain.
|
| 42 |
+
- PVCs require a default StorageClass or specify one as needed.
|
| 43 |
+
- `JWT_SECRET` is managed entirely by the server — auto-generated into the data PVC on first start and rotatable via the admin panel (Settings → Danger Zone). No Helm configuration needed.
|
| 44 |
+
- `ENCRYPTION_KEY` encrypts stored secrets (API keys, MFA, SMTP, OIDC) at rest. Recommended: set via `secretEnv.ENCRYPTION_KEY` or `existingSecret`. If left empty, the server falls back automatically: existing installs use `data/.jwt_secret` (no action needed on upgrade); fresh installs auto-generate a key persisted to the data PVC.
|
| 45 |
+
- If using ingress, you must manually keep `env.ALLOWED_ORIGINS` and `ingress.hosts` in sync to ensure CORS works correctly. The chart does not sync these automatically.
|
| 46 |
+
- Set `env.ALLOW_INTERNAL_NETWORK: "true"` if Immich or other integrated services are hosted on a private/RFC-1918 address (e.g. a pod on the same cluster or a NAS on your LAN). Loopback (`127.x`) and link-local/metadata addresses (`169.254.x`) remain blocked regardless.
|
| 47 |
+
- `FORCE_HTTPS` is optional. Set `env.FORCE_HTTPS: "true"` only when ingress (or another proxy) terminates TLS. It enables HTTPS redirects, HSTS, CSP `upgrade-insecure-requests`, and forces the session cookie `secure` flag. Requires `TRUST_PROXY` to be set.
|
| 48 |
+
- Set `env.TRUST_PROXY: "1"` (or the number of proxy hops) when running behind ingress or a load balancer. Required for `FORCE_HTTPS` to detect the forwarded protocol correctly. In production it defaults to `1` automatically.
|
| 49 |
+
- `COOKIE_SECURE` is auto-derived (on when `NODE_ENV=production` or `FORCE_HTTPS=true`). Set `env.COOKIE_SECURE: "false"` only during local testing without TLS. **Not recommended for production.**
|
| 50 |
+
- Set `env.OIDC_DISCOVERY_URL` to override the auto-constructed OIDC discovery endpoint. Required for providers (e.g. Authentik) that expose it at a non-standard path.
|
charts/trek/Chart.yaml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v2
|
| 2 |
+
name: trek
|
| 3 |
+
version: 3.1.0
|
| 4 |
+
description: Minimal Helm chart for TREK app
|
| 5 |
+
appVersion: "3.1.0"
|
charts/trek/templates/NOTES.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1. ENCRYPTION_KEY handling:
|
| 2 |
+
- ENCRYPTION_KEY encrypts stored secrets (API keys, MFA, SMTP, OIDC) at rest.
|
| 3 |
+
- By default, the chart creates a Kubernetes Secret from `secretEnv.ENCRYPTION_KEY` in values.yaml.
|
| 4 |
+
- To generate a random key at install (preserved across upgrades), set `generateEncryptionKey: true`.
|
| 5 |
+
- To use an existing Kubernetes secret, set `existingSecret` to the secret name. The secret must
|
| 6 |
+
contain a key matching `existingSecretKey` (defaults to `ENCRYPTION_KEY`).
|
| 7 |
+
- If left empty, the server resolves the key automatically: existing installs fall back to
|
| 8 |
+
data/.jwt_secret (encrypted data stays readable with no manual action); fresh installs
|
| 9 |
+
auto-generate a key persisted to the data PVC.
|
| 10 |
+
|
| 11 |
+
2. JWT_SECRET is managed entirely by the server:
|
| 12 |
+
- Auto-generated on first start and persisted to the data PVC (data/.jwt_secret).
|
| 13 |
+
- Rotate it via the admin panel (Settings → Danger Zone → Rotate JWT Secret).
|
| 14 |
+
- No Helm configuration needed or supported.
|
| 15 |
+
|
| 16 |
+
3. Example usage:
|
| 17 |
+
- Set an explicit encryption key: `--set secretEnv.ENCRYPTION_KEY=your_enc_key`
|
| 18 |
+
- Generate a random key at install: `--set generateEncryptionKey=true`
|
| 19 |
+
- Use an existing secret: `--set existingSecret=my-k8s-secret`
|
| 20 |
+
- Use a custom key name in the existing secret: `--set existingSecret=my-k8s-secret --set existingSecretKey=MY_ENC_KEY`
|
| 21 |
+
|
| 22 |
+
4. Only one method should be used at a time. If both `generateEncryptionKey` and `existingSecret` are
|
| 23 |
+
set, `existingSecret` takes precedence. Ensure the referenced secret and key exist in the namespace.
|
charts/trek/templates/_helpers.tpl
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{/*
|
| 2 |
+
Expand the name of the chart.
|
| 3 |
+
*/}}
|
| 4 |
+
{{- define "trek.name" -}}
|
| 5 |
+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
| 6 |
+
{{- end -}}
|
| 7 |
+
|
| 8 |
+
{{/*
|
| 9 |
+
Create a default fully qualified app name.
|
| 10 |
+
*/}}
|
| 11 |
+
{{- define "trek.fullname" -}}
|
| 12 |
+
{{- if .Values.fullnameOverride -}}
|
| 13 |
+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
| 14 |
+
{{- else -}}
|
| 15 |
+
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
| 16 |
+
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
|
| 17 |
+
{{- end -}}
|
| 18 |
+
{{- end -}}
|
charts/trek/templates/configmap.yaml
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v1
|
| 2 |
+
kind: ConfigMap
|
| 3 |
+
metadata:
|
| 4 |
+
name: {{ include "trek.fullname" . }}-config
|
| 5 |
+
labels:
|
| 6 |
+
app: {{ include "trek.name" . }}
|
| 7 |
+
data:
|
| 8 |
+
NODE_ENV: {{ .Values.env.NODE_ENV | quote }}
|
| 9 |
+
PORT: {{ .Values.env.PORT | quote }}
|
| 10 |
+
{{- if .Values.env.TZ }}
|
| 11 |
+
TZ: {{ .Values.env.TZ | quote }}
|
| 12 |
+
{{- end }}
|
| 13 |
+
{{- if .Values.env.LOG_LEVEL }}
|
| 14 |
+
LOG_LEVEL: {{ .Values.env.LOG_LEVEL | quote }}
|
| 15 |
+
{{- end }}
|
| 16 |
+
{{- if .Values.env.ALLOWED_ORIGINS }}
|
| 17 |
+
ALLOWED_ORIGINS: {{ .Values.env.ALLOWED_ORIGINS | quote }}
|
| 18 |
+
{{- end }}
|
| 19 |
+
{{- if .Values.env.APP_URL }}
|
| 20 |
+
APP_URL: {{ .Values.env.APP_URL | quote }}
|
| 21 |
+
{{- end }}
|
| 22 |
+
{{- if .Values.env.FORCE_HTTPS }}
|
| 23 |
+
FORCE_HTTPS: {{ .Values.env.FORCE_HTTPS | quote }}
|
| 24 |
+
{{- end }}
|
| 25 |
+
{{- if .Values.env.HSTS_INCLUDE_SUBDOMAINS }}
|
| 26 |
+
HSTS_INCLUDE_SUBDOMAINS: {{ .Values.env.HSTS_INCLUDE_SUBDOMAINS | quote }}
|
| 27 |
+
{{- end }}
|
| 28 |
+
{{- if .Values.env.COOKIE_SECURE }}
|
| 29 |
+
COOKIE_SECURE: {{ .Values.env.COOKIE_SECURE | quote }}
|
| 30 |
+
{{- end }}
|
| 31 |
+
{{- if .Values.env.SESSION_DURATION }}
|
| 32 |
+
SESSION_DURATION: {{ .Values.env.SESSION_DURATION | quote }}
|
| 33 |
+
{{- end }}
|
| 34 |
+
{{- if .Values.env.SESSION_DURATION_REMEMBER }}
|
| 35 |
+
SESSION_DURATION_REMEMBER: {{ .Values.env.SESSION_DURATION_REMEMBER | quote }}
|
| 36 |
+
{{- end }}
|
| 37 |
+
{{- if .Values.env.TRUST_PROXY }}
|
| 38 |
+
TRUST_PROXY: {{ .Values.env.TRUST_PROXY | quote }}
|
| 39 |
+
{{- end }}
|
| 40 |
+
{{- if .Values.env.ALLOW_INTERNAL_NETWORK }}
|
| 41 |
+
ALLOW_INTERNAL_NETWORK: {{ .Values.env.ALLOW_INTERNAL_NETWORK | quote }}
|
| 42 |
+
{{- end }}
|
| 43 |
+
{{- if .Values.env.OIDC_ISSUER }}
|
| 44 |
+
OIDC_ISSUER: {{ .Values.env.OIDC_ISSUER | quote }}
|
| 45 |
+
{{- end }}
|
| 46 |
+
{{- if .Values.env.OIDC_CLIENT_ID }}
|
| 47 |
+
OIDC_CLIENT_ID: {{ .Values.env.OIDC_CLIENT_ID | quote }}
|
| 48 |
+
{{- end }}
|
| 49 |
+
{{- if .Values.env.OIDC_DISPLAY_NAME }}
|
| 50 |
+
OIDC_DISPLAY_NAME: {{ .Values.env.OIDC_DISPLAY_NAME | quote }}
|
| 51 |
+
{{- end }}
|
| 52 |
+
{{- if .Values.env.OIDC_ONLY }}
|
| 53 |
+
OIDC_ONLY: {{ .Values.env.OIDC_ONLY | quote }}
|
| 54 |
+
{{- end }}
|
| 55 |
+
{{- if .Values.env.OIDC_ADMIN_CLAIM }}
|
| 56 |
+
OIDC_ADMIN_CLAIM: {{ .Values.env.OIDC_ADMIN_CLAIM | quote }}
|
| 57 |
+
{{- end }}
|
| 58 |
+
{{- if .Values.env.OIDC_ADMIN_VALUE }}
|
| 59 |
+
OIDC_ADMIN_VALUE: {{ .Values.env.OIDC_ADMIN_VALUE | quote }}
|
| 60 |
+
{{- end }}
|
| 61 |
+
{{- if .Values.env.OIDC_SCOPE }}
|
| 62 |
+
OIDC_SCOPE: {{ .Values.env.OIDC_SCOPE | quote }}
|
| 63 |
+
{{- end }}
|
| 64 |
+
{{- if .Values.env.OIDC_DISCOVERY_URL }}
|
| 65 |
+
OIDC_DISCOVERY_URL: {{ .Values.env.OIDC_DISCOVERY_URL | quote }}
|
| 66 |
+
{{- end }}
|
| 67 |
+
{{- if .Values.env.DEMO_MODE }}
|
| 68 |
+
DEMO_MODE: {{ .Values.env.DEMO_MODE | quote }}
|
| 69 |
+
{{- end }}
|
| 70 |
+
{{- if .Values.env.MCP_RATE_LIMIT }}
|
| 71 |
+
MCP_RATE_LIMIT: {{ .Values.env.MCP_RATE_LIMIT | quote }}
|
| 72 |
+
{{- end }}
|
charts/trek/templates/deployment.yaml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: apps/v1
|
| 2 |
+
kind: Deployment
|
| 3 |
+
metadata:
|
| 4 |
+
name: {{ include "trek.fullname" . }}
|
| 5 |
+
labels:
|
| 6 |
+
app: {{ include "trek.name" . }}
|
| 7 |
+
spec:
|
| 8 |
+
replicas: 1
|
| 9 |
+
selector:
|
| 10 |
+
matchLabels:
|
| 11 |
+
app: {{ include "trek.name" . }}
|
| 12 |
+
template:
|
| 13 |
+
metadata:
|
| 14 |
+
annotations:
|
| 15 |
+
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
| 16 |
+
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
| 17 |
+
labels:
|
| 18 |
+
app: {{ include "trek.name" . }}
|
| 19 |
+
spec:
|
| 20 |
+
{{- if .Values.imagePullSecrets }}
|
| 21 |
+
imagePullSecrets:
|
| 22 |
+
{{- range .Values.imagePullSecrets }}
|
| 23 |
+
- name: {{ .name }}
|
| 24 |
+
{{- end }}
|
| 25 |
+
{{- end }}
|
| 26 |
+
securityContext:
|
| 27 |
+
fsGroup: 1000
|
| 28 |
+
containers:
|
| 29 |
+
- name: trek
|
| 30 |
+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
| 31 |
+
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
| 32 |
+
{{- with .Values.resources }}
|
| 33 |
+
resources:
|
| 34 |
+
{{- toYaml . | nindent 12 }}
|
| 35 |
+
{{- end }}
|
| 36 |
+
ports:
|
| 37 |
+
- containerPort: 3000
|
| 38 |
+
envFrom:
|
| 39 |
+
- configMapRef:
|
| 40 |
+
name: {{ include "trek.fullname" . }}-config
|
| 41 |
+
env:
|
| 42 |
+
- name: ENCRYPTION_KEY
|
| 43 |
+
valueFrom:
|
| 44 |
+
secretKeyRef:
|
| 45 |
+
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) .Values.existingSecret }}
|
| 46 |
+
key: {{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}
|
| 47 |
+
optional: true
|
| 48 |
+
- name: ADMIN_EMAIL
|
| 49 |
+
valueFrom:
|
| 50 |
+
secretKeyRef:
|
| 51 |
+
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) .Values.existingSecret }}
|
| 52 |
+
key: ADMIN_EMAIL
|
| 53 |
+
optional: true
|
| 54 |
+
- name: ADMIN_PASSWORD
|
| 55 |
+
valueFrom:
|
| 56 |
+
secretKeyRef:
|
| 57 |
+
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) .Values.existingSecret }}
|
| 58 |
+
key: ADMIN_PASSWORD
|
| 59 |
+
optional: true
|
| 60 |
+
- name: OIDC_CLIENT_SECRET
|
| 61 |
+
valueFrom:
|
| 62 |
+
secretKeyRef:
|
| 63 |
+
name: {{ default (printf "%s-secret" (include "trek.fullname" .)) .Values.existingSecret }}
|
| 64 |
+
key: OIDC_CLIENT_SECRET
|
| 65 |
+
optional: true
|
| 66 |
+
volumeMounts:
|
| 67 |
+
- name: data
|
| 68 |
+
mountPath: /app/data
|
| 69 |
+
- name: uploads
|
| 70 |
+
mountPath: /app/uploads
|
| 71 |
+
livenessProbe:
|
| 72 |
+
httpGet:
|
| 73 |
+
path: /api/health
|
| 74 |
+
port: 3000
|
| 75 |
+
initialDelaySeconds: 15
|
| 76 |
+
periodSeconds: 30
|
| 77 |
+
readinessProbe:
|
| 78 |
+
httpGet:
|
| 79 |
+
path: /api/health
|
| 80 |
+
port: 3000
|
| 81 |
+
initialDelaySeconds: 5
|
| 82 |
+
periodSeconds: 10
|
| 83 |
+
volumes:
|
| 84 |
+
- name: data
|
| 85 |
+
persistentVolumeClaim:
|
| 86 |
+
claimName: {{ include "trek.fullname" . }}-data
|
| 87 |
+
- name: uploads
|
| 88 |
+
persistentVolumeClaim:
|
| 89 |
+
claimName: {{ include "trek.fullname" . }}-uploads
|
charts/trek/templates/ingress.yaml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if .Values.ingress.enabled }}
|
| 2 |
+
apiVersion: networking.k8s.io/v1
|
| 3 |
+
kind: Ingress
|
| 4 |
+
metadata:
|
| 5 |
+
name: {{ include "trek.fullname" . }}
|
| 6 |
+
labels:
|
| 7 |
+
app: {{ include "trek.name" . }}
|
| 8 |
+
{{- with .Values.ingress.annotations }}
|
| 9 |
+
annotations:
|
| 10 |
+
{{- toYaml . | nindent 4 }}
|
| 11 |
+
{{- end }}
|
| 12 |
+
spec:
|
| 13 |
+
{{- if .Values.ingress.className }}
|
| 14 |
+
ingressClassName: {{ .Values.ingress.className }}
|
| 15 |
+
{{- end }}
|
| 16 |
+
{{- if .Values.ingress.tls }}
|
| 17 |
+
tls:
|
| 18 |
+
{{- toYaml .Values.ingress.tls | nindent 4 }}
|
| 19 |
+
{{- end }}
|
| 20 |
+
rules:
|
| 21 |
+
{{- range .Values.ingress.hosts }}
|
| 22 |
+
- host: {{ .host }}
|
| 23 |
+
http:
|
| 24 |
+
paths:
|
| 25 |
+
{{- range .paths }}
|
| 26 |
+
- path: {{ . }}
|
| 27 |
+
pathType: Prefix
|
| 28 |
+
backend:
|
| 29 |
+
service:
|
| 30 |
+
name: {{ include "trek.fullname" $ }}
|
| 31 |
+
port:
|
| 32 |
+
number: {{ $.Values.service.port }}
|
| 33 |
+
{{- end }}
|
| 34 |
+
{{- end }}
|
| 35 |
+
{{- end }}
|
charts/trek/templates/pvc.yaml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if .Values.persistence.enabled }}
|
| 2 |
+
apiVersion: v1
|
| 3 |
+
kind: PersistentVolumeClaim
|
| 4 |
+
metadata:
|
| 5 |
+
name: {{ include "trek.fullname" . }}-data
|
| 6 |
+
labels:
|
| 7 |
+
app: {{ include "trek.name" . }}
|
| 8 |
+
spec:
|
| 9 |
+
accessModes:
|
| 10 |
+
- ReadWriteOnce
|
| 11 |
+
resources:
|
| 12 |
+
requests:
|
| 13 |
+
storage: {{ .Values.persistence.data.size }}
|
| 14 |
+
---
|
| 15 |
+
apiVersion: v1
|
| 16 |
+
kind: PersistentVolumeClaim
|
| 17 |
+
metadata:
|
| 18 |
+
name: {{ include "trek.fullname" . }}-uploads
|
| 19 |
+
labels:
|
| 20 |
+
app: {{ include "trek.name" . }}
|
| 21 |
+
spec:
|
| 22 |
+
accessModes:
|
| 23 |
+
- ReadWriteOnce
|
| 24 |
+
resources:
|
| 25 |
+
requests:
|
| 26 |
+
storage: {{ .Values.persistence.uploads.size }}
|
| 27 |
+
{{- end }}
|
charts/trek/templates/secret.yaml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- if and (not .Values.existingSecret) (not .Values.generateEncryptionKey) }}
|
| 2 |
+
apiVersion: v1
|
| 3 |
+
kind: Secret
|
| 4 |
+
metadata:
|
| 5 |
+
name: {{ include "trek.fullname" . }}-secret
|
| 6 |
+
labels:
|
| 7 |
+
app: {{ include "trek.name" . }}
|
| 8 |
+
type: Opaque
|
| 9 |
+
data:
|
| 10 |
+
{{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}: {{ .Values.secretEnv.ENCRYPTION_KEY | b64enc | quote }}
|
| 11 |
+
{{- if .Values.secretEnv.ADMIN_EMAIL }}
|
| 12 |
+
ADMIN_EMAIL: {{ .Values.secretEnv.ADMIN_EMAIL | b64enc | quote }}
|
| 13 |
+
{{- end }}
|
| 14 |
+
{{- if .Values.secretEnv.ADMIN_PASSWORD }}
|
| 15 |
+
ADMIN_PASSWORD: {{ .Values.secretEnv.ADMIN_PASSWORD | b64enc | quote }}
|
| 16 |
+
{{- end }}
|
| 17 |
+
{{- if .Values.secretEnv.OIDC_CLIENT_SECRET }}
|
| 18 |
+
OIDC_CLIENT_SECRET: {{ .Values.secretEnv.OIDC_CLIENT_SECRET | b64enc | quote }}
|
| 19 |
+
{{- end }}
|
| 20 |
+
{{- end }}
|
| 21 |
+
|
| 22 |
+
{{- if and (not .Values.existingSecret) (.Values.generateEncryptionKey) }}
|
| 23 |
+
{{- $secretName := printf "%s-secret" (include "trek.fullname" .) }}
|
| 24 |
+
{{- $existingSecret := (lookup "v1" "Secret" .Release.Namespace $secretName) }}
|
| 25 |
+
apiVersion: v1
|
| 26 |
+
kind: Secret
|
| 27 |
+
metadata:
|
| 28 |
+
name: {{ $secretName }}
|
| 29 |
+
labels:
|
| 30 |
+
app: {{ include "trek.name" . }}
|
| 31 |
+
type: Opaque
|
| 32 |
+
stringData:
|
| 33 |
+
{{- if and $existingSecret $existingSecret.data }}
|
| 34 |
+
{{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}: {{ index $existingSecret.data (.Values.existingSecretKey | default "ENCRYPTION_KEY") | b64dec }}
|
| 35 |
+
{{- else }}
|
| 36 |
+
{{ .Values.existingSecretKey | default "ENCRYPTION_KEY" }}: {{ randAlphaNum 32 }}
|
| 37 |
+
{{- end }}
|
| 38 |
+
{{- if .Values.secretEnv.ADMIN_EMAIL }}
|
| 39 |
+
ADMIN_EMAIL: {{ .Values.secretEnv.ADMIN_EMAIL }}
|
| 40 |
+
{{- end }}
|
| 41 |
+
{{- if .Values.secretEnv.ADMIN_PASSWORD }}
|
| 42 |
+
ADMIN_PASSWORD: {{ .Values.secretEnv.ADMIN_PASSWORD }}
|
| 43 |
+
{{- end }}
|
| 44 |
+
{{- if .Values.secretEnv.OIDC_CLIENT_SECRET }}
|
| 45 |
+
OIDC_CLIENT_SECRET: {{ .Values.secretEnv.OIDC_CLIENT_SECRET }}
|
| 46 |
+
{{- end }}
|
| 47 |
+
{{- end }}
|
charts/trek/templates/service.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
apiVersion: v1
|
| 2 |
+
kind: Service
|
| 3 |
+
metadata:
|
| 4 |
+
name: {{ include "trek.fullname" . }}
|
| 5 |
+
labels:
|
| 6 |
+
app: {{ include "trek.name" . }}
|
| 7 |
+
spec:
|
| 8 |
+
type: {{ .Values.service.type }}
|
| 9 |
+
ports:
|
| 10 |
+
- port: {{ .Values.service.port }}
|
| 11 |
+
targetPort: 3000
|
| 12 |
+
protocol: TCP
|
| 13 |
+
name: http
|
| 14 |
+
selector:
|
| 15 |
+
app: {{ include "trek.name" . }}
|
charts/trek/values.yaml
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
image:
|
| 3 |
+
repository: mauriceboe/trek
|
| 4 |
+
# tag: latest
|
| 5 |
+
pullPolicy: IfNotPresent
|
| 6 |
+
|
| 7 |
+
# Optional image pull secrets for private registries
|
| 8 |
+
imagePullSecrets: []
|
| 9 |
+
# - name: my-registry-secret
|
| 10 |
+
|
| 11 |
+
service:
|
| 12 |
+
type: ClusterIP
|
| 13 |
+
port: 3000
|
| 14 |
+
|
| 15 |
+
env:
|
| 16 |
+
NODE_ENV: production
|
| 17 |
+
PORT: 3000
|
| 18 |
+
# TZ: "UTC"
|
| 19 |
+
# Timezone for logs, reminders, and cron jobs (e.g. Europe/Berlin).
|
| 20 |
+
# LOG_LEVEL: "info"
|
| 21 |
+
# "info" = concise user actions, "debug" = verbose details.
|
| 22 |
+
# DEFAULT_LANGUAGE: "en"
|
| 23 |
+
# Default language on the login page for users with no saved preference.
|
| 24 |
+
# Browser/OS language is auto-detected first; this is the fallback when no match is found.
|
| 25 |
+
# Supported: de, en, es, fr, hu, nl, br, cs, pl, ru, zh, zh-TW, it, ar
|
| 26 |
+
# ALLOWED_ORIGINS: ""
|
| 27 |
+
# NOTE: If using ingress, ensure env.ALLOWED_ORIGINS matches the domains in ingress.hosts for proper CORS configuration.
|
| 28 |
+
# APP_URL: "https://trek.example.com"
|
| 29 |
+
# Public base URL of this instance. Required when OIDC is enabled — must match the redirect URI registered with your IdP.
|
| 30 |
+
# Also used as the base URL for links in email notifications and other external links.
|
| 31 |
+
# FORCE_HTTPS: "false"
|
| 32 |
+
# Optional. When "true": HTTPS redirect, HSTS, CSP upgrade-insecure-requests, secure cookies. Only behind a TLS proxy. Requires TRUST_PROXY.
|
| 33 |
+
# HSTS_INCLUDE_SUBDOMAINS: "false"
|
| 34 |
+
# When "true": adds includeSubDomains to the HSTS header. Only effective when HSTS is active. Leave "false" if sibling subdomains still run over plain HTTP.
|
| 35 |
+
# COOKIE_SECURE: "true"
|
| 36 |
+
# Auto-derived (true in production or when FORCE_HTTPS=true). Set "false" to force cookies over plain HTTP. Not recommended for production.
|
| 37 |
+
# SESSION_DURATION: "24h"
|
| 38 |
+
# How long a login session stays valid when "Remember me" is unchecked (the default): trek_session JWT exp + a browser-session cookie. Accepts 1h, 12h, 7d, 30d, 90d. Defaults to 24h.
|
| 39 |
+
# SESSION_DURATION_REMEMBER: "30d"
|
| 40 |
+
# Session length when "Remember me" is ticked: a longer-lived JWT + persistent cookie that survives browser restarts. Same format as SESSION_DURATION. Defaults to 30d.
|
| 41 |
+
# TRUST_PROXY: "1"
|
| 42 |
+
# Trusted proxy hops for X-Forwarded-For/X-Forwarded-Proto. Defaults to 1 in production. Must be set for FORCE_HTTPS to work.
|
| 43 |
+
# ALLOW_INTERNAL_NETWORK: "false"
|
| 44 |
+
# Set to "true" if Immich or other integrated services are hosted on a private/RFC-1918 network address.
|
| 45 |
+
# Loopback (127.x) and link-local/metadata addresses (169.254.x) are always blocked.
|
| 46 |
+
# OIDC_ISSUER: ""
|
| 47 |
+
# OpenID Connect provider URL.
|
| 48 |
+
# OIDC_CLIENT_ID: ""
|
| 49 |
+
# OIDC client ID.
|
| 50 |
+
# OIDC_DISPLAY_NAME: "SSO"
|
| 51 |
+
# Label shown on the SSO login button.
|
| 52 |
+
# OIDC_ONLY: "false"
|
| 53 |
+
# Set to "true" to force SSO-only mode: disables password login and password registration.
|
| 54 |
+
# Overrides the granular toggles in Admin > Settings and cannot be changed at runtime.
|
| 55 |
+
# First SSO login becomes admin on a fresh instance.
|
| 56 |
+
# OIDC_ADMIN_CLAIM: ""
|
| 57 |
+
# OIDC claim used to identify admin users.
|
| 58 |
+
# OIDC_ADMIN_VALUE: ""
|
| 59 |
+
# Value of the OIDC claim that grants admin role.
|
| 60 |
+
# OIDC_SCOPE: "openid email profile groups"
|
| 61 |
+
# Space-separated OIDC scopes to request. Must include scopes for any claim used by OIDC_ADMIN_CLAIM.
|
| 62 |
+
# OIDC_DISCOVERY_URL: ""
|
| 63 |
+
# Override the OIDC discovery endpoint for providers with non-standard paths (e.g. Authentik).
|
| 64 |
+
# DEMO_MODE: "false"
|
| 65 |
+
# Enable demo mode (hourly data resets).
|
| 66 |
+
# MCP_RATE_LIMIT: "300"
|
| 67 |
+
# Max MCP API requests per user per minute. Defaults to 300.
|
| 68 |
+
# MCP_MAX_SESSION_PER_USER: "20"
|
| 69 |
+
# Max concurrent MCP sessions per user. Defaults to 20.
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# Secret environment variables stored in a Kubernetes Secret.
|
| 73 |
+
# JWT_SECRET is managed entirely by the server (auto-generated into the data PVC,
|
| 74 |
+
# rotatable via the admin panel) — it is not configured here.
|
| 75 |
+
secretEnv:
|
| 76 |
+
# At-rest encryption key for stored secrets (API keys, MFA, SMTP, OIDC, etc.).
|
| 77 |
+
# Recommended: set to a random 32-byte hex value (openssl rand -hex 32).
|
| 78 |
+
# If left empty the server resolves the key automatically:
|
| 79 |
+
# 1. data/.jwt_secret (existing installs — encrypted data stays readable after upgrade)
|
| 80 |
+
# 2. data/.encryption_key auto-generated on first start (fresh installs)
|
| 81 |
+
ENCRYPTION_KEY: ""
|
| 82 |
+
# Initial admin account — only used on first boot when no users exist yet.
|
| 83 |
+
# If both values are non-empty the admin account is created with these credentials.
|
| 84 |
+
# If either is empty a random password is generated and printed to the server log.
|
| 85 |
+
ADMIN_EMAIL: ""
|
| 86 |
+
ADMIN_PASSWORD: ""
|
| 87 |
+
# OIDC client secret — set together with env.OIDC_ISSUER and env.OIDC_CLIENT_ID.
|
| 88 |
+
OIDC_CLIENT_SECRET: ""
|
| 89 |
+
|
| 90 |
+
# If true, a random ENCRYPTION_KEY is generated at install and preserved across upgrades
|
| 91 |
+
generateEncryptionKey: false
|
| 92 |
+
|
| 93 |
+
# If set, use an existing Kubernetes secret that contains ENCRYPTION_KEY
|
| 94 |
+
existingSecret: ""
|
| 95 |
+
existingSecretKey: ENCRYPTION_KEY
|
| 96 |
+
|
| 97 |
+
persistence:
|
| 98 |
+
enabled: true
|
| 99 |
+
data:
|
| 100 |
+
size: 1Gi
|
| 101 |
+
uploads:
|
| 102 |
+
size: 1Gi
|
| 103 |
+
|
| 104 |
+
resources:
|
| 105 |
+
requests:
|
| 106 |
+
cpu: 100m
|
| 107 |
+
memory: 256Mi
|
| 108 |
+
limits:
|
| 109 |
+
cpu: 500m
|
| 110 |
+
memory: 512Mi
|
| 111 |
+
|
| 112 |
+
ingress:
|
| 113 |
+
enabled: false
|
| 114 |
+
className: ""
|
| 115 |
+
annotations: {}
|
| 116 |
+
hosts:
|
| 117 |
+
- host: chart-example.local
|
| 118 |
+
paths:
|
| 119 |
+
- /
|
| 120 |
+
tls: []
|
| 121 |
+
# - secretName: chart-example-tls
|
| 122 |
+
# hosts:
|
| 123 |
+
# - chart-example.local
|
client/.gitignore
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Playwright E2E (FE7)
|
| 2 |
+
e2e/.tmp/
|
| 3 |
+
test-results/
|
| 4 |
+
playwright-report/
|
| 5 |
+
playwright/.cache/
|
client/.prettierrc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"printWidth": 120,
|
| 3 |
+
"useTabs": false,
|
| 4 |
+
"tabWidth": 2,
|
| 5 |
+
"trailingComma": "es5",
|
| 6 |
+
"semi": true,
|
| 7 |
+
"singleQuote": true,
|
| 8 |
+
"bracketSpacing": true,
|
| 9 |
+
"arrowParens": "always",
|
| 10 |
+
"jsxSingleQuote": false,
|
| 11 |
+
"bracketSameLine": false,
|
| 12 |
+
"endOfLine": "lf",
|
| 13 |
+
"plugins": [
|
| 14 |
+
"prettier-plugin-organize-imports",
|
| 15 |
+
"@trivago/prettier-plugin-sort-imports",
|
| 16 |
+
"prettier-plugin-tailwindcss"
|
| 17 |
+
],
|
| 18 |
+
"importOrder": [
|
| 19 |
+
"^[a-zA-Z]",
|
| 20 |
+
"^@/.*"
|
| 21 |
+
],
|
| 22 |
+
"importOrderSeparation": true,
|
| 23 |
+
"importOrderParserPlugins": [
|
| 24 |
+
"typescript",
|
| 25 |
+
"decorators-legacy"
|
| 26 |
+
]
|
| 27 |
+
}
|
client/e2e/auth.setup.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { test as setup, expect } from '@playwright/test'
|
| 2 |
+
|
| 3 |
+
// Relative to the config dir (client/), matching `storageState` in
|
| 4 |
+
// playwright.config.ts. Playwright runs from the client workspace root.
|
| 5 |
+
const stateFile = 'e2e/.tmp/state.json'
|
| 6 |
+
|
| 7 |
+
// Credentials match e2e/server-launch.mjs (ADMIN_EMAIL/ADMIN_PASSWORD). The
|
| 8 |
+
// seeded admin is created with must_change_password=1, so the first login goes
|
| 9 |
+
// through the forced change-password step before reaching the dashboard.
|
| 10 |
+
const EMAIL = 'e2e@trek.local'
|
| 11 |
+
const SEED_PW = 'E2eTest12345!'
|
| 12 |
+
const NEW_PW = 'E2eChanged12345!'
|
| 13 |
+
|
| 14 |
+
setup('authenticate the seeded admin (incl. forced password change)', async ({ page }) => {
|
| 15 |
+
await page.goto('/login')
|
| 16 |
+
await page.locator('input[type="email"]').fill(EMAIL)
|
| 17 |
+
await page.locator('input[type="password"]').fill(SEED_PW)
|
| 18 |
+
await page.locator('button[type="submit"]').click()
|
| 19 |
+
|
| 20 |
+
// must_change_password=1 → the change-password step renders two password
|
| 21 |
+
// fields (new + confirm). Selector-agnostic of the UI language.
|
| 22 |
+
const pw = page.locator('input[type="password"]')
|
| 23 |
+
await expect(pw).toHaveCount(2)
|
| 24 |
+
await pw.nth(0).fill(NEW_PW)
|
| 25 |
+
await pw.nth(1).fill(NEW_PW)
|
| 26 |
+
await page.locator('button[type="submit"]').click()
|
| 27 |
+
|
| 28 |
+
await page.waitForURL('**/dashboard', { timeout: 30_000 })
|
| 29 |
+
|
| 30 |
+
// Dismiss the first-run "Welcome to TREK" system-notice modal(s). It renders
|
| 31 |
+
// asynchronously (after the notices fetch), so wait for it before clicking.
|
| 32 |
+
// Dismissal is recorded server-side against this user, so clearing it here
|
| 33 |
+
// keeps it cleared for every authenticated flow in the run (shared test DB).
|
| 34 |
+
const ok = page.getByRole('button', { name: 'OK', exact: true })
|
| 35 |
+
await ok.waitFor({ state: 'visible', timeout: 10_000 }).catch(() => {})
|
| 36 |
+
for (let i = 0; i < 8 && (await ok.isVisible().catch(() => false)); i++) {
|
| 37 |
+
await ok.click()
|
| 38 |
+
await page.waitForTimeout(400)
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
await page.context().storageState({ path: stateFile })
|
| 42 |
+
})
|
client/e2e/create-trip.spec.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { test, expect } from '@playwright/test'
|
| 2 |
+
|
| 3 |
+
// Trip lifecycle (core): from the dashboard, open the new-trip modal, name the
|
| 4 |
+
// trip, submit, and confirm it shows up on the dashboard. Exercises the whole
|
| 5 |
+
// authenticated stack — dashboard → TripFormModal → POST /api/trips → store →
|
| 6 |
+
// re-render — against the real backend + isolated test DB.
|
| 7 |
+
test('create a trip and see it on the dashboard', async ({ page }) => {
|
| 8 |
+
await page.goto('/dashboard')
|
| 9 |
+
|
| 10 |
+
// The "+ New Trip" card is always rendered in the default (planned) filter.
|
| 11 |
+
await page.locator('.add-trip-card').click()
|
| 12 |
+
|
| 13 |
+
// Scope to the shared Modal (.modal-backdrop). Its form has no in-form submit
|
| 14 |
+
// button (the primary action lives in the footer), so click it explicitly
|
| 15 |
+
// rather than pressing Enter. The Create button is the slate primary button;
|
| 16 |
+
// Cancel is the bordered one.
|
| 17 |
+
const modal = page.locator('.modal-backdrop')
|
| 18 |
+
await expect(modal).toBeVisible()
|
| 19 |
+
|
| 20 |
+
const title = `E2E Trip ${Date.now()}`
|
| 21 |
+
await modal.locator('input[type="text"]').first().fill(title)
|
| 22 |
+
await modal.getByRole('button', { name: 'Create New Trip' }).click()
|
| 23 |
+
|
| 24 |
+
await expect(page.getByText(title).first()).toBeVisible({ timeout: 15_000 })
|
| 25 |
+
})
|
client/e2e/dashboard.spec.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { test, expect } from '@playwright/test'
|
| 2 |
+
|
| 3 |
+
// Authenticated smoke: the stored session lands on the dashboard and the
|
| 4 |
+
// app chrome (navbar) renders instead of bouncing back to /login.
|
| 5 |
+
test('authenticated session reaches the dashboard', async ({ page }) => {
|
| 6 |
+
await page.goto('/dashboard')
|
| 7 |
+
await expect(page).toHaveURL(/\/dashboard/)
|
| 8 |
+
// The shared Navbar shows the TREK brand once authenticated.
|
| 9 |
+
await expect(page.getByRole('img', { name: 'TREK' }).first()).toBeVisible()
|
| 10 |
+
})
|
client/e2e/login.public.spec.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { test, expect } from '@playwright/test'
|
| 2 |
+
|
| 3 |
+
// Infra smoke + first unauthenticated flow: the app boots, the backend is
|
| 4 |
+
// reachable through the Vite proxy, and the login screen renders its form.
|
| 5 |
+
test('login screen renders with a password field', async ({ page }) => {
|
| 6 |
+
await page.goto('/login')
|
| 7 |
+
await expect(page.locator('input[type="password"]')).toBeVisible()
|
| 8 |
+
})
|
client/e2e/server-launch.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boots the TREK backend for the Playwright E2E run against a fresh, isolated
|
| 2 |
+
// SQLite database. The DB file is deleted first so every run starts clean, then
|
| 3 |
+
// the server's own startup seeds a known admin from ADMIN_EMAIL/ADMIN_PASSWORD.
|
| 4 |
+
//
|
| 5 |
+
// The server is built once and launched as a SINGLE node process (not the
|
| 6 |
+
// watch-mode `npm run dev`, which spawns tsc -w + node --watch grandchildren
|
| 7 |
+
// that survive Playwright's teardown and then linger on :3001 with stale DB
|
| 8 |
+
// state). A single child is killed cleanly when Playwright tears the run down.
|
| 9 |
+
import { rmSync } from 'node:fs'
|
| 10 |
+
import { spawn, execSync } from 'node:child_process'
|
| 11 |
+
import path from 'node:path'
|
| 12 |
+
import { fileURLToPath } from 'node:url'
|
| 13 |
+
|
| 14 |
+
const here = path.dirname(fileURLToPath(import.meta.url))
|
| 15 |
+
const dbFile = path.join(here, '.tmp', 'e2e.db')
|
| 16 |
+
const serverDir = path.join(here, '..', '..', 'server')
|
| 17 |
+
|
| 18 |
+
for (const f of [dbFile, `${dbFile}-wal`, `${dbFile}-shm`]) {
|
| 19 |
+
try { rmSync(f, { force: true }) } catch {}
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
// Build once (no watcher) — the resulting process is a single killable node.
|
| 23 |
+
execSync('node scripts/build.mjs', { cwd: serverDir, stdio: 'inherit' })
|
| 24 |
+
|
| 25 |
+
const env = {
|
| 26 |
+
...process.env,
|
| 27 |
+
TREK_DB_FILE: dbFile,
|
| 28 |
+
ADMIN_EMAIL: 'e2e@trek.local',
|
| 29 |
+
ADMIN_PASSWORD: 'E2eTest12345!',
|
| 30 |
+
PORT: '3001',
|
| 31 |
+
NODE_ENV: 'development',
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const child = spawn(process.execPath, ['--require', 'tsconfig-paths/register', 'dist/index.js'], {
|
| 35 |
+
cwd: serverDir,
|
| 36 |
+
env,
|
| 37 |
+
stdio: 'inherit',
|
| 38 |
+
})
|
| 39 |
+
const stop = () => { try { child.kill() } catch {} }
|
| 40 |
+
process.on('SIGINT', stop)
|
| 41 |
+
process.on('SIGTERM', stop)
|
| 42 |
+
process.on('exit', stop)
|
| 43 |
+
child.on('exit', code => process.exit(code ?? 0))
|
client/e2e/trip-planner.spec.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { test, expect } from '@playwright/test'
|
| 2 |
+
|
| 3 |
+
// Open a trip into the planner: create a trip, open it from the dashboard, and
|
| 4 |
+
// confirm the trip planner (TripPlannerPage — the app's largest page) actually
|
| 5 |
+
// mounts, proving the day-plan/map shell renders rather than crashing on load.
|
| 6 |
+
test('open a trip and land in the planner with a map', async ({ page }) => {
|
| 7 |
+
await page.goto('/dashboard')
|
| 8 |
+
|
| 9 |
+
// Create a trip to open.
|
| 10 |
+
await page.locator('.add-trip-card').click()
|
| 11 |
+
const modal = page.locator('.modal-backdrop')
|
| 12 |
+
await expect(modal).toBeVisible()
|
| 13 |
+
const title = `E2E Planner ${Date.now()}`
|
| 14 |
+
await modal.locator('input[type="text"]').first().fill(title)
|
| 15 |
+
await modal.getByRole('button', { name: 'Create New Trip' }).click()
|
| 16 |
+
|
| 17 |
+
// Open it from the dashboard.
|
| 18 |
+
await page.getByText(title).first().click()
|
| 19 |
+
|
| 20 |
+
await expect(page).toHaveURL(/\/trips\/\d+/)
|
| 21 |
+
// The planner shows a Leaflet map once mounted (past the splash screen).
|
| 22 |
+
await expect(page.locator('.leaflet-container')).toBeVisible({ timeout: 20_000 })
|
| 23 |
+
})
|
client/eslint.config.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import js from '@eslint/js';
|
| 2 |
+
|
| 3 |
+
import gitignore from 'eslint-config-flat-gitignore';
|
| 4 |
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
| 5 |
+
import reactHooks from 'eslint-plugin-react-hooks';
|
| 6 |
+
import reactRefresh from 'eslint-plugin-react-refresh';
|
| 7 |
+
import tseslint from 'typescript-eslint';
|
| 8 |
+
|
| 9 |
+
// Minimal stub so the existing `// eslint-disable-next-line react/no-danger`
|
| 10 |
+
// directive in src/i18n/TransHtml.tsx resolves without pulling in the full
|
| 11 |
+
// eslint-plugin-react (not a dependency here). The rule is a no-op.
|
| 12 |
+
const reactStub = {
|
| 13 |
+
rules: {
|
| 14 |
+
'no-danger': {
|
| 15 |
+
meta: { schema: [] },
|
| 16 |
+
create() {
|
| 17 |
+
return {};
|
| 18 |
+
},
|
| 19 |
+
},
|
| 20 |
+
},
|
| 21 |
+
};
|
| 22 |
+
|
| 23 |
+
export default tseslint.config(
|
| 24 |
+
gitignore({ strict: false }),
|
| 25 |
+
{
|
| 26 |
+
ignores: [
|
| 27 |
+
'node_modules',
|
| 28 |
+
'dist',
|
| 29 |
+
'coverage',
|
| 30 |
+
'public',
|
| 31 |
+
'test-results',
|
| 32 |
+
'playwright-report',
|
| 33 |
+
'e2e/**',
|
| 34 |
+
'scripts/**',
|
| 35 |
+
'**/*.config.js',
|
| 36 |
+
'**/*.config.ts',
|
| 37 |
+
'**/*.config.mjs',
|
| 38 |
+
],
|
| 39 |
+
},
|
| 40 |
+
js.configs.recommended,
|
| 41 |
+
...tseslint.configs.recommended,
|
| 42 |
+
eslintConfigPrettier,
|
| 43 |
+
{
|
| 44 |
+
files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
|
| 45 |
+
plugins: {
|
| 46 |
+
'react-hooks': reactHooks,
|
| 47 |
+
'react-refresh': reactRefresh,
|
| 48 |
+
react: reactStub,
|
| 49 |
+
},
|
| 50 |
+
rules: {
|
| 51 |
+
'react/no-danger': 'off',
|
| 52 |
+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
| 53 |
+
|
| 54 |
+
// --- Severities tuned to keep CI green on a codebase that was never linted ---
|
| 55 |
+
// (each rule below has pre-existing violations; surfaced as warnings, not blockers)
|
| 56 |
+
|
| 57 |
+
// rules-of-hooks has one conditional-hook violation in PlaceInspector.tsx -> warn (not error).
|
| 58 |
+
'react-hooks/rules-of-hooks': 'warn',
|
| 59 |
+
'react-hooks/exhaustive-deps': 'warn',
|
| 60 |
+
|
| 61 |
+
'@typescript-eslint/no-explicit-any': 'warn',
|
| 62 |
+
'@typescript-eslint/no-unused-vars': [
|
| 63 |
+
'warn',
|
| 64 |
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
| 65 |
+
],
|
| 66 |
+
'@typescript-eslint/no-unused-expressions': 'warn',
|
| 67 |
+
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
| 68 |
+
'@typescript-eslint/no-this-alias': 'warn',
|
| 69 |
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
|
| 70 |
+
|
| 71 |
+
// js.recommended rules with pre-existing hits.
|
| 72 |
+
'no-empty': 'warn',
|
| 73 |
+
'no-useless-escape': 'warn',
|
| 74 |
+
'no-useless-assignment': 'warn',
|
| 75 |
+
'preserve-caught-error': 'warn',
|
| 76 |
+
},
|
| 77 |
+
},
|
| 78 |
+
);
|
client/index.html
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
| 6 |
+
<title>TREK</title>
|
| 7 |
+
|
| 8 |
+
<!-- PWA / iOS -->
|
| 9 |
+
<meta name="theme-color" content="#09090b" />
|
| 10 |
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
| 11 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
| 12 |
+
<meta name="apple-mobile-web-app-title" content="TREK" />
|
| 13 |
+
<link rel="apple-touch-icon" href="/icons/apple-touch-icon-180x180.png" />
|
| 14 |
+
|
| 15 |
+
<!-- Favicon -->
|
| 16 |
+
<link rel="icon" type="image/svg+xml" href="/icons/icon-dark.svg" />
|
| 17 |
+
|
| 18 |
+
<!-- Fonts -->
|
| 19 |
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
| 20 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
| 21 |
+
<link href="https://fonts.googleapis.com/css2?family=MuseoModerno:wght@400;700;800&display=swap" rel="stylesheet" />
|
| 22 |
+
|
| 23 |
+
<!-- Leaflet -->
|
| 24 |
+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
| 25 |
+
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
| 26 |
+
crossorigin="" />
|
| 27 |
+
</head>
|
| 28 |
+
<body>
|
| 29 |
+
<div id="root"></div>
|
| 30 |
+
<script type="module" src="/src/main.tsx"></script>
|
| 31 |
+
</body>
|
| 32 |
+
</html>
|
client/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "@trek/client",
|
| 3 |
+
"version": "3.1.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"type": "module",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"dev": "vite",
|
| 8 |
+
"prebuild": "node scripts/generate-icons.mjs",
|
| 9 |
+
"build": "vite build",
|
| 10 |
+
"preview": "vite preview",
|
| 11 |
+
"typecheck": "tsc --noEmit",
|
| 12 |
+
"test": "vitest run",
|
| 13 |
+
"test:unit": "vitest run tests/unit",
|
| 14 |
+
"test:integration": "vitest run tests/integration src/**/*.test.{ts,tsx}",
|
| 15 |
+
"test:watch": "vitest",
|
| 16 |
+
"test:coverage": "vitest run --coverage",
|
| 17 |
+
"lint": "eslint .",
|
| 18 |
+
"lint:check": "eslint .",
|
| 19 |
+
"lint:pages": "node scripts/check-page-pattern.mjs",
|
| 20 |
+
"e2e": "playwright test",
|
| 21 |
+
"e2e:report": "playwright show-report",
|
| 22 |
+
"format": "prettier --write \"src/**/*.tsx\" \"src/**/*.css\"",
|
| 23 |
+
"format:check": "prettier --check \"src/**/*.tsx\" \"src/**/*.css\""
|
| 24 |
+
},
|
| 25 |
+
"dependencies": {
|
| 26 |
+
"@fontsource/geist-sans": "^5.2.5",
|
| 27 |
+
"@fontsource/poppins": "^5.2.7",
|
| 28 |
+
"@react-pdf/renderer": "^4.5.1",
|
| 29 |
+
"@simplewebauthn/browser": "^13.1.2",
|
| 30 |
+
"@trek/shared": "*",
|
| 31 |
+
"axios": "^1.6.7",
|
| 32 |
+
"dexie": "^4.4.2",
|
| 33 |
+
"heic-to": "^1.4.2",
|
| 34 |
+
"leaflet": "^1.9.4",
|
| 35 |
+
"lucide-react": "^0.344.0",
|
| 36 |
+
"mapbox-gl": "^3.22.0",
|
| 37 |
+
"marked": "^18.0.0",
|
| 38 |
+
"react": "^19.2.6",
|
| 39 |
+
"react-dom": "^19.2.6",
|
| 40 |
+
"react-dropzone": "^14.4.1",
|
| 41 |
+
"react-leaflet": "^5.0.0",
|
| 42 |
+
"react-leaflet-cluster": "^4.1.3",
|
| 43 |
+
"react-markdown": "^10.1.0",
|
| 44 |
+
"react-router-dom": "^6.22.2",
|
| 45 |
+
"react-window": "^2.2.7",
|
| 46 |
+
"rehype-sanitize": "^6.0.0",
|
| 47 |
+
"remark-breaks": "^4.0.0",
|
| 48 |
+
"remark-gfm": "^4.0.1",
|
| 49 |
+
"topojson-client": "^3.1.0",
|
| 50 |
+
"zod": "^4.3.6",
|
| 51 |
+
"zustand": "^4.5.2"
|
| 52 |
+
},
|
| 53 |
+
"devDependencies": {
|
| 54 |
+
"@eslint/js": "^10.0.1",
|
| 55 |
+
"@playwright/test": "^1.60.0",
|
| 56 |
+
"@testing-library/jest-dom": "^6.9.1",
|
| 57 |
+
"@testing-library/react": "^16.3.2",
|
| 58 |
+
"@testing-library/user-event": "^14.6.1",
|
| 59 |
+
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
| 60 |
+
"@types/leaflet": "^1.9.8",
|
| 61 |
+
"@types/node": "^25.9.3",
|
| 62 |
+
"@types/react": "^19.2.15",
|
| 63 |
+
"@types/react-dom": "^19.2.3",
|
| 64 |
+
"@types/react-window": "^1.8.8",
|
| 65 |
+
"@vitejs/plugin-react": "^6.0.2",
|
| 66 |
+
"@vitest/coverage-v8": "^4.1.9",
|
| 67 |
+
"autoprefixer": "^10.4.18",
|
| 68 |
+
"eslint": "^10.2.1",
|
| 69 |
+
"eslint-config-flat-gitignore": "^2.3.0",
|
| 70 |
+
"eslint-config-prettier": "^10.1.8",
|
| 71 |
+
"eslint-plugin-react-hooks": "^7.1.1",
|
| 72 |
+
"eslint-plugin-react-refresh": "^0.5.2",
|
| 73 |
+
"fake-indexeddb": "^6.2.5",
|
| 74 |
+
"jsdom": "^29.0.1",
|
| 75 |
+
"msw": "^2.13.0",
|
| 76 |
+
"postcss": "^8.4.35",
|
| 77 |
+
"prettier": "^3.8.3",
|
| 78 |
+
"prettier-plugin-organize-imports": "^4.3.0",
|
| 79 |
+
"prettier-plugin-tailwindcss": "^0.8.0",
|
| 80 |
+
"sharp": "^0.33.0",
|
| 81 |
+
"tailwindcss": "^3.4.1",
|
| 82 |
+
"typescript": "^6.0.2",
|
| 83 |
+
"typescript-eslint": "^8.58.2",
|
| 84 |
+
"vite": "^8.0.16",
|
| 85 |
+
"vite-plugin-pwa": "^1.3.0",
|
| 86 |
+
"vitest": "^4.1.9"
|
| 87 |
+
}
|
| 88 |
+
}
|