feat(dashboard): use public_base_url helper for share link generation
This commit is contained in:
@@ -11,6 +11,7 @@ from roundtable.models.users import UserRole
|
|||||||
from roundtable.models.hosts import Host
|
from roundtable.models.hosts import Host
|
||||||
from roundtable.models.monitors import PingResult, DnsResult
|
from roundtable.models.monitors import PingResult, DnsResult
|
||||||
from roundtable.models.dashboard import Dashboard, DashboardWidget, DashboardShareToken
|
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
|
from roundtable.core.widgets import get_available_widgets, WIDGET_REGISTRY
|
||||||
|
|
||||||
dashboard_bp = Blueprint("dashboard", __name__)
|
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))
|
result = await db.execute(select(Dashboard).where(Dashboard.id == dash_id))
|
||||||
dash = result.scalar_one_or_none()
|
dash = result.scalar_one_or_none()
|
||||||
|
|
||||||
|
share_url = f"{public_base_url(request)}/share/{raw_token}"
|
||||||
return await render_template(
|
return await render_template(
|
||||||
"dashboard/share_created.html",
|
"dashboard/share_created.html",
|
||||||
dashboard=dash,
|
dashboard=dash,
|
||||||
raw_token=raw_token,
|
raw_token=raw_token,
|
||||||
label=label,
|
label=label,
|
||||||
expires_at=expires_at,
|
expires_at=expires_at,
|
||||||
|
share_url=share_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
Copy this link now — it cannot be shown again
|
Copy this link now — it cannot be shown again
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% set share_url = request.host_url.rstrip('/') + '/share/' + raw_token %}
|
|
||||||
<div style="display:flex;gap:0.5rem;align-items:center;">
|
<div style="display:flex;gap:0.5rem;align-items:center;">
|
||||||
<input type="text" id="share-url" value="{{ share_url }}" readonly
|
<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);">
|
style="flex:1;font-family:ui-monospace,monospace;font-size:0.8rem;background:var(--bg);color:var(--text);">
|
||||||
|
|||||||
Reference in New Issue
Block a user