Use headers instead of params

This commit is contained in:
Lncvrt committed 2026-04-26 18:14:00 -07:00
1 parent f9e67fee0f
commit 998fb6d309
3 files changed
+52 -7

No files matched your search

@@ -6,10 +6,11 @@ import { BirdColor } from '@/types/BerryDash/BirdColor'
import { GetIconForUser } from '@/lib/berrydashutil' import { GetIconForUser } from '@/lib/berrydashutil'
import Image from 'next/image' import Image from 'next/image'
import { useRouter } from 'next/navigation' 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 { fetch } from '@tauri-apps/plugin-http'
import { verifySignature } from '@/lib/util' import { verifySignature } from '@/lib/util'
import Dropdown from '@/components/Dropdown' import Dropdown from '@/components/Dropdown'
import { app } from '@tauri-apps/api'
interface BaseEntry { interface BaseEntry {
id: number id: number
@@ -95,7 +96,14 @@ export default function BerryDashLeaderboards () {
try { try {
if (selected == 3 || selected == 4) { if (selected == 3 || selected == 4) {
const response = await fetch( 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 signature = response.headers.get('x-signature') ?? ''
const data = await response.json() const data = await response.json()
@@ -135,7 +143,14 @@ export default function BerryDashLeaderboards () {
? 'coin' ? 'coin'
: selected == 5 : selected == 5
? 'legacy' ? 'legacy'
: 'total') : 'total'),
{
headers: {
Requester: 'LncvrtGamesLauncherClient',
ClientVersion: await app.getVersion(),
ClientPlatform: platform() + '-' + arch()
}
}
) )
const signature = response.headers.get('x-signature') ?? '' const signature = response.headers.get('x-signature') ?? ''
const data = await response.json() const data = await response.json()
+16 -2
View File
@@ -271,7 +271,14 @@ export default function RootLayout ({
setVersion(client) setVersion(client)
try { try {
const response = await fetch( 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 signature = response.headers.get('x-signature') ?? ''
const data = await response.json() const data = await response.json()
@@ -509,7 +516,14 @@ export default function RootLayout ({
(downloadInfo.type == 1 (downloadInfo.type == 1
? info.modSupportDownload ? info.modSupportDownload
: downloadInfo.modDownload)) + : 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 signature = downloadInfoRequest.headers.get('x-signature') ?? ''
const data = await downloadInfoRequest.json() const data = await downloadInfoRequest.json()
+18 -2
View File
@@ -19,6 +19,7 @@ import { BaseDirectory, exists, remove } from '@tauri-apps/plugin-fs'
import { fetch } from '@tauri-apps/plugin-http' import { fetch } from '@tauri-apps/plugin-http'
import { arch, platform } from '@tauri-apps/plugin-os' import { arch, platform } from '@tauri-apps/plugin-os'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { app } from '@tauri-apps/api'
export default function ModDownloadsPopup () { export default function ModDownloadsPopup () {
const { const {
@@ -39,7 +40,14 @@ export default function ModDownloadsPopup () {
if (!managingVersion) return if (!managingVersion) return
;(async () => { ;(async () => {
const response = await fetch( 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 signature = response.headers.get('x-signature') ?? ''
const data = await response.json() const data = await response.json()
@@ -64,7 +72,15 @@ export default function ModDownloadsPopup () {
onClick={async () => { onClick={async () => {
setMods(0) setMods(0)
const response = await fetch( 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 signature = response.headers.get('x-signature') ?? ''
const data = await response.json() const data = await response.json()