mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update StatusController, add shortcodeRedirect method
This commit is contained in:
parent
a327f5c167
commit
f34977d9a8
1 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,7 @@ use Illuminate\Http\Request;
|
|||
use League\Fractal;
|
||||
use App\Util\Media\Filter;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Services\HashidService;
|
||||
|
||||
class StatusController extends Controller
|
||||
{
|
||||
|
@ -65,6 +66,16 @@ class StatusController extends Controller
|
|||
return view($template, compact('user', 'status'));
|
||||
}
|
||||
|
||||
public function shortcodeRedirect(Request $request, $id)
|
||||
{
|
||||
if(strlen($id) < 5 || !Auth::check()) {
|
||||
return redirect('/login?next='.urlencode('/' . $request->path()));
|
||||
}
|
||||
$id = HashidService::decode($id);
|
||||
$status = Status::findOrFail($id);
|
||||
return redirect($status->url());
|
||||
}
|
||||
|
||||
public function showId(int $id)
|
||||
{
|
||||
abort(404);
|
||||
|
|
Loading…
Reference in a new issue