pinokiod 5.3.3 → 5.3.5
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/index.js +18 -7
- package/server/views/app.ejs +54 -12
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -1099,6 +1099,7 @@ class Server {
|
|
|
1099
1099
|
git_fork_url: `/run/scripts/git/fork.json?cwd=${encodeURIComponent(this.kernel.path('api', name))}`
|
|
1100
1100
|
// rawpath,
|
|
1101
1101
|
}
|
|
1102
|
+
result.snapshotFooterEnabled = !!(options && options.snapshotFooterEnabled)
|
|
1102
1103
|
result.hasSnapshots = !!(options && options.hasSnapshots)
|
|
1103
1104
|
result.pendingSnapshotId = options && options.pendingSnapshotId ? String(options.pendingSnapshotId) : null
|
|
1104
1105
|
const registryBetaEnabled = await this.isRegistryBetaEnabled().catch(() => false)
|
|
@@ -9162,20 +9163,30 @@ class Server {
|
|
|
9162
9163
|
})
|
|
9163
9164
|
}))
|
|
9164
9165
|
this.app.get("/p/:name/dev", ex(async (req, res) => {
|
|
9165
|
-
|
|
9166
|
-
await this.chrome(req, res, "browse", { hasSnapshots, pendingSnapshotId })
|
|
9166
|
+
await this.chrome(req, res, "browse")
|
|
9167
9167
|
}))
|
|
9168
9168
|
this.app.get("/p/:name/files", ex(async (req, res) => {
|
|
9169
|
-
|
|
9170
|
-
await this.chrome(req, res, "files", { hasSnapshots, pendingSnapshotId })
|
|
9169
|
+
await this.chrome(req, res, "files")
|
|
9171
9170
|
}))
|
|
9172
9171
|
this.app.get("/p/:name/browse", ex(async (req, res) => {
|
|
9172
|
+
await this.chrome(req, res, "browse")
|
|
9173
|
+
}))
|
|
9174
|
+
this.app.get("/p/:name/snapshot_status", ex(async (req, res) => {
|
|
9175
|
+
let d = Date.now()
|
|
9176
|
+
console.time("/snapshot/" + req.params.name + "/" + d)
|
|
9173
9177
|
const { hasSnapshots, pendingSnapshotId } = await this.getSnapshotStatus(req.params.name)
|
|
9174
|
-
|
|
9178
|
+
res.json({
|
|
9179
|
+
ok: true,
|
|
9180
|
+
hasSnapshots: !!hasSnapshots,
|
|
9181
|
+
pendingSnapshotId: pendingSnapshotId ? String(pendingSnapshotId) : ""
|
|
9182
|
+
})
|
|
9183
|
+
console.timeEnd("/snapshot/" + req.params.name + "/" + d)
|
|
9175
9184
|
}))
|
|
9176
9185
|
this.app.get("/p/:name", ex(async (req, res) => {
|
|
9177
|
-
|
|
9178
|
-
|
|
9186
|
+
let d = Date.now()
|
|
9187
|
+
console.time("/p/" + req.params.name + "/" + d)
|
|
9188
|
+
await this.chrome(req, res, "run", { snapshotFooterEnabled: true })
|
|
9189
|
+
console.timeEnd("/p/" + req.params.name + "/" + d)
|
|
9179
9190
|
}))
|
|
9180
9191
|
this.app.post("/pinokio/delete", ex(async (req, res) => {
|
|
9181
9192
|
try {
|
package/server/views/app.ejs
CHANGED
|
@@ -3456,8 +3456,8 @@ body.dark .snapshot-footer-input input {
|
|
|
3456
3456
|
(function() {
|
|
3457
3457
|
try {
|
|
3458
3458
|
var workspace = <%- JSON.stringify(name || "") %>
|
|
3459
|
-
var
|
|
3460
|
-
if (!workspace ||
|
|
3459
|
+
var snapshotFooterEnabled = <%- JSON.stringify(!!snapshotFooterEnabled) %>
|
|
3460
|
+
if (!workspace || !snapshotFooterEnabled) {
|
|
3461
3461
|
return
|
|
3462
3462
|
}
|
|
3463
3463
|
var key = "pinokio.snapshot-footer.dismissed:" + workspace
|
|
@@ -3703,9 +3703,9 @@ body.dark .snapshot-footer-input input {
|
|
|
3703
3703
|
<% } %>
|
|
3704
3704
|
</main>
|
|
3705
3705
|
<% const registryEnabled = typeof registryBetaEnabled === "undefined" ? false : registryBetaEnabled; %>
|
|
3706
|
-
<% const
|
|
3707
|
-
<% if (
|
|
3708
|
-
<div class='snapshot-footer' data-workspace="<%=name%>" data-pending-snapshot-id="<%= pendingSnapshotId ? pendingSnapshotId : '' %>" data-registry-beta-enabled="<%= registryEnabled ? '1' : '0' %>">
|
|
3706
|
+
<% const snapshotFooterAllowed = typeof snapshotFooterEnabled === "undefined" ? false : snapshotFooterEnabled; %>
|
|
3707
|
+
<% if (snapshotFooterAllowed) { %>
|
|
3708
|
+
<div class='snapshot-footer hidden' data-workspace="<%=name%>" data-pending-snapshot-id="<%= pendingSnapshotId ? pendingSnapshotId : '' %>" data-registry-beta-enabled="<%= registryEnabled ? '1' : '0' %>">
|
|
3709
3709
|
<div class="snapshot-footer-save <%= registryEnabled && pendingSnapshotId ? 'hidden' : '' %>">
|
|
3710
3710
|
<div class='caption' title="<%= registryEnabled ? 'Saves a tiny JSON checkpoint of exact commit hashes (no files). You can publish it after saving.' : 'Saves a tiny JSON checkpoint of exact commit hashes (no files).' %>">
|
|
3711
3711
|
Snapshot installed modules information and restore later
|
|
@@ -9737,7 +9737,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
9737
9737
|
footer.classList.add("hidden")
|
|
9738
9738
|
return
|
|
9739
9739
|
}
|
|
9740
|
-
|
|
9740
|
+
footer.classList.add("hidden")
|
|
9741
|
+
let pendingSnapshotId = footer.getAttribute("data-pending-snapshot-id") || ""
|
|
9741
9742
|
const dismissStorageKey = `pinokio.snapshot-footer.dismissed:${workspace}`
|
|
9742
9743
|
const getDismissedState = () => {
|
|
9743
9744
|
try {
|
|
@@ -9755,9 +9756,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
9755
9756
|
}
|
|
9756
9757
|
} catch (_) {}
|
|
9757
9758
|
}
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9759
|
+
const setDismissedClass = (dismissed) => {
|
|
9760
|
+
if (dismissed) {
|
|
9761
|
+
document.documentElement.classList.add("snapshot-footer-dismissed")
|
|
9762
|
+
} else {
|
|
9763
|
+
document.documentElement.classList.remove("snapshot-footer-dismissed")
|
|
9764
|
+
}
|
|
9761
9765
|
}
|
|
9762
9766
|
let savedSnapshotId = null
|
|
9763
9767
|
const saveOriginal = saveBtn.innerHTML
|
|
@@ -9783,10 +9787,47 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
9783
9787
|
if (publishPanel) publishPanel.classList.remove("hidden")
|
|
9784
9788
|
if (savePanel) savePanel.classList.add("hidden")
|
|
9785
9789
|
}
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9790
|
+
const showSavePanel = () => {
|
|
9791
|
+
if (savePanel) savePanel.classList.remove("hidden")
|
|
9792
|
+
if (publishPanel) publishPanel.classList.add("hidden")
|
|
9793
|
+
}
|
|
9794
|
+
const applySnapshotStatus = (status) => {
|
|
9795
|
+
const hasSnapshots = !!(status && status.hasSnapshots)
|
|
9796
|
+
pendingSnapshotId = status && status.pendingSnapshotId ? String(status.pendingSnapshotId) : ""
|
|
9797
|
+
footer.setAttribute("data-pending-snapshot-id", pendingSnapshotId)
|
|
9798
|
+
const shouldShow = !hasSnapshots || (registryBetaEnabled && pendingSnapshotId)
|
|
9799
|
+
if (!shouldShow) {
|
|
9800
|
+
setDismissedClass(false)
|
|
9801
|
+
footer.classList.add("hidden")
|
|
9802
|
+
return
|
|
9803
|
+
}
|
|
9804
|
+
const dismissed = !pendingSnapshotId && getDismissedState()
|
|
9805
|
+
setDismissedClass(dismissed)
|
|
9806
|
+
if (dismissed) {
|
|
9807
|
+
footer.classList.add("hidden")
|
|
9808
|
+
return
|
|
9809
|
+
}
|
|
9810
|
+
footer.classList.remove("hidden")
|
|
9811
|
+
if (pendingSnapshotId) {
|
|
9812
|
+
savedSnapshotId = pendingSnapshotId
|
|
9813
|
+
showPublishPanel()
|
|
9814
|
+
} else {
|
|
9815
|
+
showSavePanel()
|
|
9816
|
+
}
|
|
9817
|
+
}
|
|
9818
|
+
const loadSnapshotStatus = async () => {
|
|
9819
|
+
try {
|
|
9820
|
+
const res = await fetch(`/p/${encodeURIComponent(workspace)}/snapshot_status`, {
|
|
9821
|
+
method: "GET",
|
|
9822
|
+
headers: { "Accept": "application/json" }
|
|
9823
|
+
})
|
|
9824
|
+
if (!res.ok) return
|
|
9825
|
+
const payload = await res.json().catch(() => null)
|
|
9826
|
+
if (!payload || !payload.ok) return
|
|
9827
|
+
applySnapshotStatus(payload)
|
|
9828
|
+
} catch (_) {}
|
|
9789
9829
|
}
|
|
9830
|
+
loadSnapshotStatus()
|
|
9790
9831
|
|
|
9791
9832
|
const snapshotInfoJson = `{
|
|
9792
9833
|
"version": 1,
|
|
@@ -10148,6 +10189,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
10148
10189
|
const handleDismiss = (event) => {
|
|
10149
10190
|
event.preventDefault()
|
|
10150
10191
|
setDismissedState(true)
|
|
10192
|
+
setDismissedClass(true)
|
|
10151
10193
|
footer.classList.add("hidden")
|
|
10152
10194
|
}
|
|
10153
10195
|
|