Update docker
This commit is contained in:
@@ -9,7 +9,29 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ../:/app
|
||||
# Force use of the container database
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://marzban:marzban_pass@db:5432/marzban_bot
|
||||
env_file:
|
||||
- ../.env
|
||||
ports:
|
||||
- "8888:8888"
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
container_name: marzban_db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: marzban
|
||||
POSTGRES_PASSWORD: marzban_pass
|
||||
POSTGRES_DB: marzban_bot
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
# Expose port if you want to connect externally (e.g. DBeaver)
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
@@ -183,6 +183,25 @@ function showAccessDenied() {
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
function showInviteRequired() {
|
||||
document.body.innerHTML = '';
|
||||
document.body.style.display = 'block';
|
||||
const div = document.createElement('div');
|
||||
div.style.cssText = 'display:flex; flex-direction:column; align-items:center; justify-content:center; height:100vh; padding:24px; text-align:center; background:var(--md-sys-color-background); color:var(--md-sys-color-on-background); font-family:var(--font-brand);';
|
||||
|
||||
div.innerHTML = `
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="var(--md-sys-color-error)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom:24px;"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><path d="m9 16 2 2 4-4"/></svg>
|
||||
<h1 style="font-size:24px; font-weight:600; margin-bottom:16px;">Registration Required</h1>
|
||||
<p style="font-size:16px; opacity:0.7; max-width:320px; margin-bottom:32px; line-height:1.5;">
|
||||
You need to activate the bot with an invite code to use this app.
|
||||
</p>
|
||||
<button onclick="window.Telegram?.WebApp?.close()" style="background:var(--md-sys-color-primary); color:var(--md-sys-color-on-primary); padding:12px 24px; border-radius:100px; border:none; font-size:16px; font-weight:500; cursor:pointer;">
|
||||
Close App
|
||||
</button>
|
||||
`;
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
function initApp() {
|
||||
// Enhanced OS Detection
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
@@ -361,6 +380,12 @@ async function loadDashboard() {
|
||||
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/user/${currentState.user.id}`);
|
||||
|
||||
if (res.status === 404) {
|
||||
showInviteRequired();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.error) throw new Error(data.error);
|
||||
|
||||
Reference in New Issue
Block a user