forked from mirror/pixelfed
Merge pull request #993 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
c844562c07
|
@ -23,6 +23,7 @@ use App\Transformer\Api\{
|
|||
AccountTransformer,
|
||||
StatusTransformer,
|
||||
};
|
||||
use App\Util\Media\Filter;
|
||||
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
||||
use League\Fractal\Serializer\ArraySerializer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
|
@ -63,7 +64,7 @@ class InternalApiController extends Controller
|
|||
if($m->profile_id !== $profile->id || $m->status_id) {
|
||||
abort(403, 'Invalid media id');
|
||||
}
|
||||
$m->filter_class = $media['filter'];
|
||||
$m->filter_class = in_array($media['filter'], Filter::classes()) ? $media['filter'] : null;
|
||||
$m->license = $media['license'];
|
||||
$m->caption = strip_tags($media['alt']);
|
||||
$m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k;
|
||||
|
|
|
@ -16,6 +16,7 @@ use Auth;
|
|||
use Cache;
|
||||
use Illuminate\Http\Request;
|
||||
use League\Fractal;
|
||||
use App\Util\Media\Filter;
|
||||
|
||||
class StatusController extends Controller
|
||||
{
|
||||
|
@ -151,6 +152,8 @@ class StatusController extends Controller
|
|||
if(in_array($v->getMimeType(), $allowedMimes) == false) {
|
||||
continue;
|
||||
}
|
||||
$filter_class = $request->input('filter_class');
|
||||
$filter_name = $request->input('filter_name');
|
||||
|
||||
$storagePath = "public/m/{$monthHash}/{$userHash}";
|
||||
$path = $v->store($storagePath);
|
||||
|
@ -163,8 +166,9 @@ class StatusController extends Controller
|
|||
$media->original_sha256 = $hash;
|
||||
$media->size = $v->getSize();
|
||||
$media->mime = $v->getMimeType();
|
||||
$media->filter_class = $request->input('filter_class');
|
||||
$media->filter_name = $request->input('filter_name');
|
||||
|
||||
$media->filter_class = in_array($filter_class, Filter::classes()) ? $filter_class : null;
|
||||
$media->filter_name = in_array($filter_name, Filter::names()) ? $filter_name : null;
|
||||
$media->order = $order;
|
||||
$media->save();
|
||||
array_push($mimes, $media->mime);
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace App\Util\Media;
|
||||
|
||||
class Filter {
|
||||
|
||||
public static $filters = [
|
||||
'1977' => 'filter-1977',
|
||||
'Aden' => 'filter-aden',
|
||||
'Amaro' => 'filter-amaro',
|
||||
'Ashby' => 'filter-ashby',
|
||||
'Brannan' => 'filter-brannan',
|
||||
'Brooklyn' => 'filter-brooklyn',
|
||||
'Charmes' => 'filter-charmes',
|
||||
'Clarendon' => 'filter-clarendon',
|
||||
'Crema' => 'filter-crema',
|
||||
'Dogpatch' => 'filter-dogpatch',
|
||||
'Earlybird' => 'filter-earlybird',
|
||||
'Gingham' => 'filter-gingham',
|
||||
'Ginza' => 'filter-ginza',
|
||||
'Hefe' => 'filter-hefe',
|
||||
'Helena' => 'filter-helena',
|
||||
'Hudson' => 'filter-hudson',
|
||||
'Inkwell' => 'filter-inkwell',
|
||||
'Kelvin' => 'filter-kelvin',
|
||||
'Kuno' => 'filter-juno',
|
||||
'Lark' => 'filter-lark',
|
||||
'Lo-Fi' => 'filter-lofi',
|
||||
'Ludwig' => 'filter-ludwig',
|
||||
'Maven' => 'filter-maven',
|
||||
'Mayfair' => 'filter-mayfair',
|
||||
'Moon' => 'filter-moon',
|
||||
'Nashville' => 'filter-nashville',
|
||||
'Perpetua' => 'filter-perpetua',
|
||||
'Poprocket' => 'filter-poprocket',
|
||||
'Reyes' => 'filter-reyes',
|
||||
'Rise' => 'filter-rise',
|
||||
'Sierra' => 'filter-sierra',
|
||||
'Skyline' => 'filter-skyline',
|
||||
'Slumber' => 'filter-slumber',
|
||||
'Stinson' => 'filter-stinson',
|
||||
'Sutro' => 'filter-sutro',
|
||||
'Toaster' => 'filter-toaster',
|
||||
'Valencia' => 'filter-valencia',
|
||||
'Vesper' => 'filter-vesper',
|
||||
'Walden' => 'filter-walden',
|
||||
'Willow' => 'filter-willow',
|
||||
'X-Pro II' => 'filter-xpro-ii'
|
||||
];
|
||||
|
||||
public static function classes()
|
||||
{
|
||||
return array_values(self::$filters);
|
||||
}
|
||||
|
||||
public static function names()
|
||||
{
|
||||
return array_keys(self::$filters);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue