pinokiod 6.0.79 → 6.0.80
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/package.json +1 -1
- package/server/views/app.ejs +65 -55
package/package.json
CHANGED
package/server/views/app.ejs
CHANGED
|
@@ -5326,23 +5326,62 @@ header.navheader .mode-selector .community-mode-toggle {
|
|
|
5326
5326
|
return []
|
|
5327
5327
|
}
|
|
5328
5328
|
}
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5329
|
+
const normalizeInjectTarget = (target) => {
|
|
5330
|
+
if (!target || typeof target !== "object") {
|
|
5331
|
+
return null
|
|
5332
|
+
}
|
|
5333
|
+
const name = typeof target.name === "string" ? target.name : ""
|
|
5334
|
+
const src = typeof target.src === "string" ? target.src : ""
|
|
5335
|
+
const inject = Array.isArray(target.inject) ? target.inject : []
|
|
5336
|
+
if (!name && !src) {
|
|
5337
|
+
return null
|
|
5338
|
+
}
|
|
5339
|
+
return {
|
|
5340
|
+
name,
|
|
5341
|
+
src,
|
|
5342
|
+
inject
|
|
5343
|
+
}
|
|
5344
|
+
}
|
|
5345
|
+
const buildFrameInjectTarget = (frame, overrides = {}) => {
|
|
5346
|
+
if (!frame || typeof frame.getAttribute !== "function") {
|
|
5347
|
+
return null
|
|
5348
|
+
}
|
|
5349
|
+
return normalizeInjectTarget({
|
|
5350
|
+
name: typeof overrides.name === "string" ? overrides.name : (frame.name || frame.getAttribute("name") || ""),
|
|
5351
|
+
src: typeof overrides.src === "string" ? overrides.src : (frame.getAttribute("src") || frame.src || ""),
|
|
5352
|
+
inject: Array.isArray(overrides.inject) ? overrides.inject : parseInjectDescriptors(frame.getAttribute("data-pinokio-inject"))
|
|
5353
|
+
})
|
|
5354
|
+
}
|
|
5355
|
+
const upsertInjectTarget = (targets, entry) => {
|
|
5356
|
+
const normalized = normalizeInjectTarget(entry)
|
|
5357
|
+
if (!normalized) {
|
|
5358
|
+
return
|
|
5359
|
+
}
|
|
5360
|
+
const index = targets.findIndex((target) => {
|
|
5361
|
+
if (normalized.name && target.name === normalized.name) {
|
|
5362
|
+
return true
|
|
5339
5363
|
}
|
|
5340
|
-
|
|
5364
|
+
return normalized.src && target.src === normalized.src
|
|
5365
|
+
})
|
|
5366
|
+
if (index >= 0) {
|
|
5367
|
+
targets[index] = normalized
|
|
5368
|
+
} else {
|
|
5369
|
+
targets.push(normalized)
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5372
|
+
const buildBrowserviewInjectTargets = (extraTargets = []) => {
|
|
5373
|
+
const targets = Array.from(document.querySelectorAll("main.browserview iframe"))
|
|
5374
|
+
.map((frame) => buildFrameInjectTarget(frame))
|
|
5375
|
+
.filter(Boolean)
|
|
5376
|
+
for (const entry of Array.isArray(extraTargets) ? extraTargets : []) {
|
|
5377
|
+
upsertInjectTarget(targets, entry)
|
|
5378
|
+
}
|
|
5379
|
+
return targets
|
|
5341
5380
|
}
|
|
5342
|
-
const publishBrowserviewInjectTargets = () => {
|
|
5381
|
+
const publishBrowserviewInjectTargets = (extraTargets = []) => {
|
|
5343
5382
|
const payload = {
|
|
5344
5383
|
pageUrl: window.location.href,
|
|
5345
|
-
targets: buildBrowserviewInjectTargets()
|
|
5384
|
+
targets: buildBrowserviewInjectTargets(extraTargets)
|
|
5346
5385
|
}
|
|
5347
5386
|
try {
|
|
5348
5387
|
if (window.electronAPI && typeof window.electronAPI.send === "function") {
|
|
@@ -5351,43 +5390,6 @@ header.navheader .mode-selector .community-mode-toggle {
|
|
|
5351
5390
|
} catch (_) {
|
|
5352
5391
|
}
|
|
5353
5392
|
}
|
|
5354
|
-
const schedulePublishBrowserviewInjectTargets = () => {
|
|
5355
|
-
if (injectTargetPublishScheduled) {
|
|
5356
|
-
return
|
|
5357
|
-
}
|
|
5358
|
-
injectTargetPublishScheduled = true
|
|
5359
|
-
setTimeout(() => {
|
|
5360
|
-
injectTargetPublishScheduled = false
|
|
5361
|
-
publishBrowserviewInjectTargets()
|
|
5362
|
-
}, 0)
|
|
5363
|
-
}
|
|
5364
|
-
const installBrowserviewInjectTargetObserver = () => {
|
|
5365
|
-
if (typeof MutationObserver !== "function") {
|
|
5366
|
-
return
|
|
5367
|
-
}
|
|
5368
|
-
const root = document.querySelector("main")
|
|
5369
|
-
if (!root) {
|
|
5370
|
-
return
|
|
5371
|
-
}
|
|
5372
|
-
const observer = new MutationObserver((records) => {
|
|
5373
|
-
const relevant = records.some((record) => {
|
|
5374
|
-
if (record.type === "childList") {
|
|
5375
|
-
return true
|
|
5376
|
-
}
|
|
5377
|
-
return record.type === "attributes"
|
|
5378
|
-
})
|
|
5379
|
-
if (relevant) {
|
|
5380
|
-
schedulePublishBrowserviewInjectTargets()
|
|
5381
|
-
}
|
|
5382
|
-
})
|
|
5383
|
-
observer.observe(root, {
|
|
5384
|
-
subtree: true,
|
|
5385
|
-
childList: true,
|
|
5386
|
-
attributes: true,
|
|
5387
|
-
attributeFilter: ["src", "name", "data-pinokio-inject", "class"]
|
|
5388
|
-
})
|
|
5389
|
-
schedulePublishBrowserviewInjectTargets()
|
|
5390
|
-
}
|
|
5391
5393
|
const readLinkInjectDescriptors = (node) => {
|
|
5392
5394
|
if (!node || typeof node.getAttribute !== "function") {
|
|
5393
5395
|
return []
|
|
@@ -5418,8 +5420,6 @@ header.navheader .mode-selector .community-mode-toggle {
|
|
|
5418
5420
|
})
|
|
5419
5421
|
let frame = document.createElement("iframe")
|
|
5420
5422
|
frame.name = name
|
|
5421
|
-
refreshTerminalSessions(href)
|
|
5422
|
-
frame.src = href
|
|
5423
5423
|
frame.classList.add("selected")
|
|
5424
5424
|
iframe_onerror(frame)
|
|
5425
5425
|
frame.setAttribute(
|
|
@@ -5428,6 +5428,11 @@ header.navheader .mode-selector .community-mode-toggle {
|
|
|
5428
5428
|
)
|
|
5429
5429
|
frame.setAttribute("allowfullscreen", "")
|
|
5430
5430
|
writeFrameInjectDescriptors(frame, injectDescriptors)
|
|
5431
|
+
publishBrowserviewInjectTargets([
|
|
5432
|
+
buildFrameInjectTarget(frame, { src: href, inject: injectDescriptors })
|
|
5433
|
+
])
|
|
5434
|
+
refreshTerminalSessions(href)
|
|
5435
|
+
frame.src = href
|
|
5431
5436
|
document.querySelector("main").appendChild(frame)
|
|
5432
5437
|
loaded[name] = true
|
|
5433
5438
|
}
|
|
@@ -5442,7 +5447,6 @@ header.navheader .mode-selector .community-mode-toggle {
|
|
|
5442
5447
|
return false
|
|
5443
5448
|
}
|
|
5444
5449
|
}
|
|
5445
|
-
installBrowserviewInjectTargetObserver()
|
|
5446
5450
|
document.addEventListener("click", (e) => {
|
|
5447
5451
|
interacted = true
|
|
5448
5452
|
})
|
|
@@ -6637,6 +6641,9 @@ const rerenderMenuSection = (container, html) => {
|
|
|
6637
6641
|
|
|
6638
6642
|
if (targetFrame) {
|
|
6639
6643
|
writeFrameInjectDescriptors(targetFrame, targetInjectDescriptors)
|
|
6644
|
+
publishBrowserviewInjectTargets([
|
|
6645
|
+
buildFrameInjectTarget(targetFrame, { src: target.href, inject: targetInjectDescriptors })
|
|
6646
|
+
])
|
|
6640
6647
|
targetFrame.classList.remove("hidden")
|
|
6641
6648
|
let mode = target.getAttribute("data-mode")
|
|
6642
6649
|
if (mode === "refresh") {
|
|
@@ -6690,8 +6697,6 @@ const rerenderMenuSection = (container, html) => {
|
|
|
6690
6697
|
} else {
|
|
6691
6698
|
let frame = document.createElement("iframe")
|
|
6692
6699
|
frame.name = target.target
|
|
6693
|
-
refreshTerminalSessions(target.href)
|
|
6694
|
-
frame.src = target.href
|
|
6695
6700
|
iframe_onerror(frame)
|
|
6696
6701
|
frame.setAttribute(
|
|
6697
6702
|
"allow",
|
|
@@ -6699,6 +6704,11 @@ const rerenderMenuSection = (container, html) => {
|
|
|
6699
6704
|
)
|
|
6700
6705
|
frame.setAttribute("allowfullscreen", "")
|
|
6701
6706
|
writeFrameInjectDescriptors(frame, targetInjectDescriptors)
|
|
6707
|
+
publishBrowserviewInjectTargets([
|
|
6708
|
+
buildFrameInjectTarget(frame, { src: target.href, inject: targetInjectDescriptors })
|
|
6709
|
+
])
|
|
6710
|
+
refreshTerminalSessions(target.href)
|
|
6711
|
+
frame.src = target.href
|
|
6702
6712
|
document.querySelector("main").appendChild(frame)
|
|
6703
6713
|
loaded[target.target] = true
|
|
6704
6714
|
lastForegroundSignature = null
|