mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
feat(desktop): add FLUXER_DISABLE_MODULE_UPDATES opt-out (#3466)
This commit is contained in:
1 parent
e8dff6a8a1
commit
e403fb6cce
11 files changed
+302
-77
No files matched your search
@@ -267,6 +267,7 @@ interface ModuleUpdaterOptions {
|
||||
readonly bundledRendererVersion?: string | null;
|
||||
readonly preferUnversionedBundle?: boolean;
|
||||
readonly forceStartupUpdate?: boolean;
|
||||
readonly moduleUpdatesDisabled?: boolean;
|
||||
readonly selfUpdateShellFirst?: (latestVersion: string) => Promise<{readonly reason: string}>;
|
||||
readonly onState?: (state: ModuleUpdaterSplashState) => void;
|
||||
readonly report?: (report: ModuleUpdaterReport) => void;
|
||||
@@ -286,6 +287,7 @@ export class ModuleUpdater {
|
||||
private readonly shellVersion: ModuleVersion;
|
||||
private readonly hasOfflineRenderer: boolean;
|
||||
private readonly forceStartupUpdate: boolean;
|
||||
private readonly moduleUpdatesDisabled: boolean;
|
||||
private readonly selfUpdateShellFirst: ((latestVersion: string) => Promise<{readonly reason: string}>) | null;
|
||||
private readonly shellFirstAttempts = new Map<string, {readonly reason: string} | null>();
|
||||
private readonly manifestFeed: ModuleManifestFeedIdentity;
|
||||
@@ -314,6 +316,7 @@ export class ModuleUpdater {
|
||||
this.shellVersion = parseModuleVersion(options.shellVersion, 'desktop shell version');
|
||||
this.hasOfflineRenderer = options.hasOfflineRenderer ?? false;
|
||||
this.forceStartupUpdate = options.forceStartupUpdate ?? false;
|
||||
this.moduleUpdatesDisabled = options.moduleUpdatesDisabled ?? false;
|
||||
this.selfUpdateShellFirst = options.selfUpdateShellFirst ?? null;
|
||||
const releaseChannel = options.releaseChannel ?? BUILD_CHANNEL;
|
||||
this.platform = options.platform ?? process.platform;
|
||||
@@ -418,6 +421,18 @@ export class ModuleUpdater {
|
||||
return reverted;
|
||||
}
|
||||
}
|
||||
if (this.moduleUpdatesDisabled) {
|
||||
const decision = await this.planner.evaluateUnreachableLaunch(this.startupUpdateEnforced);
|
||||
if (decision.kind === ModuleUnreachableLaunchDecision.LAUNCH) {
|
||||
return await this.launchUnreachable();
|
||||
}
|
||||
return this.blockUpdateRequired(
|
||||
decision.reason,
|
||||
[],
|
||||
'module updates are disabled by FLUXER_DISABLE_MODULE_UPDATES',
|
||||
{updateServerUnreachable: true},
|
||||
);
|
||||
}
|
||||
if (this.platform === 'linux' && !(await this.startupUpdateRequired())) {
|
||||
return await this.launchIfAtFloor();
|
||||
}
|
||||
@@ -486,13 +501,7 @@ export class ModuleUpdater {
|
||||
if (exhausted || !fetched) {
|
||||
const decision = await this.planner.evaluateUnreachableLaunch(this.startupUpdateEnforced);
|
||||
if (decision.kind === ModuleUnreachableLaunchDecision.LAUNCH) {
|
||||
const launchAttempt = await this.store.recordLaunchAttempt();
|
||||
this.emit(ModuleUpdaterStatus.UNREACHABLE_LAUNCH);
|
||||
return {
|
||||
status: ModuleUpdaterStatus.UNREACHABLE_LAUNCH,
|
||||
committed: this.store.getCommitted(),
|
||||
launchAttempt,
|
||||
};
|
||||
return await this.launchUnreachable();
|
||||
}
|
||||
if (exhausted) {
|
||||
return this.blockUpdateRequired(decision.reason, [], describeErrorChain(error), {
|
||||
@@ -802,6 +811,16 @@ export class ModuleUpdater {
|
||||
};
|
||||
}
|
||||
|
||||
private async launchUnreachable(): Promise<ModuleUpdaterOutcome> {
|
||||
const launchAttempt = await this.store.recordLaunchAttempt();
|
||||
this.emit(ModuleUpdaterStatus.UNREACHABLE_LAUNCH);
|
||||
return {
|
||||
status: ModuleUpdaterStatus.UNREACHABLE_LAUNCH,
|
||||
committed: this.store.getCommitted(),
|
||||
launchAttempt,
|
||||
};
|
||||
}
|
||||
|
||||
private async launchRevertedSetBypassingFloor(
|
||||
committed: Readonly<Record<string, string>>,
|
||||
): Promise<ModuleUpdaterOutcome | null> {
|
||||
|
||||
Reference in new issue
Block a user