Accessing self-hosted instances via the official Fluxer apps

(#1223) Feature Shipped desktop self-hosting

Thread

Comment by @WatchCollector67
RexSystem 1 vote originally by @WatchCollector67 on GitHub
It already is possible, you can switch instances via the Account Switcher menu, although it is currently broken. I was able to patch a quick fix and get it working.
Patch:

  diff --git a/fluxer_desktop/src/main/IpcHandlers.ts b/fluxer_desktop/src/main/IpcHandlers.ts
  index 62bac2c269..0000000000 100644
  --- a/fluxer_desktop/src/main/IpcHandlers.ts
  +++ b/fluxer_desktop/src/main/IpcHandlers.ts
  @@ -151,6 +151,14 @@ async function assertValidFluxerInstance(instanceOrigin: string): Promise<void> {
        }
   }

  +function getElectronLoadErrorCode(error: unknown): number | null {
  +     const message = error instanceof Error ? error.message : String(error);
  +     const match = /\(([-\d]+)\)/.exec(message);
  +     if (!match) return null;
  +     const value = Number.parseInt(match[1], 10);
  +     return Number.isFinite(value) ? value : null;
  +}
  +
   export function registerIpcHandlers(): void {
        registerVoiceDebugEventSinkPopoutIpcHandlers();
        registerVoiceBackgroundMediaCacheHandlers();
  @@ -168,6 +176,10 @@ export function registerIpcHandlers(): void {
                try {
                        await mainWindow.loadURL(instanceOrigin);
                } catch (error) {
  +                     if (getElectronLoadErrorCode(error) === -3) {
  +                             return;
  +                     }
  +
                        setCustomAppUrl(null);
                        pendingDesktopHandoffCode = null;
                        const detail = error instanceof Error ? error.message : String(error);