Skip to content

Commit

Permalink
add gdr support and fix level ticket crap
Browse files Browse the repository at this point in the history
  • Loading branch information
0x1DEA committed Mar 8, 2024
1 parent 9958450 commit ddf4b1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/Http/Controllers/Game/LevelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Game/LevelReplayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
},
Expand Down

0 comments on commit ddf4b1a

Please sign in to comment.