summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
26 hourschore: add systemd user service unit for wikiapiserverwikiapiserver1-0/+14
Starts the binary from the project directory with automatic restart on failure. Install with: cp wikiapiserver.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user start wikiapiserver systemctl --user enable wikiapiserver
29 hoursfix: filter to English Wikipedia via POST with filter bodywikiapiserver1-2/+14
The structured contents API requires a POST request with the filter in the JSON body to narrow results: {"filters": [{"field": "in_language.identifier", "value": "en"}]} Replaces the non-functional query-string filter parameter.
29 hoursfix: remove invalid project filter from article API callwikiapiserver1-1/+1
The filters[project]=en.wikipedia.org parameter caused timeouts and empty responses. The filter value was incorrect for the Wikimedia Enterprise API. Articles from 404-list.test that genuinely don't exist on Wikipedia (e.g. TV episodes without standalone articles) still return 404 — this is expected behavior from the upstream API.
32 hoursfix: pass through upstream HTTP status codes from /articlewikiapiserver2-2/+10
- Non-2xx responses (404, 429, 5xx) are now forwarded to the client with their original status code and response body - Increased WriteTimeout to 45s to accommodate slow upstream API - Added explicit resp.Body.Close() and response flush before return
33 hourschore: add SQL migration files for production schemawikiapiserver2-0/+24
- sql/000_widen_tokens.sql: widen token columns to TEXT, add refresh_token_created and access_token_created timestamps - sql/001_add_api_logs.sql: create api_logs table for request logging
33 hoursfeat: log article API failures to databasewikiapiserver2-2/+50
- Created api_logs table (username, article_name, status_code, response_time_ms, error, request_url) - GetArticle logs failures (network errors and non-2xx responses) with timing, status code, and response body - Successful requests are not logged
33 hourschore: add wikiapiserver binary to .gitignore and remove from historywikiapiserver1-1/+1
Binary was tracked for several commits, bloating the repo. Removed all references via git filter-repo.
38 hoursfix: limit article search to English Wikipediawikiapiserver1-2/+2
Add limit=1&filters[project]=en.wikipedia.org to structured contents API call.
38 hoursfeat: GET /article endpoint proxies Wikimedia structured contentswikiapiserver2-0/+50
GET /article?username=alice&name=en.wikipedia/Sun → proxies to api.enterprise.wikimedia.com/v2/structured-contents/{name} with Authorization: Bearer <access_token> Returns 401 for unknown users, 400 if params missing, and passes through the upstream HTTP status on errors.
39 hoursfeat: add GET /token endpointwikiapiserver1-1/+1
Returns access_token and valid_until for a given username. GET /token?username=foo → {"access_token": "...", "valid_until": "2026-06-26T15:00:51Z"}
39 hoursfeat: GET /token?username=... returns access_token and valid_untilwikiapiserver3-1/+41
Returns the stored access_token and the timestamp when it was created (access_token_created). Returns 401 for unknown users.
39 hoursfeat: token refresh with age-based logicwikiapiserver3-72/+141
- RefreshTokens checks token age and chooses the right path: - refresh_token > 90 days: re-auth via WikimediaLogin (full login) - access_token > 24 hours: refresh via WikimediaTokenRefresh - otherwise: return current tokens - WikimediaTokenRefresh posts to /v1/token-refresh endpoint - Login also uses WikimediaLogin instead of local RotateTokens - Removed dead RotateTokens, RefreshByToken, and randomHex - DSN includes parseTime=true for timestamp columns
39 hoursrefactor: extract Wikimedia auth into reusable functionwikiapiserver2-11/+18
- WikimediaLogin is a standalone function: POSTs to auth.enterprise.wikimedia.com and returns the tokens. Can be called from any flow. - Register composes WikimediaLogin + CreateAccount - CreateAccount now takes tokens as arguments (pure DB insert)
41 hoursfix: update queries for new refresh_token_created column and add error loggingwikiapiserver2-3/+5
- INSERT and UPDATE now set both refresh_token_created and access_token_created timestamps - Register handler logs the actual error on failure
41 hoursrefactor: store tokens in plaintextwikiapiserver1-10/+4
Remove SHA-256 hashing of refresh_token and access_token. Tokens are now stored and looked up as-is, matching the Wikimedia API format.
41 hoursfeat: integrate Wikimedia Enterprise auth API on registerwikiapiserver1-6/+58
Register now calls POST /v1/login on the Wikimedia auth endpoint to obtain refresh_token and access_token. Tokens are hashed (SHA-256) before storage. If the API call fails, registration fails.
42 hoursrefactor: remove token generation from registerwikiapiserver1-15/+7
Register only saves username and plaintext password. Token fields are left empty until set by the Wikimedia API.
42 hoursrefactor: store password in plaintextwikiapiserver1-6/+6
Remove SHA-256 hashing for the password column. Tokens still hashed with SHA-256 in the database.
42 hoursfeat: initial wiki API server with account managementwikiapiserver6-0/+528
- HTTP API with JSON over configurable port (default 8080) - Endpoints: POST /register, POST /login, POST /refresh, GET /health - MariaDB storage with SHA-256 hashed credentials and tokens - Token rotation on login and refresh - Config loaded from config.json (not tracked in git) - Graceful shutdown on SIGINT/SIGTERM - Connection pool (25 max open, 10 idle, 5min max lifetime)