forked from mirror/pixelfed
Update AP Helpers
This commit is contained in:
parent
e14e18e6b4
commit
f6e652223d
1 changed files with 20 additions and 22 deletions
|
@ -319,7 +319,7 @@ class Helpers {
|
||||||
$status->scope = $scope;
|
$status->scope = $scope;
|
||||||
$status->visibility = $scope;
|
$status->visibility = $scope;
|
||||||
$status->save();
|
$status->save();
|
||||||
// self::importNoteAttachment($res, $status);
|
self::importNoteAttachment($res, $status);
|
||||||
return $status;
|
return $status;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -330,8 +330,6 @@ class Helpers {
|
||||||
|
|
||||||
public static function importNoteAttachment($data, Status $status)
|
public static function importNoteAttachment($data, Status $status)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
|
|
||||||
if(self::verifyAttachments($data) == false) {
|
if(self::verifyAttachments($data) == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -348,28 +346,28 @@ class Helpers {
|
||||||
if(in_array($type, $allowed) == false || $valid == false) {
|
if(in_array($type, $allowed) == false || $valid == false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// $info = pathinfo($url);
|
$info = pathinfo($url);
|
||||||
|
|
||||||
// // pleroma attachment fix
|
// pleroma attachment fix
|
||||||
// $url = str_replace(' ', '%20', $url);
|
$url = str_replace(' ', '%20', $url);
|
||||||
|
|
||||||
// $img = file_get_contents($url, false, stream_context_create(['ssl' => ["verify_peer"=>true,"verify_peer_name"=>true]]));
|
$img = file_get_contents($url, false, stream_context_create(['ssl' => ["verify_peer"=>true,"verify_peer_name"=>true]]));
|
||||||
// $file = '/tmp/'.str_random(32);
|
$file = '/tmp/pxmi-'.str_random(32);
|
||||||
// file_put_contents($file, $img);
|
file_put_contents($file, $img);
|
||||||
// $fdata = new File($file);
|
$fdata = new File($file);
|
||||||
// $path = Storage::putFile($storagePath, $fdata, 'public');
|
$path = Storage::putFile($storagePath, $fdata, 'public');
|
||||||
// $media = new Media();
|
$media = new Media();
|
||||||
// $media->status_id = $status->id;
|
$media->status_id = $status->id;
|
||||||
// $media->profile_id = $status->profile_id;
|
$media->profile_id = $status->profile_id;
|
||||||
// $media->user_id = null;
|
$media->user_id = null;
|
||||||
// $media->media_path = $path;
|
$media->media_path = $path;
|
||||||
// $media->size = $fdata->getSize();
|
$media->size = $fdata->getSize();
|
||||||
// $media->mime = $fdata->getMimeType();
|
$media->mime = $fdata->getMimeType();
|
||||||
// $media->save();
|
$media->save();
|
||||||
|
|
||||||
// ImageThumbnail::dispatch($media);
|
ImageThumbnail::dispatch($media);
|
||||||
// ImageOptimize::dispatch($media);
|
ImageOptimize::dispatch($media);
|
||||||
// unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue