mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: Respect the restriction when picking a random book
This commit is contained in:
parent
76582f2fe3
commit
f5094c211e
@ -894,7 +894,8 @@ class BrowseServer(object):
|
|||||||
@Endpoint()
|
@Endpoint()
|
||||||
def browse_random(self, *args, **kwargs):
|
def browse_random(self, *args, **kwargs):
|
||||||
import random
|
import random
|
||||||
book_id = random.choice(tuple(self.db.all_ids()))
|
book_id = random.choice(self.db.search_getting_ids(
|
||||||
|
'', self.search_restriction))
|
||||||
ans = self.browse_render_details(book_id)
|
ans = self.browse_render_details(book_id)
|
||||||
return self.browse_template('').format(
|
return self.browse_template('').format(
|
||||||
title='', script='book();', main=ans)
|
title='', script='book();', main=ans)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user