mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update ApiV1Controller, add default license support
This commit is contained in:
parent
833d110c9e
commit
2a791f1991
1 changed files with 14 additions and 0 deletions
|
@ -1091,6 +1091,17 @@ class ApiV1Controller extends Controller
|
||||||
$storagePath = MediaPathService::get($user, 2);
|
$storagePath = MediaPathService::get($user, 2);
|
||||||
$path = $photo->store($storagePath);
|
$path = $photo->store($storagePath);
|
||||||
$hash = \hash_file('sha256', $photo);
|
$hash = \hash_file('sha256', $photo);
|
||||||
|
$license = null;
|
||||||
|
|
||||||
|
$settings = UserSetting::whereUserId($user->id)->first();
|
||||||
|
|
||||||
|
if($settings && !empty($settings->compose_settings)) {
|
||||||
|
$compose = json_decode($settings->compose_settings, true);
|
||||||
|
|
||||||
|
if(isset($compose['default_license']) && $compose['default_license'] != 1) {
|
||||||
|
$license = $compose['default_license'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abort_if(MediaBlocklistService::exists($hash) == true, 451);
|
abort_if(MediaBlocklistService::exists($hash) == true, 451);
|
||||||
|
|
||||||
|
@ -1105,6 +1116,9 @@ class ApiV1Controller extends Controller
|
||||||
$media->caption = $request->input('description');
|
$media->caption = $request->input('description');
|
||||||
$media->filter_class = $filterClass;
|
$media->filter_class = $filterClass;
|
||||||
$media->filter_name = $filterName;
|
$media->filter_name = $filterName;
|
||||||
|
if($license) {
|
||||||
|
$media->license = $license;
|
||||||
|
}
|
||||||
$media->save();
|
$media->save();
|
||||||
|
|
||||||
switch ($media->mime) {
|
switch ($media->mime) {
|
||||||
|
|
Loading…
Reference in a new issue