복귀 링크와 설정 토글 표시 정리

This commit is contained in:
seo
2026-07-01 01:04:45 +09:00
parent eeef4c008d
commit bd167f4d14
2 changed files with 10 additions and 9 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ Home Assistant에 기록된 Galaxy Z Fold7의 위치, 배터리, 활동 상태,
- 강제 위치/센서 업데이트 요청 - 강제 위치/센서 업데이트 요청
- 한국어/영어 전환 - 한국어/영어 전환
- Wake Lock 지원 - Wake Lock 지원
- 상단 복귀 링크는 이전 페이지가 있으면 해당 페이지 제목과 URL을 사용하고, 직접 접속이면 `https://chaegeon.com/blog`로 이동합니다. - 상단 복귀 링크는 이전 페이지가 있으면 해당 페이지 제목과 URL을 사용하고, 직접 접속이면 `https://chaegeon.com/`로 이동합니다.
## 구조 ## 구조
@@ -42,7 +42,7 @@ Home Assistant에 기록된 Galaxy Z Fold7의 위치, 배터리, 활동 상태,
표시할 모바일 앱 센서 목록은 `/custom/common/config.php``findmydevice_sensor_sections`에서 섹션 단위로 관리합니다. 화면 CSS 원본은 `/custom/common/css/findmydevice.css`를 사용합니다. 기존 운영 HTML이 `/custom/findmydevice/css/style.css`를 참조해도 호환 파일이 공용 CSS를 import합니다. 표시할 모바일 앱 센서 목록은 `/custom/common/config.php``findmydevice_sensor_sections`에서 섹션 단위로 관리합니다. 화면 CSS 원본은 `/custom/common/css/findmydevice.css`를 사용합니다. 기존 운영 HTML이 `/custom/findmydevice/css/style.css`를 참조해도 호환 파일이 공용 CSS를 import합니다.
페이지 본문에는 `<div id="findmydevice"></div>`만 두면 됩니다. `main.js`는 이 컨테이너 안에 지도, 헤더, 설정/기록/위치/업데이트/배터리/활동 섹션과 iOS PWA 안내 영역을 항상 자동 생성합니다. 상단 복귀 링크는 같은 출처의 이전 페이지라면 문서 제목을 읽어 표시하고, 다른 `chaegeon.com` 하위 도메인이나 직접 접속에서는 경로 이름과 기본 블로그 주소를 사용합니다. 페이지 본문에는 `<div id="findmydevice"></div>`만 두면 됩니다. `main.js`는 이 컨테이너 안에 지도, 헤더, 설정/기록/위치/업데이트/배터리/활동 섹션과 iOS PWA 안내 영역을 항상 자동 생성합니다. 상단 복귀 링크는 `chaegeon.com`이면 채건닷컴, `/blog`이면 블로그처럼 알려진 경로명을 우선 표시하고, 같은 출처의 다른 이전 페이지 문서 제목을 읽어 표시합니다. 직접 접속처럼 이전 페이지 확인이 어려우면 채건닷컴으로 표시하고 `https://chaegeon.com/`로 이동합니다.
위치 갱신 명령은 `/custom/common/config.php``findmydevice_location_refresh` 설정을 사용합니다. `seoul`, `main` Home Assistant 프로필의 `notify.mobile_app_seocaegeonyi_z_fold7` 서비스로 Companion App notification command를 보냅니다. 자동 업데이트가 켜지면 Android high accuracy mode를 5초 간격으로 설정하고 `force_on`을 보낸 뒤 `request_location_update``command_update_sensors`를 함께 호출합니다. 자동 업데이트 중에는 10초마다 위치 요청과 센서 업데이트 요청을 반복하고, 자동 업데이트를 끄거나 페이지를 벗어나면 `force_off`를 보냅니다. 위치 갱신 명령은 `/custom/common/config.php``findmydevice_location_refresh` 설정을 사용합니다. `seoul`, `main` Home Assistant 프로필의 `notify.mobile_app_seocaegeonyi_z_fold7` 서비스로 Companion App notification command를 보냅니다. 자동 업데이트가 켜지면 Android high accuracy mode를 5초 간격으로 설정하고 `force_on`을 보낸 뒤 `request_location_update``command_update_sensors`를 함께 호출합니다. 자동 업데이트 중에는 10초마다 위치 요청과 센서 업데이트 요청을 반복하고, 자동 업데이트를 끄거나 페이지를 벗어나면 `force_off`를 보냅니다.
+8 -7
View File
@@ -459,7 +459,7 @@ let langCode = localStorage.getItem("currentLang") || deviceLang,
_overrideRange, _overrideRange,
wakeLock = null; wakeLock = null;
const FALLBACK_BACK_TARGET = 'https://chaegeon.com/blog'; const FALLBACK_BACK_TARGET = 'https://chaegeon.com/';
const BACK_LINK_PATH_TITLE = { const BACK_LINK_PATH_TITLE = {
'/': '채건닷컴', '/': '채건닷컴',
'/home': '홈', '/home': '홈',
@@ -494,9 +494,10 @@ async function resolveBackTarget() {
const ref = sameSiteUrl(document.referrer || ''); const ref = sameSiteUrl(document.referrer || '');
const current = new URL(location.href); const current = new URL(location.href);
const target = ref && ref.href !== current.href ? ref.href : FALLBACK_BACK_TARGET; const target = ref && ref.href !== current.href ? ref.href : FALLBACK_BACK_TARGET;
let title = titleFromBackUrl(target); const knownTitle = titleFromBackUrl(target);
let title = knownTitle;
if (ref && ref.origin === location.origin) { if (!knownTitle && ref && ref.origin === location.origin) {
try { try {
const res = await fetch(ref.href, { credentials: 'same-origin', cache: 'force-cache' }); const res = await fetch(ref.href, { credentials: 'same-origin', cache: 'force-cache' });
if (res.ok) { if (res.ok) {
@@ -521,7 +522,7 @@ function setupBackLink() {
if (!blogBackLink) return; if (!blogBackLink) return;
blogBackLink.href = FALLBACK_BACK_TARGET; blogBackLink.href = FALLBACK_BACK_TARGET;
blogBackLink.dataset.backLabel = '블로그'; blogBackLink.dataset.backLabel = '채건닷컴';
updateBackLinkLabel(blogBackLink.dataset.backLabel); updateBackLinkLabel(blogBackLink.dataset.backLabel);
resolveBackTarget().then(({ href, label }) => { resolveBackTarget().then(({ href, label }) => {
@@ -559,7 +560,7 @@ function ensureFindMyDeviceShell() {
<div id="mapContainer"><div id="map" style="width:100%; height:100%;">&nbsp;</div></div> <div id="mapContainer"><div id="map" style="width:100%; height:100%;">&nbsp;</div></div>
<div class="settingTitle"><span id="titleSettings"></span></div> <div class="settingTitle"><span id="titleSettings"></span></div>
<div class="settingSection"> <div class="settingSection">
<div class="settingRow" id="wakeLockRow"><span id="labelKeepScreenOn"></span><label class="iosSwitch"><input id="wakeLockSwitch" type="checkbox" /></label></div> <div class="settingRow" id="wakeLockRow"><span id="labelKeepScreenOn"></span><label class="iosSwitch"><input id="wakeLockSwitch" type="checkbox" /><span class="slider"></span></label></div>
</div> </div>
<div class="settingTitle"><span id="titleHistory"></span></div> <div class="settingTitle"><span id="titleHistory"></span></div>
<div class="settingSection"> <div class="settingSection">
@@ -571,14 +572,14 @@ function ensureFindMyDeviceShell() {
<div class="settingSection"> <div class="settingSection">
<div class="settingRow"><span id="labelCurrentPosition"></span><span id="currentPosition"></span></div> <div class="settingRow"><span id="labelCurrentPosition"></span><span id="currentPosition"></span></div>
<div class="settingRow"><span id="labelGpsAccuracy"></span><span id="accuracyValue"></span></div> <div class="settingRow"><span id="labelGpsAccuracy"></span><span id="accuracyValue"></span></div>
<div class="settingRow" id="autoLocateBtn"><span id="labelCurrentAutoPosition"></span><label class="iosSwitch"><input id="autoPositionSwitch" type="checkbox" /></label></div> <div class="settingRow" id="autoLocateBtn"><span id="labelCurrentAutoPosition"></span><label class="iosSwitch"><input id="autoPositionSwitch" type="checkbox" /><span class="slider"></span></label></div>
<div class="settingRow locateRow" id="locateBtn"><span id="labelMoveToCurrent"></span></div> <div class="settingRow locateRow" id="locateBtn"><span id="labelMoveToCurrent"></span></div>
</div> </div>
<div class="settingTitle"><span id="titleUpdate"></span></div> <div class="settingTitle"><span id="titleUpdate"></span></div>
<div class="settingSection"> <div class="settingSection">
<div class="settingRow"><span id="labelLastUpdate"></span><span id="lastUpdateTime"></span></div> <div class="settingRow"><span id="labelLastUpdate"></span><span id="lastUpdateTime"></span></div>
<div class="settingRow"><span id="labelUpdateTrigger"></span><span id="updateTrigger"></span></div> <div class="settingRow"><span id="labelUpdateTrigger"></span><span id="updateTrigger"></span></div>
<div class="settingRow" id="autoUpdateBtn"><span id="labelAutoUpdate"></span><label class="iosSwitch"><input id="autoUpdateSwitch" type="checkbox" /></label></div> <div class="settingRow" id="autoUpdateBtn"><span id="labelAutoUpdate"></span><label class="iosSwitch"><input id="autoUpdateSwitch" type="checkbox" /><span class="slider"></span></label></div>
<div class="settingRow locateRow" id="updateBtn"><span id="labelForceUpdate"></span></div> <div class="settingRow locateRow" id="updateBtn"><span id="labelForceUpdate"></span></div>
</div> </div>
<div class="settingTitle"><span id="titleBattery"></span></div> <div class="settingTitle"><span id="titleBattery"></span></div>