@cccarv82/freya 1.0.51 → 1.0.52
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/cli/web.js +26 -2
- package/package.json +1 -1
package/cli/web.js
CHANGED
|
@@ -8,6 +8,28 @@ const { spawn } = require('child_process');
|
|
|
8
8
|
const { searchWorkspace } = require('../scripts/lib/search-utils');
|
|
9
9
|
const { searchIndex } = require('../scripts/lib/index-utils');
|
|
10
10
|
|
|
11
|
+
function readAppVersion() {
|
|
12
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
13
|
+
try {
|
|
14
|
+
const json = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
15
|
+
if (json && typeof json.version === 'string' && json.version.trim() !== '') return json.version.trim();
|
|
16
|
+
} catch {
|
|
17
|
+
// Fall back below.
|
|
18
|
+
}
|
|
19
|
+
return 'unknown';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function escapeHtml(str) {
|
|
23
|
+
return String(str)
|
|
24
|
+
.replace(/&/g, '&')
|
|
25
|
+
.replace(/</g, '<')
|
|
26
|
+
.replace(/>/g, '>')
|
|
27
|
+
.replace(/"/g, '"')
|
|
28
|
+
.replace(/'/g, ''');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const APP_VERSION = readAppVersion();
|
|
32
|
+
|
|
11
33
|
function guessNpmCmd() {
|
|
12
34
|
// We'll execute via cmd.exe on Windows for reliability.
|
|
13
35
|
return process.platform === 'win32' ? 'npm' : 'npm';
|
|
@@ -795,10 +817,11 @@ async function pickDirectoryNative() {
|
|
|
795
817
|
function html(defaultDir) {
|
|
796
818
|
// Aesthetic: “clean workstation” — light-first UI inspired by modern productivity apps.
|
|
797
819
|
const safeDefault = String(defaultDir || './freya').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
798
|
-
return buildHtml(safeDefault);
|
|
820
|
+
return buildHtml(safeDefault, APP_VERSION);
|
|
799
821
|
}
|
|
800
822
|
|
|
801
|
-
function buildHtml(safeDefault) {
|
|
823
|
+
function buildHtml(safeDefault, appVersion) {
|
|
824
|
+
const safeVersion = escapeHtml(appVersion || 'unknown');
|
|
802
825
|
return `<!doctype html>
|
|
803
826
|
<html>
|
|
804
827
|
<head>
|
|
@@ -861,6 +884,7 @@ function buildHtml(safeDefault) {
|
|
|
861
884
|
<div class="topbar">
|
|
862
885
|
<div class="brand"><span class="spark"></span> Assistente de status local-first</div>
|
|
863
886
|
<div class="actions">
|
|
887
|
+
<span class="chip" id="chipVersion">v${safeVersion}</span>
|
|
864
888
|
<span class="chip" id="chipPort">127.0.0.1:3872</span>
|
|
865
889
|
<button class="toggle" id="themeToggle" onclick="toggleTheme()">Escuro</button>
|
|
866
890
|
</div>
|