backend: implement /random

This commit is contained in:
Lucas 2023-02-19 20:22:30 +00:00
parent c55bdd6ea7
commit ad6a6cb9c0

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;