fix random, fml
This commit is contained in:
parent
9fe601d0fa
commit
8f709d197e
|
@ -312,15 +312,15 @@ function Websrv(tlib) {
|
||||||
switch(url[3]) {
|
switch(url[3]) {
|
||||||
case "image":
|
case "image":
|
||||||
mimes = ["image/png", "image/gif", "image/jpeg"];
|
mimes = ["image/png", "image/gif", "image/jpeg"];
|
||||||
query = "where ("+mimes.map(mime => "`mime` = '"+mime+"'").join(" or ")+") and rand() limit 1";
|
query = "where "+mimes.map(mime => "`mime` = '"+mime+"'").join(" or ")+" order by rand() limit 1";
|
||||||
break;
|
break;
|
||||||
case "video":
|
case "video":
|
||||||
mimes = ["video/webm", "video/mp4", "video/quicktime"];
|
mimes = ["video/webm", "video/mp4", "video/quicktime"];
|
||||||
query = "where ("+mimes.map(mime => "`mime` = '"+mime+"'").join(" or ")+") and rand() limit 1";
|
query = "where "+mimes.map(mime => "`mime` = '"+mime+"'").join(" or ")+" order by rand() limit 1";
|
||||||
break;
|
break;
|
||||||
case "audio":
|
case "audio":
|
||||||
mimes = ["audio/mpeg", "audio/flac", "audio/x-flac", "audio/ogg"];
|
mimes = ["audio/mpeg", "audio/flac", "audio/x-flac", "audio/ogg"];
|
||||||
query = "where ("+mimes.map(mime => "`mime` = '"+mime+"'").join(" or ")+") and rand() limit 1";
|
query = "where "+mimes.map(mime => "`mime` = '"+mime+"'").join(" or ")+" order by rand() limit 1";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
query = "order by rand() limit 1";
|
query = "order by rand() limit 1";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user