mirror of
https://github.com/YuzuZensai/Discord-Presence-Relay.git
synced 2026-09-14 01:08:50 +00:00
👷 ci: Add GitHub Actions workflow for cross-platform builds
This commit is contained in:
@@ -5,6 +5,8 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import icon from '../../resources/icon.png?asset'
|
||||
import { relay, RelayStatus } from './relay'
|
||||
|
||||
declare const __COMMIT_HASH__: string
|
||||
|
||||
function settingsPath(): string {
|
||||
return join(app.getPath('userData'), 'settings.json')
|
||||
}
|
||||
@@ -135,6 +137,10 @@ app.whenReady().then(() => {
|
||||
|
||||
relay.setDisabledMirrors(loadDisabledMirrors())
|
||||
|
||||
ipcMain.handle('relay:get-version', () => ({
|
||||
version: app.getVersion(),
|
||||
commit: __COMMIT_HASH__
|
||||
}))
|
||||
ipcMain.handle('relay:get-status', () => relay.getStatus())
|
||||
ipcMain.handle('relay:start', () => relay.start())
|
||||
ipcMain.handle('relay:stop', () => relay.stop())
|
||||
|
||||
@@ -3,6 +3,8 @@ import { electronAPI } from '@electron-toolkit/preload'
|
||||
import type { RelayStatus } from '../main/relay'
|
||||
|
||||
const api = {
|
||||
getVersion: (): Promise<{ version: string; commit: string }> =>
|
||||
ipcRenderer.invoke('relay:get-version'),
|
||||
getStatus: (): Promise<RelayStatus> => ipcRenderer.invoke('relay:get-status'),
|
||||
start: (): Promise<void> => ipcRenderer.invoke('relay:start'),
|
||||
stop: (): Promise<void> => ipcRenderer.invoke('relay:stop'),
|
||||
|
||||
@@ -103,11 +103,13 @@ export function App(): React.JSX.Element {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [autostart, setAutostart] = useState(false)
|
||||
const [view, setView] = useState<'main' | 'settings'>('main')
|
||||
const [appVersion, setAppVersion] = useState<{ version: string; commit: string } | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
void (async () => {
|
||||
setStatus(await window.api.getStatus())
|
||||
setAutostart(await window.api.getAutostart())
|
||||
setAppVersion(await window.api.getVersion())
|
||||
})()
|
||||
|
||||
return window.api.onStatus(setStatus)
|
||||
@@ -167,6 +169,12 @@ export function App(): React.JSX.Element {
|
||||
</div>
|
||||
<Toggle checked={autostart} onChange={onToggleAutostart} />
|
||||
</section>
|
||||
|
||||
{appVersion && (
|
||||
<p className="text-xs text-zinc-500 mt-auto">
|
||||
Version {appVersion.version} ({appVersion.commit})
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user