summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Misc/Redirects.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNWeb/Misc/Redirects.pm')
-rw-r--r--lib/VNWeb/Misc/Redirects.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNWeb/Misc/Redirects.pm b/lib/VNWeb/Misc/Redirects.pm
index 964c4e24..4a84150b 100644
--- a/lib/VNWeb/Misc/Redirects.pm
+++ b/lib/VNWeb/Misc/Redirects.pm
@@ -1,7 +1,7 @@
package VNWeb::Misc::Redirects;
use VNWeb::Prelude;
-use VNWeb::Filters;
+use VNWeb::AdvSearch;
# VNDB URLs don't have a trailing /, redirect if we get one.
@@ -28,11 +28,11 @@ TUWF::get qr{/v/rand}, sub {
state $stats ||= tuwf->dbRowi('SELECT COUNT(*) AS total, COUNT(*) FILTER(WHERE NOT hidden) AS subset FROM vn');
state $sample ||= 100*min 1, (100 / $stats->{subset}) * ($stats->{total} / $stats->{subset});
- my $filt = auth->pref('filter_vn') && eval { filter_parse v => auth->pref('filter_vn') };
+ my $filt = advsearch_default 'v';
my $vn = tuwf->dbVali('
SELECT id
- FROM vn v', $filt ? '' : ('TABLESAMPLE SYSTEM (', \$sample, ')'), '
- WHERE NOT hidden AND', filter_vn_query($filt||{}), '
+ FROM vn v', $filt->{query} ? '' : ('TABLESAMPLE SYSTEM (', \$sample, ')'), '
+ WHERE NOT hidden AND', $filt->sql_where(), '
ORDER BY random() LIMIT 1'
);
return tuwf->resNotFound if !$vn;