hivedesk 1.0.1 → 1.0.2
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/CHANGELOG.md +21 -0
- package/README.md +307 -303
- package/desktop/release-notes/1.0.2.json +12 -0
- package/desktop/scripts/package.mjs +134 -134
- package/i18n/README.pt-BR.md +308 -304
- package/package.json +1 -1
- package/src/p2p/doctor.js +4 -1
- package/ui/office/office.js +662 -662
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": "hivedesk 1.0.2. A new website in 10 languages, with a light and a dark theme. The relay check (hivedesk doctor --p2p) no longer prints a warning when a relay is an IP address. A download whose part file turned into a folder now stops with a clear message, and Code together links open the right page.",
|
|
3
|
+
"pt-BR": "hivedesk 1.0.2. Um site novo em 10 idiomas, com tema claro e escuro. A verificação do relay (hivedesk doctor --p2p) não mostra mais um aviso quando o relay é um endereço IP. Um download cujo arquivo parcial virou uma pasta agora para com uma mensagem clara, e os links de Code together abrem a página certa.",
|
|
4
|
+
"es": "hivedesk 1.0.2. Un sitio nuevo en 10 idiomas, con tema claro y oscuro. La comprobación del relay (hivedesk doctor --p2p) ya no muestra un aviso cuando el relay es una dirección IP. Una descarga cuyo archivo parcial se convirtió en carpeta ahora se detiene con un mensaje claro, y los enlaces de Code together abren la página correcta.",
|
|
5
|
+
"fr": "hivedesk 1.0.2. Un nouveau site en 10 langues, avec un thème clair et un thème sombre. La vérification du relais (hivedesk doctor --p2p) n'affiche plus d'avertissement quand le relais est une adresse IP. Un téléchargement dont le fichier partiel est devenu un dossier s'arrête maintenant avec un message clair, et les liens Code together ouvrent la bonne page.",
|
|
6
|
+
"de": "hivedesk 1.0.2. Eine neue Website in 10 Sprachen, mit hellem und dunklem Design. Die Relay-Prüfung (hivedesk doctor --p2p) zeigt keine Warnung mehr, wenn ein Relay eine IP-Adresse ist. Ein Download, dessen Teildatei zu einem Ordner wurde, stoppt jetzt mit einer klaren Meldung, und Code together-Links öffnen die richtige Seite.",
|
|
7
|
+
"it": "hivedesk 1.0.2. Un sito nuovo in 10 lingue, con tema chiaro e scuro. Il controllo del relay (hivedesk doctor --p2p) non mostra più un avviso quando il relay è un indirizzo IP. Un download il cui file parziale è diventato una cartella ora si ferma con un messaggio chiaro, e i link di Code together aprono la pagina giusta.",
|
|
8
|
+
"ja": "hivedesk 1.0.2。10言語に対応し、ライトとダークのテーマを備えた新しいWebサイトになりました。リレーの確認(hivedesk doctor --p2p)は、リレーがIPアドレスのときに警告を出さなくなりました。途中のファイルがフォルダーになってしまったダウンロードは、わかりやすいメッセージとともに止まるようになり、Code together のリンクは正しいページを開きます。",
|
|
9
|
+
"ko": "hivedesk 1.0.2. 10개 언어와 라이트, 다크 테마를 갖춘 새 웹사이트입니다. 릴레이 확인(hivedesk doctor --p2p)은 릴레이가 IP 주소일 때 더 이상 경고를 표시하지 않습니다. 임시 파일이 폴더로 바뀐 다운로드는 이제 분명한 메시지와 함께 멈추고, Code together 링크는 올바른 페이지를 엽니다.",
|
|
10
|
+
"zh-CN": "hivedesk 1.0.2。全新的网站,支持 10 种语言,提供浅色和深色主题。中继检查(hivedesk doctor --p2p)在中继为 IP 地址时不再显示警告。如果下载的临时文件变成了文件夹,下载现在会停止并给出清楚的提示;Code together 链接会打开正确的页面。",
|
|
11
|
+
"ru": "hivedesk 1.0.2. Новый сайт на 10 языках, со светлой и тёмной темой. Проверка ретранслятора (hivedesk doctor --p2p) больше не выводит предупреждение, когда ретранслятор задан IP-адресом. Загрузка, у которой временный файл оказался папкой, теперь останавливается с понятным сообщением, а ссылки Code together открывают нужную страницу."
|
|
12
|
+
}
|
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
// Builds the folder of one downloadable package. Used by .github/workflows/desktop.yml.
|
|
2
|
-
// node desktop/scripts/package.mjs --target windows-x64|macos-universal|linux-x64 --node <node binary> --out <dir>
|
|
3
|
-
// [--launcher <hivedesk.exe>] (Windows: the compiled launcher)
|
|
4
|
-
// [--npm <npm folder>] (the npm package of the same Node.js build; found next to --node when left out)
|
|
5
|
-
// The runtime binary comes from the pinned upstream archive and is checked against desktop/platform.js.
|
|
6
|
-
import fs from 'node:fs';
|
|
7
|
-
import os from 'node:os';
|
|
8
|
-
import path from 'node:path';
|
|
9
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import { RUNTIME, BINARIES } from '../platform.js';
|
|
11
|
-
import { sha256 } from '../runtime.js';
|
|
12
|
-
import { extractEntry } from '../zip.js';
|
|
13
|
-
import { packagedHelperAllowed } from '../native.js';
|
|
14
|
-
|
|
15
|
-
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
const ROOT = path.resolve(HERE, '..', '..');
|
|
17
|
-
const DESKTOP = path.join(ROOT, 'desktop');
|
|
18
|
-
|
|
19
|
-
const opts = {};
|
|
20
|
-
for (let i = 2; i < process.argv.length; i += 2) opts[process.argv[i].replace(/^--/, '')] = process.argv[i + 1];
|
|
21
|
-
const TARGETS = {
|
|
22
|
-
'windows-x64': { bin: 'win_x64', runtimeName: 'hivedesk-runtime.exe' },
|
|
23
|
-
'macos-universal': { bin: 'mac_universal', runtimeName: 'hivedesk-runtime' },
|
|
24
|
-
'linux-x64': { bin: 'linux_x64', runtimeName: 'hivedesk-runtime' }
|
|
25
|
-
};
|
|
26
|
-
const t = TARGETS[opts.target];
|
|
27
|
-
if (!t || !opts.node || !opts.out) {
|
|
28
|
-
console.error('usage: package.mjs --target windows-x64|macos-universal|linux-x64 --node <node binary> --out <dir> [--launcher <exe>] [--zip <runtime zip>]');
|
|
29
|
-
process.exit(2);
|
|
30
|
-
}
|
|
31
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
32
|
-
|
|
33
|
-
/** Copies what npm would publish (package.json "files"), always with desktop/. */
|
|
34
|
-
function copyApp(dest) {
|
|
35
|
-
// "!path" entries of package.json files are left out, as npm does.
|
|
36
|
-
const slash = (p) => p.split(path.sep).join('/');
|
|
37
|
-
const excluded = (pkg.files || []).filter((f) => f.startsWith('!')).map((f) => f.slice(1));
|
|
38
|
-
const files = new Set([...(pkg.files || []).filter((f) => !f.startsWith('!')), 'desktop', 'package.json', 'LICENSE']);
|
|
39
|
-
// Only the native helpers desktop/native.js lists (with a pinned hash) go into a package.
|
|
40
|
-
const helperOk = (rel) => !/^desktop[\\/]helpers([\\/]|$)/.test(rel) || packagedHelperAllowed(rel.replace(/^desktop[\\/]/, ''));
|
|
41
|
-
const skip = (rel) => excluded.some((x) => slash(rel) === x || slash(rel).startsWith(`${x}/`)) || !helperOk(rel) || /^desktop[\\/](scripts|launcher|bin)([\\/]|$)/.test(rel) || /^desktop[\\/]icons[\\/].*\.(icns|ico)$/.test(rel) || /(^|[\\/])node_modules([\\/]|$)/.test(rel);
|
|
42
|
-
for (const f of files) {
|
|
43
|
-
const src = path.join(ROOT, f);
|
|
44
|
-
if (!fs.existsSync(src)) continue;
|
|
45
|
-
fs.cpSync(src, path.join(dest, f), { recursive: true, filter: (s) => !skip(path.relative(ROOT, s)) });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function runtimeBinary() {
|
|
50
|
-
let zip;
|
|
51
|
-
if (opts.zip) zip = fs.readFileSync(opts.zip);
|
|
52
|
-
else {
|
|
53
|
-
const res = await fetch(RUNTIME.zip.url, { redirect: 'follow' });
|
|
54
|
-
if (!res.ok) throw new Error(`runtime download: HTTP ${res.status}`);
|
|
55
|
-
zip = Buffer.from(await res.arrayBuffer());
|
|
56
|
-
}
|
|
57
|
-
if (sha256(zip) !== RUNTIME.zip.sha256) throw new Error('runtime archive checksum mismatch');
|
|
58
|
-
const b = BINARIES[t.bin];
|
|
59
|
-
const bin = extractEntry(zip, b.file);
|
|
60
|
-
if (!bin || sha256(bin) !== b.sha256) throw new Error(`${b.file}: checksum mismatch`);
|
|
61
|
-
return bin;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const out = path.resolve(opts.out);
|
|
65
|
-
fs.rmSync(out, { recursive: true, force: true });
|
|
66
|
-
const bin = await runtimeBinary();
|
|
67
|
-
let appDir;
|
|
68
|
-
let nodeDest;
|
|
69
|
-
if (opts.target === 'macos-universal') {
|
|
70
|
-
const contents = path.join(out, 'hivedesk.app', 'Contents');
|
|
71
|
-
appDir = path.join(contents, 'Resources', 'app');
|
|
72
|
-
nodeDest = path.join(contents, 'Resources', 'node', 'bin', 'node');
|
|
73
|
-
fs.mkdirSync(path.join(contents, 'MacOS'), { recursive: true });
|
|
74
|
-
fs.writeFileSync(path.join(contents, 'Info.plist'), fs.readFileSync(path.join(DESKTOP, 'launcher', 'macos', 'Info.plist'), 'utf8').replaceAll('@VERSION@', pkg.version));
|
|
75
|
-
fs.copyFileSync(path.join(DESKTOP, 'launcher', 'macos', 'hivedesk'), path.join(contents, 'MacOS', 'hivedesk'));
|
|
76
|
-
fs.chmodSync(path.join(contents, 'MacOS', 'hivedesk'), 0o755);
|
|
77
|
-
fs.mkdirSync(path.join(contents, 'Resources'), { recursive: true });
|
|
78
|
-
fs.copyFileSync(path.join(DESKTOP, 'icons', 'hivedesk.icns'), path.join(contents, 'Resources', 'hivedesk.icns'));
|
|
79
|
-
} else if (opts.target === 'windows-x64') {
|
|
80
|
-
if (!opts.launcher) throw new Error('--launcher <hivedesk.exe> is needed for Windows');
|
|
81
|
-
appDir = path.join(out, 'hivedesk', 'app');
|
|
82
|
-
nodeDest = path.join(out, 'hivedesk', 'node', 'node.exe');
|
|
83
|
-
fs.mkdirSync(path.join(out, 'hivedesk'), { recursive: true });
|
|
84
|
-
fs.copyFileSync(opts.launcher, path.join(out, 'hivedesk', 'hivedesk.exe'));
|
|
85
|
-
} else {
|
|
86
|
-
const base = path.join(out, 'hivedesk');
|
|
87
|
-
appDir = path.join(base, 'app');
|
|
88
|
-
nodeDest = path.join(base, 'node', 'bin', 'node');
|
|
89
|
-
fs.mkdirSync(base, { recursive: true });
|
|
90
|
-
for (const f of ['hivedesk', 'hivedesk.desktop']) fs.copyFileSync(path.join(DESKTOP, 'launcher', 'linux', f), path.join(base, f));
|
|
91
|
-
fs.chmodSync(path.join(base, 'hivedesk'), 0o755);
|
|
92
|
-
fs.copyFileSync(path.join(DESKTOP, 'icons', 'icon-512.png'), path.join(base, 'hivedesk.png'));
|
|
93
|
-
}
|
|
94
|
-
copyApp(appDir);
|
|
95
|
-
fs.mkdirSync(path.join(appDir, 'desktop', 'bin'), { recursive: true });
|
|
96
|
-
fs.writeFileSync(path.join(appDir, 'desktop', 'bin', t.runtimeName), bin, { mode: 0o755 });
|
|
97
|
-
// Licenses of the bundled runtimes.
|
|
98
|
-
const lic = await fetch(RUNTIME.license);
|
|
99
|
-
if (!lic.ok) throw new Error('runtime license: HTTP ' + lic.status);
|
|
100
|
-
fs.writeFileSync(path.join(appDir, 'desktop', 'bin', 'LICENSE-neutralinojs.txt'), Buffer.from(await lic.arrayBuffer()));
|
|
101
|
-
fs.mkdirSync(path.dirname(nodeDest), { recursive: true });
|
|
102
|
-
const nodeLicense = [path.dirname(opts.node), path.dirname(path.dirname(opts.node))].map((d) => path.join(d, 'LICENSE')).find((f) => fs.existsSync(f));
|
|
103
|
-
if (nodeLicense) fs.copyFileSync(nodeLicense, path.join(path.dirname(nodeDest), 'LICENSE'));
|
|
104
|
-
else console.warn('package: no Node.js LICENSE found next to the node binary');
|
|
105
|
-
fs.copyFileSync(opts.node, nodeDest);
|
|
106
|
-
fs.chmodSync(nodeDest, 0o755);
|
|
107
|
-
// npm goes with the bundled Node.js: the local model runtime (node-llama-cpp) is installed with it on first use,
|
|
108
|
-
// and a PC without Node.js has no other npm. It sits where src/brain/runtime.js looks for it: next to node.exe on
|
|
109
|
-
// Windows, in ../lib/node_modules on macOS and Linux, the layout of the official Node.js archives.
|
|
110
|
-
const npmSrc = opts.npm || [path.join(path.dirname(opts.node), 'node_modules', 'npm'), path.join(path.dirname(path.dirname(opts.node)), 'lib', 'node_modules', 'npm')]
|
|
111
|
-
.find((d) => fs.existsSync(path.join(d, 'bin', 'npm-cli.js')));
|
|
112
|
-
if (!npmSrc || !fs.existsSync(path.join(npmSrc, 'bin', 'npm-cli.js'))) throw new Error('package: npm was not found next to the bundled Node.js; pass --npm <folder>');
|
|
113
|
-
const npmDest = opts.target === 'windows-x64'
|
|
114
|
-
? path.join(path.dirname(nodeDest), 'node_modules', 'npm')
|
|
115
|
-
: path.join(path.dirname(path.dirname(nodeDest)), 'lib', 'node_modules', 'npm');
|
|
116
|
-
fs.cpSync(npmSrc, npmDest, { recursive: true });
|
|
117
|
-
|
|
118
|
-
const readme = [
|
|
119
|
-
`hivedesk ${pkg.version} (${opts.target})`,
|
|
120
|
-
'',
|
|
121
|
-
'Start it:',
|
|
122
|
-
opts.target === 'windows-x64' ? ' double click hivedesk.exe' : opts.target === 'macos-universal' ? ' open hivedesk.app' : ' ./hivedesk (or install hivedesk.desktop in ~/.local/share/applications)',
|
|
123
|
-
'',
|
|
124
|
-
'Inside:',
|
|
125
|
-
' the hivedesk app (the same files as the npm package),',
|
|
126
|
-
` a Node.js runtime (${path.basename(opts.node)}), so nothing else needs to be installed,`,
|
|
127
|
-
` the desktop runtime ${RUNTIME.name} ${RUNTIME.version} (MIT), which shows the app in the system web view.`,
|
|
128
|
-
'',
|
|
129
|
-
'The app is not signed. See https://github.com/kwy404/hivedesk/blob/main/desktop/README.md for the first launch prompts.',
|
|
130
|
-
'Logs: ~/.hivedesk/desktop/launcher.log. Projects default to ~/hivedesk.',
|
|
131
|
-
''
|
|
132
|
-
].join(os.EOL);
|
|
133
|
-
fs.writeFileSync(path.join(opts.target === 'macos-universal' ? out : path.join(out, 'hivedesk'), 'README.txt'), readme);
|
|
134
|
-
console.log(`package: ${opts.target} staged in ${out}`);
|
|
1
|
+
// Builds the folder of one downloadable package. Used by .github/workflows/desktop.yml.
|
|
2
|
+
// node desktop/scripts/package.mjs --target windows-x64|macos-universal|linux-x64 --node <node binary> --out <dir>
|
|
3
|
+
// [--launcher <hivedesk.exe>] (Windows: the compiled launcher)
|
|
4
|
+
// [--npm <npm folder>] (the npm package of the same Node.js build; found next to --node when left out)
|
|
5
|
+
// The runtime binary comes from the pinned upstream archive and is checked against desktop/platform.js.
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { RUNTIME, BINARIES } from '../platform.js';
|
|
11
|
+
import { sha256 } from '../runtime.js';
|
|
12
|
+
import { extractEntry } from '../zip.js';
|
|
13
|
+
import { packagedHelperAllowed } from '../native.js';
|
|
14
|
+
|
|
15
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const ROOT = path.resolve(HERE, '..', '..');
|
|
17
|
+
const DESKTOP = path.join(ROOT, 'desktop');
|
|
18
|
+
|
|
19
|
+
const opts = {};
|
|
20
|
+
for (let i = 2; i < process.argv.length; i += 2) opts[process.argv[i].replace(/^--/, '')] = process.argv[i + 1];
|
|
21
|
+
const TARGETS = {
|
|
22
|
+
'windows-x64': { bin: 'win_x64', runtimeName: 'hivedesk-runtime.exe' },
|
|
23
|
+
'macos-universal': { bin: 'mac_universal', runtimeName: 'hivedesk-runtime' },
|
|
24
|
+
'linux-x64': { bin: 'linux_x64', runtimeName: 'hivedesk-runtime' }
|
|
25
|
+
};
|
|
26
|
+
const t = TARGETS[opts.target];
|
|
27
|
+
if (!t || !opts.node || !opts.out) {
|
|
28
|
+
console.error('usage: package.mjs --target windows-x64|macos-universal|linux-x64 --node <node binary> --out <dir> [--launcher <exe>] [--zip <runtime zip>]');
|
|
29
|
+
process.exit(2);
|
|
30
|
+
}
|
|
31
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
32
|
+
|
|
33
|
+
/** Copies what npm would publish (package.json "files"), always with desktop/. */
|
|
34
|
+
function copyApp(dest) {
|
|
35
|
+
// "!path" entries of package.json files are left out, as npm does.
|
|
36
|
+
const slash = (p) => p.split(path.sep).join('/');
|
|
37
|
+
const excluded = (pkg.files || []).filter((f) => f.startsWith('!')).map((f) => f.slice(1));
|
|
38
|
+
const files = new Set([...(pkg.files || []).filter((f) => !f.startsWith('!')), 'desktop', 'package.json', 'LICENSE']);
|
|
39
|
+
// Only the native helpers desktop/native.js lists (with a pinned hash) go into a package.
|
|
40
|
+
const helperOk = (rel) => !/^desktop[\\/]helpers([\\/]|$)/.test(rel) || packagedHelperAllowed(rel.replace(/^desktop[\\/]/, ''));
|
|
41
|
+
const skip = (rel) => excluded.some((x) => slash(rel) === x || slash(rel).startsWith(`${x}/`)) || !helperOk(rel) || /^desktop[\\/](scripts|launcher|bin)([\\/]|$)/.test(rel) || /^desktop[\\/]icons[\\/].*\.(icns|ico)$/.test(rel) || /(^|[\\/])node_modules([\\/]|$)/.test(rel);
|
|
42
|
+
for (const f of files) {
|
|
43
|
+
const src = path.join(ROOT, f);
|
|
44
|
+
if (!fs.existsSync(src)) continue;
|
|
45
|
+
fs.cpSync(src, path.join(dest, f), { recursive: true, filter: (s) => !skip(path.relative(ROOT, s)) });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function runtimeBinary() {
|
|
50
|
+
let zip;
|
|
51
|
+
if (opts.zip) zip = fs.readFileSync(opts.zip);
|
|
52
|
+
else {
|
|
53
|
+
const res = await fetch(RUNTIME.zip.url, { redirect: 'follow' });
|
|
54
|
+
if (!res.ok) throw new Error(`runtime download: HTTP ${res.status}`);
|
|
55
|
+
zip = Buffer.from(await res.arrayBuffer());
|
|
56
|
+
}
|
|
57
|
+
if (sha256(zip) !== RUNTIME.zip.sha256) throw new Error('runtime archive checksum mismatch');
|
|
58
|
+
const b = BINARIES[t.bin];
|
|
59
|
+
const bin = extractEntry(zip, b.file);
|
|
60
|
+
if (!bin || sha256(bin) !== b.sha256) throw new Error(`${b.file}: checksum mismatch`);
|
|
61
|
+
return bin;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const out = path.resolve(opts.out);
|
|
65
|
+
fs.rmSync(out, { recursive: true, force: true });
|
|
66
|
+
const bin = await runtimeBinary();
|
|
67
|
+
let appDir;
|
|
68
|
+
let nodeDest;
|
|
69
|
+
if (opts.target === 'macos-universal') {
|
|
70
|
+
const contents = path.join(out, 'hivedesk.app', 'Contents');
|
|
71
|
+
appDir = path.join(contents, 'Resources', 'app');
|
|
72
|
+
nodeDest = path.join(contents, 'Resources', 'node', 'bin', 'node');
|
|
73
|
+
fs.mkdirSync(path.join(contents, 'MacOS'), { recursive: true });
|
|
74
|
+
fs.writeFileSync(path.join(contents, 'Info.plist'), fs.readFileSync(path.join(DESKTOP, 'launcher', 'macos', 'Info.plist'), 'utf8').replaceAll('@VERSION@', pkg.version));
|
|
75
|
+
fs.copyFileSync(path.join(DESKTOP, 'launcher', 'macos', 'hivedesk'), path.join(contents, 'MacOS', 'hivedesk'));
|
|
76
|
+
fs.chmodSync(path.join(contents, 'MacOS', 'hivedesk'), 0o755);
|
|
77
|
+
fs.mkdirSync(path.join(contents, 'Resources'), { recursive: true });
|
|
78
|
+
fs.copyFileSync(path.join(DESKTOP, 'icons', 'hivedesk.icns'), path.join(contents, 'Resources', 'hivedesk.icns'));
|
|
79
|
+
} else if (opts.target === 'windows-x64') {
|
|
80
|
+
if (!opts.launcher) throw new Error('--launcher <hivedesk.exe> is needed for Windows');
|
|
81
|
+
appDir = path.join(out, 'hivedesk', 'app');
|
|
82
|
+
nodeDest = path.join(out, 'hivedesk', 'node', 'node.exe');
|
|
83
|
+
fs.mkdirSync(path.join(out, 'hivedesk'), { recursive: true });
|
|
84
|
+
fs.copyFileSync(opts.launcher, path.join(out, 'hivedesk', 'hivedesk.exe'));
|
|
85
|
+
} else {
|
|
86
|
+
const base = path.join(out, 'hivedesk');
|
|
87
|
+
appDir = path.join(base, 'app');
|
|
88
|
+
nodeDest = path.join(base, 'node', 'bin', 'node');
|
|
89
|
+
fs.mkdirSync(base, { recursive: true });
|
|
90
|
+
for (const f of ['hivedesk', 'hivedesk.desktop']) fs.copyFileSync(path.join(DESKTOP, 'launcher', 'linux', f), path.join(base, f));
|
|
91
|
+
fs.chmodSync(path.join(base, 'hivedesk'), 0o755);
|
|
92
|
+
fs.copyFileSync(path.join(DESKTOP, 'icons', 'icon-512.png'), path.join(base, 'hivedesk.png'));
|
|
93
|
+
}
|
|
94
|
+
copyApp(appDir);
|
|
95
|
+
fs.mkdirSync(path.join(appDir, 'desktop', 'bin'), { recursive: true });
|
|
96
|
+
fs.writeFileSync(path.join(appDir, 'desktop', 'bin', t.runtimeName), bin, { mode: 0o755 });
|
|
97
|
+
// Licenses of the bundled runtimes.
|
|
98
|
+
const lic = await fetch(RUNTIME.license);
|
|
99
|
+
if (!lic.ok) throw new Error('runtime license: HTTP ' + lic.status);
|
|
100
|
+
fs.writeFileSync(path.join(appDir, 'desktop', 'bin', 'LICENSE-neutralinojs.txt'), Buffer.from(await lic.arrayBuffer()));
|
|
101
|
+
fs.mkdirSync(path.dirname(nodeDest), { recursive: true });
|
|
102
|
+
const nodeLicense = [path.dirname(opts.node), path.dirname(path.dirname(opts.node))].map((d) => path.join(d, 'LICENSE')).find((f) => fs.existsSync(f));
|
|
103
|
+
if (nodeLicense) fs.copyFileSync(nodeLicense, path.join(path.dirname(nodeDest), 'LICENSE'));
|
|
104
|
+
else console.warn('package: no Node.js LICENSE found next to the node binary');
|
|
105
|
+
fs.copyFileSync(opts.node, nodeDest);
|
|
106
|
+
fs.chmodSync(nodeDest, 0o755);
|
|
107
|
+
// npm goes with the bundled Node.js: the local model runtime (node-llama-cpp) is installed with it on first use,
|
|
108
|
+
// and a PC without Node.js has no other npm. It sits where src/brain/runtime.js looks for it: next to node.exe on
|
|
109
|
+
// Windows, in ../lib/node_modules on macOS and Linux, the layout of the official Node.js archives.
|
|
110
|
+
const npmSrc = opts.npm || [path.join(path.dirname(opts.node), 'node_modules', 'npm'), path.join(path.dirname(path.dirname(opts.node)), 'lib', 'node_modules', 'npm')]
|
|
111
|
+
.find((d) => fs.existsSync(path.join(d, 'bin', 'npm-cli.js')));
|
|
112
|
+
if (!npmSrc || !fs.existsSync(path.join(npmSrc, 'bin', 'npm-cli.js'))) throw new Error('package: npm was not found next to the bundled Node.js; pass --npm <folder>');
|
|
113
|
+
const npmDest = opts.target === 'windows-x64'
|
|
114
|
+
? path.join(path.dirname(nodeDest), 'node_modules', 'npm')
|
|
115
|
+
: path.join(path.dirname(path.dirname(nodeDest)), 'lib', 'node_modules', 'npm');
|
|
116
|
+
fs.cpSync(npmSrc, npmDest, { recursive: true });
|
|
117
|
+
|
|
118
|
+
const readme = [
|
|
119
|
+
`hivedesk ${pkg.version} (${opts.target})`,
|
|
120
|
+
'',
|
|
121
|
+
'Start it:',
|
|
122
|
+
opts.target === 'windows-x64' ? ' double click hivedesk.exe' : opts.target === 'macos-universal' ? ' open hivedesk.app' : ' ./hivedesk (or install hivedesk.desktop in ~/.local/share/applications)',
|
|
123
|
+
'',
|
|
124
|
+
'Inside:',
|
|
125
|
+
' the hivedesk app (the same files as the npm package),',
|
|
126
|
+
` a Node.js runtime (${path.basename(opts.node)}), so nothing else needs to be installed,`,
|
|
127
|
+
` the desktop runtime ${RUNTIME.name} ${RUNTIME.version} (MIT), which shows the app in the system web view.`,
|
|
128
|
+
'',
|
|
129
|
+
'The app is not signed. See https://github.com/kwy404/hivedesk/blob/main/desktop/README.md for the first launch prompts.',
|
|
130
|
+
'Logs: ~/.hivedesk/desktop/launcher.log. Projects default to ~/hivedesk.',
|
|
131
|
+
''
|
|
132
|
+
].join(os.EOL);
|
|
133
|
+
fs.writeFileSync(path.join(opts.target === 'macos-universal' ? out : path.join(out, 'hivedesk'), 'README.txt'), readme);
|
|
134
|
+
console.log(`package: ${opts.target} staged in ${out}`);
|