Load leaflet protomaps only if not selfhosted on public month page

This commit is contained in:
Eugene Burmakin 2025-09-13 12:07:29 +02:00
parent cc1fecfd22
commit ef01d028ba
2 changed files with 9 additions and 7 deletions

View file

@ -34,7 +34,7 @@ export default class extends Controller {
const formData = new FormData()
formData.append('enabled', this.enableToggleTarget.checked ? '1' : '0')
if (this.enableToggleTarget.checked && this.hasExpirationSelectTarget) {
formData.append('expiration', this.expirationSelectTarget.value || '1h')
} else if (this.enableToggleTarget.checked) {
@ -55,13 +55,13 @@ export default class extends Controller {
.then(response => response.json())
.then(data => {
this.hideLoadingState()
if (data.success) {
// Update sharing link if provided
if (data.sharing_url) {
this.sharingLinkTarget.value = data.sharing_url
}
// Show a subtle notification for auto-save
this.showNotification("✓ Auto-saved", "success")
} else {
@ -128,4 +128,4 @@ export default class extends Controller {
toast.remove()
}, 3000)
}
}
}

View file

@ -19,9 +19,11 @@
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<!-- ProtomapsL for vector tiles -->
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
<% if @self_hosted %>
<!-- ProtomapsL for vector tiles -->
<script src="https://unpkg.com/protomaps-leaflet@5.0.0/dist/protomaps-leaflet.js"></script>
<% end %>
</head>
<body data-theme="dark">
<div class="min-h-screen bg-base-100 mx-auto">