diff --git a/packages/core/src/blitzkit/alias.ts b/packages/core/src/blitzkit/alias.ts index 67e1f8d71..ad648f35f 100644 --- a/packages/core/src/blitzkit/alias.ts +++ b/packages/core/src/blitzkit/alias.ts @@ -1,6 +1,5 @@ import { environmentConfig } from "@blitzkit/core"; -// TODO: remove the need for a `/ in the front of all paths export function alias(alias: string, path: string) { const environment = environmentConfig(); @@ -8,7 +7,7 @@ export function alias(alias: string, path: string) { throw new Error(`Invalid alias "${alias}"`); } - const base = environment.aliases[alias]; + const base = environment.aliases[alias].replace(/\/$/, ""); - return `${base}${path}`; + return `${base}/${path}`; } diff --git a/packages/core/src/blitzkit/api/client.ts b/packages/core/src/blitzkit/api/client.ts index d8e5a2cb0..9fddb1b25 100644 --- a/packages/core/src/blitzkit/api/client.ts +++ b/packages/core/src/blitzkit/api/client.ts @@ -21,26 +21,26 @@ import { Cache } from "./cache"; export class ClientBlitzKitAPI extends AbstractBlitzKitAPI { @Cache() game() { - return fetchPB(alias("api", "/definitions/game.pb"), GameDefinitions); + return fetchPB(alias("api", "definitions/game.pb"), GameDefinitions); } @Cache() consumables() { return fetchPB( - alias("api", "/definitions/consumables.pb"), + alias("api", "definitions/consumables.pb"), ConsumableDefinitions, ); } @Cache() tanks() { - return fetchPB(alias("api", "/definitions/tanks.pb"), TankDefinitions); + return fetchPB(alias("api", "definitions/tanks.pb"), TankDefinitions); } @Cache() camouflages() { return fetchPB( - alias("api", "/definitions/camouflage.pb"), + alias("api", "definitions/camouflage.pb"), CamouflageDefinitions, ); } @@ -48,46 +48,46 @@ export class ClientBlitzKitAPI extends AbstractBlitzKitAPI { @Cache() provisions() { return fetchPB( - alias("api", "/definitions/provisions.pb"), + alias("api", "definitions/provisions.pb"), ProvisionDefinitions, ); } @Cache() models() { - return fetchPB(alias("api", "/definitions/models.pb"), ModelDefinitions); + return fetchPB(alias("api", "definitions/models.pb"), ModelDefinitions); } @Cache() skills() { - return fetchPB(alias("api", "/definitions/skills.pb"), SkillDefinitions); + return fetchPB(alias("api", "definitions/skills.pb"), SkillDefinitions); } @Cache() equipment() { return fetchPB( - alias("api", "/definitions/equipment.pb"), + alias("api", "definitions/equipment.pb"), EquipmentDefinitions, ); } @Cache() gallery() { - return fetchPB(alias("api", "/definitions/gallery.pb"), Gallery); + return fetchPB(alias("api", "definitions/gallery.pb"), Gallery); } @Cache() maps() { - return fetchPB(alias("api", "/definitions/maps.pb"), MapDefinitions); + return fetchPB(alias("api", "definitions/maps.pb"), MapDefinitions); } @Cache() scripts() { - return fetchJSON(alias("api", "/definitions/scripts.json")); + return fetchJSON(alias("api", "definitions/scripts.json")); } @Cache() strings(locale: string) { - return fetchJSON(alias("api", `/strings/${locale}.json`)); + return fetchJSON(alias("api", `strings/${locale}.json`)); } } diff --git a/packages/core/src/blitzkit/tankIcon.ts b/packages/core/src/blitzkit/tankIcon.ts index 8eef1203d..0f8c56db9 100644 --- a/packages/core/src/blitzkit/tankIcon.ts +++ b/packages/core/src/blitzkit/tankIcon.ts @@ -3,5 +3,5 @@ import { alias } from "@blitzkit/core"; export const BLITZKIT_TANK_ICON_SIZE = { width: 40 * 16, height: 30 * 16 }; export function tankIcon(id: number, size: "big" | "small" = "big") { - return alias("api", `/tanks/${id}/icons/${size}.webp`); + return alias("api", `tanks/${id}/icons/${size}.webp`); } diff --git a/packages/website/src/components/AvatarCard.tsx b/packages/website/src/components/AvatarCard.tsx index 56813d099..0b2edf540 100644 --- a/packages/website/src/components/AvatarCard.tsx +++ b/packages/website/src/components/AvatarCard.tsx @@ -16,7 +16,7 @@ type GalleryCardProps = MaybeSkeletonComponentProps<{ export function AvatarCard(props: GalleryCardProps) { const src = alias( "api", - `/gallery/avatars/${ + `gallery/avatars/${ !props.skeleton && `${props.avatar.id}${props.avatar.extension}` }` ); diff --git a/packages/website/src/components/CompareLoadout/index.tsx b/packages/website/src/components/CompareLoadout/index.tsx index ed753e4ef..eed09bc98 100644 --- a/packages/website/src/components/CompareLoadout/index.tsx +++ b/packages/website/src/components/CompareLoadout/index.tsx @@ -114,7 +114,7 @@ function Camouflage({ index }: SectionProps) { > ); @@ -133,7 +133,7 @@ function ModulesSummary(props: SummaryProps) { key={module} alt={strings.tanks.loadout.module_types[module]} className={styles["summary-module"]} - src={alias("api", `/icons/modules/${module}.webp`)} + src={alias("api", `icons/modules/${module}.webp`)} /> ))} @@ -162,7 +162,7 @@ function ItemsSummary({ index, kind, ...props }: ItemsSummaryProps) { : consumables.consumables[id].name, )} className={styles["summary-item"]} - src={alias("api", `/icons/${kind}/${id}.webp`)} + src={alias("api", `icons/${kind}/${id}.webp`)} /> ))} diff --git a/packages/website/src/components/CompareTable/index.tsx b/packages/website/src/components/CompareTable/index.tsx index ac5f8318e..bd874955b 100644 --- a/packages/website/src/components/CompareTable/index.tsx +++ b/packages/website/src/components/CompareTable/index.tsx @@ -184,7 +184,7 @@ function ShellSwitcher({ member, index }: ShellSwitcherProps) { > diff --git a/packages/website/src/components/CustomShellButton/index.tsx b/packages/website/src/components/CustomShellButton/index.tsx index 8a1862682..fd4804de0 100644 --- a/packages/website/src/components/CustomShellButton/index.tsx +++ b/packages/website/src/components/CustomShellButton/index.tsx @@ -198,7 +198,7 @@ export function CustomShellButton() { alt={strings.common.shells[label]} src={alias( "api", - `/icons/shells/${label}.webp`, + `icons/shells/${label}.webp`, )} /> diff --git a/packages/website/src/components/Guesser/index.tsx b/packages/website/src/components/Guesser/index.tsx index 9c2944f44..dc0c001b9 100644 --- a/packages/website/src/components/Guesser/index.tsx +++ b/packages/website/src/components/Guesser/index.tsx @@ -124,7 +124,7 @@ export function Guesser() { text={unwrap(result.name!)} prefix={ } discriminator={ diff --git a/packages/website/src/components/HomeHero.astro b/packages/website/src/components/HomeHero.astro index 105ab3e80..4b52ea7af 100644 --- a/packages/website/src/components/HomeHero.astro +++ b/packages/website/src/components/HomeHero.astro @@ -76,7 +76,7 @@ const season = SEASONS[Math.floor(((month + 2) % 12) / 3)]; class="wrapper" style={{ backgroundPosition: season.position, - backgroundImage: `url(${alias("api", `/hero/${season.name}.webp`)})`, + backgroundImage: `url(${alias("api", `hero/${season.name}.webp`)})`, }} >
diff --git a/packages/website/src/components/LoadoutAugments/index.tsx b/packages/website/src/components/LoadoutAugments/index.tsx index 473f6ff27..5f9c73c6f 100644 --- a/packages/website/src/components/LoadoutAugments/index.tsx +++ b/packages/website/src/components/LoadoutAugments/index.tsx @@ -34,7 +34,7 @@ function AugmentIcon({ icon, isCommon }: AugmentIconProps) { return ( ); @@ -59,7 +59,7 @@ function Price({ xp }: PriceProps) { return (
{formatCompact(locale, xp)} - +
); } diff --git a/packages/website/src/components/LoadoutConsumables/index.tsx b/packages/website/src/components/LoadoutConsumables/index.tsx index f405e8604..2e6737cac 100644 --- a/packages/website/src/components/LoadoutConsumables/index.tsx +++ b/packages/website/src/components/LoadoutConsumables/index.tsx @@ -59,7 +59,7 @@ function Content({ tank, gun, selected, onToggle }: ContentProps) { onClick={() => onToggle(consumable.id)} >
{duration > 0 && ( diff --git a/packages/website/src/components/LoadoutEquipment/index.tsx b/packages/website/src/components/LoadoutEquipment/index.tsx index 853199314..59a8d484b 100644 --- a/packages/website/src/components/LoadoutEquipment/index.tsx +++ b/packages/website/src/components/LoadoutEquipment/index.tsx @@ -73,7 +73,7 @@ function Slot({ slot, slotIndex, selected, onToggle }: SlotProps) { > diff --git a/packages/website/src/components/LoadoutModules/index.tsx b/packages/website/src/components/LoadoutModules/index.tsx index bb46776a6..5f306f8fb 100644 --- a/packages/website/src/components/LoadoutModules/index.tsx +++ b/packages/website/src/components/LoadoutModules/index.tsx @@ -228,7 +228,7 @@ function ModuleNode({ ? tankIcon(unlock.id) : alias( "api", - `/icons/modules/${moduleIconNames[unlock.type]}.webp`, + `icons/modules/${moduleIconNames[unlock.type]}.webp`, ) } /> @@ -240,7 +240,7 @@ function ModuleNode({ {formatCompact(locale, unlock.cost!.value)}
)} diff --git a/packages/website/src/components/LoadoutProvisions/index.tsx b/packages/website/src/components/LoadoutProvisions/index.tsx index 72be76715..6e73c83e8 100644 --- a/packages/website/src/components/LoadoutProvisions/index.tsx +++ b/packages/website/src/components/LoadoutProvisions/index.tsx @@ -57,7 +57,7 @@ function Content({ onClick={() => onToggle(provision.id)} > diff --git a/packages/website/src/components/LoadoutShells/index.tsx b/packages/website/src/components/LoadoutShells/index.tsx index 120c9506d..bc2c030a5 100644 --- a/packages/website/src/components/LoadoutShells/index.tsx +++ b/packages/website/src/components/LoadoutShells/index.tsx @@ -37,7 +37,7 @@ export function LoadoutShells({ gun, selected, onSelect }: LoadoutShellsProps) { > diff --git a/packages/website/src/components/LoadoutSkills/index.tsx b/packages/website/src/components/LoadoutSkills/index.tsx index ab0e5226c..50ef659c5 100644 --- a/packages/website/src/components/LoadoutSkills/index.tsx +++ b/packages/website/src/components/LoadoutSkills/index.tsx @@ -50,7 +50,7 @@ function Content({ selected, onChange }: ContentProps) { } }} > - + {level > 0 && ( {romanize(level)} )} diff --git a/packages/website/src/components/MixerModuleChooser/index.tsx b/packages/website/src/components/MixerModuleChooser/index.tsx index 75c1cdf4c..dd6f0b222 100644 --- a/packages/website/src/components/MixerModuleChooser/index.tsx +++ b/packages/website/src/components/MixerModuleChooser/index.tsx @@ -63,7 +63,7 @@ export function MixerModuleChooser({ style={{ backgroundImage: `url(${alias( "api", - `/tanks/${tank}/icons/big.webp`, + `tanks/${tank}/icons/big.webp`, )})`, }} /> @@ -105,7 +105,7 @@ export function MixerModuleChooser({ > @@ -140,7 +140,7 @@ export function MixerModuleChooser({ > diff --git a/packages/website/src/components/NavbarBig.astro b/packages/website/src/components/NavbarBig.astro index 7d362d729..f3304ce33 100644 --- a/packages/website/src/components/NavbarBig.astro +++ b/packages/website/src/components/NavbarBig.astro @@ -361,7 +361,7 @@ const groups = toolGroups.map((group) => { class="thumbnail" style={`background-image: url(${alias( "api", - `/tools/${tool.id}/banners/thumbnail.webp`, + `tools/${tool.id}/banners/thumbnail.webp`, )})`} /> diff --git a/packages/website/src/components/NavbarSmall.astro b/packages/website/src/components/NavbarSmall.astro index 84cc46375..ce09fe4e2 100644 --- a/packages/website/src/components/NavbarSmall.astro +++ b/packages/website/src/components/NavbarSmall.astro @@ -230,7 +230,7 @@ const filtered = Object.values(tools).filter(