Add Tailscale Serve pairing support

- add desktop and server settings for hosted HTTPS pairing
- resolve and probe MagicDNS endpoints via shared Tailscale helpers
- update remote pairing docs and UI to surface the new setup flow
This commit is contained in:
Julius Marminge committed 2026-04-27 22:24:40 -07:00
1 parent db6a2a6dc1
commit fc49669529
34 files changed
+2110 -446

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env node
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { Effect, FileSystem, Option, Path } from "effect";
import { Argument, Command } from "effect/unstable/cli";
import { resolveWebIconOverrides, type WebAssetBrand } from "./lib/brand-assets.ts";
const WEB_ASSET_BRANDS = [
"development",
"production",
] as const satisfies ReadonlyArray<WebAssetBrand>;
export const applyWebBrandAssets = Effect.fn("applyWebBrandAssets")(function* (
brand: WebAssetBrand,
targetDirectory: string,
) {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const repoRoot = yield* path.fromFileUrl(new URL("..", import.meta.url));
yield* Effect.forEach(
resolveWebIconOverrides(brand, targetDirectory),
(override) =>
fs.copyFile(
path.join(repoRoot, override.sourceRelativePath),
path.join(repoRoot, override.targetRelativePath),
),
{ concurrency: "unbounded" },
);
});
export const applyWebBrandAssetsCommand = Command.make(
"apply-web-brand-assets",
{
brand: Argument.choice("brand", WEB_ASSET_BRANDS).pipe(
Argument.withDescription("Asset brand to copy into the hosted web output directory."),
),
targetDirectory: Argument.string("target-directory").pipe(
Argument.withDescription("Output directory that contains the hosted web build assets."),
Argument.optional,
),
},
({ brand, targetDirectory }) =>
applyWebBrandAssets(
brand,
Option.getOrElse(targetDirectory, () => "apps/web/dist"),
),
).pipe(Command.withDescription("Copy web brand assets into a built hosted web app."));
if (import.meta.main) {
Command.run(applyWebBrandAssetsCommand, { version: "0.0.0" }).pipe(
Effect.provide(NodeServices.layer),
NodeRuntime.runMain,
);
}
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import {
BRAND_ASSET_PATHS,
DEVELOPMENT_ICON_OVERRIDES,
PUBLISH_ICON_OVERRIDES,
resolveWebIconOverrides,
} from "./brand-assets.ts";
describe("brand-assets", () => {
it("maps server publish web assets to production icons", () => {
expect(PUBLISH_ICON_OVERRIDES).toEqual([
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
]);
});
it("maps server build web assets to development icons", () => {
expect(DEVELOPMENT_ICON_OVERRIDES[0]).toEqual({
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
});
});
it("can target hosted web dist directly", () => {
expect(resolveWebIconOverrides("production", "apps/web/dist")).toContainEqual({
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "apps/web/dist/apple-touch-icon.png",
});
});
});
+49 -34
View File
@@ -19,45 +19,60 @@ export const BRAND_ASSET_PATHS = {
developmentWebAppleTouchIconPng: "assets/dev/blueprint-web-apple-touch-180.png",
} as const;
export type WebAssetBrand = "development" | "production";
export interface IconOverride {
readonly sourceRelativePath: string;
readonly targetRelativePath: string;
}
export const DEVELOPMENT_ICON_OVERRIDES: ReadonlyArray<IconOverride> = [
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.developmentWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
];
const WEB_ICON_TARGET_FILENAMES = {
faviconIco: "favicon.ico",
favicon16Png: "favicon-16x16.png",
favicon32Png: "favicon-32x32.png",
appleTouchIconPng: "apple-touch-icon.png",
} as const;
export const PUBLISH_ICON_OVERRIDES: ReadonlyArray<IconOverride> = [
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFaviconIco,
targetRelativePath: "dist/client/favicon.ico",
const WEB_ICON_SOURCE_PATHS_BY_BRAND = {
development: {
faviconIco: BRAND_ASSET_PATHS.developmentWebFaviconIco,
favicon16Png: BRAND_ASSET_PATHS.developmentWebFavicon16Png,
favicon32Png: BRAND_ASSET_PATHS.developmentWebFavicon32Png,
appleTouchIconPng: BRAND_ASSET_PATHS.developmentWebAppleTouchIconPng,
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon16Png,
targetRelativePath: "dist/client/favicon-16x16.png",
production: {
faviconIco: BRAND_ASSET_PATHS.productionWebFaviconIco,
favicon16Png: BRAND_ASSET_PATHS.productionWebFavicon16Png,
favicon32Png: BRAND_ASSET_PATHS.productionWebFavicon32Png,
appleTouchIconPng: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebFavicon32Png,
targetRelativePath: "dist/client/favicon-32x32.png",
},
{
sourceRelativePath: BRAND_ASSET_PATHS.productionWebAppleTouchIconPng,
targetRelativePath: "dist/client/apple-touch-icon.png",
},
];
} as const satisfies Record<WebAssetBrand, Record<keyof typeof WEB_ICON_TARGET_FILENAMES, string>>;
export function resolveWebIconOverrides(
brand: WebAssetBrand,
targetDirectory: string,
): ReadonlyArray<IconOverride> {
const sourcePaths = WEB_ICON_SOURCE_PATHS_BY_BRAND[brand];
return [
{
sourceRelativePath: sourcePaths.faviconIco,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.faviconIco}`,
},
{
sourceRelativePath: sourcePaths.favicon16Png,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.favicon16Png}`,
},
{
sourceRelativePath: sourcePaths.favicon32Png,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.favicon32Png}`,
},
{
sourceRelativePath: sourcePaths.appleTouchIconPng,
targetRelativePath: `${targetDirectory}/${WEB_ICON_TARGET_FILENAMES.appleTouchIconPng}`,
},
];
}
export const DEVELOPMENT_ICON_OVERRIDES = resolveWebIconOverrides("development", "dist/client");
export const PUBLISH_ICON_OVERRIDES = resolveWebIconOverrides("production", "dist/client");