SHA256
Настроить локальный запуск UI с devnet сервером
This commit is contained in:
+26
-4
@@ -50,6 +50,8 @@ import {
|
||||
markOutgoingDeliveryState,
|
||||
markOutgoingReadByBaseKey,
|
||||
normalizeDmChatId,
|
||||
applyUrlServerLoginOverrideIfNeeded,
|
||||
hasUrlEntrySettingsOverride,
|
||||
setContacts,
|
||||
} from './state.js';
|
||||
|
||||
@@ -226,6 +228,11 @@ const SCROLL_TO_BOTTOM_PAGE_IDS = new Set([
|
||||
'channel-thread-view',
|
||||
]);
|
||||
|
||||
function isLocalPreviewHost() {
|
||||
const host = String(window.location.hostname || '').toLowerCase();
|
||||
return host === 'localhost' || host === '127.0.0.1' || host === '::1';
|
||||
}
|
||||
|
||||
const FILLED_ACTION_BUTTON_PAGE_IDS = new Set([
|
||||
...PRE_AUTH_PAGES.filter((pageId) => pageId !== 'entry-settings-view'),
|
||||
'settings-view',
|
||||
@@ -1528,10 +1535,12 @@ async function ensureSessionRuntimeStarted() {
|
||||
if (!state.session.isAuthorized || sessionRuntimeStarted) return;
|
||||
sessionRuntimeStarted = true;
|
||||
|
||||
await initPwaPush({
|
||||
authService,
|
||||
onLog: (entry) => addAppLogEntry(entry),
|
||||
});
|
||||
if (!isLocalPreviewHost()) {
|
||||
await initPwaPush({
|
||||
authService,
|
||||
onLog: (entry) => addAppLogEntry(entry),
|
||||
});
|
||||
}
|
||||
|
||||
startConnectionMonitor();
|
||||
|
||||
@@ -1956,6 +1965,19 @@ async function init() {
|
||||
|
||||
void (async () => {
|
||||
try {
|
||||
let urlEntrySettingsReady = true;
|
||||
try {
|
||||
await applyUrlServerLoginOverrideIfNeeded();
|
||||
} catch (error) {
|
||||
urlEntrySettingsReady = false;
|
||||
addAppLogEntry({
|
||||
level: 'warn',
|
||||
source: 'entry-settings',
|
||||
message: 'Не удалось применить сервер из URL',
|
||||
details: { error: error?.message || 'unknown' },
|
||||
});
|
||||
}
|
||||
if (hasUrlEntrySettingsOverride() && !urlEntrySettingsReady) return;
|
||||
await tryAutoLogin();
|
||||
if (initialNotificationOpenPayload) {
|
||||
await handleNotificationClick(initialNotificationOpenPayload);
|
||||
|
||||
Reference in New Issue
Block a user