나의 찾기 인증 안내 화면 정리
This commit is contained in:
+20
-13
@@ -539,21 +539,28 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
location.href = '/blog';
|
||||
});
|
||||
|
||||
// PWA 상태인지 확인 (iOS 및 기타 브라우저 지원)
|
||||
function isInStandaloneMode() {
|
||||
return (window.matchMedia('(display-mode: standalone)').matches) || (window.navigator.standalone === true);
|
||||
function renderAuthErrorPage() {
|
||||
document.body.innerHTML = `
|
||||
<main class="find-auth-error">
|
||||
<section class="find-auth-error-box">
|
||||
<h1>인증이 필요합니다</h1>
|
||||
<p>런처에서 관리자 세션 또는 공통 비밀번호 인증을 완료한 뒤 나의 찾기에 접속할 수 있습니다.</p>
|
||||
<a href="/blog">런처로 이동</a>
|
||||
</section>
|
||||
</main>
|
||||
`;
|
||||
}
|
||||
|
||||
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'));
|
||||
}
|
||||
if (location.pathname.startsWith('/findmydevice')) {
|
||||
fetch('/custom/launcher/api.php?session=1', { credentials: 'same-origin' })
|
||||
.then(res => res.ok ? res.json() : Promise.reject())
|
||||
.then(session => {
|
||||
if (!session.authenticated) {
|
||||
renderAuthErrorPage();
|
||||
}
|
||||
})
|
||||
.catch(renderAuthErrorPage);
|
||||
}
|
||||
|
||||
const btnArea = document.querySelector('body > div.btnArea');
|
||||
const pageModifyLink = btnArea?.querySelectorAll('a')[1]?.getAttribute('href') || '';
|
||||
|
||||
Reference in New Issue
Block a user