Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Show the desktop app's own version in its update rows
Aditya Umale5c769c055fdd
diff --git a/src/components/UpdateIndicator.test.ts b/src/components/UpdateIndicator.test.tsindex 27d2561281..44a3a7a75e 100644--- a/src/components/UpdateIndicator.test.ts+++ b/src/components/UpdateIndicator.test.ts@@ -100,6 +100,13 @@ describe("the update card", () => {expect(install).toHaveBeenCalledOnce();});+ it("names the desktop app's version, not the version of a server page it shows", async () => {+ (window as unknown as { ogb: { app: unknown } }).ogb.app = { version: "9.8.7", ownPage: false };+ await emit({ status: "downloaded", version: "0.2.0", releaseNotes: NOTES, installMode: "restart" });+ await act(async () => button()!.click());+ expect(card()!.textContent).toContain("you have 9.8.7");+ });+it("shows the download's progress and holds the action until it is done", async () => {await emit({ status: "downloading", version: "0.2.0", percent: 45 });await act(async () => button()!.click());diff --git a/src/components/UpdateIndicator.tsx b/src/components/UpdateIndicator.tsxindex 1d48cc2b98..50bcf20235 100644--- a/src/components/UpdateIndicator.tsx+++ b/src/components/UpdateIndicator.tsx@@ -4,7 +4,7 @@ import { ArrowDown, ArrowDownToLine, Loader2, PackageOpen, RefreshCw, X } from "import { updaterMessage, useUpdaterState, type UpdaterState } from "@/lib/updater";import { releaseHighlights } from "@/lib/release-highlights";-import { RELEASES_URL, appVersion, openExternalLink } from "@/lib/app-links";+import { RELEASES_URL, desktopAppVersion, openExternalLink } from "@/lib/app-links";import { productName } from "../lib/brand";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";@@ -210,7 +210,7 @@ export function UpdateCard({{t("update.card.title")}</h2><p className="text-[13px] leading-5 text-ink-secondary">- {[state.version ? `${productName()} ${state.version}` : productName(), appVersion() ? t("update.card.current", { version: appVersion() }) : ""].filter(Boolean).join(" · ")}+ {[state.version ? `${productName()} ${state.version}` : productName(), t("update.card.current", { version: desktopAppVersion() })].join(" · ")}</p></div></div>diff --git a/src/components/settings/SettingsNav.tsx b/src/components/settings/SettingsNav.tsxindex db3e1bc91a..7e0a12de51 100644--- a/src/components/settings/SettingsNav.tsx+++ b/src/components/settings/SettingsNav.tsx@@ -18,7 +18,7 @@ import type { SettingsPlace } from "./settings-context";import { OWNERS, pageById, type SearchHit, type SettingsContext, type SettingsOwner, type SettingsPage, type SettingsPageId } from "./settings-index";import { useUpdaterState } from "@/lib/updater";import { keySection, type KeyEntry } from "../keys/key-catalog";-import { HELP_CENTER_URL, appVersion } from "@/lib/app-links";+import { HELP_CENTER_URL, desktopAppVersion } from "@/lib/app-links";export const NAV_ITEM = "relative flex h-8 w-full shrink-0 cursor-pointer items-center gap-2 rounded-lg px-2 text-left text-[13px] leading-5 text-ink transition-colors motion-reduce:transition-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus";@@ -68,8 +68,8 @@ export function usePlaceSubLine(place: SettingsPlace): string {export function useAppSubLine(desktop: boolean): string {const update = useUpdaterState();if (!desktop) return t("settings.scope.browser");- if (update?.status === "downloaded") return t("settings.app.updateReadyLine", { version: appVersion() });- return t("settings.app.upToDateLine", { version: appVersion() });+ if (update?.status === "downloaded") return t("settings.app.updateReadyLine", { version: desktopAppVersion() });+ return t("settings.app.upToDateLine", { version: desktopAppVersion() });}export function ownerLabel(owner: SettingsOwner, place: SettingsPlace, desktop: boolean): string {diff --git a/src/components/settings/SettingsPageHeader.test.ts b/src/components/settings/SettingsPageHeader.test.tsnew file mode 100644index 0000000000..244cdbcf0c--- /dev/null+++ b/src/components/settings/SettingsPageHeader.test.ts@@ -0,0 +1,26 @@+// @vitest-environment happy-dom+import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { setLocale } from "@/lib/i18n";+import { appVersion } from "@/lib/app-links";+import { overviewStatus } from "./SettingsPageHeader";++beforeEach(() => {+ setLocale("en");+ (window as unknown as { ogb: unknown }).ogb = { app: { version: "9.8.7", ownPage: false } };+});++afterEach(() => {+ delete (window as unknown as { ogb?: unknown }).ogb;+});++describe("overviewStatus on a Cloud's page in the desktop window", () => {+ it("names the desktop app's version for This computer", () => {+ expect(overviewStatus({ name: "This computer", kind: "computer", color: null, named: false })).toContain("9.8.7");+ });++ it("names the page's own version for the Cloud", () => {+ const line = overviewStatus({ name: "My Cloud", kind: "cloud", color: null, named: false });+ expect(line).toContain(appVersion());+ expect(line).not.toContain("9.8.7");+ });+});diff --git a/src/components/settings/SettingsPageHeader.tsx b/src/components/settings/SettingsPageHeader.tsxindex fe04d5176f..4958414805 100644--- a/src/components/settings/SettingsPageHeader.tsx+++ b/src/components/settings/SettingsPageHeader.tsx@@ -2,8 +2,8 @@ import type { ReactNode } from "react";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";import { productName } from "@/lib/brand";-import { appVersion } from "@/lib/app-links";-import type { SettingsPlace } from "./settings-context";+import { desktopAppVersion } from "@/lib/app-links";+import { versionLine, type SettingsPlace } from "./settings-context";import type { SettingsContext, SettingsPage } from "./settings-index";import { AppIcon, PlaceBadge, YouAvatar, pageLabel } from "./SettingsNav";@@ -26,9 +26,8 @@ function everyPlace(ctx: SettingsContext): ReactNode {}export function overviewStatus(place: SettingsPlace): string {- const version = t("settings.overview.version", { version: appVersion() });- if (place.kind === "computer") return `${version} · ${t("settings.overview.updatesWithApp")}`;- return `${place.kind === "server" ? t("settings.place.running") : t("settings.place.alwaysOn")} · ${version}`;+ if (place.kind === "computer") return `${versionLine(desktopAppVersion())} · ${t("settings.overview.updatesWithApp")}`;+ return `${place.kind === "server" ? t("settings.place.running") : t("settings.place.alwaysOn")} · ${versionLine()}`;}export function ScopeLine({ page, ctx, place }: { page: SettingsPage; ctx: SettingsContext; place: SettingsPlace }) {diff --git a/src/components/settings/pages/AppPages.tsx b/src/components/settings/pages/AppPages.tsxindex a1335ad21e..110f8fbc69 100644--- a/src/components/settings/pages/AppPages.tsx+++ b/src/components/settings/pages/AppPages.tsx@@ -1,7 +1,7 @@import { useState } from "react";import { Plus } from "lucide-react";import { productName } from "@/lib/brand";-import { FEEDBACK_URL, HELP_CENTER_URL, openExternalLink } from "@/lib/app-links";+import { FEEDBACK_URL, HELP_CENTER_URL, desktopAppVersion, openExternalLink } from "@/lib/app-links";import { t } from "@/lib/i18n";import { useStore } from "@/state/store";import { AboutDialog } from "../../AboutDialog";@@ -39,15 +39,16 @@ export function AppPage() {const [about, setAbout] = useState(false);const desk = ctx.desktop && !ctx.client;const computer = useSwitchToComputer();+ const appVersionLine = versionLine(desktopAppVersion());return <>{ctx.desktop && (<SettingsGroup label={t("settings.updates.title")} block="updates"><SettingsRows>- {window.ogb?.updater ? <UpdatesRow title={versionLine()} />+ {window.ogb?.updater ? <UpdatesRow title={appVersionLine} />// On the app's own page with no updater (a package or store build), the version is live and says why// there is no button; only another place's page names This computer.- : ctx.home || ctx.client ? <SettingRow title={versionLine()} subtitle={t("settings.updates.fromPackage")}>{null}</SettingRow>- : <InertRow title={versionLine()} reason={t("settings.inert.checkFromHere", { place: computer.name })}+ : ctx.home || ctx.client ? <SettingRow title={appVersionLine} subtitle={t("settings.updates.fromPackage")}>{null}</SettingRow>+ : <InertRow title={appVersionLine} reason={t("settings.inert.checkFromHere", { place: computer.name })}control={<button type="button" className="ui-button" tabIndex={-1}>{t("settings.updates.check")}</button>} />}</SettingsRows></SettingsGroup>diff --git a/src/components/settings/settings-context.ts b/src/components/settings/settings-context.tsindex d2b3110b55..c6912e6bdf 100644--- a/src/components/settings/settings-context.ts+++ b/src/components/settings/settings-context.ts@@ -96,4 +96,4 @@ export function useOtherPlaces(page?: string): OtherPlace[] {return listed;}-export const versionLine = (): string => t("settings.overview.version", { version: appVersion() });+export const versionLine = (version = appVersion()): string => t("settings.overview.version", { version });diff --git a/src/lib/app-links.ts b/src/lib/app-links.tsindex 2712f5af4c..0ef286c1e9 100644--- a/src/lib/app-links.ts+++ b/src/lib/app-links.ts@@ -19,6 +19,10 @@ export function appVersion(): string {return typeof __APP_VERSION__ === "string" ? __APP_VERSION__ : "dev";}+export function desktopAppVersion(): string {+ return (typeof window !== "undefined" && window.ogb?.app?.version) || appVersion();+}+const PLATFORM_NAMES: Record<string, string> = {darwin: "macOS",win32: "Windows",