pinokiod 1.0.53 → 1.0.55
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/proxy/index.js +12 -0
- package/kernel/api/set/index.js +1 -0
- package/kernel/index.js +36 -0
- package/package.json +2 -2
- package/server/index.js +37 -1
- package/server/public/style.css +15 -6
|
@@ -9,7 +9,13 @@ class P {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
*/
|
|
12
|
+
ondata({
|
|
13
|
+
raw: `\r\n[Start proxy] ${req.params.name} ${req.params.uri}\r\n`
|
|
14
|
+
})
|
|
12
15
|
let response = await kernel.api.startProxy(req.parent.path, req.params.uri, req.params.name)
|
|
16
|
+
ondata({
|
|
17
|
+
raw: "Proxy Started"
|
|
18
|
+
})
|
|
13
19
|
return response
|
|
14
20
|
}
|
|
15
21
|
async stop (req, ondata, kernel) {
|
|
@@ -21,7 +27,13 @@ class P {
|
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
*/
|
|
30
|
+
ondata({
|
|
31
|
+
raw: `\r\n[Stop proxy] ${req.params.uri}\r\n`
|
|
32
|
+
})
|
|
24
33
|
kernel.api.stopProxy({ uri: req.params.uri })
|
|
34
|
+
ondata({
|
|
35
|
+
raw: "Proxy Stopped"
|
|
36
|
+
})
|
|
25
37
|
}
|
|
26
38
|
}
|
|
27
39
|
module.exports = P
|
package/kernel/api/set/index.js
CHANGED
package/kernel/index.js
CHANGED
|
@@ -39,6 +39,42 @@ class Kernel {
|
|
|
39
39
|
this.procs[uri] = undefined
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
// on(name, event) {
|
|
43
|
+
// if (name === "refresh_memory") {
|
|
44
|
+
// let urlSet = new Set()
|
|
45
|
+
// // start relevant proxies
|
|
46
|
+
// for(let scriptPath in this.memory.local) {
|
|
47
|
+
// let local = this.memory.local[scriptPath]
|
|
48
|
+
// // if 'url' is set
|
|
49
|
+
// // 1. check if a proxy is already running
|
|
50
|
+
// // 2. if running => ignore
|
|
51
|
+
// // 3. if not running => start proxy
|
|
52
|
+
// if (local.url) {
|
|
53
|
+
// urlSet.add(local.url)
|
|
54
|
+
// }
|
|
55
|
+
// let local = this.api.proxies[parentPath]
|
|
56
|
+
// }
|
|
57
|
+
//
|
|
58
|
+
// // get all running urls
|
|
59
|
+
//
|
|
60
|
+
//
|
|
61
|
+
// // stop relevant proxies
|
|
62
|
+
//
|
|
63
|
+
// for(let scriptPath in this.api.proxies) {
|
|
64
|
+
// // 1. get all the proxies for a scriptPath
|
|
65
|
+
// let proxies = this.api.proxies[scriptPath]
|
|
66
|
+
// // 2. iterate through the proxies
|
|
67
|
+
// for(let proxy of proxies) {
|
|
68
|
+
// if (urlSet.has(proxy.target)) {
|
|
69
|
+
// // the proxy target is part of the urlSet => don't do anything since all the relevant proxies have started above
|
|
70
|
+
// } else {
|
|
71
|
+
// // the proxy target is not part of the urlSet => stop the proxy
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
// // - if the proxy.target is included in one of the uris in one of the local variables
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
77
|
+
// }
|
|
42
78
|
local(...args) {
|
|
43
79
|
// get local variables at path
|
|
44
80
|
let v = this.memory.local[path.resolve(...args)]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinokiod",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.55",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"jsonpath-plus": "^7.2.0",
|
|
37
37
|
"key-store": "^1.2.0",
|
|
38
38
|
"lodash": "^4.17.21",
|
|
39
|
-
"lproxy": "^0.0.
|
|
39
|
+
"lproxy": "^0.0.2",
|
|
40
40
|
"marked": "^5.0.1",
|
|
41
41
|
"mime-types": "^2.1.35",
|
|
42
42
|
"multer": "^1.4.5-lts.1",
|
package/server/index.js
CHANGED
|
@@ -1174,7 +1174,12 @@ class Server {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
|
-
|
|
1177
|
+
console.log("menu item", config.menu[i])
|
|
1178
|
+
if (config.menu[i].popout) {
|
|
1179
|
+
config.menu[i].target = "_blank"
|
|
1180
|
+
} else {
|
|
1181
|
+
config.menu[i].target = "@" + (config.menu[i].id || config.menu[i].src)
|
|
1182
|
+
}
|
|
1178
1183
|
}
|
|
1179
1184
|
|
|
1180
1185
|
|
|
@@ -1185,6 +1190,34 @@ class Server {
|
|
|
1185
1190
|
|
|
1186
1191
|
|
|
1187
1192
|
console.log("config", JSON.stringify(config,null,2))
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
// get all proxies that belong to this repository
|
|
1196
|
+
let childProxies = []
|
|
1197
|
+
console.log("this.kernel.api.proxies=", this.kernel.api.proxies)
|
|
1198
|
+
for(let scriptPath in this.kernel.api.proxies) {
|
|
1199
|
+
let proxies = this.kernel.api.proxies[scriptPath]
|
|
1200
|
+
console.log("PROXIES", proxies)
|
|
1201
|
+
for(let proxy of proxies) {
|
|
1202
|
+
if (scriptPath.startsWith(this.kernel.path("api", name))) {
|
|
1203
|
+
childProxies.push(proxy)
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
console.log({ childProxies })
|
|
1208
|
+
|
|
1209
|
+
let proxyMenu = []
|
|
1210
|
+
for(let proxy of childProxies) {
|
|
1211
|
+
proxyMenu.push({
|
|
1212
|
+
btn: `<i class="fa-solid fa-bolt-lightning"></i> [Proxy] ${proxy.name}`,
|
|
1213
|
+
target: "_blank",
|
|
1214
|
+
href: proxy.target
|
|
1215
|
+
})
|
|
1216
|
+
}
|
|
1217
|
+
console.log({ proxyMenu })
|
|
1218
|
+
config.menu = proxyMenu.concat(config.menu)
|
|
1219
|
+
|
|
1220
|
+
|
|
1188
1221
|
return config
|
|
1189
1222
|
} else {
|
|
1190
1223
|
return config
|
|
@@ -1844,12 +1877,14 @@ class Server {
|
|
|
1844
1877
|
let uri = this.kernel.path("api")
|
|
1845
1878
|
await this.renderMenu(uri, name, config, [])
|
|
1846
1879
|
|
|
1880
|
+
|
|
1847
1881
|
console.log({ config })
|
|
1848
1882
|
|
|
1849
1883
|
}
|
|
1850
1884
|
|
|
1851
1885
|
|
|
1852
1886
|
|
|
1887
|
+
|
|
1853
1888
|
console.log("MEMORY", this.kernel.memory)
|
|
1854
1889
|
res.render("browser", {
|
|
1855
1890
|
running:this.kernel.api.running,
|
|
@@ -1865,6 +1900,7 @@ class Server {
|
|
|
1865
1900
|
agent: this.agent,
|
|
1866
1901
|
src: "/_api/" + name,
|
|
1867
1902
|
rawpath,
|
|
1903
|
+
proxies: this.kernel.api
|
|
1868
1904
|
})
|
|
1869
1905
|
})
|
|
1870
1906
|
this.app.post("/pinokio/delete", async (req, res) => {
|
package/server/public/style.css
CHANGED
|
@@ -1037,8 +1037,8 @@ body.dark .btn {
|
|
|
1037
1037
|
background: rgba(0,0,0,0.8);
|
|
1038
1038
|
}
|
|
1039
1039
|
body.dark .swal2-popup {
|
|
1040
|
-
|
|
1041
|
-
|
|
1040
|
+
background: var(--dark-btn-bg);
|
|
1041
|
+
color: var(--dark-btn-color);
|
|
1042
1042
|
}
|
|
1043
1043
|
.swal2-popup {
|
|
1044
1044
|
border-radius: 0 !important;
|
|
@@ -1059,7 +1059,7 @@ body.dark .swal2-popup {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
.swal2-html-container {
|
|
1061
1061
|
display: block !important;
|
|
1062
|
-
margin:
|
|
1062
|
+
margin: 0px 20px !important;
|
|
1063
1063
|
}
|
|
1064
1064
|
.swal2-html-container .desc:empty {
|
|
1065
1065
|
display: none;
|
|
@@ -1119,7 +1119,7 @@ body.dark .swal2-popup {
|
|
|
1119
1119
|
width: 100% !important;
|
|
1120
1120
|
justify-content: flex-end !important;
|
|
1121
1121
|
margin: 0 !important;
|
|
1122
|
-
padding:
|
|
1122
|
+
padding: 20px !important;
|
|
1123
1123
|
/*
|
|
1124
1124
|
background: rgba(0,0,200,0.04);
|
|
1125
1125
|
*/
|
|
@@ -1147,9 +1147,11 @@ body.dark .swal2-popup {
|
|
|
1147
1147
|
box-sizing: border-box;
|
|
1148
1148
|
}
|
|
1149
1149
|
body.dark .swal2-modal input {
|
|
1150
|
+
/*
|
|
1150
1151
|
background: var(--dark-btn-bg);
|
|
1152
|
+
*/
|
|
1151
1153
|
color: var(--dark-btn-color);
|
|
1152
|
-
border:
|
|
1154
|
+
border: 2px solid rgba(255,255,255,0.1);
|
|
1153
1155
|
}
|
|
1154
1156
|
.swal2-modal input {
|
|
1155
1157
|
/*
|
|
@@ -1166,11 +1168,18 @@ body.dark .swal2-modal input {
|
|
|
1166
1168
|
border-radius: 2px !important;
|
|
1167
1169
|
}
|
|
1168
1170
|
body.dark .swal2-styled.swal2-confirm{
|
|
1171
|
+
background: rgba(255,255,255,0.9) !important;
|
|
1172
|
+
color: black;
|
|
1173
|
+
/*
|
|
1169
1174
|
background: var(--dark-btn-bg);
|
|
1170
1175
|
color: var(--dark-btn-color);
|
|
1176
|
+
*/
|
|
1171
1177
|
}
|
|
1172
1178
|
.swal2-styled.swal2-confirm{
|
|
1173
|
-
background:
|
|
1179
|
+
background: rgba(0,0,0,0.8) !important;
|
|
1180
|
+
margin: 0;
|
|
1181
|
+
font-weight: bold;
|
|
1182
|
+
border: none;
|
|
1174
1183
|
}
|
|
1175
1184
|
.swal2-input {
|
|
1176
1185
|
margin: 0 !important;
|