mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
feat: removed webp checking in every page
This commit is contained in:
parent
6664400d50
commit
43ce7e3810
@ -20,6 +20,7 @@ let systemColor
|
||||
export default function App({ Component, pageProps }: AppProps): JSX.Element {
|
||||
const [ betaKey, setBetaKey ] = useState('')
|
||||
const [ theme, setDefaultTheme ] = useState<string|undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
setBetaKey(localStorage.betaKey)
|
||||
console.log(
|
||||
@ -30,10 +31,6 @@ export default function App({ Component, pageProps }: AppProps): JSX.Element {
|
||||
'%c' + '이곳에 코드를 붙여넣으면 공격자에게 엑세스 토큰을 넘겨줄 수 있습니다!!',
|
||||
'color: #ff0000; font-size: 20px; font-weight: bold;'
|
||||
)
|
||||
if(!localStorage.webp) {
|
||||
if(canUseWebP()) localStorage.webp = true
|
||||
else localStorage.webp = false
|
||||
}
|
||||
try {
|
||||
systemColor = window.matchMedia('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light'
|
||||
} catch (e) {
|
||||
@ -71,14 +68,4 @@ export default function App({ Component, pageProps }: AppProps): JSX.Element {
|
||||
<Footer />
|
||||
</ThemeProvider>
|
||||
)
|
||||
}
|
||||
|
||||
function canUseWebP() {
|
||||
const elem = document.createElement('canvas')
|
||||
if (elem.getContext && elem.getContext('2d')) {
|
||||
// was able or not to get WebP representation
|
||||
return elem.toDataURL('image/webp').indexOf('data:image/webp') == 0
|
||||
}
|
||||
// very old browser like IE 8, canvas not supported
|
||||
return false
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user