Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: remove no longer needed bundle visibility (#4951)

Peter Chinmanecef12ee9951
diff --git a/apps/web/src/features/settings/Account.tsx b/apps/web/src/features/settings/Account.tsx
index 245e02e8ad..3f9a280ea1 100644
--- a/apps/web/src/features/settings/Account.tsx
+++ b/apps/web/src/features/settings/Account.tsx
@@ -36,15 +36,7 @@ import SignOutIcon from '@phosphor-icons/core/regular/sign-out.svg?component-sol
import IconUpload from '@phosphor-icons/core/regular/upload-simple.svg?component-solid';
import { authServiceClient } from '@service-auth/client';
import { invoke } from '@tauri-apps/api/core';
-import {
- Button,
- cn,
- Dialog,
- Dropdown,
- Panel,
- ToggleSwitch,
- Tooltip,
-} from '@ui';
+import { Button, Dialog, Dropdown, Panel, ToggleSwitch, Tooltip } from '@ui';
import {
createEffect,
createMemo,
@@ -57,7 +49,6 @@ import {
Switch,
} from 'solid-js';
import { Transition } from 'solid-transition-group';
-import { formatAssetUrl, loadEntryAssetInfo } from './entryAssetInfo';
import {
SettingsCard,
SettingsPage,
@@ -720,119 +711,21 @@ type BundleDebugInfo = {
function BundleVersionRow() {
if (!isNativeMobilePlatform()) return null;
- const [showBuildInfo, setShowBuildInfo] = createSignal(false);
const [bundleDebugInfo] = createResource(() =>
invoke<BundleDebugInfo>('get_bundle_debug_info').catch((error) => {
console.error('[bundle-update] get_bundle_debug_info failed', error);
return null;
})
);
- const [entryAssetInfo] = createResource(showBuildInfo, (open) =>
- open ? loadEntryAssetInfo() : null
- );
return (
<Show when={bundleDebugInfo()}>
{(info) => (
<>
<Row label="Version">
- <button
- type="button"
- class="appearance-none rounded-sm border-0 bg-transparent p-0 text-right text-sm text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent"
- onClick={() => setShowBuildInfo(true)}
- >
- {info().bundleBuild} (
- {info().source === 'embedded' ? 'app' : 'ota'}) -{' '}
- {info().nativeBuild}
- </button>
+ {info().bundleBuild} ({info().source === 'embedded' ? 'app' : 'ota'}
+ ) - {info().nativeBuild}
</Row>
- <Dialog
- open={showBuildInfo()}
- onOpenChange={setShowBuildInfo}
- position="center"
- class="w-120"
- >
- <Panel active depth={2} class="rounded-xl">
- <Panel.Header class="px-6">
- <Dialog.Title class="text-ink text-sm font-semibold">
- App Debug Info
- </Dialog.Title>
- </Panel.Header>
- <Panel.Body class="p-6 font-sans flex flex-col gap-4">
- <div class="grid gap-2 text-sm">
- <div class="flex items-center justify-between gap-4">
- <span class="text-ink-muted">Selected bundle</span>
- <span class="text-ink">
- {info().bundleBuild} (
- {info().source === 'embedded' ? 'app' : 'ota'})
- </span>
- </div>
- <div class="flex items-center justify-between gap-4">
- <span class="text-ink-muted">Native build</span>
- <span class="text-ink">{info().nativeBuild}</span>
- </div>
- <div class="flex items-center justify-between gap-4">
- <span class="text-ink-muted">Runtime entry</span>
- <span
- class={cn(
- 'text-right break-all',
- entryAssetInfo()?.matches === false
- ? 'text-failure'
- : 'text-ink'
- )}
- >
- {entryAssetInfo.loading
- ? 'Loading...'
- : formatAssetUrl(entryAssetInfo()?.loadedEntryUrl)}
- </span>
- </div>
- <div class="flex items-center justify-between gap-4">
- <span class="text-ink-muted">Fresh index entry</span>
- <span
- class={cn(
- 'text-right break-all',
- entryAssetInfo()?.matches === false
- ? 'text-failure'
- : 'text-ink'
- )}
- >
- {entryAssetInfo.loading
- ? 'Loading...'
- : formatAssetUrl(entryAssetInfo()?.freshIndexEntryUrl)}
- </span>
- </div>
- <div class="flex items-center justify-between gap-4">
- <span class="text-ink-muted">Matches</span>
- <span
- class={cn(
- entryAssetInfo()?.matches === false
- ? 'text-failure'
- : 'text-ink'
- )}
- >
- {entryAssetInfo.loading
- ? 'Loading...'
- : entryAssetInfo()?.matches == null
- ? 'unknown'
- : entryAssetInfo()?.matches
- ? 'true'
- : 'false'}
- </span>
- </div>
- <Show when={entryAssetInfo()?.error}>
- {(error) => (
- <div class="flex items-center justify-between gap-4">
- <span class="text-ink-muted">Error</span>
- <span class="text-right text-failure break-all">
- {error()}
- </span>
- </div>
- )}
- </Show>
- </div>
- </Panel.Body>
- </Panel>
- </Dialog>
</>
)}
</Show>
diff --git a/apps/web/src/features/settings/entryAssetInfo.ts b/apps/web/src/features/settings/entryAssetInfo.ts
deleted file mode 100644
index bef43a8c70..0000000000
--- a/apps/web/src/features/settings/entryAssetInfo.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-export type EntryAssetInfo = {
- freshIndexEntryUrl: string | null;
- loadedEntryUrl: string | null;
- matches: boolean | null;
- error?: string;
-};
-
-function normalizeAssetUrl(value: string): string {
- const url = new URL(value, window.location.href);
- url.hash = '';
- url.search = '';
- return url.href;
-}
-
-export function formatAssetUrl(value: string | null | undefined): string {
- if (!value) return 'Unavailable';
- try {
- const path = new URL(value, window.location.href).pathname;
- return path.split('/').filter(Boolean).at(-1) ?? value;
- } catch {
- return value;
- }
-}
-
-function extractEntryScriptUrl(html: string, indexUrl: string): string | null {
- const document = new DOMParser().parseFromString(html, 'text/html');
- const entryScript = document.querySelector<HTMLScriptElement>(
- 'script[type="module"][src]'
- );
- const src = entryScript?.getAttribute('src');
- return src ? new URL(src, indexUrl).href : null;
-}
-
-export async function loadEntryAssetInfo(): Promise<EntryAssetInfo> {
- const loadedEntryUrl = window.__MACRO_RUNTIME_ENTRY_URL__ ?? null;
- if (!loadedEntryUrl) {
- return {
- freshIndexEntryUrl: null,
- loadedEntryUrl,
- matches: null,
- error: 'Runtime entry URL unavailable',
- };
- }
-
- try {
- const indexUrl = new URL('index.html', loadedEntryUrl);
- indexUrl.searchParams.set('__macro_bundle_probe', Date.now().toString());
- const browserFetch =
- window.__MACRO_BROWSER_FETCH__ ?? window.fetch.bind(window);
- const response = await browserFetch(indexUrl.href, { cache: 'no-store' });
- if (!response.ok) {
- throw new Error(`Fresh index fetch failed with ${response.status}`);
- }
- const freshIndexEntryUrl = extractEntryScriptUrl(
- await response.text(),
- indexUrl.href
- );
- return {
- freshIndexEntryUrl,
- loadedEntryUrl,
- matches:
- freshIndexEntryUrl !== null &&
- normalizeAssetUrl(loadedEntryUrl) ===
- normalizeAssetUrl(freshIndexEntryUrl),
- };
- } catch (error) {
- return {
- freshIndexEntryUrl: null,
- loadedEntryUrl,
- matches: null,
- error: error instanceof Error ? error.message : String(error),
- };
- }
-}
diff --git a/apps/web/src/index.tsx b/apps/web/src/index.tsx
index 1bb9a0a8e7..f21a381854 100644
--- a/apps/web/src/index.tsx
+++ b/apps/web/src/index.tsx
@@ -13,16 +13,6 @@ import { ErrorBoundary, render } from 'solid-js/web';
import { FatalError } from './components/app/FatalError';
import { Root } from './routes/Root';
-declare global {
- interface Window {
- __MACRO_BROWSER_FETCH__?: typeof window.fetch;
- __MACRO_RUNTIME_ENTRY_URL__?: string;
- }
-}
-
-window.__MACRO_BROWSER_FETCH__ = window.fetch.bind(window);
-window.__MACRO_RUNTIME_ENTRY_URL__ = import.meta.url;
-
// Override global fetch with platformFetch for Tauri compatibility
// Skip localhost requests (dev server) to avoid breaking HMR
if (isTauri()) {