diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml
index 27e2d60..3f87d81 100644
--- a/.gitea/workflows/deploy.yml
+++ b/.gitea/workflows/deploy.yml
@@ -26,5 +26,5 @@ jobs:
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASS }}
local-dir: ./
- server-dir: /public_html/
+ server-dir: /
diff --git a/app.js b/app.js
index 2b45b81..1550a2e 100644
--- a/app.js
+++ b/app.js
@@ -450,15 +450,15 @@ historyToggle.addEventListener('click', ()=>{
// historyBtn.addEventListener('click', toggleHistory)
// if (historyToggle) historyToggle.addEventListener('click', toggleHistory)
-historyBack.addEventListener('click', ()=>{
- historyScreen.classList.add('hidden')
- menuScreen.classList.remove('hidden')
-})
+// historyBack.addEventListener('click', ()=>{
+// historyScreen.classList.add('hidden')
+// menuScreen.classList.remove('hidden')
+// })
-clearHistoryBtn.addEventListener('click', ()=>{
- try{ localStorage.removeItem('matma:history') }catch(e){}
- renderHistory()
-})
+// clearHistoryBtn.addEventListener('click', ()=>{
+// try{ localStorage.removeItem('matma:history') }catch(e){}
+// renderHistory()
+// })
// keyboard support: allow Enter/Backspace/0-9
window.addEventListener('keydown', (e)=>{
@@ -479,29 +479,34 @@ window.addEventListener('keydown', (e)=>{
// small helper to set initial focus - mobile browsers will not open keyboard for divs
document.addEventListener('touchstart', ()=>{}, {passive:true})
-// load COMMIT_SHA from /version.js if present (no-cache fetch)
-;(function loadCommitSha(){
+// Load commit SHA into footer (robust: prefers window.COMMIT_SHA, then meta tag, then fetch plain file)
+document.addEventListener('DOMContentLoaded', async () => {
const el = document.getElementById('commit-sha')
if (!el) return
- // prefer a no-cache fetch
- fetch('/version.js', {cache: 'no-store'})
- .then(r => {
- if (!r.ok) throw new Error('no version.js')
- return r.text()
- })
- .then(text => {
- // naive parse: look for COMMIT_SHA = '...'; or window.COMMIT_SHA
- let m = text.match(/COMMIT_SHA\s*=\s*['\"]([0-9a-fA-F]+)['\"]/)
- if (m) return m[1]
- m = text.match(/window\.COMMIT_SHA\s*=\s*['\"]([0-9a-fA-F]+)['\"]/)
- if (m) return m[1]
- return null
- })
- .catch(()=>{
- // fallback to global
- return (window && window.COMMIT_SHA) ? window.COMMIT_SHA : null
- })
- .then(sha => {
- el.textContent = sha ? sha.slice(0,8) : 'unknown'
- })
-})()
+ // 1) prefer a global injected by CI: window.COMMIT_SHA
+ let sha = (window.COMMIT_SHA || '').toString().trim()
+ // 2) fallback to meta tag if CI injects that instead
+ if (!sha) {
+ const meta = document.querySelector('meta[name="commit-sha"]')
+ if (meta && meta.content) sha = meta.content.trim()
+ }
+ // 3) finally try to fetch the external file (works if it's plain text or a tiny JS file)
+ if (!sha) {
+ try {
+ const res = await fetch('/version.js', { cache: 'no-cache' })
+ if (res.ok) {
+ const txt = (await res.text()).trim()
+ // try to extract a quoted/assigned sha like: window.COMMIT_SHA = "abc..." or COMMIT_SHA: "..."
+ const m = txt.match(/COMMIT_SHA\s*(?:=|:)\s*["']?([0-9a-fA-F]{7,40})["']?/)
+ if (m && m[1]) sha = m[1]
+ else {
+ const firstLine = txt.split(/\r?\n/).find(l => l.trim().length>0)
+ if (firstLine) sha = firstLine.trim()
+ }
+ }
+ } catch (e) {
+ // ignore failures silently
+ }
+ }
+ if (sha) el.textContent = sha.slice(0,8)
+})
diff --git a/index.html b/index.html
index 56a730b..c6f8612 100644
--- a/index.html
+++ b/index.html
@@ -140,24 +140,11 @@
-
-
-
-
-
-
+
+
+