나의 찾기 인증 안내 화면 정리

This commit is contained in:
seo
2026-06-26 19:31:20 +09:00
parent 325d521044
commit d471799c5c
2 changed files with 21 additions and 14 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ Home Assistant에 기록된 Galaxy Z Fold7의 위치, 배터리, 활동 상태,
인증과 Home Assistant 호출은 `/custom/common`을 사용합니다. 브라우저 JS에는 더 이상 API Bearer 토큰이나 Home Assistant 웹훅 식별자를 직접 넣지 않습니다.
접근 확인은 JS에서 읽을 수 있는 레거시 쿠키가 아니라 `/custom/launcher/api.php?session=1` 서버 응답으로 처리합니다. 공통 인증 쿠키는 `HttpOnly`이므로 브라우저 스크립트가 직접 읽지 않습니다.
접근 확인은 JS에서 읽을 수 있는 레거시 쿠키가 아니라 `/custom/launcher/api.php?session=1` 서버 응답으로 처리합니다. 공통 인증 쿠키는 `HttpOnly`이므로 브라우저 스크립트가 직접 읽지 않습니다. 미인증 접근은 `/blog`로 강제 이동하지 않고 현재 화면 안에 인증 필요 안내를 표시합니다. PWA standalone 여부와 관계없이 같은 세션 확인을 수행합니다.
표시할 모바일 앱 센서 목록은 `/custom/common/config.php``findmydevice_sensor_sections`에서 섹션 단위로 관리합니다. 화면 CSS 원본은 `/custom/common/css/findmydevice.css`를 사용합니다. 기존 운영 HTML이 `/custom/findmydevice/css/style.css`를 참조해도 호환 파일이 공용 CSS를 import합니다.
+13 -6
View File
@@ -539,20 +539,27 @@ 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()) {
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) {
location.replace('/blog');
renderAuthErrorPage();
}
})
.catch(() => location.replace('/blog'));
.catch(renderAuthErrorPage);
}
const btnArea = document.querySelector('body > div.btnArea');