pinokiod 3.9.23 → 3.9.24
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/index.js +2 -1
- package/package.json +1 -1
- package/server/index.js +13 -5
package/kernel/api/index.js
CHANGED
|
@@ -68,7 +68,8 @@ class Api {
|
|
|
68
68
|
// }
|
|
69
69
|
// }
|
|
70
70
|
|
|
71
|
-
meta.iconpath = meta.icon ?
|
|
71
|
+
meta.iconpath = meta.icon ? meta.icon : null
|
|
72
|
+
//meta.iconpath = meta.icon ? path.resolve(api_path, meta.icon) : null
|
|
72
73
|
meta.icon = meta.icon ? `/api/${api_name}/${meta.icon}?raw=true` : "/pinokio-black.png"
|
|
73
74
|
meta.path = api_path
|
|
74
75
|
meta.name = meta.title
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -102,11 +102,7 @@ class Server {
|
|
|
102
102
|
return new Promise(r=>fs.access(s, fs.constants.F_OK, e => r(!e)))
|
|
103
103
|
}
|
|
104
104
|
async updateMeta(formData, app_path) {
|
|
105
|
-
|
|
106
|
-
// write icon file
|
|
107
|
-
let icon_path = this.kernel.path("api", formData.new_path, formData.icon_path)
|
|
108
|
-
await fs.promises.writeFile(icon_path, formData.avatar)
|
|
109
|
-
}
|
|
105
|
+
console.log("updateMeta", formData)
|
|
110
106
|
|
|
111
107
|
// write title/description to pinokio.json
|
|
112
108
|
let dirty
|
|
@@ -127,7 +123,18 @@ class Server {
|
|
|
127
123
|
menu: []
|
|
128
124
|
}
|
|
129
125
|
}
|
|
126
|
+
|
|
127
|
+
if (formData.icon_dirty) {
|
|
128
|
+
//
|
|
129
|
+
// write icon file
|
|
130
|
+
let icon_path = this.kernel.path("api", formData.new_path, formData.icon_path)
|
|
131
|
+
console.log({ icon_path })
|
|
132
|
+
await fs.promises.writeFile(icon_path, formData.avatar)
|
|
133
|
+
meta.icon = formData.icon_path
|
|
134
|
+
dirty = true
|
|
135
|
+
}
|
|
130
136
|
if (dirty) {
|
|
137
|
+
console.log("Save", meta_path, meta)
|
|
131
138
|
await fs.promises.writeFile(meta_path, JSON.stringify(meta, null, 2))
|
|
132
139
|
}
|
|
133
140
|
}
|
|
@@ -4263,6 +4270,7 @@ class Server {
|
|
|
4263
4270
|
// 1. copy first
|
|
4264
4271
|
let old_path = this.kernel.path("api", formData.old_path)
|
|
4265
4272
|
let new_path = this.kernel.path("api", formData.new_path)
|
|
4273
|
+
|
|
4266
4274
|
console.log({ old_path, new_path })
|
|
4267
4275
|
await fs.promises.cp(old_path, new_path, { recursive: true })
|
|
4268
4276
|
|