fix for main origin 575a5adbeff0b46390fb08901c7166649255204c

This commit is contained in:
gandc committed 2026-10-11 03:11:48 +03:00
1 parent 703bf076e2
commit eef54a61cc
11 files changed
+1008 -703

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
diff --git a/fluxer_desktop/package.json b/fluxer_desktop/package.json
index e1b4f22..dd0cc08 100644
--- a/fluxer_desktop/package.json
+++ b/fluxer_desktop/package.json
@@ -2,7 +2,7 @@
"name": "fluxer_desktop",
"version": "0.0.0",
"description": "Instant messaging and VoIP application",
- "homepage": "https://fluxer.app",
+ "homepage": "https://ds.gandc.ru",
"author": "Fluxer Platform AB <support@fluxer.com>",
"license": "AGPL-3.0-or-later",
"private": true,
diff --git a/fluxer_desktop/src/common/Constants.ts b/fluxer_desktop/src/common/Constants.ts
index 04709f7..6fdcff1 100644
--- a/fluxer_desktop/src/common/Constants.ts
+++ b/fluxer_desktop/src/common/Constants.ts
@@ -14,8 +14,8 @@ export const CHANNEL_APP_PROTOCOLS: Record<BuildChannel, string> = {
development: 'fluxer-development',
};
export const APP_PROTOCOL = CHANNEL_APP_PROTOCOLS[BUILD_CHANNEL];
-export const STABLE_APP_URL = 'https://web.fluxer.app';
-export const CANARY_APP_URL = 'https://web.canary.fluxer.app';
+export const STABLE_APP_URL = 'https://ds.gandc.ru';
+export const CANARY_APP_URL = 'https://ds.gandc.ru';
const DEVELOPMENT_APP_URL = 'http://localhost:8088';
export const CHANNEL_APP_URLS: Record<BuildChannel, string> = {
stable: STABLE_APP_URL,
@@ -28,8 +28,8 @@ export const DOWNLOAD_PAGE_URLS: Record<BuildChannel, string> = {
canary: 'https://canary.fluxer.app/download',
development: 'http://localhost:8088/download',
};
-export const STABLE_MIGRATED_APP_ORIGIN = 'https://fluxer.com';
-export const CANARY_MIGRATED_APP_ORIGIN = 'https://canary.fluxer.com';
+export const STABLE_MIGRATED_APP_ORIGIN = 'https://ds.gandc.ru';
+export const CANARY_MIGRATED_APP_ORIGIN = 'https://ds.gandc.ru';
export const DESKTOP_APP_SCHEME = DESKTOP_LOCAL_APP_SCHEME;
export const DESKTOP_APP_HOST = DESKTOP_LOCAL_APP_HOST;
export const DESKTOP_APP_ORIGIN = DESKTOP_LOCAL_APP_ORIGIN;
diff --git a/fluxer_desktop/src/main/DesktopRuntimeDiscovery.ts b/fluxer_desktop/src/main/DesktopRuntimeDiscovery.ts
index 3b23773..ddcc993 100644
--- a/fluxer_desktop/src/main/DesktopRuntimeDiscovery.ts
+++ b/fluxer_desktop/src/main/DesktopRuntimeDiscovery.ts
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
+import {BUILD_CHANNEL} from '@electron/common/BuildChannel';
+import {CHANNEL_APP_URLS} from '@electron/common/Constants';
import {getLaunchInstanceEndpointOverride} from '@electron/common/DesktopConfig';
import {createChildLogger} from '@electron/common/Logger';
import {getDesktopAppStorage} from '@electron/main/DesktopAppStorage';
@@ -140,7 +142,7 @@ export async function restoreRememberedRuntimePlan(instanceKey: string): Promise
}
export function desktopRuntimeInitialInput(): string | null {
- return getLaunchInstanceEndpointOverride();
+ return getLaunchInstanceEndpointOverride() ?? CHANNEL_APP_URLS[BUILD_CHANNEL];
}
async function fetchRuntimePlan(
+48
View File
@@ -0,0 +1,48 @@
diff --git a/fluxer_desktop/src/main/Window.ts b/fluxer_desktop/src/main/Window.ts
index f537d89..b0a3454 100644
--- a/fluxer_desktop/src/main/Window.ts
+++ b/fluxer_desktop/src/main/Window.ts
@@ -104,13 +104,22 @@ function getSanitizedPath(rawUrl: string): string | null {
}
}
+function isAllowedSsoNavigation(url: string): boolean {
+ try {
+ const origin = new URL(url).origin;
+ return origin === 'https://sso.gandc.ru' || origin === 'https://ds.gandc.ru';
+ } catch {
+ return false;
+ }
+}
+
function preventUntrustedNavigation(event: Electron.Event, url: string, isMainFrame: boolean): void {
if (isLocalAppURL(url) && !isLocalAppRendererDocumentURL(url)) {
logger.warn('Blocked a navigation to a reserved local app path', {url, isMainFrame});
event.preventDefault();
return;
}
- if (isMainFrame && !isTrustedOrigin(url)) {
+ if (isMainFrame && !isTrustedOrigin(url) && !isAllowedSsoNavigation(url)) {
event.preventDefault();
}
}
@@ -128,6 +137,9 @@ function attachChildWindowGuards(webContents: Electron.WebContents): void {
webContents.on('will-frame-navigate', (event) => {
preventUntrustedChildNavigation(event, event.url, event.isMainFrame);
});
+ webContents.on('will-redirect', (event, url, _isInPlace, isMainFrame) => {
+ preventUntrustedChildNavigation(event, url, isMainFrame);
+ });
webContents.setWindowOpenHandler(({url}) => {
openExternalDeduped(url).catch((error) => {
log.warn('Failed to open external URL from a popout window-open:', error);
@@ -1081,6 +1093,9 @@ export function createWindow(options: CreateWindowOptions = {}): BrowserWindow {
webContents.on('will-frame-navigate', (event) => {
preventUntrustedNavigation(event, event.url, event.isMainFrame);
});
+ webContents.on('will-redirect', (event, url, _isInPlace, isMainFrame) => {
+ preventUntrustedNavigation(event, url, isMainFrame);
+ });
webContents.on('did-create-window', (window, details) => {
if (
details.frameName === THEME_STUDIO_POPOUT_WINDOW_NAME &&
+155
View File
@@ -0,0 +1,155 @@
diff --git a/fluxer_desktop/src/preload/GscordCompatibility.ts b/fluxer_desktop/src/preload/GscordCompatibility.ts
new file mode 100644
index 0000000..9085d5a
--- /dev/null
+++ b/fluxer_desktop/src/preload/GscordCompatibility.ts
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+// These functions are serialized by executeInMainWorld: keep them self-contained.
+export function installForceAllIceTransportPolicy(): void {
+ const NativeRTCPeerConnection = window.RTCPeerConnection;
+
+ if (typeof NativeRTCPeerConnection !== 'function') {
+ return;
+ }
+
+ const nativeSetConfiguration = NativeRTCPeerConnection.prototype.setConfiguration;
+ NativeRTCPeerConnection.prototype.setConfiguration = function (configuration: RTCConfiguration): void {
+ const next = configuration?.iceTransportPolicy === 'relay'
+ ? {...configuration, iceTransportPolicy: 'all' as RTCIceTransportPolicy}
+ : configuration;
+ return nativeSetConfiguration.call(this, next);
+ };
+
+ window.RTCPeerConnection = new Proxy(NativeRTCPeerConnection, {
+ construct(Target, args, newTarget) {
+ const config = args[0] as RTCConfiguration | undefined;
+
+ if (config?.iceTransportPolicy === 'relay') {
+ args[0] = {
+ ...config,
+ iceTransportPolicy: 'all',
+ };
+ }
+
+ return Reflect.construct(Target, args, newTarget);
+ },
+ });
+
+ console.info('[Fluxer Desktop] WebRTC iceTransportPolicy forced to all');
+}
+
+export function installDisableLiveKitOfferWithJoin(): void {
+ const NativeWebSocket = window.WebSocket;
+ const compressionDescriptor = Object.getOwnPropertyDescriptor(
+ window,
+ 'CompressionStream',
+ );
+
+ let compressionSuppressed = false;
+
+ const suppressCompressionStream = (): void => {
+ if (compressionSuppressed) {
+ return;
+ }
+
+ Object.defineProperty(window, 'CompressionStream', {
+ configurable: true,
+ writable: true,
+ value: undefined,
+ });
+
+ compressionSuppressed = true;
+ };
+
+ const restoreCompressionStream = (): void => {
+ if (!compressionSuppressed) {
+ return;
+ }
+
+ if (compressionDescriptor) {
+ Object.defineProperty(
+ window,
+ 'CompressionStream',
+ compressionDescriptor,
+ );
+ } else {
+ delete (window as typeof window & {
+ CompressionStream?: typeof CompressionStream;
+ }).CompressionStream;
+ }
+
+ compressionSuppressed = false;
+ };
+
+ const isLiveKitRtcSocket = (value: string | URL): boolean => {
+ try {
+ const url = new URL(String(value), window.location.href);
+ return /\/rtc\/v1\/?$/.test(url.pathname);
+ } catch {
+ return false;
+ }
+ };
+
+ window.WebSocket = new Proxy(NativeWebSocket, {
+ construct(Target, args) {
+ const isLiveKitRtc = isLiveKitRtcSocket(
+ args[0] as string | URL,
+ );
+
+ if (isLiveKitRtc) {
+ restoreCompressionStream();
+ }
+
+ let socket: WebSocket;
+
+ try {
+ socket = Reflect.construct(Target, args, Target);
+ } catch (error) {
+ if (isLiveKitRtc) {
+ suppressCompressionStream();
+ }
+ throw error;
+ }
+
+ if (isLiveKitRtc) {
+ socket.addEventListener(
+ 'close',
+ () => suppressCompressionStream(),
+ {once: true},
+ );
+ }
+
+ return socket;
+ },
+ }) as typeof WebSocket;
+
+ suppressCompressionStream();
+
+ console.info(
+ '[Fluxer Desktop] LiveKit publisher offer-with-join disabled',
+ );
+}
diff --git a/fluxer_desktop/src/preload/index.ts b/fluxer_desktop/src/preload/index.ts
index 07ef677..12d4913 100644
--- a/fluxer_desktop/src/preload/index.ts
+++ b/fluxer_desktop/src/preload/index.ts
@@ -59,6 +59,7 @@ import type {
} from '@electron/common/Types';
import {createBrowserHandoffPreloadAPI} from '@electron/preload/BrowserHandoffPreload';
import {createDesktopStoragePreloadAPI} from '@electron/preload/DesktopStoragePreload';
+import {installDisableLiveKitOfferWithJoin, installForceAllIceTransportPolicy} from '@electron/preload/GscordCompatibility';
import {createFirstContentPaintSignal} from '@electron/preload/FirstContentPaint';
import {applyLegacyRawLocalStorage} from '@electron/preload/LegacyRawStorageSeed';
import {createLocalAppPreloadAPI} from '@electron/preload/LocalAppPreload';
@@ -86,6 +87,9 @@ import type {
} from '@simplewebauthn/browser';
import {contextBridge, ipcRenderer, webFrame} from 'electron';
+contextBridge.executeInMainWorld({func: installForceAllIceTransportPolicy});
+contextBridge.executeInMainWorld({func: installDisableLiveKitOfferWithJoin});
+
const ACCESSIBILITY_STORE_STORAGE_KEY = 'AccessibilityStore';
const ACTIVE_ALLOW_TRANSPARENCY_RENDERER_ARG = '--fluxer-active-allow-transparency=1';
const ACTIVE_USE_NATIVE_TITLEBAR_RENDERER_ARG = '--fluxer-active-use-native-titlebar=1';
+198
View File
@@ -0,0 +1,198 @@
diff --git a/fluxer_desktop/src/main/GscordRelease.ts b/fluxer_desktop/src/main/GscordRelease.ts
new file mode 100644
index 0000000..54e6593
--- /dev/null
+++ b/fluxer_desktop/src/main/GscordRelease.ts
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import type {ManualDesktopFormat} from '@electron/main/ShellDownloadFormats';
+import type {ManualLatestInfo} from '@electron/main/UpdaterDownloads';
+
+function isRecord(value: unknown): value is Record<string, unknown> {
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
+}
+
+export function parseGscordRelease(
+ payload: unknown,
+ platform: NodeJS.Platform = process.platform,
+ arch: NodeJS.Architecture = process.arch,
+): ManualLatestInfo {
+ if (!isRecord(payload) || typeof payload.tag_name !== 'string' || !payload.tag_name.trim()) {
+ throw new Error('GSCORD latest release response missing tag_name');
+ }
+ const version = payload.tag_name.trim().replace(/^v/, '');
+ if (!version) throw new Error('GSCORD latest release response missing version');
+ const files: ManualLatestInfo['files'] = {};
+ const arm = arch === 'arm64';
+ const patterns: Array<[ManualDesktopFormat, RegExp]> = platform === 'linux'
+ ? [
+ ['appimage', arm ? /-linux-arm64\.AppImage$/i : /-linux-x86_64\.AppImage$/i],
+ ['deb', arm ? /-linux-arm64\.deb$/i : /-linux-amd64\.deb$/i],
+ ['rpm', arm ? /-linux-aarch64\.rpm$/i : /-linux-x86_64\.rpm$/i],
+ ['tar_gz', arm ? /-linux-arm64\.tar\.gz$/i : /-linux-x64\.tar\.gz$/i],
+ ]
+ : platform === 'win32'
+ ? [['setup', arm ? /-win-arm64\.exe$/i : /-win-x64\.exe$/i]]
+ : [];
+ for (const asset of Array.isArray(payload.assets) ? payload.assets : []) {
+ if (!isRecord(asset) || typeof asset.name !== 'string' ||
+ typeof asset.browser_download_url !== 'string' || !asset.browser_download_url.trim()) continue;
+ const format = patterns.find(([, pattern]) => pattern.test(asset.name as string))?.[0];
+ if (format) files[format] = {url: asset.browser_download_url, sha256: null};
+ }
+ return {
+ version,
+ pubDate: typeof payload.published_at === 'string' ? payload.published_at
+ : typeof payload.created_at === 'string' ? payload.created_at : null,
+ files,
+ };
+}
diff --git a/fluxer_desktop/src/main/ShellUpdateCapability.ts b/fluxer_desktop/src/main/ShellUpdateCapability.ts
index ce31659..465e2e4 100644
--- a/fluxer_desktop/src/main/ShellUpdateCapability.ts
+++ b/fluxer_desktop/src/main/ShellUpdateCapability.ts
@@ -40,18 +40,13 @@ export function decideShellUpdatePlan(runtime: ShellUpdateRuntime): ShellUpdateP
if (runtime.flatpak) {
return {capability: ShellUpdateCapability.MANAGED_PACKAGE};
}
- if (runtime.portable) {
+ // GSCORD publishes portable EXE/AppImage/DEB assets, not upstream updater feeds.
+ if (runtime.portable || runtime.platform === 'win32' || runtime.platform === 'linux') {
return {capability: ShellUpdateCapability.MANUAL_DOWNLOAD, reason: 'platform'};
}
- if (runtime.platform === 'win32') {
- return {capability: ShellUpdateCapability.SELF_UPDATE, updater: 'velopack'};
- }
if (runtime.platform === 'darwin') {
return {capability: ShellUpdateCapability.SELF_UPDATE, updater: 'electron'};
}
- if (runtime.platform === 'linux' && runtime.appImage != null) {
- return {capability: ShellUpdateCapability.SELF_UPDATE, updater: 'appimage', target: runtime.appImage};
- }
return {capability: ShellUpdateCapability.MANUAL_DOWNLOAD, reason: 'platform'};
}
diff --git a/fluxer_desktop/src/main/Updater.ts b/fluxer_desktop/src/main/Updater.ts
index 4403ed7..dc0420b 100644
--- a/fluxer_desktop/src/main/Updater.ts
+++ b/fluxer_desktop/src/main/Updater.ts
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {checkDesktopUpdateNow} from '@electron/main/DesktopUpdateGate';
-import {MANUAL_DESKTOP_FORMATS, type ManualDesktopFormat} from '@electron/main/ShellDownloadFormats';
+import {parseGscordRelease} from '@electron/main/GscordRelease';
import {resolveShellUpdatePlan, ShellUpdateCapability} from '@electron/main/ShellUpdateCapability';
import {
DOWNLOAD_PAGE_URL,
getManualDownloadOptions,
getManualDownloadUrl,
- type ManualLatestFile,
type ManualLatestInfo,
UPDATE_BASE_URL,
type UpdaterDownloadOption,
@@ -48,9 +47,6 @@ function send(win: BrowserWindow | null, event: UpdaterEvent) {
win?.webContents.send('updater-event', event);
}
-function isRecord(value: unknown): value is Record<string, unknown> {
- return value !== null && typeof value === 'object' && !Array.isArray(value);
-}
function getErrorMessage(error: unknown): string {
if (error instanceof Error) {
@@ -89,23 +85,6 @@ function compareVersions(a: string, b: string): number {
return aPre < bPre ? -1 : 1;
}
-function parseManualLatestFiles(value: unknown): Partial<Record<ManualDesktopFormat, ManualLatestFile>> {
- if (!isRecord(value)) {
- return {};
- }
- const files: Partial<Record<ManualDesktopFormat, ManualLatestFile>> = {};
- for (const format of MANUAL_DESKTOP_FORMATS) {
- const entry = value[format];
- if (!isRecord(entry) || typeof entry.url !== 'string' || entry.url.trim().length === 0) {
- continue;
- }
- files[format] = {
- url: entry.url,
- sha256: typeof entry.sha256 === 'string' ? entry.sha256 : null,
- };
- }
- return files;
-}
async function fetchManualLatest(options: {forceRefresh?: boolean} = {}): Promise<ManualLatestInfo> {
const now = Date.now();
@@ -123,15 +102,7 @@ async function fetchManualLatest(options: {forceRefresh?: boolean} = {}): Promis
if (!response.ok) {
throw new Error(`Latest version request failed: ${response.status}`);
}
- const payload = (await response.json()) as {version?: unknown; pub_date?: unknown; files?: unknown};
- if (typeof payload.version !== 'string' || payload.version.length === 0) {
- throw new Error('Latest version response missing version string');
- }
- const info: ManualLatestInfo = {
- version: payload.version,
- pubDate: typeof payload.pub_date === 'string' ? payload.pub_date : null,
- files: parseManualLatestFiles(payload.files),
- };
+ const info = parseGscordRelease(await response.json());
manualLatestCache = {at: now, info};
return info;
}
diff --git a/fluxer_desktop/src/main/UpdaterDownloads.ts b/fluxer_desktop/src/main/UpdaterDownloads.ts
index f63685b..c82ca74 100644
--- a/fluxer_desktop/src/main/UpdaterDownloads.ts
+++ b/fluxer_desktop/src/main/UpdaterDownloads.ts
@@ -1,11 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
-import {BUILD_CHANNEL} from '@electron/common/BuildChannel';
-import {DOWNLOAD_PAGE_URLS} from '@electron/common/Constants';
import {DESKTOP_ARTIFACT_PRODUCT_NAME} from '@electron/common/DesktopIdentity';
import {
DESKTOP_DOWNLOAD_ARCH,
- getUpdateBaseUrl,
isLinuxManualDesktopFormat,
LINUX_MANUAL_ARCH_TOKENS,
LINUX_MANUAL_FORMAT_EXTENSIONS,
@@ -21,8 +18,8 @@ export type UpdaterDownloadOption = {
sha256?: string | null;
};
-export const UPDATE_BASE_URL = getUpdateBaseUrl();
-export const DOWNLOAD_PAGE_URL = DOWNLOAD_PAGE_URLS[BUILD_CHANNEL];
+export const DOWNLOAD_PAGE_URL = 'https://git.gandc.ru/gscord/gscord-desktop/releases';
+export const UPDATE_BASE_URL = 'https://git.gandc.ru/api/v1/repos/gscord/gscord-desktop/releases';
export type ManualLatestFile = {url: string; sha256: string | null};
@@ -53,7 +50,9 @@ const LINUX_MANUAL_FORMAT_LABELS: Record<LinuxManualDesktopFormat, string> = {
};
export function buildManualVersionDownloadUrl(version: string, format: ManualDesktopFormat): string {
- return `${UPDATE_BASE_URL}/${version}/${format}`;
+ void version;
+ void format;
+ return DOWNLOAD_PAGE_URL;
}
function getArtifactProductName(): string {
@@ -72,12 +71,13 @@ export function getManualDownloadOptions(info: ManualLatestInfo): Array<UpdaterD
}
return getManualDownloadFormatPreference()
.filter(isLinuxManualDesktopFormat)
+ .filter((format) => info.files[format] != null)
.map((format) => {
const file = info.files[format];
return {
format,
label: LINUX_MANUAL_FORMAT_LABELS[format],
- url: buildManualVersionDownloadUrl(info.version, format),
+ url: file?.url ?? buildManualVersionDownloadUrl(info.version, format),
suggestedName: getManualUpdateSuggestedName(format, info.version),
sha256: file?.sha256 ?? null,
};
+4
View File
@@ -0,0 +1,4 @@
0001-self-hosted-instance.patch
0002-sso-navigation.patch
0003-webrtc-livekit.patch
0004-gitea-updates.patch