@hyperframes/studio-server 0.7.38 → 0.7.39
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/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4639,6 +4639,31 @@ function registerMediaRoutes(api, adapter, options = {}) {
|
|
|
4639
4639
|
});
|
|
4640
4640
|
}
|
|
4641
4641
|
|
|
4642
|
+
// src/routes/globalAssets.ts
|
|
4643
|
+
import { existsSync as existsSync10, readFileSync as readFileSync12 } from "fs";
|
|
4644
|
+
import { homedir } from "os";
|
|
4645
|
+
import { join as join14 } from "path";
|
|
4646
|
+
function readGlobalAssets(home = homedir()) {
|
|
4647
|
+
const manifestPath = join14(home, ".media", "manifest.jsonl");
|
|
4648
|
+
if (!existsSync10(manifestPath)) return [];
|
|
4649
|
+
const out = [];
|
|
4650
|
+
for (const line of readFileSync12(manifestPath, "utf8").split("\n")) {
|
|
4651
|
+
if (!line.trim()) continue;
|
|
4652
|
+
try {
|
|
4653
|
+
const rec = JSON.parse(line);
|
|
4654
|
+
if (rec && rec.reusable) out.push(rec);
|
|
4655
|
+
} catch {
|
|
4656
|
+
}
|
|
4657
|
+
}
|
|
4658
|
+
return out;
|
|
4659
|
+
}
|
|
4660
|
+
function toPublicAsset(r) {
|
|
4661
|
+
return { id: r.id, type: r.type, description: r.description, sha: r.sha, entity: r.entity };
|
|
4662
|
+
}
|
|
4663
|
+
function registerGlobalAssetRoutes(api) {
|
|
4664
|
+
api.get("/assets/global", (c) => c.json({ assets: readGlobalAssets().map(toPublicAsset) }));
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4642
4667
|
// src/createStudioApi.ts
|
|
4643
4668
|
function createStudioApi(adapter) {
|
|
4644
4669
|
const api = new Hono();
|
|
@@ -4654,6 +4679,7 @@ function createStudioApi(adapter) {
|
|
|
4654
4679
|
registerWaveformRoutes(api, adapter);
|
|
4655
4680
|
registerFontRoutes(api);
|
|
4656
4681
|
registerRegistryRoutes(api, adapter);
|
|
4682
|
+
registerGlobalAssetRoutes(api);
|
|
4657
4683
|
return api;
|
|
4658
4684
|
}
|
|
4659
4685
|
|