streamby-core 0.28.0 → 0.28.3

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.
@@ -298,12 +298,11 @@ function exportRouter(config) {
298
298
  const origin = req.headers.origin;
299
299
  let effectiveAllowedOrigins = exportMetadata.allowedOrigin;
300
300
  const projectOrigins = project.allowedOrigin;
301
- // If export's allowedOrigin is ['*'] or it's not set, it inherits from the project.
302
- if (!effectiveAllowedOrigins || (effectiveAllowedOrigins.length === 1 && effectiveAllowedOrigins[0] === '*')) {
301
+ // If export's allowedOrigin is empty, ['*'], or not set, it inherits from the project.
302
+ if (!effectiveAllowedOrigins || effectiveAllowedOrigins.length === 0 || (effectiveAllowedOrigins.length === 1 && effectiveAllowedOrigins[0] === '*')) {
303
303
  effectiveAllowedOrigins = projectOrigins;
304
304
  }
305
305
  else {
306
- // If the export has its own list, ensure it's a subset of the project's list (if project is not public).
307
306
  if (projectOrigins && !projectOrigins.includes('*')) {
308
307
  const isSubset = effectiveAllowedOrigins.every((o) => projectOrigins.includes(o));
309
308
  if (!isSubset) {
@@ -329,11 +328,9 @@ function exportRouter(config) {
329
328
  }
330
329
  }
331
330
  if (!devModeAllowed) {
332
- // If there's no origin header, deny access unless the effective scope is public.
333
331
  if (!origin && !(effectiveAllowedOrigins && effectiveAllowedOrigins.includes('*'))) {
334
332
  return res.status(403).json({ message: 'Origin header required' });
335
333
  }
336
- // Check for public access ('*') or if the request's origin is in the effective list.
337
334
  const isAllowed = effectiveAllowedOrigins && (effectiveAllowedOrigins.includes('*') || (origin && effectiveAllowedOrigins.includes(origin)));
338
335
  if (!isAllowed) {
339
336
  return res.status(403).json({ message: 'Unauthorized' });
@@ -16,6 +16,8 @@ const resolveSubscription = async (auth) => {
16
16
  const ensureSubscription = async (req, res, next) => {
17
17
  try {
18
18
  const auth = req.auth;
19
+ if (!auth)
20
+ return next();
19
21
  const plan = await resolveSubscription(auth);
20
22
  req.subscription = plan;
21
23
  next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamby-core",
3
- "version": "0.28.0",
3
+ "version": "0.28.3",
4
4
  "description": "StreamBy middleware framework for media storage management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",