Use server session check for access
This commit is contained in:
+10
-5
@@ -434,11 +434,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
return (window.matchMedia('(display-mode: standalone)').matches) || (window.navigator.standalone === true);
|
||||
}
|
||||
|
||||
// 조건: /findmydevice로 시작하고 access 쿠키가 없으며, PWA가 아닌 경우에만 리디렉션
|
||||
if (location.pathname.startsWith('/findmydevice') && getCookie('access') !== '9KxH6236' && !isInStandaloneMode()) {
|
||||
location.replace('/blog');
|
||||
return; // 이하 코드 실행 방지
|
||||
}
|
||||
if (location.pathname.startsWith('/findmydevice') && !isInStandaloneMode()) {
|
||||
fetch('/custom/launcher/api.php?session=1', { credentials: 'same-origin' })
|
||||
.then(res => res.ok ? res.json() : Promise.reject())
|
||||
.then(session => {
|
||||
if (!session.authenticated) {
|
||||
location.replace('/blog');
|
||||
}
|
||||
})
|
||||
.catch(() => location.replace('/blog'));
|
||||
}
|
||||
|
||||
const btnArea = document.querySelector('body > div.btnArea');
|
||||
const pageModifyLink = btnArea?.querySelectorAll('a')[1]?.getAttribute('href') || '';
|
||||
|
||||
Reference in New Issue
Block a user