backend: implement /random

This commit is contained in:
Lucas 2023-02-19 20:22:30 +00:00
parent c55bdd6ea7
commit ad6a6cb9c0
1 changed files with 5 additions and 0 deletions

View File

@ -149,6 +149,11 @@ get "/media/:media_id" => sub {
};
get "/random" => sub {
my $res = api_get("/random");
send_error("API error", 500) if !$res->{success};
my $data = decode_json($res->{content});
forward "/media/" . $data->{id};
};
true;