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
iOS: ready for TestFlight, as place.hud.app
crates/hud-core/src/oauth/mod.rs+1−1
| @@ -49,7 +49,7 @@ pub const REFRESH_LIFE: u64 = 30 * 86_400; | ||
pub const SCOPE: &str = "hud"; | ||
/// Where the iOS app is sent back to: a private-use URI of its bundle | ||
/// identifier (RFC 8252 §7.1), which only it catches. | ||
pub const APP_REDIRECT: &str = "com.chadtmiller.hud:/oauth/callback"; | ||
pub const APP_REDIRECT: &str = "place.hud.app:/oauth/callback"; | ||
/// How long a web session's cookie is good for. | ||
pub const WEB_LIFE: u64 = 30 * 86_400; | ||
/// The name of a web session's cookie. | ||
docs/running.md+8−0
| @@ -45,3 +45,11 @@ Add `http://localhost:8787/mcp` to a host that reaches it. For a public deployme | ||
## The image | ||
| ||
Build it with `just image` (`Dockerfile`). It runs `hud serve` as uid 10001 and keeps the cache on the volume `/data`, so sign-ins and canvases live there too. | ||
| ||
## The iOS app | ||
| ||
`just ios` makes the Xcode project, `ios/HUD.xcodeproj`, from `ios/project.yml`. A Debug build reaches `just serve` at http://localhost:8787 by default, and a Release build reaches https://hud.place. Either can be pointed elsewhere on Home. | ||
| ||
The app is `place.hud.app`. Its sign-in comes back to `place.hud.app:/oauth/callback`, the one redirect the server's client document for it names, so a server and the builds that sign in to it change that together. | ||
| ||
`just testflight` archives a Release build and uploads it to App Store Connect for TestFlight, as the Apple ID Xcode is signed in with. Raise `CURRENT_PROJECT_VERSION` in `ios/project.yml` before each upload, since App Store Connect takes each build number once. | ||
ios/App/Browser.swift+9−2
| @@ -17,6 +17,13 @@ final class Browser { | ||
restore() | ||
} | ||
} | ||
/// The server a new install reaches: hud.place, but in a Debug build, | ||
/// `just serve` on this Mac. | ||
#if DEBUG | ||
static let defaultServer = "http://localhost:8787" | ||
#else | ||
static let defaultServer = "https://hud.place" | ||
#endif | ||
/// What plays the screens' players' tracks: one for the app, so music | ||
/// goes on as one moves about the stack. | ||
let player = AudioPlayer() | ||
| @@ -49,7 +56,7 @@ final class Browser { | ||
// `-server <url>` at launch sets the server and keeps it, as typing it | ||
// on Home does. | ||
let defaults = UserDefaults.standard | ||
let given = defaults.string(forKey: "server") ?? "http://localhost:8787" | ||
let given = defaults.string(forKey: "server") ?? Self.defaultServer | ||
server = given | ||
if defaults.volatileDomain(forName: UserDefaults.argumentDomain)["server"] != nil, let id = Bundle.main.bundleIdentifier { | ||
defaults.setPersistentDomain((defaults.persistentDomain(forName: id) ?? [:]).merging(["server": given]) { _, new in new }, forName: id) | ||
| @@ -74,7 +81,7 @@ final class Browser { | ||
} | ||
| ||
var serverURL: URL { | ||
URL(string: server) ?? URL(string: "http://localhost:8787")! | ||
URL(string: server) ?? URL(string: Self.defaultServer)! | ||
} | ||
| ||
var client: HUDClient { | ||
ios/App/GalleryScreen.swift+1−1
| @@ -194,7 +194,7 @@ struct Gallery { | ||
let heading: [String: String] | ||
let groups: [Group] | ||
| ||
static let log = Logger(subsystem: "com.chadtmiller.hud", category: "gallery") | ||
static let log = Logger(subsystem: "place.hud.app", category: "gallery") | ||
| ||
enum Loaded { | ||
case missing | ||
ios/App/Home.swift+4−0
| @@ -340,7 +340,11 @@ struct Home: View { | ||
} header: { | ||
Text("Server") | ||
} footer: { | ||
#if DEBUG | ||
Text("HUD's address: `just serve` on this Mac is http://localhost:8787.") | ||
#else | ||
Text("HUD's address: \(Browser.defaultServer) unless you run your own.") | ||
#endif | ||
} | ||
} | ||
| ||
ios/HUDKit/Sources/HUDKit/Data/Keychain.swift+1−1
| @@ -5,7 +5,7 @@ import Security | ||
/// its origin: readable after the device's first unlock (a player plays on | ||
/// in the background), and never moving to another device. | ||
enum Keychain { | ||
static let service = "com.chadtmiller.hud.session" | ||
static let service = "place.hud.app.session" | ||
| ||
private static func query(_ account: String) -> [String: Any] { | ||
[ | ||
ios/HUDKit/Sources/HUDKit/Data/SignIn.swift+2−2
| @@ -31,9 +31,9 @@ public enum SignInError: LocalizedError, Equatable { | ||
/// metadata names them. | ||
public struct AuthServer: Codable, Sendable, Equatable { | ||
/// Where the server sends the app back to (`oauth::APP_REDIRECT`). | ||
public static let redirect = "com.chadtmiller.hud:/oauth/callback" | ||
public static let redirect = "place.hud.app:/oauth/callback" | ||
/// The redirect's scheme, which `ASWebAuthenticationSession` waits for. | ||
public static let callbackScheme = "com.chadtmiller.hud" | ||
public static let callbackScheme = "place.hud.app" | ||
/// The one scope HUD's tokens carry. | ||
public static let scope = "hud" | ||
| ||
ios/HUDKit/Tests/HUDKitTests/HUDKitTests.swift+2−2
| @@ -220,7 +220,7 @@ private func conversation() throws -> (drawn: Drawn, root: JSON) { | ||
) | ||
| ||
private func back(_ query: String) -> URL { | ||
URL(string: "com.chadtmiller.hud:/oauth/callback?\(query)")! | ||
URL(string: "place.hud.app:/oauth/callback?\(query)")! | ||
} | ||
| ||
@Test func theCodeComesBackOnlyForThisRequestFromThisServer() throws { | ||
| @@ -240,7 +240,7 @@ private func conversation() throws -> (drawn: Drawn, root: JSON) { | ||
let request = SignInRequest(server: server) | ||
let asked = Form.decode(try #require(URLComponents(url: request.url, resolvingAgainstBaseURL: false)?.percentEncodedQuery)) | ||
#expect(asked["client_id"] == "https://hud.example/oauth/app-client.json") | ||
#expect(asked["redirect_uri"] == "com.chadtmiller.hud:/oauth/callback") | ||
#expect(asked["redirect_uri"] == "place.hud.app:/oauth/callback") | ||
#expect(asked["resource"] == "https://hud.example/mcp") | ||
#expect(asked["code_challenge_method"] == "S256") | ||
#expect(asked["code_challenge"] == request.challenge) | ||
ios/ExportOptions.plistnew+16−0
| @@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>method</key> | ||
<string>app-store-connect</string> | ||
<key>teamID</key> | ||
<string>YN68LN9T7Z</string> | ||
<key>destination</key> | ||
<string>upload</string> | ||
<key>signingStyle</key> | ||
<string>automatic</string> | ||
<key>manageAppVersionAndBuildNumber</key> | ||
<false/> | ||
</dict> | ||
</plist> | ||
ios/project.yml+6−2
| @@ -2,7 +2,7 @@ | ||
# ios/HUD.xcodeproj (and App/Info.plist) from this, both gitignored. | ||
name: HUD | ||
options: | ||
bundleIdPrefix: com.chadtmiller | ||
bundleIdPrefix: place.hud | ||
deploymentTarget: | ||
iOS: "17.0" | ||
createIntermediateGroups: true | ||
| @@ -40,9 +40,13 @@ targets: | ||
NSLocalNetworkUsageDescription: HUD reaches a HUD server on your local network, as one you run on your Mac. | ||
# A view's player plays on with the app in the background, as a web page's does. | ||
UIBackgroundModes: [audio] | ||
# An iPad app shares the screen, so it takes every orientation. | ||
UISupportedInterfaceOrientations~ipad: [UIInterfaceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight] | ||
# No encryption but the system's HTTPS: App Store Connect asks nothing of a build. | ||
ITSAppUsesNonExemptEncryption: false | ||
settings: | ||
base: | ||
PRODUCT_BUNDLE_IDENTIFIER: com.chadtmiller.hud | ||
PRODUCT_BUNDLE_IDENTIFIER: place.hud.app | ||
MARKETING_VERSION: "0.1" | ||
CURRENT_PROJECT_VERSION: "1" | ||
SWIFT_VERSION: "6.0" | ||