merge: update adsb degraded branch
This commit is contained in:
@@ -17,3 +17,4 @@ Source docs:
|
||||
- [FIRMS](firms.md)
|
||||
- [Maritime](maritime.md)
|
||||
- [ADS-B](adsb.md)
|
||||
- [Reddit](reddit.md)
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
Provides conflict events, fatalities, event types, and locations.
|
||||
|
||||
- Auth: `ACLED_EMAIL` and `ACLED_PASSWORD`.
|
||||
- Auth: `ACLED_EMAIL` and `ACLED_PASSWORD`. `ACLED_USER` or `ACLED_USERNAME` may be used as aliases for `ACLED_EMAIL`.
|
||||
- Flow: OAuth password grant is tried first, then cookie session fallback.
|
||||
- Failure modes: missing credentials, terms/profile not completed, expired token, account missing API access.
|
||||
- Behavior: missing or rejected credentials produce degraded source health with the ACLED error text.
|
||||
- Test: set credentials, run `node apis/sources/acled.mjs`, then check `/api/health`.
|
||||
- Failure modes are classified as `no_credentials`, `auth_failed`, `access_denied`, or `api_failed`.
|
||||
- Behavior: missing, rejected, or unauthorized credentials produce degraded source health with a concise operator message.
|
||||
- Secret handling: debug output never prints bearer tokens, cookies, or the configured password.
|
||||
- Test: run `node --test test/acled-source.test.mjs`; with real credentials, run `node apis/sources/acled.mjs`, then check `/api/health`.
|
||||
|
||||
`access_denied` normally means the login worked but the account cannot read API data. Check that ACLED terms are accepted, required profile fields are complete, and API access is enabled for the account.
|
||||
|
||||
@@ -6,4 +6,4 @@ Provides public aircraft state data for regional air-activity hotspots.
|
||||
- Failure modes: timeouts, `HTTP 429`, and empty regions.
|
||||
- Behavior: source health is marked degraded on API errors. The dashboard may use the most recent non-empty air snapshot from `runs/` and marks it in `airMeta.fallback`.
|
||||
- Test: start a sweep and inspect `/api/health` plus `airMeta` from `/api/data`.
|
||||
- Operator note: Crucix does not bypass OpenSky throttles. Increase `REFRESH_INTERVAL_MINUTES` if the source degrades repeatedly.
|
||||
- Operator note: Intelligence Terminal does not bypass OpenSky throttles. Increase `REFRESH_INTERVAL_MINUTES` if the source degrades repeatedly.
|
||||
|
||||
33
docs/sources/reddit.md
Normal file
33
docs/sources/reddit.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Reddit Source
|
||||
|
||||
Reddit is used as a social sentiment input for selected geopolitical and market subreddits.
|
||||
|
||||
## Configuration
|
||||
|
||||
Create a Reddit script app at:
|
||||
|
||||
```text
|
||||
https://www.reddit.com/prefs/apps/
|
||||
```
|
||||
|
||||
Then set:
|
||||
|
||||
```env
|
||||
REDDIT_CLIENT_ID=
|
||||
REDDIT_CLIENT_SECRET=
|
||||
```
|
||||
|
||||
## Runtime Behavior
|
||||
|
||||
- The source uses the OAuth client credentials flow and then reads `https://oauth.reddit.com`.
|
||||
- Unauthenticated `reddit.com/.../hot.json` scraping is intentionally disabled.
|
||||
- Missing credentials return `status: no_credentials` and are surfaced as source degradation.
|
||||
- OAuth failures return `status: auth_failed` without logging or returning the client secret.
|
||||
- Subreddit fetch failures return `status: degraded` with per-subreddit errors.
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
node apis/sources/reddit.mjs
|
||||
npm run test:unit
|
||||
```
|
||||
Reference in New Issue
Block a user