feat(dashboard): use public_base_url helper for share link generation

This commit is contained in:
2026-04-16 00:18:45 -04:00
parent b7293588be
commit e118543b2e
2 changed files with 3 additions and 1 deletions
+3
View File
@@ -11,6 +11,7 @@ from roundtable.models.users import UserRole
from roundtable.models.hosts import Host
from roundtable.models.monitors import PingResult, DnsResult
from roundtable.models.dashboard import Dashboard, DashboardWidget, DashboardShareToken
from roundtable.core.settings import public_base_url
from roundtable.core.widgets import get_available_widgets, WIDGET_REGISTRY
dashboard_bp = Blueprint("dashboard", __name__)
@@ -522,12 +523,14 @@ async def create_share_token(dash_id: int):
result = await db.execute(select(Dashboard).where(Dashboard.id == dash_id))
dash = result.scalar_one_or_none()
share_url = f"{public_base_url(request)}/share/{raw_token}"
return await render_template(
"dashboard/share_created.html",
dashboard=dash,
raw_token=raw_token,
label=label,
expires_at=expires_at,
share_url=share_url,
)
@@ -9,7 +9,6 @@
Copy this link now — it cannot be shown again
</div>
{% set share_url = request.host_url.rstrip('/') + '/share/' + raw_token %}
<div style="display:flex;gap:0.5rem;align-items:center;">
<input type="text" id="share-url" value="{{ share_url }}" readonly
style="flex:1;font-family:ui-monospace,monospace;font-size:0.8rem;background:var(--bg);color:var(--text);">