From ad51007693c419af816c3ff4ee85b13081358089 Mon Sep 17 00:00:00 2001 From: Alexander Tarasov Date: Mon, 21 Jul 2025 05:07:09 +0300 Subject: [PATCH] add is_portrait() function --- web/misc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/misc.py b/web/misc.py index eb94e27..356dd31 100644 --- a/web/misc.py +++ b/web/misc.py @@ -55,3 +55,10 @@ async def default_page_setup(): ui.add_head_html("") await ui.context.client.connected(timeout=config.CONNECTION_TIMEOUT_SECONDS) ui.timer(60, update_user) + + +async def is_portrait(): + width, height = await ui.run_javascript("return [window.screen.availWidth, window.screen.availHeight]") + if width > height: + return False + return True