fix: unblock startup on network and external font

- Make license status snapshot non-blocking (revocation check in background)

- Speed boot by not awaiting license network and capping editor ready wait

- Stop disabling GPU by default on Win packaged builds

- Remove external font fetch; bundle local Inter

Made-with: Cursor
This commit is contained in:
Ivan Fontosh
2026-04-20 16:28:17 +08:00
parent e39a72206d
commit 2ce1e02753
7 changed files with 54 additions and 18 deletions
+13 -10
View File
@@ -28,10 +28,10 @@ import {
} from './windows/createWindows';
/**
* На части конфигураций Windows окно Electron с `file://` остаётся чёрным из‑за GPU/композитора.
* Отключаем аппаратное ускорение в упакованном приложении; отключить обход: `DND_DISABLE_GPU=0`.
* Отключение GPU ломает скорость вторичных окон (презентация/пульт — WebGL). По умолчанию не трогаем.
* При чёрном экране в упакованной сборке: `DND_DISABLE_GPU=1`.
*/
if (process.platform === 'win32' && app.isPackaged && process.env.DND_DISABLE_GPU !== '0') {
if (process.platform === 'win32' && app.isPackaged && process.env.DND_DISABLE_GPU === '1') {
app.disableHardwareAcceleration();
}
@@ -144,17 +144,20 @@ async function runStartupAfterHandlers(licenseService: LicenseService): Promise<
console.error('[boot] ensureRoots', e);
}
setBootWindowStatus(splash, 'Устанавливаем связь…');
setBootWindowStatus(splash, 'Проверка лицензии…');
try {
await licenseService.getStatus();
} catch (e) {
console.error('[boot] license getStatus', e);
}
// Сеть в `getStatus()` не блокируем старт: синхронный снимок, отзыв — в фоне.
licenseService.getStatusSync();
queueMicrotask(() => {
licenseService.getStatus();
});
setBootWindowStatus(splash, 'Загрузка редактора…');
const editor = createEditorWindowDeferred();
await waitForEditorWindowReady(editor);
const bootEditorMs = 2000;
await Promise.race([
waitForEditorWindowReady(editor),
new Promise<void>((resolve) => setTimeout(resolve, bootEditorMs)),
]);
setBootWindowStatus(splash, 'Готово');
destroyBootWindow(splash);
if (!editor.isDestroyed()) {
+11 -2
View File
@@ -113,12 +113,17 @@ export class LicenseService {
return normalizeLicenseTokenInput(token);
}
/**
* Онлайн-проверка отзыва. Не вызывать через `await` из UI-пути: без VPN/DNS до сервера
* лицензий TCP может висеть до таймаута (см. fetch), из‑за чего главное окно долго «чёрное».
*/
private async maybeRefreshRemoteRevocation(payload: LicensePayloadV1): Promise<void> {
const base = process.env.DND_LICENSE_STATUS_URL?.trim();
if (!base) return;
const now = Date.now();
if (now - this.lastRemoteRevokeCheckMs < 60_000) return;
this.lastRemoteRevokeCheckMs = now;
const wasRevoked = this.lastRemoteRevoked;
try {
const u = new URL('v1/status', base.endsWith('/') ? base : `${base}/`);
u.searchParams.set('sub', payload.sub);
@@ -129,6 +134,9 @@ export class LicenseService {
} catch {
/* offline: не блокируем */
}
if (wasRevoked !== this.lastRemoteRevoked) {
emitLicenseStatusChanged();
}
}
getStatusSync(): LicenseSnapshot {
@@ -212,7 +220,8 @@ export class LicenseService {
};
}
async getStatus(): Promise<LicenseSnapshot> {
/** Снимок для UI/IPC: без ожидания сети (проверка отзыва уходит в фон). */
getStatus(): LicenseSnapshot {
if (this.isSkipLicense()) return this.getStatusSync();
const base = this.getStatusSync();
if (!base.active || !base.summary) return base;
@@ -223,7 +232,7 @@ export class LicenseService {
deviceId: this.deviceId,
});
if (!v.ok) return this.getStatusSync();
await this.maybeRefreshRemoteRevocation(v.payload);
void this.maybeRefreshRemoteRevocation(v.payload);
return this.getStatusSync();
}