streamby-core 0.25.0 → 0.25.1
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.
|
@@ -173,20 +173,23 @@ function storageRouter(config) {
|
|
|
173
173
|
router.get('/storages', async (req, res) => {
|
|
174
174
|
try {
|
|
175
175
|
const auth = await config.authProvider(req);
|
|
176
|
-
if (!auth ||
|
|
177
|
-
!auth.userId ||
|
|
178
|
-
!auth.role) {
|
|
176
|
+
if (!auth || !auth.userId || !auth.role) {
|
|
179
177
|
return res.status(401).json({ message: 'Unauthorized' });
|
|
180
178
|
}
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
179
|
+
const STORAGE_DISPLAY = {
|
|
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
|
+
};
|
|
185
|
+
const storages = (config.storageProviders || []).map(provider => ({
|
|
186
|
+
...STORAGE_DISPLAY[provider.type],
|
|
187
|
+
type: provider.type,
|
|
188
|
+
}));
|
|
189
|
+
res.status(200).json({ storages });
|
|
187
190
|
}
|
|
188
191
|
catch (err) {
|
|
189
|
-
res.status(500).json({ message:
|
|
192
|
+
res.status(500).json({ message: err.message });
|
|
190
193
|
}
|
|
191
194
|
});
|
|
192
195
|
return router;
|