| @@ -95,10 +95,10 @@ SRHT_TOKEN=replace-me |
| 95 | 95 | TODO_SRHT_ENDPOINT=https://todo.sr.ht/query |
| 96 | 96 | GIT_SRHT_ENDPOINT=https://git.sr.ht/query |
| 97 | 97 | DATABASE_URL=sqlite:///./srht_contrib.db |
| 98 | | DEFAULT_ACTOR=~ccleberg |
| 98 | DEFAULT_ACTOR=~your-user |
| 99 | 99 | POLL_INTERVAL_SECONDS=900 |
| 100 | | ACTOR_ALIASES_JSON={"~ccleberg":["cmc@example.com","Chris Cleberg"]} |
| 101 | | GIT_TRACKED_REPOSITORIES=["Hutch","~ccleberg/cleberg.net"] |
| 100 | ACTOR_ALIASES_JSON={"~your-user":["you@example.com","Your Name"]} |
| 101 | GIT_TRACKED_REPOSITORIES=["your-repo","~your-user/your-site"] |
| 102 | 102 | ``` |
| 103 | 103 | |
| 104 | 104 | ## Local Run Instructions |
| @@ -151,7 +151,7 @@ uvicorn srht_contrib.main:app --reload |
| 151 | 151 | Manual polling is exposed as an API endpoint: |
| 152 | 152 | |
| 153 | 153 | ```bash |
| 154 | | curl -X POST "http://127.0.0.1:8000/api/contributions/poll?actor=~ccleberg" \ |
| 154 | curl -X POST "http://127.0.0.1:8000/api/contributions/poll?actor=~your-user" \ |
| 155 | 155 | -H "X-API-Key: replace-me" |
| 156 | 156 | ``` |
| 157 | 157 | |
| @@ -159,7 +159,7 @@ Example response: |
| 159 | 159 | |
| 160 | 160 | ```json |
| 161 | 161 | { |
| 162 | | "actor": "~ccleberg", |
| 162 | "actor": "~your-user", |
| 163 | 163 | "inserted_events": 3, |
| 164 | 164 | "services": ["todo", "git"] |
| 165 | 165 | } |
| @@ -170,7 +170,7 @@ Scheduled polling only runs when `ENABLE_SCHEDULER=true` and uses `DEFAULT_ACTOR |
| 170 | 170 | For `git.sr.ht`, tracked repositories are configured via `GIT_TRACKED_REPOSITORIES`. Entries may be either: |
| 171 | 171 | |
| 172 | 172 | - `"Hutch"` for a repository owned by `DEFAULT_ACTOR` |
| 173 | | - `"~ccleberg/cleberg.net"` for an explicit owner/repository pair |
| 173 | - `"~your-user/your-site"` for an explicit owner/repository pair |
| 174 | 174 | |
| 175 | 175 | ## API Endpoints |
| 176 | 176 | |
| @@ -189,20 +189,20 @@ Response: |
| 189 | 189 | ### Contribution Calendar by Year |
| 190 | 190 | |
| 191 | 191 | ```bash |
| 192 | | curl "http://127.0.0.1:8000/api/contributions/~ccleberg?year=2026" |
| 192 | curl "http://127.0.0.1:8000/api/contributions/~your-user?year=2026" |
| 193 | 193 | ``` |
| 194 | 194 | |
| 195 | 195 | ### Contribution Calendar by Date Range |
| 196 | 196 | |
| 197 | 197 | ```bash |
| 198 | | curl "http://127.0.0.1:8000/api/contributions/~ccleberg?from=2026-01-01&to=2026-03-30" |
| 198 | curl "http://127.0.0.1:8000/api/contributions/~your-user?from=2026-01-01&to=2026-03-30" |
| 199 | 199 | ``` |
| 200 | 200 | |
| 201 | 201 | Example response: |
| 202 | 202 | |
| 203 | 203 | ```json |
| 204 | 204 | { |
| 205 | | "actor": "~ccleberg", |
| 205 | "actor": "~your-user", |
| 206 | 206 | "from": "2026-01-01", |
| 207 | 207 | "to": "2026-03-30", |
| 208 | 208 | "days": [ |
| @@ -216,14 +216,14 @@ Example response: |
| 216 | 216 | ### Contribution Stats |
| 217 | 217 | |
| 218 | 218 | ```bash |
| 219 | | curl "http://127.0.0.1:8000/api/contributions/~ccleberg/stats?year=2026" |
| 219 | curl "http://127.0.0.1:8000/api/contributions/~your-user/stats?year=2026" |
| 220 | 220 | ``` |
| 221 | 221 | |
| 222 | 222 | Example response: |
| 223 | 223 | |
| 224 | 224 | ```json |
| 225 | 225 | { |
| 226 | | "actor": "~ccleberg", |
| 226 | "actor": "~your-user", |
| 227 | 227 | "from": "2026-01-01", |
| 228 | 228 | "to": "2026-12-31", |
| 229 | 229 | "total_events": 42, |
| @@ -239,7 +239,7 @@ Example response: |
| 239 | 239 | List tracked repositories: |
| 240 | 240 | |
| 241 | 241 | ```bash |
| 242 | | curl "http://127.0.0.1:8000/api/repositories?actor=~ccleberg" \ |
| 242 | curl "http://127.0.0.1:8000/api/repositories?actor=~your-user" \ |
| 243 | 243 | -H "X-API-Key: replace-me" |
| 244 | 244 | ``` |
| 245 | 245 | |
| @@ -249,7 +249,7 @@ Create a tracked repository: |
| 249 | 249 | curl -X POST "http://127.0.0.1:8000/api/repositories" \ |
| 250 | 250 | -H "X-API-Key: replace-me" \ |
| 251 | 251 | -H "Content-Type: application/json" \ |
| 252 | | -d '{"actor":"~ccleberg","repo_name":"Hutch"}' |
| 252 | -d '{"actor":"~your-user","repo_name":"your-repo"}' |
| 253 | 253 | ``` |
| 254 | 254 | |
| 255 | 255 | Get, update, and delete a tracked repository: |
| @@ -261,7 +261,7 @@ curl "http://127.0.0.1:8000/api/repositories/1" \ |
| 261 | 261 | curl -X PATCH "http://127.0.0.1:8000/api/repositories/1" \ |
| 262 | 262 | -H "X-API-Key: replace-me" \ |
| 263 | 263 | -H "Content-Type: application/json" \ |
| 264 | | -d '{"repo_name":"~ccleberg/cleberg.net"}' |
| 264 | -d '{"repo_name":"~your-user/your-site"}' |
| 265 | 265 | |
| 266 | 266 | curl -X DELETE "http://127.0.0.1:8000/api/repositories/1" \ |
| 267 | 267 | -H "X-API-Key: replace-me" |
| @@ -316,6 +316,12 @@ The SourceHut-specific assumptions are isolated to the service modules: |
| 316 | 316 | - alias management is config-driven; there is no alias CRUD API yet |
| 317 | 317 | - current deployment model is trusted-operator V1, not a public multi-tenant service |
| 318 | 318 | |
| 319 | ## Deployment Notes |
| 320 | |
| 321 | - Add a `.dockerignore` when building container images so local secrets and SQLite files are never sent to the build context. |
| 322 | - For production, prefer exposing the service behind a reverse proxy instead of publishing the application port directly to the internet. |
| 323 | - Set `ENABLE_SCHEDULER=true` only for single-instance deployments where this service should own polling. |
| 324 | |
| 319 | 325 | ## Recommended Next Steps |
| 320 | 326 | |
| 321 | 327 | 1. Add alias-management APIs or seed files for stronger actor identity mapping. |