Merge pull request #97 from Bortlesboat/fix/display-app-version

fix: display app version in More menu
This commit is contained in:
webadderall
2026-03-25 19:07:59 +11:00
committed by GitHub
4 changed files with 38 additions and 0 deletions
+2
View File
@@ -286,6 +286,8 @@ interface Window {
message?: string;
error?: string;
}>;
/** Returns the app version from package.json */
getAppVersion: () => Promise<string>;
/** Hide the OS cursor before browser capture starts. */
hideOsCursor: () => Promise<{ success: boolean }>;
/** Countdown timer before recording */
+4
View File
@@ -4474,5 +4474,9 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
seconds: countdownInProgress ? countdownRemaining : null,
}
})
ipcMain.handle('app:getVersion', () => {
return app.getVersion()
})
}
+1
View File
@@ -296,6 +296,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
isNativeWindowsCaptureAvailable: () => ipcRenderer.invoke("is-native-windows-capture-available"),
muxNativeWindowsRecording: () => ipcRenderer.invoke("mux-native-windows-recording"),
hideOsCursor: () => ipcRenderer.invoke("hide-cursor"),
getAppVersion: () => ipcRenderer.invoke("app:getVersion"),
getCountdownDelay: () => ipcRenderer.invoke("get-countdown-delay"),
setCountdownDelay: (delay: number) => ipcRenderer.invoke("set-countdown-delay", delay),
startCountdown: (seconds: number) => ipcRenderer.invoke("start-countdown", seconds),
+31
View File
@@ -188,6 +188,7 @@ export function LaunchWindow() {
const [sourcesLoading, setSourcesLoading] = useState(false);
const [hideHudFromCapture, setHideHudFromCapture] = useState(true);
const [platform, setPlatform] = useState<string | null>(null);
const [appVersion, setAppVersion] = useState<string | null>(null);
const dropdownRef = useRef<HTMLDivElement>(null);
const hudContentRef = useRef<HTMLDivElement>(null);
const hudBarRef = useRef<HTMLDivElement>(null);
@@ -372,6 +373,22 @@ export function LaunchWindow() {
};
}, []);
useEffect(() => {
let cancelled = false;
const loadVersion = async () => {
try {
const version = await window.electronAPI.getAppVersion();
if (!cancelled) setAppVersion(version);
} catch (error) {
console.error("Failed to load app version:", error);
}
};
void loadVersion();
return () => {
cancelled = true;
};
}, []);
useEffect(() => {
let cancelled = false;
const loadHudCaptureProtection = async () => {
@@ -1006,6 +1023,20 @@ export function LaunchWindow() {
{LOCALE_LABELS[code] ?? code}
</DropdownItem>
))}
{appVersion && (
<div
style={{
marginTop: 8,
padding: "4px 12px",
fontSize: 11,
color: "#6b6b78",
textAlign: "center",
userSelect: "text",
}}
>
v{appVersion}
</div>
)}
</>
)}
</div>