Upload index.html
Browse files- templates/index.html +90 -0
templates/index.html
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="ko">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
6 |
+
<title>디지털 굿판</title>
|
7 |
+
|
8 |
+
<!-- PWA 메타 태그 -->
|
9 |
+
<link rel="manifest" href="/static/manifest.json">
|
10 |
+
<meta name="theme-color" content="#000000">
|
11 |
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
12 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
13 |
+
<meta name="apple-mobile-web-app-title" content="디지털 굿판">
|
14 |
+
<link rel="apple-touch-icon" href="/static/icons/icon-152x152.png">
|
15 |
+
|
16 |
+
<script>
|
17 |
+
// 화면 꺼짐 방지
|
18 |
+
async function preventSleep() {
|
19 |
+
try {
|
20 |
+
if ('wakeLock' in navigator) {
|
21 |
+
const wakeLock = await navigator.wakeLock.request('screen');
|
22 |
+
console.log('화면 켜짐 유지 활성화');
|
23 |
+
|
24 |
+
// 화면이 다시 활성화될 때 wakeLock 재요청
|
25 |
+
document.addEventListener('visibilitychange', async () => {
|
26 |
+
if (document.visibilityState === 'visible') {
|
27 |
+
await preventSleep();
|
28 |
+
}
|
29 |
+
});
|
30 |
+
}
|
31 |
+
} catch (err) {
|
32 |
+
console.log('화면 켜짐 유지 실패:', err);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
// 앱 상태 관리
|
37 |
+
class AppState {
|
38 |
+
static async save(state) {
|
39 |
+
try {
|
40 |
+
localStorage.setItem('appState', JSON.stringify(state));
|
41 |
+
} catch (err) {
|
42 |
+
console.error('상태 저장 실패:', err);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
static async load() {
|
47 |
+
try {
|
48 |
+
const state = localStorage.getItem('appState');
|
49 |
+
return state ? JSON.parse(state) : null;
|
50 |
+
} catch (err) {
|
51 |
+
console.error('상태 복원 실패:', err);
|
52 |
+
return null;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
// 초기화
|
58 |
+
window.addEventListener('load', async () => {
|
59 |
+
// PWA 설치 확인
|
60 |
+
if ('serviceWorker' in navigator) {
|
61 |
+
try {
|
62 |
+
const registration = await navigator.serviceWorker.register('/static/service-worker.js');
|
63 |
+
console.log('ServiceWorker 등록 성공:', registration.scope);
|
64 |
+
} catch (err) {
|
65 |
+
console.log('ServiceWorker 등록 실패:', err);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
// 화면 켜짐 유지
|
70 |
+
await preventSleep();
|
71 |
+
|
72 |
+
// 상태 복원
|
73 |
+
const savedState = await AppState.load();
|
74 |
+
if (savedState) {
|
75 |
+
// Gradio 앱 상태 복원 로직
|
76 |
+
window.gradioApp().querySelector('#component-0').value = savedState;
|
77 |
+
}
|
78 |
+
});
|
79 |
+
|
80 |
+
// 상태 저장
|
81 |
+
window.addEventListener('beforeunload', () => {
|
82 |
+
const currentState = window.gradioApp().querySelector('#component-0').value;
|
83 |
+
AppState.save(currentState);
|
84 |
+
});
|
85 |
+
</script>
|
86 |
+
</head>
|
87 |
+
<body>
|
88 |
+
<div id="gradio-app"></div>
|
89 |
+
</body>
|
90 |
+
</html>
|