Enhance API access control and update Docker configuration

- Added port mapping to docker-compose for local development.
- Modified the API to allow access from localhost without Telegram initData for local development.
- Updated the web application to check for localhost before denying access based on initData.
This commit is contained in:
2026-02-17 14:15:06 +03:00
parent 57c24a79af
commit 7cdf1edc34
3 changed files with 31 additions and 4 deletions

View File

@@ -36,6 +36,11 @@
return (window.Telegram && window.Telegram.WebApp && window.Telegram.WebApp.initData) || "";
}
function isLocalhost() {
var h = window.location.hostname;
return h === "localhost" || h === "127.0.0.1" || h === "";
}
function showAccessDenied() {
if (headerEl) headerEl.hidden = true;
if (weekdaysEl) weekdaysEl.hidden = true;
@@ -147,7 +152,8 @@
}
async function loadMonth() {
if (!getInitData()) {
var _initData = getInitData();
if (!_initData && !isLocalhost()) {
showAccessDenied();
return;
}