Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hosted-static-web-dist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@t3tools/web": patch
---

Build release web dist archives as hosted static apps.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ jobs:
T3CODE_CLERK_PUBLISHABLE_KEY: ""
T3CODE_CLERK_JWT_TEMPLATE: ""
T3CODE_RELAY_URL: ""
VITE_HOSTED_STATIC_APP: "true"
VITE_HOSTED_APP_CHANNEL: ${{ needs.preflight.outputs.release_channel == 'stable' && 'latest' || 'nightly' }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down
1 change: 1 addition & 0 deletions FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This repository is a fork of `pingdotgg/t3code`. Keep this file focused on fork
- macOS passkey entitlements are only enabled when Apple notarization/profile configuration is present.
- Windows releases can sign with the static certificate when Azure Trusted Signing is not configured.
- Fork release jobs use GitHub-hosted runners where upstream private runners are unavailable.
- Web dist release archives are built as hosted static apps and carry the release channel.

### Desktop Updater Channels

Expand Down
18 changes: 17 additions & 1 deletion apps/web/src/hostedPairing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ export interface HostedPairingRequest {

export type HostedAppChannel = "latest" | "nightly";

function hostedStaticAppEnabled(): boolean {
return import.meta.env.VITE_HOSTED_STATIC_APP === "true";
}

function currentOrigin(): string | null {
return typeof window === "undefined" ? null : window.location.origin;
}

export function configuredHostedAppUrl(): string {
return import.meta.env.VITE_HOSTED_APP_URL?.trim() || DEFAULT_HOSTED_APP_URL;
return (
import.meta.env.VITE_HOSTED_APP_URL?.trim() ||
(hostedStaticAppEnabled() ? currentOrigin() : null) ||
DEFAULT_HOSTED_APP_URL
);
}

function configuredBackendUrl(): string {
Expand All @@ -36,6 +48,10 @@ export function isHostedStaticApp(url: URL = new URL(window.location.href)): boo
return false;
}

if (hostedStaticAppEnabled()) {
return true;
}

if (configuredHostedAppChannel()) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { DesktopBridge, LocalApi } from "@t3tools/contracts";
interface ImportMetaEnv {
readonly VITE_HTTP_URL: string;
readonly VITE_WS_URL: string;
readonly VITE_HOSTED_STATIC_APP: string;
readonly VITE_HOSTED_APP_URL: string;
readonly VITE_HOSTED_APP_CHANNEL: string;
readonly VITE_CLERK_PUBLISHABLE_KEY: string;
Expand Down
2 changes: 2 additions & 0 deletions apps/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const configuredClerkJwtTemplate = repoEnv.VITE_CLERK_JWT_TEMPLATE?.trim() || ""
const configuredRelayTracingUrl = repoEnv.VITE_RELAY_OTLP_TRACES_URL?.trim() || "";
const configuredRelayTracingDataset = repoEnv.VITE_RELAY_OTLP_TRACES_DATASET?.trim() || "";
const configuredRelayTracingToken = repoEnv.VITE_RELAY_OTLP_TRACES_TOKEN?.trim() || "";
const configuredHostedStaticApp = process.env.VITE_HOSTED_STATIC_APP?.trim() || "";
const configuredHostedAppChannel = process.env.VITE_HOSTED_APP_CHANNEL?.trim() || "";
const configuredAppVersion = process.env.APP_VERSION?.trim() || pkg.version;
const configuredHostedAppUrl = (() => {
Expand Down Expand Up @@ -121,6 +122,7 @@ export default defineConfig(() => {
configuredRelayTracingDataset,
),
"import.meta.env.VITE_RELAY_OTLP_TRACES_TOKEN": JSON.stringify(configuredRelayTracingToken),
"import.meta.env.VITE_HOSTED_STATIC_APP": JSON.stringify(configuredHostedStaticApp),
"import.meta.env.VITE_HOSTED_APP_URL": JSON.stringify(configuredHostedAppUrl ?? ""),
"import.meta.env.VITE_HOSTED_APP_CHANNEL": JSON.stringify(configuredHostedAppChannel),
"import.meta.env.APP_VERSION": JSON.stringify(configuredAppVersion),
Expand Down
Loading