pinokiod 2.15.47 → 2.15.49
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/shells.js +0 -3
- package/kernel/util.js +11 -1
- package/package.json +1 -1
- package/server/index.js +8 -0
- package/server/views/editor.ejs +11 -0
- package/server/views/fullscreen_editor.ejs +9 -0
package/kernel/shells.js
CHANGED
|
@@ -150,8 +150,6 @@ class Shells {
|
|
|
150
150
|
ondata(stream)
|
|
151
151
|
})
|
|
152
152
|
|
|
153
|
-
console.log(">>>>>> RESPONSE", response)
|
|
154
|
-
|
|
155
153
|
/*
|
|
156
154
|
{
|
|
157
155
|
method: "shell.run",
|
|
@@ -181,7 +179,6 @@ class Shells {
|
|
|
181
179
|
|
|
182
180
|
// 2. first find the `break: false` handlers and replace the patterns with blank => so they won't be matched in the next step
|
|
183
181
|
//let line = response.replaceAll(/[\r\n]/g, "")
|
|
184
|
-
console.log("checking breakpoints", breakPoints)
|
|
185
182
|
for(let handler of breakPoints) {
|
|
186
183
|
if (handler.event) {
|
|
187
184
|
let matches = /^\/(.+)\/([dgimsuy]*)$/gs.exec(handler.event)
|
package/kernel/util.js
CHANGED
|
@@ -140,6 +140,16 @@ const parse_env_detail = async (filename) => {
|
|
|
140
140
|
*/
|
|
141
141
|
return items
|
|
142
142
|
}
|
|
143
|
+
const log_path = (fullpath, kernel) => {
|
|
144
|
+
let api_path = `${kernel.homedir}${path.sep}api`
|
|
145
|
+
let rel_path = path.relative(api_path, fullpath)
|
|
146
|
+
console.log({ rel_path })
|
|
147
|
+
let log_root = `${kernel.homedir}${path.sep}logs`
|
|
148
|
+
console.log({ log_root })
|
|
149
|
+
let current_log_path = path.resolve(log_root, "shell/cleaned/api", rel_path)
|
|
150
|
+
console.log({ current_log_path })
|
|
151
|
+
return current_log_path
|
|
152
|
+
}
|
|
143
153
|
const api_path = (fullpath, kernel) => {
|
|
144
154
|
let api_path = `${kernel.homedir}${path.sep}api`
|
|
145
155
|
let rel_path = path.relative(api_path, fullpath)
|
|
@@ -196,5 +206,5 @@ const update_env = async (filepath, changes) => {
|
|
|
196
206
|
await fs.promises.writeFile(filepath, newval)
|
|
197
207
|
};
|
|
198
208
|
module.exports = {
|
|
199
|
-
parse_env, api_path, update_env, parse_env_detail, openfs, port_running, du
|
|
209
|
+
parse_env, log_path, api_path, update_env, parse_env_detail, openfs, port_running, du
|
|
200
210
|
}
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -931,6 +931,8 @@ class Server {
|
|
|
931
931
|
items: pre_items
|
|
932
932
|
})
|
|
933
933
|
} else {
|
|
934
|
+
let logpath = encodeURIComponent(Util.log_path(filepath, this.kernel))
|
|
935
|
+
console.log({ logpath })
|
|
934
936
|
const result = {
|
|
935
937
|
prev,
|
|
936
938
|
error,
|
|
@@ -949,6 +951,7 @@ class Server {
|
|
|
949
951
|
gitRemote,
|
|
950
952
|
filename,
|
|
951
953
|
filepath,
|
|
954
|
+
logpath,
|
|
952
955
|
encodedFilePath: encodeURIComponent(filepath),
|
|
953
956
|
schemaPath,
|
|
954
957
|
uri,
|
|
@@ -2363,6 +2366,11 @@ class Server {
|
|
|
2363
2366
|
apps
|
|
2364
2367
|
})
|
|
2365
2368
|
}))
|
|
2369
|
+
this.app.get("/getlog", ex(async (req, res) => {
|
|
2370
|
+
console.log("query", req.query)
|
|
2371
|
+
let str = await fs.promises.readFile(req.query.logpath, "utf8")
|
|
2372
|
+
res.send(str)
|
|
2373
|
+
}))
|
|
2366
2374
|
this.app.post("/proxy", ex(async (req, res) => {
|
|
2367
2375
|
/*
|
|
2368
2376
|
req.body := {
|
package/server/views/editor.ejs
CHANGED
|
@@ -742,6 +742,14 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
742
742
|
document.querySelector("#close-error-screen").addEventListener('click', (e) => {
|
|
743
743
|
document.querySelector("#error-screen").classList.add("hidden")
|
|
744
744
|
})
|
|
745
|
+
/*
|
|
746
|
+
document.querySelector("#open-log").addEventListener("click", async (e) => {
|
|
747
|
+
let logs = await fetch("/getlog?logpath=<%=logpath%>").then((res) => {
|
|
748
|
+
return res.text()
|
|
749
|
+
})
|
|
750
|
+
console.log(logs)
|
|
751
|
+
})
|
|
752
|
+
*/
|
|
745
753
|
})
|
|
746
754
|
const reloadMemory = async () => {
|
|
747
755
|
// let url = "/pinokio/memory?filepath=" + encodeURI("<%-filepath%>")
|
|
@@ -795,6 +803,9 @@ const reloadMemory = async () => {
|
|
|
795
803
|
</div>
|
|
796
804
|
<button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View File</button>
|
|
797
805
|
<!--
|
|
806
|
+
<button class='btn' id='open-log' data-logpath="<%=logpath%>"><i class="fa-solid fa-align-left"></i> View Logs</button>
|
|
807
|
+
-->
|
|
808
|
+
<!--
|
|
798
809
|
<button class='btn' id='source' data-editor-url="<%=editorUrl%>">Navigate</button>
|
|
799
810
|
-->
|
|
800
811
|
<div id='save' class='btn disabled'>
|
|
@@ -711,6 +711,12 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|
|
711
711
|
document.querySelector("#close-error-screen").addEventListener('click', (e) => {
|
|
712
712
|
document.querySelector("#error-screen").classList.add("hidden")
|
|
713
713
|
})
|
|
714
|
+
// document.querySelector("#open-log").addEventListener("click", async (e) => {
|
|
715
|
+
// let logs = await fetch("/getlog?logpath=<%=logpath%>").then((res) => {
|
|
716
|
+
// return res.text()
|
|
717
|
+
// })
|
|
718
|
+
// console.log(logs)
|
|
719
|
+
// })
|
|
714
720
|
})
|
|
715
721
|
const reloadMemory = async () => {
|
|
716
722
|
// let url = "/pinokio/memory?filepath=<%=encodedFilePath%>"
|
|
@@ -754,6 +760,9 @@ const reloadMemory = async () => {
|
|
|
754
760
|
<span class='stop hidden'><i class="fa-solid fa-stop"></i> Stop</span>
|
|
755
761
|
</div>
|
|
756
762
|
<button class='btn' id='open-fs' data-filepath="<%=filepath%>"><i class="fa-solid fa-eye"></i> View File</button>
|
|
763
|
+
<!--
|
|
764
|
+
<button class='btn' id='open-log' data-logpath="<%=logpath%>"><i class="fa-solid fa-align-left"></i> View Logs</button>
|
|
765
|
+
-->
|
|
757
766
|
</div>
|
|
758
767
|
<% } %>
|
|
759
768
|
</header>
|