Bläddra i källkod

Update ComposeController, add addl compose settings data

Daniel Supernault 1 månad sedan
förälder
incheckning
1cb01545bc
1 ändrade filer med 7 tillägg och 3 borttagningar
  1. 7 3
      app/Http/Controllers/ComposeController.php

+ 7 - 3
app/Http/Controllers/ComposeController.php

@@ -780,14 +780,18 @@ class ComposeController extends Controller
         $uid = $request->user()->id;
         abort_if($request->user()->has_roles && ! UserRoleService::can('can-post', $request->user()->id), 403, 'Invalid permissions for this action');
 
+        $types = config_cache('pixelfed.media_types');
+        if (str_contains($types, ',')) {
+            $types = explode(',', $types);
+        }
         $default = [
-            'allowed_media_types' => config_cache('pixelfed.media_types'),
+            'allowed_media_types' => $types,
             'max_caption_length' => (int) config_cache('pixelfed.max_caption_length'),
             'default_license' => 1,
             'media_descriptions' => false,
-            'max_file_size' => config_cache('pixelfed.max_photo_size'),
+            'max_file_size' => (int) config_cache('pixelfed.max_photo_size'),
             'max_media_attachments' => (int) config_cache('pixelfed.max_album_length'),
-            'max_altext_length' => config_cache('pixelfed.max_altext_length'),
+            'max_altext_length' => (int) config_cache('pixelfed.max_altext_length'),
         ];
         $settings = AccountService::settings($uid);
         if (isset($settings['other']) && isset($settings['other']['scope'])) {