Spaces:
Sleeping
Sleeping
Upload static/index.html with huggingface_hub
Browse files- static/index.html +57 -17
static/index.html
CHANGED
|
@@ -9,12 +9,14 @@
|
|
| 9 |
<meta name="theme-color" content="#27c93f"/>
|
| 10 |
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
| 11 |
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
| 12 |
-
<meta name="apple-mobile-web-app-title" content="
|
| 13 |
-
<meta name="description" content="Full screen web terminal
|
| 14 |
|
| 15 |
<!-- PWA Links -->
|
| 16 |
<link rel="manifest" href="/static/manifest.json"/>
|
| 17 |
<link rel="apple-touch-icon" href="/static/icon-192.png"/>
|
|
|
|
|
|
|
| 18 |
|
| 19 |
<!-- Fonts & Terminal -->
|
| 20 |
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet"/>
|
|
@@ -25,11 +27,6 @@
|
|
| 25 |
<style>
|
| 26 |
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 27 |
html, body { height: 100%; overflow: hidden; background: #0d1117; font-family: 'JetBrains Mono', monospace; }
|
| 28 |
-
|
| 29 |
-
/* Full screen PWA */
|
| 30 |
-
@media display-mode: fullscreen {
|
| 31 |
-
body { padding: 0; }
|
| 32 |
-
}
|
| 33 |
|
| 34 |
#pass-screen {
|
| 35 |
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
|
@@ -48,6 +45,19 @@
|
|
| 48 |
}
|
| 49 |
#pass-screen .err { color: #ff5f56; font-size: 12px; }
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
#toolbar {
|
| 52 |
display: none; background: #161b22; padding: 6px 12px; border-bottom: 1px solid #30363d;
|
| 53 |
gap: 8px; align-items: center;
|
|
@@ -83,6 +93,14 @@
|
|
| 83 |
<div class="err" id="pass-err"></div>
|
| 84 |
</div>
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
<div id="toolbar">
|
| 87 |
<button id="btn-copy">π Copy</button>
|
| 88 |
<button id="btn-paste">π Paste</button>
|
|
@@ -101,11 +119,38 @@
|
|
| 101 |
</div>
|
| 102 |
|
| 103 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
// Register Service Worker
|
| 105 |
if ('serviceWorker' in navigator) {
|
| 106 |
-
navigator.serviceWorker.register('/static/sw.js')
|
| 107 |
-
.then(reg => console.log('SW registered'))
|
| 108 |
-
.catch(err => console.log('SW error'));
|
| 109 |
}
|
| 110 |
|
| 111 |
const PASS_HASH = "opencode";
|
|
@@ -187,13 +232,8 @@
|
|
| 187 |
} catch(e) {}
|
| 188 |
};
|
| 189 |
|
| 190 |
-
document.getElementById("btn-selectall").onclick = () => {
|
| 191 |
-
|
| 192 |
-
};
|
| 193 |
-
|
| 194 |
-
document.getElementById("btn-clear").onclick = () => {
|
| 195 |
-
term.clear();
|
| 196 |
-
};
|
| 197 |
|
| 198 |
// Context menu
|
| 199 |
const ctxMenu = document.getElementById("ctx-menu");
|
|
|
|
| 9 |
<meta name="theme-color" content="#27c93f"/>
|
| 10 |
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
| 11 |
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
| 12 |
+
<meta name="apple-mobile-web-app-title" content="OpenCode"/>
|
| 13 |
+
<meta name="description" content="Full screen web terminal"/>
|
| 14 |
|
| 15 |
<!-- PWA Links -->
|
| 16 |
<link rel="manifest" href="/static/manifest.json"/>
|
| 17 |
<link rel="apple-touch-icon" href="/static/icon-192.png"/>
|
| 18 |
+
<link rel="icon" type="image/png" sizes="192x192" href="/static/icon-192.png"/>
|
| 19 |
+
<link rel="icon" type="image/png" sizes="512x512" href="/static/icon-512.png"/>
|
| 20 |
|
| 21 |
<!-- Fonts & Terminal -->
|
| 22 |
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet"/>
|
|
|
|
| 27 |
<style>
|
| 28 |
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 29 |
html, body { height: 100%; overflow: hidden; background: #0d1117; font-family: 'JetBrains Mono', monospace; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
#pass-screen {
|
| 32 |
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
|
|
|
| 45 |
}
|
| 46 |
#pass-screen .err { color: #ff5f56; font-size: 12px; }
|
| 47 |
|
| 48 |
+
#install-banner {
|
| 49 |
+
display: none; position: fixed; bottom: 0; left: 0; width: 100%;
|
| 50 |
+
background: #161b22; border-top: 1px solid #30363d; padding: 12px 16px;
|
| 51 |
+
z-index: 10000; flex-direction: row; align-items: center; justify-content: space-between;
|
| 52 |
+
}
|
| 53 |
+
#install-banner.show { display: flex; }
|
| 54 |
+
#install-banner span { color: #e6edf3; font-size: 13px; }
|
| 55 |
+
#install-banner button {
|
| 56 |
+
background: #27c93f; color: #000; border: none; padding: 8px 20px;
|
| 57 |
+
font-size: 12px; border-radius: 6px; cursor: pointer; font-weight: bold;
|
| 58 |
+
}
|
| 59 |
+
#install-banner .close { background: none; color: #768390; padding: 8px; }
|
| 60 |
+
|
| 61 |
#toolbar {
|
| 62 |
display: none; background: #161b22; padding: 6px 12px; border-bottom: 1px solid #30363d;
|
| 63 |
gap: 8px; align-items: center;
|
|
|
|
| 93 |
<div class="err" id="pass-err"></div>
|
| 94 |
</div>
|
| 95 |
|
| 96 |
+
<div id="install-banner">
|
| 97 |
+
<span>Install OpenCode Terminal</span>
|
| 98 |
+
<div>
|
| 99 |
+
<button id="install-btn">Install</button>
|
| 100 |
+
<button class="close" id="install-close">β</button>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
<div id="toolbar">
|
| 105 |
<button id="btn-copy">π Copy</button>
|
| 106 |
<button id="btn-paste">π Paste</button>
|
|
|
|
| 119 |
</div>
|
| 120 |
|
| 121 |
<script>
|
| 122 |
+
// PWA Install
|
| 123 |
+
let deferredPrompt;
|
| 124 |
+
const installBanner = document.getElementById('install-banner');
|
| 125 |
+
|
| 126 |
+
window.addEventListener('beforeinstallprompt', (e) => {
|
| 127 |
+
e.preventDefault();
|
| 128 |
+
deferredPrompt = e;
|
| 129 |
+
installBanner.classList.add('show');
|
| 130 |
+
});
|
| 131 |
+
|
| 132 |
+
document.getElementById('install-btn').onclick = async () => {
|
| 133 |
+
if (deferredPrompt) {
|
| 134 |
+
deferredPrompt.prompt();
|
| 135 |
+
const { outcome } = await deferredPrompt.userChoice;
|
| 136 |
+
console.log(outcome);
|
| 137 |
+
deferredPrompt = null;
|
| 138 |
+
installBanner.classList.remove('show');
|
| 139 |
+
}
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
document.getElementById('install-close').onclick = () => {
|
| 143 |
+
installBanner.classList.remove('show');
|
| 144 |
+
};
|
| 145 |
+
|
| 146 |
+
window.addEventListener('appinstalled', () => {
|
| 147 |
+
installBanner.classList.remove('show');
|
| 148 |
+
deferredPrompt = null;
|
| 149 |
+
});
|
| 150 |
+
|
| 151 |
// Register Service Worker
|
| 152 |
if ('serviceWorker' in navigator) {
|
| 153 |
+
navigator.serviceWorker.register('/static/sw.js');
|
|
|
|
|
|
|
| 154 |
}
|
| 155 |
|
| 156 |
const PASS_HASH = "opencode";
|
|
|
|
| 232 |
} catch(e) {}
|
| 233 |
};
|
| 234 |
|
| 235 |
+
document.getElementById("btn-selectall").onclick = () => { term.selectAll(); };
|
| 236 |
+
document.getElementById("btn-clear").onclick = () => { term.clear(); };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
// Context menu
|
| 239 |
const ctxMenu = document.getElementById("ctx-menu");
|