chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
0
0
Themes: HUD's own, and anyone's, on the web and iOS
.knotless/issue.md+1−1
| @@ -23,5 +23,5 @@ | ||
## Where | ||
| ||
<!-- The MCP view in a host (Claude, ChatGPT), the workspace, or the | ||
iOS app; which server (its address, or `just serve`); the | ||
iOS app; which server (its address, `just serve` or `just local`); the | ||
commit you built from, if not what is deployed. --> | ||
.knotless/pull.md+2−2
| @@ -36,8 +36,8 @@ | ||
| ||
<!-- `just check`, and what else was run: `just look` pictures of | ||
every state touched (desktop light and phone dark, critiqued by an | ||
agent that did not draw them), `just e2e`, `just ios-test`, | ||
`just serve` by hand. What is left to CI. --> | ||
agent that did not draw them), `just e2e` or `just e2e-spaces`, | ||
`just ios-test`, `just local` by hand. What is left to CI. --> | ||
| ||
## Shortcomings | ||
| ||
crates/hud/src/main.rs+21−5
| @@ -78,6 +78,9 @@ Configuration, from the environment: | ||
their fallback; never a space's or a private answer's, | ||
nor a GIF; empty serves every image through the blob | ||
proxy (https://cdn.bsky.app/img) | ||
HUD_RELAY the relay asked which repositories hold people's | ||
workspace themes, to browse everyone's; empty lists | ||
only an account's (https://bsky.network) | ||
RUST_LOG log filter (info) | ||
"; | ||
| ||
| @@ -108,10 +111,9 @@ fn origin(name: &str, value: &str) -> Result<String, String> { | ||
} | ||
| ||
/// An `http` or `https` URL with a host, no query or fragment: the base | ||
/// image URLs are made under, without a trailing `/`. | ||
fn cdn(name: &str, value: &str) -> Result<String, String> { | ||
let bad = | ||
|| format!("{name}: {value:?} is not an http or https URL, as https://cdn.bsky.app/img"); | ||
/// URLs are made under (the image CDN's, the relay's), without a trailing `/`. | ||
fn url_base(name: &str, value: &str, example: &str) -> Result<String, String> { | ||
let bad = || format!("{name}: {value:?} is not an http or https URL, as {example}"); | ||
let url = Url::parse(value).map_err(|_| bad())?; | ||
let plain = url.query().is_none() | ||
&& url.fragment().is_none() | ||
| @@ -240,12 +242,25 @@ fn config() -> Result<Config, String> { | ||
// Set but empty is the blob proxy alone, as with HUD_FAVICONS. | ||
let image_cdn = match std::env::var("HUD_IMAGE_CDN") { | ||
Ok(v) if v.trim().is_empty() => None, | ||
Ok(v) => Some(cdn("HUD_IMAGE_CDN", v.trim())?), | ||
Ok(v) => Some(url_base( | ||
"HUD_IMAGE_CDN", | ||
v.trim(), | ||
hud_core::blobs::IMAGE_CDN, | ||
)?), | ||
Err(std::env::VarError::NotPresent) => Some(hud_core::blobs::IMAGE_CDN.to_string()), | ||
Err(std::env::VarError::NotUnicode(_)) => { | ||
return Err("HUD_IMAGE_CDN is not valid text".into()); | ||
} | ||
}; | ||
// Set but empty lists only an account's themes. | ||
let relay = match std::env::var("HUD_RELAY") { | ||
Ok(v) if v.trim().is_empty() => None, | ||
Ok(v) => Some(url_base("HUD_RELAY", v.trim(), hud_core::theme::RELAY)?), | ||
Err(std::env::VarError::NotPresent) => Some(hud_core::theme::RELAY.to_string()), | ||
Err(std::env::VarError::NotUnicode(_)) => { | ||
return Err("HUD_RELAY is not valid text".into()); | ||
} | ||
}; | ||
Ok(Config { | ||
port, | ||
bind, | ||
| @@ -263,6 +278,7 @@ fn config() -> Result<Config, String> { | ||
backlinks, | ||
favicons, | ||
image_cdn, | ||
relay, | ||
}) | ||
} | ||
| ||
crates/hud-core/src/canvas/engine.rs+3−2
| @@ -381,8 +381,9 @@ impl Canvases { | ||
); | ||
} | ||
| ||
/// Where a person's canvases are kept changed: their streams are told. | ||
pub(crate) fn storage_changed(&self, did: &str) { | ||
/// A person's workspace changed apart from a canvas (where their | ||
/// canvases are kept, their theme): their streams are told. | ||
pub fn workspace_changed(&self, did: &str) { | ||
self.nudge(did, None, None); | ||
} | ||
| ||
crates/hud-core/src/canvas/mod.rs+1−1
| @@ -900,7 +900,7 @@ fn new_id() -> String { | ||
} | ||
| ||
/// Now, ISO 8601 in UTC, to the millisecond. | ||
fn iso_now() -> String { | ||
pub(crate) fn iso_now() -> String { | ||
let ms = SystemTime::now() | ||
.duration_since(UNIX_EPOCH) | ||
.map_or(0, |d| d.as_millis() as i64); | ||
crates/hud-core/src/canvas/space.rs+1−1
| @@ -480,7 +480,7 @@ impl Inner { | ||
} | ||
tracing::warn!(did, "canvases back in files"); | ||
if let Some(hud) = self.hud.upgrade() { | ||
hud.canvases.storage_changed(did); | ||
hud.canvases.workspace_changed(did); | ||
} | ||
line | ||
} | ||
crates/hud-core/src/canvas/tools.rs+1−0
| @@ -502,6 +502,7 @@ mod tests { | ||
backlinks: crate::backlinks::Backlinks::None, | ||
favicons: None, | ||
image_cdn: None, | ||
relay: None, | ||
}) | ||
.unwrap() | ||
} | ||
crates/hud-core/src/oauth/tests.rs+1−0
| @@ -60,6 +60,7 @@ fn config(plc: &str) -> crate::Config { | ||
backlinks: Backlinks::None, | ||
favicons: None, | ||
image_cdn: None, | ||
relay: None, | ||
} | ||
} | ||
| ||
crates/hud-core/src/config.rs+5−0
| @@ -93,6 +93,11 @@ pub struct Config { | ||
/// (`HUD_IMAGE_CDN`, by default `blobs::IMAGE_CDN`); none for the blob | ||
/// proxy alone. | ||
pub image_cdn: Option<String>, | ||
/// The relay asked which repositories hold people's themes | ||
/// (`com.atproto.sync.listReposByCollection`), no trailing `/` | ||
/// (`HUD_RELAY`, by default `theme::RELAY`); none to list only an | ||
/// account's. | ||
pub relay: Option<String>, | ||
} | ||
| ||
impl Config { | ||
crates/hud-core/src/identity.rs+1−0
| @@ -441,6 +441,7 @@ mod tests { | ||
backlinks: crate::backlinks::Backlinks::None, | ||
favicons: None, | ||
image_cdn: None, | ||
relay: None, | ||
}) | ||
.unwrap(); | ||
(hud, move || asked.load(SeqCst)) | ||
crates/hud-core/src/lib.rs+8−3
crates/hud-core/src/theme.rsnew+610−0
610 lines changed: not loaded until asked for.
crates/hud-core/src/tools.rs+1−0
crates/hud-core/build.rs+16−6
crates/hud-server/src/xrpc/tests.rs+255−2
crates/hud-server/src/mcp.rs+1−0
crates/hud-server/src/workspace.rs+1−0
crates/hud-server/src/xrpc.rs+78−0
harness/e2e/setup.mjs+1−0
harness/e2e/themes.spec.mjsnew+88−0
harness/e2e/world.mjs+11−3
harness/spaces/package-lock.jsonnew+8267−0
A large diff, not shown.
harness/spaces/package.jsonnew+58−0
harness/contrast.json+1−1
harness/contrast.mjs+36−11
harness/local.mjsnew+117−0
harness/look.mjs+29−1
harness/pds.mjs+109−42
harness/tls.mjsnew+84−0
ios/App/GalleryScreen.swift+3−2
ios/App/Home.swift+20−2
ios/App/HUDApp.swift+27−1
ios/App/StepScreen.swift+2−1
ios/App/StripView.swift+3−3
ios/App/Themes.swiftnew+263−0
ios/App/TileView.swift+6−6
ios/App/WorkspaceScreen.swift+6−4
ios/HUDKit/Sources/HUDKit/Embed/EmbedExternal.swift+1−1
ios/HUDKit/Sources/HUDKit/Embed/EmbedRules.swift+1−1
ios/HUDKit/Sources/HUDKit/Embed/QuoteCard.swift+1−1
ios/HUDKit/Sources/HUDKit/Parts/ActionButton.swift+7−6
ios/HUDKit/Sources/HUDKit/Parts/ChainLayout.swift+1−1
ios/HUDKit/Sources/HUDKit/Parts/ImageBox.swift+1−1
ios/HUDKit/Sources/HUDKit/Parts/Lightbox.swift+2−2
ios/HUDKit/Sources/HUDKit/Parts/LinkLabel.swift+1−1
ios/HUDKit/Sources/HUDKit/Parts/ProfileCard.swift+2−4
ios/HUDKit/Sources/HUDKit/Parts/TextBody.swift+1−1
ios/HUDKit/Sources/HUDKit/Parts/ThreadItem.swift+2−2
ios/HUDKit/Sources/HUDKit/Parts/TreeLevel.swift+1−1
ios/HUDKit/Sources/HUDKit/Support/Controls.swift+2−2
ios/HUDKit/Sources/HUDKit/Support/Glass.swift+4−4
ios/HUDKit/Sources/HUDKit/Support/Picture.swift+2−2
ios/HUDKit/Sources/HUDKit/Support/Surface.swift+96−4
ios/HUDKit/Sources/HUDKit/Tree/ResolvedBlocks.swift+8−7
ios/HUDKit/Sources/HUDKit/Tree/ResolvedDiff.swift+16−21
ios/HUDKit/Sources/HUDKit/Tree/ResolvedFields.swift+2−2
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMarks.swift+19−23
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMedia.swift+17−14
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMessages.swift+7−6
ios/HUDKit/Sources/HUDKit/Tree/TreeView.swift+2−2
ios/HUDKit/Sources/HUDKit/Workspace/Theme.swiftnew+102−0
ios/HUDKit/Sources/HUDKit/Workspace/Workspace.swift+31−0
ios/HUDKit/Sources/HUDKit/Workspace/WorkspaceClient.swift+11−0
ios/HUDKit/Tests/HUDKitTests/WorkspaceTests.swift+103−0
schemas/place.hud.checkTheme.jsonnew+55−0
schemas/place.hud.createTheme.jsonnew+68−0
schemas/place.hud.defs.json+215−0
schemas/place.hud.deleteTheme.jsonnew+44−0
schemas/place.hud.getWorkspace.json+14−1
schemas/place.hud.listThemes.jsonnew+64−0
schemas/place.hud.setTheme.jsonnew+56−0
schemas/place.hud.theme.jsonnew+47−0
themes/amber.jsonnew+28−0
themes/blueprint.jsonnew+28−0
themes/dark.jsonnew+5−0
themes/dusk.jsonnew+28−0
themes/frost.jsonnew+28−0
themes/light.jsonnew+5−0
themes/paper.jsonnew+28−0
themes/phosphor.jsonnew+28−0
web/workspace/lib/atoms/ThemeSwatch.sveltenew+51−0
web/workspace/lib/organisms/TabBar.svelte+24−2
web/workspace/lib/organisms/ThemeBrowser.sveltenew+233−0
web/workspace/lib/organisms/ThemeEditor.sveltenew+424−0
424 lines changed: not loaded until asked for.