omnimem 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/omnimem/__init__.py +1 -1
- package/omnimem/webui.py +39 -17
- package/package.json +1 -1
package/omnimem/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__all__ = ["__version__"]
|
|
2
|
-
__version__ = "0.1.
|
|
2
|
+
__version__ = "0.1.4"
|
package/omnimem/webui.py
CHANGED
|
@@ -56,7 +56,7 @@ HTML_PAGE = """<!doctype html>
|
|
|
56
56
|
<div class=\"small\" data-i18n=\"subtitle\">Simple mode: Status & Actions / Configuration / Memory</div>
|
|
57
57
|
</div>
|
|
58
58
|
<div>
|
|
59
|
-
<label class=\"small\" data-i18n=\"language\">Language</label>
|
|
59
|
+
<label class=\"small\"><span data-i18n=\"language\">Language</span></label>
|
|
60
60
|
<select id=\"langSelect\" class=\"lang\">
|
|
61
61
|
<option value=\"en\">English</option>
|
|
62
62
|
<option value=\"zh\">中文</option>
|
|
@@ -88,14 +88,14 @@ HTML_PAGE = """<!doctype html>
|
|
|
88
88
|
<div class=\"card\">
|
|
89
89
|
<h3 data-i18n=\"actions\">Actions</h3>
|
|
90
90
|
<div class=\"row-btn\">
|
|
91
|
-
<button
|
|
92
|
-
<button
|
|
93
|
-
<button
|
|
94
|
-
<button
|
|
91
|
+
<button id=\"btnSyncStatus\" data-i18n=\"btn_status\">Check Sync Status</button>
|
|
92
|
+
<button id=\"btnSyncBootstrap\" data-i18n=\"btn_bootstrap\">Bootstrap Device Sync</button>
|
|
93
|
+
<button id=\"btnSyncPush\" data-i18n=\"btn_push\">Push</button>
|
|
94
|
+
<button id=\"btnSyncPull\" data-i18n=\"btn_pull\">Pull</button>
|
|
95
95
|
</div>
|
|
96
96
|
<div class=\"row-btn\">
|
|
97
|
-
<button
|
|
98
|
-
<button
|
|
97
|
+
<button id=\"btnDaemonOn\" data-i18n=\"btn_daemon_on\">Enable Daemon</button>
|
|
98
|
+
<button id=\"btnDaemonOff\" data-i18n=\"btn_daemon_off\">Disable Daemon</button>
|
|
99
99
|
</div>
|
|
100
100
|
<pre id=\"syncOut\" class=\"small\"></pre>
|
|
101
101
|
</div>
|
|
@@ -107,14 +107,14 @@ HTML_PAGE = """<!doctype html>
|
|
|
107
107
|
<div class=\"card wide\">
|
|
108
108
|
<h3 data-i18n=\"config_title\">Configuration</h3>
|
|
109
109
|
<form id=\"cfgForm\">
|
|
110
|
-
<label data-i18n=\"cfg_path\">Config Path
|
|
111
|
-
<label data-i18n=\"cfg_home\">Home
|
|
112
|
-
<label data-i18n=\"cfg_markdown\">Markdown Path
|
|
113
|
-
<label data-i18n=\"cfg_jsonl\">JSONL Path
|
|
114
|
-
<label data-i18n=\"cfg_sqlite\">SQLite Path
|
|
115
|
-
<label data-i18n=\"cfg_remote_name\">Git Remote Name
|
|
116
|
-
<label data-i18n=\"cfg_remote_url\">Git Remote URL
|
|
117
|
-
<label data-i18n=\"cfg_branch\">Git Branch
|
|
110
|
+
<label><span data-i18n=\"cfg_path\">Config Path</span><input name=\"config_path\" readonly /></label>
|
|
111
|
+
<label><span data-i18n=\"cfg_home\">Home</span><input name=\"home\" /></label>
|
|
112
|
+
<label><span data-i18n=\"cfg_markdown\">Markdown Path</span><input name=\"markdown\" /></label>
|
|
113
|
+
<label><span data-i18n=\"cfg_jsonl\">JSONL Path</span><input name=\"jsonl\" /></label>
|
|
114
|
+
<label><span data-i18n=\"cfg_sqlite\">SQLite Path</span><input name=\"sqlite\" /></label>
|
|
115
|
+
<label><span data-i18n=\"cfg_remote_name\">Git Remote Name</span><input name=\"remote_name\" /></label>
|
|
116
|
+
<label><span data-i18n=\"cfg_remote_url\">Git Remote URL</span><input name=\"remote_url\" placeholder=\"git@github.com:user/repo.git\" /></label>
|
|
117
|
+
<label><span data-i18n=\"cfg_branch\">Git Branch</span><input name=\"branch\" /></label>
|
|
118
118
|
<button type=\"submit\" data-i18n=\"btn_save\">Save Configuration</button>
|
|
119
119
|
</form>
|
|
120
120
|
</div>
|
|
@@ -263,7 +263,14 @@ HTML_PAGE = """<!doctype html>
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
function safeGetLang() {
|
|
267
|
+
try { return localStorage.getItem('omnimem.lang') || 'en'; } catch (_) { return 'en'; }
|
|
268
|
+
}
|
|
269
|
+
function safeSetLang(v) {
|
|
270
|
+
try { localStorage.setItem('omnimem.lang', v); } catch (_) {}
|
|
271
|
+
}
|
|
272
|
+
let currentLang = safeGetLang();
|
|
273
|
+
if (!I18N[currentLang]) currentLang = 'en';
|
|
267
274
|
let daemonCache = { running:false, enabled:false, initialized:false };
|
|
268
275
|
|
|
269
276
|
function t(key) {
|
|
@@ -370,11 +377,26 @@ HTML_PAGE = """<!doctype html>
|
|
|
370
377
|
|
|
371
378
|
document.getElementById('langSelect').onchange = (e) => {
|
|
372
379
|
currentLang = e.target.value;
|
|
373
|
-
|
|
380
|
+
safeSetLang(currentLang);
|
|
374
381
|
applyI18n();
|
|
375
382
|
loadCfg();
|
|
376
383
|
};
|
|
377
384
|
|
|
385
|
+
function bindActions() {
|
|
386
|
+
document.getElementById('btnSyncStatus').onclick = () => runSync('github-status');
|
|
387
|
+
document.getElementById('btnSyncBootstrap').onclick = () => runSync('github-bootstrap');
|
|
388
|
+
document.getElementById('btnSyncPush').onclick = () => runSync('github-push');
|
|
389
|
+
document.getElementById('btnSyncPull').onclick = () => runSync('github-pull');
|
|
390
|
+
document.getElementById('btnDaemonOn').onclick = () => toggleDaemon(true);
|
|
391
|
+
document.getElementById('btnDaemonOff').onclick = () => toggleDaemon(false);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
window.addEventListener('error', (e) => {
|
|
395
|
+
const s = document.getElementById('status');
|
|
396
|
+
if (s) s.innerHTML = `<span class=\"err\">UI error: ${e.message}</span>`;
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
bindActions();
|
|
378
400
|
bindTabs();
|
|
379
401
|
applyI18n();
|
|
380
402
|
loadCfg();
|