pinokiod 3.147.0 → 3.150.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/prototype.js +0 -1
- package/kernel/shell.js +14 -14
- package/kernel/util.js +0 -1
- package/package.json +1 -1
- package/server/index.js +17 -4
- package/server/public/files-app/app.css +317 -0
- package/server/public/files-app/app.js +686 -0
- package/server/public/style.css +5 -5
- package/server/public/tab-idle-notifier.js +48 -6
- package/server/public/terminal_input_tracker.js +5 -3
- package/server/routes/files.js +284 -0
- package/server/views/app.ejs +75 -33
- package/server/views/file_browser.ejs +130 -0
- package/server/views/terminal.ejs +6 -4
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
6
|
+
<title>Files · <%=workspaceLabel%></title>
|
|
7
|
+
<link href="/css/fontawesome.min.css" rel="stylesheet">
|
|
8
|
+
<link href="/css/solid.min.css" rel="stylesheet">
|
|
9
|
+
<link href="/css/regular.min.css" rel="stylesheet">
|
|
10
|
+
<link href="/css/brands.min.css" rel="stylesheet">
|
|
11
|
+
<link href="/style.css" rel="stylesheet">
|
|
12
|
+
<link href="/files-app/app.css" rel="stylesheet">
|
|
13
|
+
<link href="/filepond.min.css" rel="stylesheet" />
|
|
14
|
+
<link href="/filepond-plugin-image-preview.min.css" rel="stylesheet" />
|
|
15
|
+
<link href="/filepond-plugin-image-edit.min.css" rel="stylesheet" />
|
|
16
|
+
<link href="/noty.css" rel="stylesheet">
|
|
17
|
+
<% if (agent === 'electron') { %>
|
|
18
|
+
<link href="/electron.css" rel="stylesheet">
|
|
19
|
+
<% } %>
|
|
20
|
+
</head>
|
|
21
|
+
<body class="<%=theme%>" data-agent="<%=agent%>">
|
|
22
|
+
<div class="files-app" data-theme="<%=theme%>">
|
|
23
|
+
<header class="files-app__header">
|
|
24
|
+
<div class="files-app__header-title">
|
|
25
|
+
<i class="fa-regular fa-folder-open"></i>
|
|
26
|
+
<div class="files-app__header-text">
|
|
27
|
+
<div class="files-app__header-primary"><%=workspaceLabel%></div>
|
|
28
|
+
<div class="files-app__header-sub"><%=workspaceRoot%></div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="files-app__header-actions">
|
|
32
|
+
<button class="files-app__meta" type="button" id="files-app-edit-metadata">
|
|
33
|
+
<i class="fa-solid fa-pen-to-square"></i>
|
|
34
|
+
<span>Edit metadata</span>
|
|
35
|
+
</button>
|
|
36
|
+
<button class="files-app__save" id="files-app-save" disabled>
|
|
37
|
+
<i class="fa-solid fa-floppy-disk"></i>
|
|
38
|
+
<span>Save</span>
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
</header>
|
|
42
|
+
<section class="files-app__body">
|
|
43
|
+
<aside class="files-app__sidebar" aria-label="Project files">
|
|
44
|
+
<div class="files-app__sidebar-scroll" id="files-app-tree">
|
|
45
|
+
</div>
|
|
46
|
+
</aside>
|
|
47
|
+
<main class="files-app__main">
|
|
48
|
+
<div class="files-app__tabs" id="files-app-tabs" role="tablist" aria-label="Open files"></div>
|
|
49
|
+
<div class="files-app__editor" id="files-app-editor" role="presentation"></div>
|
|
50
|
+
<div class="files-app__status" id="files-app-status" role="status" aria-live="polite"></div>
|
|
51
|
+
</main>
|
|
52
|
+
</section>
|
|
53
|
+
</div>
|
|
54
|
+
<script src="/sweetalert2.js"></script>
|
|
55
|
+
<script src="/filepond-plugin-file-validate-type.min.js"></script>
|
|
56
|
+
<script src="/filepond-plugin-image-exif-orientation.min.js"></script>
|
|
57
|
+
<script src="/filepond-plugin-image-preview.min.js"></script>
|
|
58
|
+
<script src="/filepond-plugin-image-edit.min.js"></script>
|
|
59
|
+
<script src="/filepond-plugin-image-crop.min.js"></script>
|
|
60
|
+
<script src="/filepond-plugin-image-resize.min.js"></script>
|
|
61
|
+
<script src="/filepond-plugin-image-transform.min.js"></script>
|
|
62
|
+
<script src="/filepond.min.js"></script>
|
|
63
|
+
<script src="/fseditor.js"></script>
|
|
64
|
+
<script src="/ace/ace.js"></script>
|
|
65
|
+
<script src="/ace/ext-modelist.js"></script>
|
|
66
|
+
<script src="/files-app/app.js"></script>
|
|
67
|
+
<script>
|
|
68
|
+
window.FilesApp.init({
|
|
69
|
+
workspace: <%- JSON.stringify(workspaceSlug) %>,
|
|
70
|
+
workspaceLabel: <%- JSON.stringify(workspaceLabel) %>,
|
|
71
|
+
theme: <%- JSON.stringify(theme) %>,
|
|
72
|
+
initialPath: <%- JSON.stringify(initialPath || '') %>,
|
|
73
|
+
initialPathType: <%- JSON.stringify(initialPathType || null) %>,
|
|
74
|
+
workspaceRoot: <%- JSON.stringify(workspaceRootEncoded || '') %>
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const workspaceMetadata = {
|
|
78
|
+
title: <%- JSON.stringify((workspaceMeta && workspaceMeta.title) || '') %>,
|
|
79
|
+
description: <%- JSON.stringify((workspaceMeta && workspaceMeta.description) || '') %>,
|
|
80
|
+
icon: <%- JSON.stringify((workspaceMeta && workspaceMeta.icon) || '') %>,
|
|
81
|
+
iconpath: <%- JSON.stringify((workspaceMeta && workspaceMeta.iconpath) || '') %>
|
|
82
|
+
};
|
|
83
|
+
const workspaceSlugValue = <%- JSON.stringify(workspaceSlug) %>;
|
|
84
|
+
|
|
85
|
+
const encodeWorkspacePath = (value) => {
|
|
86
|
+
if (!value) {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
return value
|
|
90
|
+
.split('/')
|
|
91
|
+
.filter(Boolean)
|
|
92
|
+
.map((segment) => encodeURIComponent(segment))
|
|
93
|
+
.join('/');
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const redirectToWorkspace = (newPath) => {
|
|
97
|
+
if (!newPath) {
|
|
98
|
+
return window.location.href;
|
|
99
|
+
}
|
|
100
|
+
const encoded = encodeWorkspacePath(newPath);
|
|
101
|
+
const url = new URL(window.location.href);
|
|
102
|
+
url.pathname = `/pinokio/fileview/${encoded}`;
|
|
103
|
+
return url.toString();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const metadataButton = document.getElementById('files-app-edit-metadata');
|
|
107
|
+
if (metadataButton) {
|
|
108
|
+
metadataButton.addEventListener('click', async (event) => {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
if (typeof FSEditor !== 'function') {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
await FSEditor({
|
|
115
|
+
title: workspaceMetadata.title,
|
|
116
|
+
description: workspaceMetadata.description,
|
|
117
|
+
old_path: workspaceSlugValue,
|
|
118
|
+
icon: workspaceMetadata.icon,
|
|
119
|
+
iconpath: workspaceMetadata.iconpath,
|
|
120
|
+
edit: true,
|
|
121
|
+
redirect: redirectToWorkspace
|
|
122
|
+
});
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error('Failed to open metadata editor', error);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
129
|
+
</body>
|
|
130
|
+
</html>
|
|
@@ -272,15 +272,15 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
272
272
|
if (!isLast) {
|
|
273
273
|
const line = this.inputBuffer + segment
|
|
274
274
|
this.inputBuffer = ""
|
|
275
|
-
this.notifyLineSubmitted(line)
|
|
275
|
+
this.notifyLineSubmitted(line, { hadLineBreak: true })
|
|
276
276
|
} else {
|
|
277
277
|
this.inputBuffer += segment
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
notifyLineSubmitted(line) {
|
|
281
|
+
notifyLineSubmitted(line, meta = {}) {
|
|
282
282
|
if (this.inputTracker) {
|
|
283
|
-
this.inputTracker.submit(line)
|
|
283
|
+
this.inputTracker.submit(line, meta)
|
|
284
284
|
return
|
|
285
285
|
}
|
|
286
286
|
if (!window || !window.parent || typeof window.parent.postMessage !== "function") {
|
|
@@ -290,11 +290,13 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
290
290
|
const preview = safeLine.trim()
|
|
291
291
|
const limit = 200
|
|
292
292
|
const truncated = preview.length > limit ? preview.slice(0, limit) + "..." : preview
|
|
293
|
+
const hadLineBreak = Boolean(meta && meta.hadLineBreak)
|
|
294
|
+
const meaningful = truncated.length > 0 || hadLineBreak
|
|
293
295
|
window.parent.postMessage({
|
|
294
296
|
type: "terminal-input",
|
|
295
297
|
frame: window.name || null,
|
|
296
298
|
line: truncated,
|
|
297
|
-
hasContent:
|
|
299
|
+
hasContent: meaningful
|
|
298
300
|
}, "*")
|
|
299
301
|
}
|
|
300
302
|
write(text) {
|