From 998fb6d30992314374478d4d26969c47e76ebfe2 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Sun, 26 Apr 2026 18:14:00 -0700 Subject: [PATCH] Use headers instead of params --- .../main/game/berrydash/leaderboards/page.tsx | 21 ++++++++++++++++--- src/app/main/layout.tsx | 18 ++++++++++++++-- src/popups/ModDownloads.tsx | 20 ++++++++++++++++-- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/app/main/game/berrydash/leaderboards/page.tsx b/src/app/main/game/berrydash/leaderboards/page.tsx index 9f9f347..a341efe 100644 --- a/src/app/main/game/berrydash/leaderboards/page.tsx +++ b/src/app/main/game/berrydash/leaderboards/page.tsx @@ -6,10 +6,11 @@ import { BirdColor } from '@/types/BerryDash/BirdColor' import { GetIconForUser } from '@/lib/berrydashutil' import Image from 'next/image' import { useRouter } from 'next/navigation' -import { platform } from '@tauri-apps/plugin-os' +import { arch, platform } from '@tauri-apps/plugin-os' import { fetch } from '@tauri-apps/plugin-http' import { verifySignature } from '@/lib/util' import Dropdown from '@/components/Dropdown' +import { app } from '@tauri-apps/api' interface BaseEntry { id: number @@ -95,7 +96,14 @@ export default function BerryDashLeaderboards () { try { if (selected == 3 || selected == 4) { const response = await fetch( - 'https://games.lncvrt.xyz/api/berrydash/account?username=' + 'https://games.lncvrt.xyz/api/berrydash/account?username=', + { + headers: { + Requester: 'LncvrtGamesLauncherClient', + ClientVersion: await app.getVersion(), + ClientPlatform: platform() + '-' + arch() + } + } ) const signature = response.headers.get('x-signature') ?? '' const data = await response.json() @@ -135,7 +143,14 @@ export default function BerryDashLeaderboards () { ? 'coin' : selected == 5 ? 'legacy' - : 'total') + : 'total'), + { + headers: { + Requester: 'LncvrtGamesLauncherClient', + ClientVersion: await app.getVersion(), + ClientPlatform: platform() + '-' + arch() + } + } ) const signature = response.headers.get('x-signature') ?? '' const data = await response.json() diff --git a/src/app/main/layout.tsx b/src/app/main/layout.tsx index c3c6967..fadb024 100644 --- a/src/app/main/layout.tsx +++ b/src/app/main/layout.tsx @@ -271,7 +271,14 @@ export default function RootLayout ({ setVersion(client) try { const response = await fetch( - `https://games.lncvrt.xyz/api/launcher/versions?platform=${platform()}&arch=${arch()}` + 'https://games.lncvrt.xyz/api/launcher/versions', + { + headers: { + Requester: 'LncvrtGamesLauncherClient', + ClientVersion: await app.getVersion(), + ClientPlatform: platform() + '-' + arch() + } + } ) const signature = response.headers.get('x-signature') ?? '' const data = await response.json() @@ -509,7 +516,14 @@ export default function RootLayout ({ (downloadInfo.type == 1 ? info.modSupportDownload : downloadInfo.modDownload)) + - (downloadInfo.type == 2 ? '&modId=' + downloadInfo.modId : '') + (downloadInfo.type == 2 ? '&modId=' + downloadInfo.modId : ''), + { + headers: { + Requester: 'LncvrtGamesLauncherClient', + ClientVersion: await app.getVersion(), + ClientPlatform: platform() + '-' + arch() + } + } ) const signature = downloadInfoRequest.headers.get('x-signature') ?? '' const data = await downloadInfoRequest.json() diff --git a/src/popups/ModDownloads.tsx b/src/popups/ModDownloads.tsx index 266e2fe..117a03a 100644 --- a/src/popups/ModDownloads.tsx +++ b/src/popups/ModDownloads.tsx @@ -19,6 +19,7 @@ import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs' import { fetch } from '@tauri-apps/plugin-http' import { arch, platform } from '@tauri-apps/plugin-os' import { useEffect, useState } from 'react' +import { app } from '@tauri-apps/api' export default function ModDownloadsPopup () { const { @@ -39,7 +40,14 @@ export default function ModDownloadsPopup () { if (!managingVersion) return ;(async () => { const response = await fetch( - `https://games.lncvrt.xyz/api/launcher/mods?platform=${platform()}&arch=${arch()}&version=${managingVersion}` + 'https://games.lncvrt.xyz/api/launcher/mods?version=' + managingVersion, + { + headers: { + Requester: 'LncvrtGamesLauncherClient', + ClientVersion: await app.getVersion(), + ClientPlatform: platform() + '-' + arch() + } + } ) const signature = response.headers.get('x-signature') ?? '' const data = await response.json() @@ -64,7 +72,15 @@ export default function ModDownloadsPopup () { onClick={async () => { setMods(0) const response = await fetch( - `https://games.lncvrt.xyz/api/launcher/mods?platform=${platform()}&arch=${arch()}&version=${managingVersion}` + 'https://games.lncvrt.xyz/api/launcher/mods?version=' + + managingVersion, + { + headers: { + Requester: 'LncvrtGamesLauncherClient', + ClientVersion: await app.getVersion(), + ClientPlatform: platform() + '-' + arch() + } + } ) const signature = response.headers.get('x-signature') ?? '' const data = await response.json()