diff --git a/app/Http/Controllers/Game/LevelController.php b/app/Http/Controllers/Game/LevelController.php index b610b3d..aded54d 100644 --- a/app/Http/Controllers/Game/LevelController.php +++ b/app/Http/Controllers/Game/LevelController.php @@ -186,6 +186,17 @@ public function replays(Level $level) { 'author', 'files' ])->paginate(12) + ->through(function (LevelReplay $r) { + $r->files->transform(function (Media $media) { + + $hashids = new Hashids(bin2hex(Crypt::getKey()), 8); + $result = $hashids->encode([$media->id, 0]); + $media->setAttribute('url', route('download', $result)); + return $media; + }); + + return $r; + }) ]); } diff --git a/app/Http/Controllers/Game/LevelReplayController.php b/app/Http/Controllers/Game/LevelReplayController.php index 774633e..51a5da1 100644 --- a/app/Http/Controllers/Game/LevelReplayController.php +++ b/app/Http/Controllers/Game/LevelReplayController.php @@ -79,7 +79,7 @@ public function store(Request $request): RedirectResponse 'required', 'max:16000', function (string $attribute, UploadedFile $value, Closure $fail) { - if (!in_array($value->getClientOriginalExtension(), ['replay', 'zbot', 'dat', 'ddhor', 'xbot', 'kd', 'zbf', 'xbot', 'rsh', 'json', 'mhr'])) { + if (!in_array($value->getClientOriginalExtension(), ['gdr', 'replay', 'zbot', 'dat', 'ddhor', 'xbot', 'kd', 'zbf', 'xbot', 'rsh', 'json', 'mhr'])) { $fail('This file type is invalid.'); } },