fix: disable fullscreen for desktop

This commit is contained in:
2025-12-21 18:32:34 +03:00
parent 08f0e24859
commit bf32d90811

View File

@@ -36,18 +36,19 @@ app
const settings = useSettingsStore(); const settings = useSettingsStore();
const blocks = useBlocksStore(); const blocks = useBlocksStore();
const pulse = usePulseStore(); const pulse = usePulseStore();
const tg = window.Telegram.WebApp;
const appLoading = createApp(AppLoading); const appLoading = createApp(AppLoading);
appLoading.mount('#app'); appLoading.mount('#app');
function setTelegramUIColors() { function setTelegramUIColors() {
const daisyUIBgColor = getCssVarOklchRgb('--color-base-200'); const daisyUIBgColor = getCssVarOklchRgb('--color-base-200');
window.Telegram.WebApp.setHeaderColor(daisyUIBgColor); tg.setHeaderColor(daisyUIBgColor);
window.Telegram.WebApp.setBackgroundColor(daisyUIBgColor); tg.setBackgroundColor(daisyUIBgColor);
} }
settings.load() settings.load()
.then(() => window.Telegram.WebApp.lockOrientation()) .then(() => tg.lockOrientation())
.then(() => { .then(() => {
if (settings.app_enabled === false) { if (settings.app_enabled === false) {
throw new Error('App disabled (maintenance mode)'); throw new Error('App disabled (maintenance mode)');
@@ -55,7 +56,7 @@ settings.load()
}) })
.then(() => settings.ya_metrika_enabled && injectYaMetrika()) .then(() => settings.ya_metrika_enabled && injectYaMetrika())
.then(() => { .then(() => {
if (! window.Telegram.WebApp.initData) { if (! tg.initData) {
throw new TelegramInitDataError('Invalid init data. Application not in Telegram View'); throw new TelegramInitDataError('Invalid init data. Application not in Telegram View');
} }
}) })
@@ -84,9 +85,9 @@ settings.load()
.then(() => blocks.processBlocks(settings.mainpage_blocks)) .then(() => blocks.processBlocks(settings.mainpage_blocks))
.then(() => { .then(() => {
console.debug('[Init] Set theme attributes'); console.debug('[Init] Set theme attributes');
document.documentElement.setAttribute('data-theme', settings.theme[window.Telegram.WebApp.colorScheme]); document.documentElement.setAttribute('data-theme', settings.theme[tg.colorScheme]);
if (settings.night_auto) { if (settings.night_auto) {
window.Telegram.WebApp.onEvent('themeChanged', function () { tg.onEvent('themeChanged', function () {
document.documentElement.setAttribute('data-theme', settings.theme[this.colorScheme]); document.documentElement.setAttribute('data-theme', settings.theme[this.colorScheme]);
setTelegramUIColors(); setTelegramUIColors();
}); });
@@ -115,10 +116,12 @@ settings.load()
appLoading.unmount(); appLoading.unmount();
app.mount('#app'); app.mount('#app');
}) })
.then(() => window.Telegram.WebApp.ready()) .then(() => tg.ready())
.then(() => { .then(() => {
window.Telegram.WebApp.disableVerticalSwipes(); if (tg.platform !== 'tdesktop') {
window.Telegram.WebApp.requestFullscreen(); tg.disableVerticalSwipes();
tg.requestFullscreen();
}
}) })
.catch(error => { .catch(error => {
console.error(error); console.error(error);