pinokiod 3.84.0 → 3.86.0
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/kernel/api/index.js +7 -0
- package/kernel/bin/caddy.js +10 -4
- package/kernel/peer.js +14 -11
- package/kernel/prototype.js +1 -0
- package/kernel/shell.js +43 -2
- package/kernel/util.js +2 -0
- package/package.json +1 -1
- package/pipe/views/login.ejs +1 -1
- package/server/index.js +139 -86
- package/server/public/common.js +534 -0
- package/server/public/opener.js +12 -11
- package/server/public/serve/style.css +1 -1
- package/server/public/style.css +25 -24
- package/server/public/urldropdown.css +474 -5
- package/server/public/urldropdown.js +233 -12
- package/server/views/404.ejs +1 -1
- package/server/views/500.ejs +1 -1
- package/server/views/app.ejs +29 -33
- package/server/views/bookmarklet.ejs +197 -0
- package/server/views/connect/x.ejs +4 -4
- package/server/views/connect.ejs +10 -10
- package/server/views/container.ejs +2 -2
- package/server/views/d.ejs +3 -3
- package/server/views/download.ejs +1 -1
- package/server/views/editor.ejs +1 -1
- package/server/views/env_editor.ejs +3 -3
- package/server/views/explore.ejs +2 -2
- package/server/views/file_explorer.ejs +2 -2
- package/server/views/git.ejs +7 -7
- package/server/views/github.ejs +3 -3
- package/server/views/help.ejs +2 -2
- package/server/views/index.ejs +5 -5
- package/server/views/index2.ejs +3 -3
- package/server/views/init/index.ejs +11 -74
- package/server/views/install.ejs +3 -3
- package/server/views/keys.ejs +2 -2
- package/server/views/mini.ejs +2 -2
- package/server/views/net.ejs +6 -6
- package/server/views/network.ejs +22 -22
- package/server/views/network2.ejs +10 -10
- package/server/views/old_network.ejs +8 -8
- package/server/views/pro.ejs +369 -0
- package/server/views/prototype/index.ejs +2 -2
- package/server/views/required_env_editor.ejs +2 -2
- package/server/views/review.ejs +6 -6
- package/server/views/screenshots.ejs +5 -4
- package/server/views/settings.ejs +3 -3
- package/server/views/setup.ejs +2 -2
- package/server/views/setup_home.ejs +2 -2
- package/server/views/share_editor.ejs +4 -4
- package/server/views/shell.ejs +3 -3
- package/server/views/start.ejs +2 -2
- package/server/views/task.ejs +2 -2
- package/server/views/terminal.ejs +5 -4
- package/server/views/tools.ejs +13 -13
package/kernel/api/index.js
CHANGED
|
@@ -802,6 +802,13 @@ class Api {
|
|
|
802
802
|
current: i,
|
|
803
803
|
uri: request.uri,
|
|
804
804
|
cwd,
|
|
805
|
+
exists: (...args) => {
|
|
806
|
+
return fs.existsSync(path.resolve(cwd, ...args))
|
|
807
|
+
},
|
|
808
|
+
running: (...args) => {
|
|
809
|
+
let fullpath = path.resolve(cwd, ...args)
|
|
810
|
+
return this.running[fullpath]
|
|
811
|
+
},
|
|
805
812
|
name,
|
|
806
813
|
self: script,
|
|
807
814
|
port,
|
package/kernel/bin/caddy.js
CHANGED
|
@@ -32,10 +32,16 @@ class Caddy {
|
|
|
32
32
|
await new Promise((resolve, reject) => {
|
|
33
33
|
let interval = setInterval(() => {
|
|
34
34
|
if (this.kernel.processes.caddy_pid) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
try {
|
|
36
|
+
console.log("kill caddy", this.kernel.processes.caddy_pid)
|
|
37
|
+
kill(this.kernel.processes.caddy_pid, "SIGKILL", true)
|
|
38
|
+
console.log("killed existing caddy")
|
|
39
|
+
clearInterval(interval)
|
|
40
|
+
resolve()
|
|
41
|
+
} catch (error) {
|
|
42
|
+
clearInterval(interval)
|
|
43
|
+
reject(error)
|
|
44
|
+
}
|
|
39
45
|
} else {
|
|
40
46
|
console.log("try killing existing caddy again in 1 sec")
|
|
41
47
|
}
|
package/kernel/peer.js
CHANGED
|
@@ -23,14 +23,11 @@ class PeerDiscovery {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
async check_peers () {
|
|
26
|
-
console.log(">>>>>>>>>>>> check peers")
|
|
27
26
|
let peer_array = Array.from(this.peers)
|
|
28
27
|
for(let host of peer_array) {
|
|
29
28
|
if (this.host !== host) {
|
|
30
29
|
let result = await this._refresh(host)
|
|
31
|
-
console.log("check peeers", { host, result })
|
|
32
30
|
if (!result) {
|
|
33
|
-
console.log("delete host", host)
|
|
34
31
|
this.peers.delete(host)
|
|
35
32
|
delete this.info[host]
|
|
36
33
|
}
|
|
@@ -367,15 +364,21 @@ class PeerDiscovery {
|
|
|
367
364
|
let d = Date.now()
|
|
368
365
|
let router_info = await this.router_info()
|
|
369
366
|
let installed = await this.installed()
|
|
370
|
-
let peers
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
367
|
+
let peers
|
|
368
|
+
if (this.info) {
|
|
369
|
+
peers = Object.values(this.info).filter((info) => {
|
|
370
|
+
return info.host !== this.host
|
|
371
|
+
}).map((info) => {
|
|
372
|
+
return {
|
|
373
|
+
name: info.name,
|
|
374
|
+
host: info.host
|
|
375
|
+
}
|
|
376
|
+
})
|
|
377
|
+
} else {
|
|
378
|
+
peers = []
|
|
379
|
+
}
|
|
378
380
|
return {
|
|
381
|
+
active: this.active,
|
|
379
382
|
version: this.kernel.version,
|
|
380
383
|
home: this.kernel.homedir,
|
|
381
384
|
arch: this.kernel.arch,
|
package/kernel/prototype.js
CHANGED
package/kernel/shell.js
CHANGED
|
@@ -18,6 +18,9 @@ const Util = require('./util')
|
|
|
18
18
|
const Environment = require('./environment')
|
|
19
19
|
const ShellParser = require('./shell_parser')
|
|
20
20
|
const home = os.homedir()
|
|
21
|
+
|
|
22
|
+
// xterm.js currently ignores DECSYNCTERM (CSI ? 2026 h/l) and renders it as text on Windows.
|
|
23
|
+
// filterDecsync() removes these sequences so they do not pollute the terminal output.
|
|
21
24
|
class Shell {
|
|
22
25
|
/*
|
|
23
26
|
params
|
|
@@ -37,6 +40,7 @@ class Shell {
|
|
|
37
40
|
this.platform = os.platform()
|
|
38
41
|
this.logs = {}
|
|
39
42
|
this.shell = this.platform === 'win32' ? 'cmd.exe' : 'bash';
|
|
43
|
+
this.decsyncBuffer = ''
|
|
40
44
|
|
|
41
45
|
// Windows: /D => ignore AutoRun Registry Key
|
|
42
46
|
// Others: --noprofile => ignore .bash_profile, --norc => ignore .bashrc
|
|
@@ -551,7 +555,7 @@ class Shell {
|
|
|
551
555
|
term.onData((data) => {
|
|
552
556
|
if (!this.prompt_done) {
|
|
553
557
|
if (this.prompt_ready) {
|
|
554
|
-
queue.push(data)
|
|
558
|
+
queue.push(this.filterDecsync(data))
|
|
555
559
|
} else {
|
|
556
560
|
setTimeout(() => {
|
|
557
561
|
if (!this.prompt_ready) {
|
|
@@ -1080,7 +1084,7 @@ class Shell {
|
|
|
1080
1084
|
data = data.replace(/\x1b\[6n/g, ''); // remove the code
|
|
1081
1085
|
}
|
|
1082
1086
|
|
|
1083
|
-
this.queue.push(data)
|
|
1087
|
+
this.queue.push(this.filterDecsync(data))
|
|
1084
1088
|
}
|
|
1085
1089
|
});
|
|
1086
1090
|
}
|
|
@@ -1182,6 +1186,43 @@ class Shell {
|
|
|
1182
1186
|
let cleaned = this.stripAnsi(buf)
|
|
1183
1187
|
this._log(buf, cleaned)
|
|
1184
1188
|
}
|
|
1189
|
+
filterDecsync(data) {
|
|
1190
|
+
if (!data) return data
|
|
1191
|
+
|
|
1192
|
+
const prefix = '\u001b[?2026'
|
|
1193
|
+
let chunk = this.decsyncBuffer ? this.decsyncBuffer + data : data
|
|
1194
|
+
if (chunk.includes('\u2190')) {
|
|
1195
|
+
chunk = chunk.replace(/\u2190/g, '\u001b')
|
|
1196
|
+
}
|
|
1197
|
+
this.decsyncBuffer = ''
|
|
1198
|
+
|
|
1199
|
+
let result = ''
|
|
1200
|
+
let i = 0
|
|
1201
|
+
while (i < chunk.length) {
|
|
1202
|
+
if (chunk.charCodeAt(i) === 0x1b) { // ESC
|
|
1203
|
+
const remaining = chunk.slice(i)
|
|
1204
|
+
if (remaining.startsWith('\u001b[?2026h') || remaining.startsWith('\u001b[?2026l')) {
|
|
1205
|
+
i += 8
|
|
1206
|
+
continue
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
// Check if the remaining characters form a partial prefix of DECSYNCTERM
|
|
1210
|
+
let matched = 0
|
|
1211
|
+
const len = Math.min(prefix.length, remaining.length)
|
|
1212
|
+
while (matched < len && remaining[matched] === prefix[matched]) {
|
|
1213
|
+
matched++
|
|
1214
|
+
}
|
|
1215
|
+
if (matched === remaining.length && matched < prefix.length + 1) {
|
|
1216
|
+
this.decsyncBuffer = remaining
|
|
1217
|
+
return result
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
result += chunk[i]
|
|
1221
|
+
i++
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
return result
|
|
1225
|
+
}
|
|
1185
1226
|
_log(buf, cleaned) {
|
|
1186
1227
|
|
|
1187
1228
|
|
package/kernel/util.js
CHANGED
package/package.json
CHANGED