mirror of
https://github.com/HugeFrog24/shakethefrog.git
synced 2026-03-02 08:24:33 +00:00
RCE fix
This commit is contained in:
18
app/hooks/useSkin.ts
Normal file
18
app/hooks/useSkin.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
'use client';
|
||||
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import { appConfig } from '../config/app';
|
||||
import { SkinId } from '../types';
|
||||
|
||||
export function useSkin() {
|
||||
const searchParams = useSearchParams();
|
||||
const skinParam = searchParams.get('skin');
|
||||
|
||||
// Validate that the skin exists in our config
|
||||
const isValidSkin = skinParam && Object.keys(appConfig.skins).includes(skinParam);
|
||||
|
||||
// Return the skin from URL if valid, otherwise return default skin
|
||||
const currentSkin = (isValidSkin ? skinParam : appConfig.defaultSkin) as SkinId;
|
||||
|
||||
return currentSkin;
|
||||
}
|
||||
Reference in New Issue
Block a user