wiki-plugin-shoppe 0.0.9 → 0.0.10
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/server.js +17 -9
package/package.json
CHANGED
package/server/server.js
CHANGED
|
@@ -247,19 +247,27 @@ async function processArchive(zipPath) {
|
|
|
247
247
|
zip.extractAllTo(tmpDir, true);
|
|
248
248
|
|
|
249
249
|
try {
|
|
250
|
-
// Find manifest.json — handle zips
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
// Find manifest.json — handle zips wrapped in a top-level folder and
|
|
251
|
+
// macOS zips that include a __MACOSX metadata folder alongside the content.
|
|
252
|
+
function findManifest(dir, depth = 0) {
|
|
253
|
+
const direct = path.join(dir, 'manifest.json');
|
|
254
|
+
if (fs.existsSync(direct)) return dir;
|
|
255
|
+
if (depth >= 2) return null;
|
|
256
|
+
const entries = fs.readdirSync(dir).filter(f =>
|
|
257
|
+
f !== '__MACOSX' && fs.statSync(path.join(dir, f)).isDirectory()
|
|
258
|
+
);
|
|
259
|
+
for (const entry of entries) {
|
|
260
|
+
const found = findManifest(path.join(dir, entry), depth + 1);
|
|
261
|
+
if (found) return found;
|
|
258
262
|
}
|
|
263
|
+
return null;
|
|
259
264
|
}
|
|
260
|
-
|
|
265
|
+
|
|
266
|
+
const root = findManifest(tmpDir);
|
|
267
|
+
if (!root) {
|
|
261
268
|
throw new Error('Archive is missing manifest.json');
|
|
262
269
|
}
|
|
270
|
+
const manifestPath = path.join(root, 'manifest.json');
|
|
263
271
|
|
|
264
272
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
265
273
|
if (!manifest.uuid || !manifest.emojicode) {
|