Skip to content

Commit

Permalink
Default to Jungle4 on non-production builds
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Jan 6, 2025
1 parent 5acab34 commit 867199f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sequence } from '@sveltejs/kit/hooks';
import type { Handle, RequestEvent } from '@sveltejs/kit';

import { PUBLIC_ENVIRONMENT } from '$env/static/public';
import { availableLanguageTags } from '$lib/paraglide/runtime.js';
import { i18n } from '$lib/i18n';
import { isNetworkShortName } from '$lib/wharf/chains';
Expand Down Expand Up @@ -63,7 +64,7 @@ export async function redirectHandle({ event, resolve }: HandleParams): Promise<
const [, pathFirst, pathSecond, ...pathMore] = pathname.split('/').map((p) => p.trim());

let lang = 'en';
let network: string | undefined = 'eos';
let network: string | undefined = PUBLIC_ENVIRONMENT !== 'production' ? 'jungle4' : 'eos';

if (isLanguage(pathFirst) && isNetwork(pathSecond)) {
// Proceed, correct URL
Expand All @@ -72,7 +73,6 @@ export async function redirectHandle({ event, resolve }: HandleParams): Promise<
} else if (isLanguage(pathFirst) && !isNetwork(pathSecond) && !pathSecond) {
// Only a language is specified, land on the language specific homepage
lang = pathFirst;
network = undefined;
} else if (isLanguage(pathFirst) && !isNetwork(pathSecond)) {
// The network isn't specified, but the language is - redirect to the default network
lang = pathFirst;
Expand Down Expand Up @@ -103,7 +103,6 @@ export async function redirectHandle({ event, resolve }: HandleParams): Promise<
}

if (pathname !== url) {
console.log('redirecting to', url + search);
return new Response(undefined, {
headers: { Location: url + search },
status: 301
Expand Down

0 comments on commit 867199f

Please sign in to comment.