| @@ -95,10 +95,10 @@ SRHT_TOKEN=replace-me |
| 95 | TODO_SRHT_ENDPOINT=https://todo.sr.ht/query |
95 | TODO_SRHT_ENDPOINT=https://todo.sr.ht/query |
| 96 | GIT_SRHT_ENDPOINT=https://git.sr.ht/query |
96 | GIT_SRHT_ENDPOINT=https://git.sr.ht/query |
| 97 | DATABASE_URL=sqlite:///./srht_contrib.db |
97 | DATABASE_URL=sqlite:///./srht_contrib.db |
| 98 | DEFAULT_ACTOR=~ccleberg |
98 | DEFAULT_ACTOR=~your-user |
| 99 | POLL_INTERVAL_SECONDS=900 |
99 | POLL_INTERVAL_SECONDS=900 |
| 100 | ACTOR_ALIASES_JSON={"~ccleberg":["cmc@example.com","Chris Cleberg"]} |
100 | ACTOR_ALIASES_JSON={"~your-user":["you@example.com","Your Name"]} |
| 101 | GIT_TRACKED_REPOSITORIES=["Hutch","~ccleberg/cleberg.net"] |
101 | GIT_TRACKED_REPOSITORIES=["your-repo","~your-user/your-site"] |
| 102 | ``` |
102 | ``` |
| 103 | |
103 | |
| 104 | ## Local Run Instructions |
104 | ## Local Run Instructions |
| @@ -151,7 +151,7 @@ uvicorn srht_contrib.main:app --reload |
| 151 | Manual polling is exposed as an API endpoint: |
151 | Manual polling is exposed as an API endpoint: |
| 152 | |
152 | |
| 153 | ```bash |
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 | -H "X-API-Key: replace-me" |
155 | -H "X-API-Key: replace-me" |
| 156 | ``` |
156 | ``` |
| 157 | |
157 | |
| @@ -159,7 +159,7 @@ Example response: |
| 159 | |
159 | |
| 160 | ```json |
160 | ```json |
| 161 | { |
161 | { |
| 162 | "actor": "~ccleberg", |
162 | "actor": "~your-user", |
| 163 | "inserted_events": 3, |
163 | "inserted_events": 3, |
| 164 | "services": ["todo", "git"] |
164 | "services": ["todo", "git"] |
| 165 | } |
165 | } |
| @@ -170,7 +170,7 @@ Scheduled polling only runs when `ENABLE_SCHEDULER=true` and uses `DEFAULT_ACTOR |
| 170 | For `git.sr.ht`, tracked repositories are configured via `GIT_TRACKED_REPOSITORIES`. Entries may be either: |
170 | For `git.sr.ht`, tracked repositories are configured via `GIT_TRACKED_REPOSITORIES`. Entries may be either: |
| 171 | |
171 | |
| 172 | - `"Hutch"` for a repository owned by `DEFAULT_ACTOR` |
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 | ## API Endpoints |
175 | ## API Endpoints |
| 176 | |
176 | |
| @@ -189,20 +189,20 @@ Response: |
| 189 | ### Contribution Calendar by Year |
189 | ### Contribution Calendar by Year |
| 190 | |
190 | |
| 191 | ```bash |
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 | ### Contribution Calendar by Date Range |
195 | ### Contribution Calendar by Date Range |
| 196 | |
196 | |
| 197 | ```bash |
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 | Example response: |
201 | Example response: |
| 202 | |
202 | |
| 203 | ```json |
203 | ```json |
| 204 | { |
204 | { |
| 205 | "actor": "~ccleberg", |
205 | "actor": "~your-user", |
| 206 | "from": "2026-01-01", |
206 | "from": "2026-01-01", |
| 207 | "to": "2026-03-30", |
207 | "to": "2026-03-30", |
| 208 | "days": [ |
208 | "days": [ |
| @@ -216,14 +216,14 @@ Example response: |
| 216 | ### Contribution Stats |
216 | ### Contribution Stats |
| 217 | |
217 | |
| 218 | ```bash |
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 | Example response: |
222 | Example response: |
| 223 | |
223 | |
| 224 | ```json |
224 | ```json |
| 225 | { |
225 | { |
| 226 | "actor": "~ccleberg", |
226 | "actor": "~your-user", |
| 227 | "from": "2026-01-01", |
227 | "from": "2026-01-01", |
| 228 | "to": "2026-12-31", |
228 | "to": "2026-12-31", |
| 229 | "total_events": 42, |
229 | "total_events": 42, |
| @@ -239,7 +239,7 @@ Example response: |
| 239 | List tracked repositories: |
239 | List tracked repositories: |
| 240 | |
240 | |
| 241 | ```bash |
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 | -H "X-API-Key: replace-me" |
243 | -H "X-API-Key: replace-me" |
| 244 | ``` |
244 | ``` |
| 245 | |
245 | |
| @@ -249,7 +249,7 @@ Create a tracked repository: |
| 249 | curl -X POST "http://127.0.0.1:8000/api/repositories" \ |
249 | curl -X POST "http://127.0.0.1:8000/api/repositories" \ |
| 250 | -H "X-API-Key: replace-me" \ |
250 | -H "X-API-Key: replace-me" \ |
| 251 | -H "Content-Type: application/json" \ |
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 | Get, update, and delete a tracked repository: |
255 | Get, update, and delete a tracked repository: |
| @@ -261,7 +261,7 @@ curl "http://127.0.0.1:8000/api/repositories/1" \ |
| 261 | curl -X PATCH "http://127.0.0.1:8000/api/repositories/1" \ |
261 | curl -X PATCH "http://127.0.0.1:8000/api/repositories/1" \ |
| 262 | -H "X-API-Key: replace-me" \ |
262 | -H "X-API-Key: replace-me" \ |
| 263 | -H "Content-Type: application/json" \ |
263 | -H "Content-Type: application/json" \ |
| 264 | -d '{"repo_name":"~ccleberg/cleberg.net"}' |
264 | -d '{"repo_name":"~your-user/your-site"}' |
| 265 | |
265 | |
| 266 | curl -X DELETE "http://127.0.0.1:8000/api/repositories/1" \ |
266 | curl -X DELETE "http://127.0.0.1:8000/api/repositories/1" \ |
| 267 | -H "X-API-Key: replace-me" |
267 | -H "X-API-Key: replace-me" |
| @@ -316,6 +316,12 @@ The SourceHut-specific assumptions are isolated to the service modules: |
| 316 | - alias management is config-driven; there is no alias CRUD API yet |
316 | - alias management is config-driven; there is no alias CRUD API yet |
| 317 | - current deployment model is trusted-operator V1, not a public multi-tenant service |
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 | ## Recommended Next Steps |
325 | ## Recommended Next Steps |
| 320 | |
326 | |
| 321 | 1. Add alias-management APIs or seed files for stronger actor identity mapping. |
327 | 1. Add alias-management APIs or seed files for stronger actor identity mapping. |