Implement HTTP timeout configurations and enhance API documentation

- Added optional HTTP server timeout configurations (`HNHMAP_READ_TIMEOUT`, `HNHMAP_WRITE_TIMEOUT`, `HNHMAP_IDLE_TIMEOUT`) to `.env.example` and updated the server initialization in `main.go` to utilize these settings.
- Enhanced API documentation for the `rebuildZooms` endpoint to clarify its background processing and polling mechanism for status updates.
- Updated `configuration.md` to include new timeout environment variables for better configuration guidance.
- Improved error handling in the client for large request bodies, ensuring appropriate responses for oversized payloads.
This commit is contained in:
2026-03-04 11:59:28 +03:00
parent a3a4c0e896
commit dda35baeca
17 changed files with 396 additions and 73 deletions

View File

@@ -60,11 +60,11 @@
aria-label="Search users"
/>
</div>
<div class="flex flex-col gap-2">
<div class="flex flex-col gap-2 max-h-[60vh] overflow-y-auto">
<div
v-for="u in filteredUsers"
:key="u"
class="flex items-center justify-between gap-3 w-full p-3 rounded-lg bg-base-300/50 hover:bg-base-300/70 transition-colors"
class="flex items-center justify-between gap-3 w-full p-3 rounded-lg bg-base-300/50 hover:bg-base-300/70 transition-colors shrink-0"
>
<div class="flex items-center gap-2 min-w-0">
<div class="avatar avatar-placeholder">
@@ -103,7 +103,7 @@
aria-label="Search maps"
/>
</div>
<div class="overflow-x-auto">
<div class="overflow-x-auto max-h-[60vh] overflow-y-auto">
<table class="table table-sm table-zebra min-w-[32rem]">
<thead>
<tr>
@@ -199,7 +199,7 @@
</h2>
<div class="flex flex-col gap-3">
<div>
<a :href="api.adminExportUrl()" target="_blank" rel="noopener" class="btn btn-sm min-h-11 touch-manipulation">
<a :href="exportUrl" target="_blank" rel="noopener" class="btn btn-sm min-h-11 touch-manipulation">
Export zip
</a>
</div>
@@ -284,6 +284,7 @@ definePageMeta({ middleware: 'admin' })
useHead({ title: 'Admin HnH Map' })
const api = useMapApi()
const exportUrl = computed(() => api.adminExportUrl())
const toast = useToast()
const users = ref<string[]>([])
const maps = ref<MapInfoAdmin[]>([])
@@ -391,6 +392,15 @@ async function doRebuildZooms() {
rebuilding.value = true
try {
await api.adminRebuildZooms()
// Rebuild runs in background; poll status until done
const poll = async (): Promise<void> => {
const { running } = await api.adminRebuildZoomsStatus()
if (running) {
await new Promise((r) => setTimeout(r, 2000))
return poll()
}
}
await poll()
markRebuildDone()
showRebuildModal.value = false
toast.success('Zooms rebuilt.')