1
0
Fork 0
forked from mirror/pixelfed
pixelfed/app/Http/Controllers/MediaController.php

32 lines
701 B
PHP
Raw Normal View History

2018-04-16 01:26:48 +00:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Media;
2018-04-16 01:26:48 +00:00
class MediaController extends Controller
{
public function index(Request $request)
{
//return view('settings.drive.index');
}
public function composeUpdate(Request $request, $id)
{
abort(400, 'Endpoint deprecated');
}
public function fallbackRedirect(Request $request, $pid, $mhash, $uhash, $f)
{
abort_if(!config_cache('pixelfed.cloud_storage'), 404);
$path = 'public/m/_v2/' . $pid . '/' . $mhash . '/' . $uhash . '/' . $f;
$media = Media::whereProfileId($pid)
->whereMediaPath($path)
->whereNotNull('cdn_url')
->firstOrFail();
return redirect()->away($media->cdn_url);
}
2018-04-16 01:26:48 +00:00
}