@page "/setup/nameserver" @rendermode InteractiveServer @using CannedNet.Admin.Models @using System.Text.Json Nameserver Setup

Nameserver Endpoints

Configure the base server URL the game client connects to. All endpoints are derived from this URL.

@if (loading) {
} else if (!string.IsNullOrEmpty(error)) {
@error
} else {
@if (!string.IsNullOrEmpty(saveMessage)) { @saveMessage }
All endpoint URLs will use this as the base.
@foreach (var (name, path) in EndpointDefinitions.Endpoints) { }
Service Full URL
@name @(baseUrl.TrimEnd('/') + path)
} @code { [Inject] private HttpClient Http { get; set; } = default!; private bool loading = true; private bool saving; private bool saveError; private string? error; private string? saveMessage; private string baseUrl = ""; protected override async Task OnInitializedAsync() { try { var json = await Http.GetStringAsync("/admin/api/endpoints"); baseUrl = EndpointDefinitions.ExtractBaseUrl(json); } catch (Exception ex) { error = $"Failed to load: {ex.Message}"; } finally { loading = false; } } private async Task Save() { saving = true; saveMessage = null; saveError = false; try { var json = EndpointDefinitions.BuildEndpointsJson(baseUrl); var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); var response = await Http.PutAsync("/admin/api/endpoints", content); response.EnsureSuccessStatusCode(); saveMessage = "Saved successfully!"; } catch (Exception ex) { saveMessage = $"Error: {ex.Message}"; saveError = true; } finally { saving = false; } } }