Remove standalone Activity log page (Refs #153)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { activityRedirectHref } from './activity-redirect.js';
|
||||
|
||||
const origin = 'https://electric-cherry.invalid';
|
||||
const pagePath =
|
||||
/^\/(?:$|activity|operations|autoscaling|account|bank|capacity|metrics|server-keys|settings(?:\/users)?|servers\/[^/]+|hosts(?:\/[^/]+)?|collections(?:\/launches\/[^/]+)?|(?:scripts|configs|plugins|betas|campaigns|maintenance|provisioning|matches)(?:\/[^/]+)?|game-files|leaderboard(?:\/players\/[^/]+(?:\/[^/]+)?)?)$/;
|
||||
@@ -16,6 +18,8 @@ export function safeReturnHref(value: string | null | undefined, fallback: strin
|
||||
try {
|
||||
const url = new URL(value, origin);
|
||||
if (url.origin !== origin || !pagePath.test(url.pathname)) return fallback;
|
||||
if (url.pathname === '/activity' || url.pathname === '/operations')
|
||||
return activityRedirectHref(url);
|
||||
return url.pathname + url.search + url.hash;
|
||||
} catch {
|
||||
return fallback;
|
||||
@@ -45,8 +49,6 @@ export function returnLabel(href: string): string {
|
||||
if (path.startsWith('/hosts/')) return 'Back to host';
|
||||
const names: Record<string, string> = {
|
||||
'': 'Servers',
|
||||
activity: 'Activity',
|
||||
operations: 'Activity',
|
||||
autoscaling: 'Autoscaling',
|
||||
collections: 'Collections',
|
||||
hosts: 'Hosts',
|
||||
|
||||
Reference in New Issue
Block a user