add profile fix

This commit is contained in:
2025-04-13 12:56:34 +02:00
parent 69409e3543
commit 9872a39b9d
8 changed files with 622 additions and 3 deletions

View File

@@ -0,0 +1,76 @@
'use client'
import {
Dropzone,
DropzoneDescription,
DropzoneGroup,
DropzoneInput,
DropzoneTitle,
DropzoneUploadIcon,
DropzoneZone,
} from '@/components/ui/dropzone'
async function fixFile(file: File) {
try {
const response = await fetch('https://profile-fix.balatromp.com/fix', {
method: 'POST',
body: (() => {
const formData = new FormData()
formData.append('file', file)
return formData
})(),
})
if (!response.ok) {
throw new Error(
`server returned ${response.status}: ${await response.text()}`
)
}
// get the blob from response
const blob = await response.blob()
// create download link
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = file.name // or whatever name you want
document.body.appendChild(a)
a.click()
// cleanup
window.URL.revokeObjectURL(url)
document.body.removeChild(a)
} catch (err) {
console.error('failed to fix file:', err)
throw err
}
}
export function FileUploader() {
return (
<Dropzone
onDropAccepted={(files) => {
const file = files[0]
if (!(file instanceof File)) {
return
}
return fixFile(file)
}}
>
<DropzoneZone className={'w-full'}>
<DropzoneInput />
<DropzoneGroup className='gap-4'>
<DropzoneUploadIcon />
<DropzoneGroup>
<DropzoneTitle>Drop files here or click to upload</DropzoneTitle>
<DropzoneDescription>
Upload your corrupted <strong>profile.jkr</strong> and get a fixed
version.
</DropzoneDescription>
</DropzoneGroup>
</DropzoneGroup>
</DropzoneZone>
</Dropzone>
)
}

View File

@@ -0,0 +1,90 @@
import { CopyCode } from '@/components/copy-code'
import { Button } from '@/components/ui/button'
import {
Dialog,
DialogClose,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
import { FileUploader } from './file-uploader'
export const metadata = {
title: 'Fix Corrupted Profile',
description: 'Fix your corrupted profile.jkr file.',
}
export default async function Home() {
return (
<div
className={
'mx-auto flex w-[calc(100%-1rem)] max-w-fd-container flex-col items-end gap-4 pt-16'
}
>
<Dialog>
<DialogTrigger asChild>
<Button variant='outline'>Where is my profile.jkr?</Button>
</DialogTrigger>
<DialogContent className='overflow-auto sm:max-w-[1025px]'>
<DialogHeader>
<DialogTitle>Where to find your profile.jkr</DialogTitle>
</DialogHeader>
<div className='prose'>
<div>
<h3>Windows</h3>
<ol>
<li>Open File Explorer and click the address bar</li>
<li>
Type: <CopyCode>%AppData%/Balatro</CopyCode>
</li>
<li>
Press <kbd>Enter</kbd>
</li>
<li>Choose from folder 1, 2, or 3</li>
</ol>
</div>
<div>
<h3>MacOS</h3>
<ol>
<li>Open Finder</li>
<li>
Press <kbd>Shift</kbd> + <kbd>Command</kbd> + <kbd>G</kbd>
</li>
<li>
Type:{' '}
<CopyCode>~/Library/Application Support/Balatro</CopyCode>
</li>
<li>
Press <kbd>Enter</kbd>
</li>
<li>Choose from folder 1, 2, or 3</li>
</ol>
</div>
<div>
<h3>Steam Deck</h3>
<ol>
<li>
Navigate to:{' '}
<CopyCode>
~/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro
</CopyCode>
</li>
<li>Choose from folder 1, 2, or 3</li>
</ol>
</div>
</div>
<DialogFooter>
<DialogClose asChild>
<Button type='button'>Got it</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
<FileUploader />
</div>
)
}

View File

@@ -1,5 +1,5 @@
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'
import { BookOpen, CircleDollarSign, Info, Trophy } from 'lucide-react'
import { BookOpen, CircleDollarSign, Info, Trophy, Upload } from 'lucide-react'
import { Header } from './_components/header'
const links = [
@@ -23,6 +23,11 @@ const links = [
url: 'https://ko-fi.com/virtualized/shop',
icon: <CircleDollarSign />,
},
{
text: 'Fix Corrupted Profile',
url: '/profile-fix',
icon: <Upload />,
},
// {
// text: 'Credits',
// url: '/credits',