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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//! `tools.cairn.public.*` handlers (#54).
//!
//! User-facing read endpoints. Authentication is the same ATProto
//! service-auth flow used for admin endpoints, but authorization is
//! "you can only ask about yourself" — the verified JWT `iss` IS
//! the subject. There is no `subject` parameter on these endpoints
//! by design; if you want to query someone else's state, that's
//! `tools.cairn.admin.*` and requires Mod or Admin role.
//!
//! CORS posture differs from admin: public endpoints are intended
//! for browser-side AppView callers and similar, so allow any
//! origin (mirrors `com.atproto.label.queryLabels` from §F3).
//! Admin endpoints reject any `Origin` header outright.
//!
//! Initial endpoint:
//! - `tools.cairn.public.getMyStrikeState` — returns the calling
//! DID's strike state, same wire shape as
//! `tools.cairn.admin.getSubjectStrikes` via the shared
//! `crate::server::strike_state` projection.
//!
//! Future user-facing endpoints (e.g., `getMyActionHistory` in
//! v1.5+) follow the same pattern.
use Arc;
use Extension;
use Router;
use Method;
use get;
use ;
use ;
use crateAuthContext;
use PublicState;
/// Build a Router exposing the `tools.cairn.public.*` endpoints.
/// Compose alongside `admin_router` and the public-label routers in
/// `serve::run`.
///
/// `strike_policy` is the resolved v1.4 `[strike_policy]` (#48);
/// the public strikes endpoint consults the threshold + decay
/// window when projecting the wire envelope. Pass the same instance
/// the writer task and admin router hold — `serve::run` resolves
/// once at startup and clones to each router.
///
/// `service_did` is cairn-mod's labeler DID. The strikes endpoint
/// (#65) uses it to scope `labels.src` when computing
/// `activeLabels`. Mirrors `AdminConfig::service_did`.