wording and platform stats url flexibility

This commit is contained in:
Oliver Kieselbach
2026-02-18 12:56:54 +01:00
parent dc30e4c9dd
commit 03069b9478
2 changed files with 26 additions and 3 deletions
@@ -998,9 +998,9 @@ export default function AdminConfigurationPage() {
<label className="block">
<span className="text-gray-700 font-medium">Global Rate Limit (Requests per Minute per Device)</span>
<p className="text-sm text-gray-600 mb-2">
Configure default DoS protection limits for all tenants. This limit applies to all tenants by default. Normal enrollment generates ~10-30 requests/min.
Configure default DoS protection limits for all tenants. Normal enrollment generates ~10-30 requests/min.
<br />
<strong className="text-indigo-700">Note:</strong> Tenants cannot change this value. Only Galactic Admins can override per tenant directly in the database.
<strong className="text-indigo-700">Note:</strong> Tenants cannot change this value. Only Galactic Admins can override per tenant in tenant management section.
</p>
<input
type="number"
@@ -22,8 +22,31 @@ const DEFAULT_PLATFORM_STATS = {
uniqueDeviceModels: 1,
};
function resolvePlatformStatsManifestUrl(rawUrl?: string): string {
const trimmed = rawUrl?.trim();
if (!trimmed) {
return "/platform-stats.json";
}
const hashIndex = trimmed.indexOf("#");
const withoutHash = hashIndex >= 0 ? trimmed.slice(0, hashIndex) : trimmed;
const hash = hashIndex >= 0 ? trimmed.slice(hashIndex) : "";
const queryIndex = withoutHash.indexOf("?");
const basePath = queryIndex >= 0 ? withoutHash.slice(0, queryIndex) : withoutHash;
const query = queryIndex >= 0 ? withoutHash.slice(queryIndex) : "";
if (/\.json$/i.test(basePath)) {
return trimmed;
}
const normalizedBasePath = basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
const manifestPath = `${normalizedBasePath}/platform-stats.json`;
return `${manifestPath}${query}${hash}`;
}
const PLATFORM_STATS_MANIFEST_URL =
process.env.NEXT_PUBLIC_PLATFORM_STATS_MANIFEST_URL || "/platform-stats.json";
resolvePlatformStatsManifestUrl(process.env.NEXT_PUBLIC_PLATFORM_STATS_MANIFEST_URL);
const QUICK_START = [
{