mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 14:55:37 +00:00
Merge pull request #97 from Bortlesboat/fix/display-app-version
fix: display app version in More menu
This commit is contained in:
Vendored
+2
@@ -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 */
|
||||
|
||||
@@ -4474,5 +4474,9 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
|
||||
seconds: countdownInProgress ? countdownRemaining : null,
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('app:getVersion', () => {
|
||||
return app.getVersion()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user