streamby-core 0.25.1 → 0.25.2
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.
|
@@ -7,7 +7,7 @@ const presign_1 = require("../../services/presign");
|
|
|
7
7
|
const storage_1 = require("../../providers/storage");
|
|
8
8
|
const manager_1 = require("../../models/manager");
|
|
9
9
|
const auth_1 = require("../../utils/auth");
|
|
10
|
-
const VALID_CATEGORIES = ['images', 'audios', 'videos', '
|
|
10
|
+
const VALID_CATEGORIES = ['images', 'audios', 'videos', '3d-models'];
|
|
11
11
|
const VALID_3D_EXTENSIONS = new Set(['.glb', '.gltf', '.obj', '.fbx', '.stl', '.ply']);
|
|
12
12
|
function validateContentType(contentType, filename, category) {
|
|
13
13
|
if (category === 'images')
|
|
@@ -16,7 +16,7 @@ function validateContentType(contentType, filename, category) {
|
|
|
16
16
|
return contentType.startsWith('audio/');
|
|
17
17
|
if (category === 'videos')
|
|
18
18
|
return contentType.startsWith('video/');
|
|
19
|
-
if (category === '
|
|
19
|
+
if (category === '3d-models') {
|
|
20
20
|
const ext = filename.split('.').pop()?.toLowerCase();
|
|
21
21
|
return ext ? VALID_3D_EXTENSIONS.has(`.${ext}`) : false;
|
|
22
22
|
}
|
|
@@ -92,7 +92,7 @@ function storageRouter(config) {
|
|
|
92
92
|
return res.status(400).json({ message: 'Query params fileName and contentType are required' });
|
|
93
93
|
}
|
|
94
94
|
if (!validateContentType(contentType, fileName, category)) {
|
|
95
|
-
const hint = category === '
|
|
95
|
+
const hint = category === '3d-models'
|
|
96
96
|
? '.glb, .gltf, .obj, .fbx, .stl, or .ply'
|
|
97
97
|
: `${category.slice(0, -1)}/* content type`;
|
|
98
98
|
return res.status(400).json({ message: `Files in the ${category} category must match ${hint}` });
|
|
@@ -177,10 +177,10 @@ function storageRouter(config) {
|
|
|
177
177
|
return res.status(401).json({ message: 'Unauthorized' });
|
|
178
178
|
}
|
|
179
179
|
const STORAGE_DISPLAY = {
|
|
180
|
-
s3: { value: '
|
|
181
|
-
gcs: { value: '
|
|
182
|
-
azure: { value: '
|
|
183
|
-
r2: { value: '
|
|
180
|
+
s3: { value: 'aws-s3', name: 'AWS S3' },
|
|
181
|
+
gcs: { value: 'google-cloud-storage', name: 'Google Cloud Storage' },
|
|
182
|
+
azure: { value: 'azure-blob', name: 'Azure Blob Storage' },
|
|
183
|
+
r2: { value: 'cloudflare-r2', name: 'Cloudflare R2' },
|
|
184
184
|
};
|
|
185
185
|
const storages = (config.storageProviders || []).map(provider => ({
|
|
186
186
|
...STORAGE_DISPLAY[provider.type],
|