@hearthlog/tooling 0.1.7 → 0.1.8
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 +2 -2
- package/src/vite/dev-plugins.ts +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hearthlog/tooling",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"tsx": "^4.23.15",
|
|
31
|
-
"@hearthlog/contracts": "0.1.
|
|
31
|
+
"@hearthlog/contracts": "0.1.8"
|
|
32
32
|
},
|
|
33
33
|
"bin": {
|
|
34
34
|
"hearthlog": "./bin/hearthlog.mjs"
|
package/src/vite/dev-plugins.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { Plugin } from 'vite';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
8
9
|
|
|
9
10
|
import { localGatewayOriginAllowed } from '../dev/local-development.js';
|
|
10
11
|
|
|
@@ -348,9 +349,17 @@ export function localStashMediaPlugin(credential?: import('../dev/local-developm
|
|
|
348
349
|
if (!localGatewayOriginAllowed(incoming.headers.origin, incoming.headers.host) || incoming.headers['sec-fetch-site'] === 'cross-site') return respond(403, 'Cross-origin local media requests are not allowed');
|
|
349
350
|
if (!credential) return respond(503, 'Start the local Ledger and run ledger:provision-local before uploading videos locally');
|
|
350
351
|
try {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
352
|
+
// Vite's config bundler follows literal imports even inside this dev-only callback.
|
|
353
|
+
// Load these through Vite so their TypeScript package dependencies stay out of config loading.
|
|
354
|
+
const [{ loadModules }, { loadTenantConfig }, { activeSiteId }] = await Promise.all([
|
|
355
|
+
server.ssrLoadModule(fileURLToPath(new URL('../compose/compose-modules.js', import.meta.url))),
|
|
356
|
+
server.ssrLoadModule(fileURLToPath(new URL('../tenants/tenant-config.js', import.meta.url))),
|
|
357
|
+
server.ssrLoadModule(fileURLToPath(new URL('../root.js', import.meta.url))),
|
|
358
|
+
]);
|
|
359
|
+
const config: Awaited<ReturnType<typeof import('../tenants/tenant-config.js').loadTenantConfig>> = await loadTenantConfig();
|
|
360
|
+
const site = config.sites.find(site => site.id === activeSiteId());
|
|
361
|
+
const modules: ReturnType<typeof import('../compose/compose-modules.js').loadModules> = loadModules();
|
|
362
|
+
const module = modules.find(module => module.manifest.server?.routes?.includes('/api/stash-media/v1') && module.manifest.features.some(feature => site?.features.some(enabled => enabled === feature.id)));
|
|
354
363
|
if (!module) return respond(404, 'Video media is not enabled for this site');
|
|
355
364
|
const endpoint = new URL(process.env.STASH_MEDIA_DEV_ENDPOINT || 'http://127.0.0.1:9000');
|
|
356
365
|
if (!['localhost', '127.0.0.1', '[::1]'].includes(endpoint.hostname)) return respond(503, 'Development media storage must use a loopback MinIO endpoint');
|