mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Custom list template option for standalone server
This commit is contained in:
parent
81afaa6512
commit
3eade1a5f2
@ -23,8 +23,6 @@ New features for the server generally
|
|||||||
- Add a way to search the set of locally available books stored in offline
|
- Add a way to search the set of locally available books stored in offline
|
||||||
storage.
|
storage.
|
||||||
|
|
||||||
- Add more book list visualizations and/or a customizable visualization
|
|
||||||
|
|
||||||
- Automatic Let's Encrypt integration so that using HTTPS is easier
|
- Automatic Let's Encrypt integration so that using HTTPS is easier
|
||||||
Should wait for the acme v2 protocol endpoint:
|
Should wait for the acme v2 protocol endpoint:
|
||||||
https://letsencrypt.org/2017/06/14/acme-v2-api.html
|
https://letsencrypt.org/2017/06/14/acme-v2-api.html
|
||||||
|
@ -3,20 +3,20 @@
|
|||||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from calibre import as_unicode
|
from calibre import as_unicode
|
||||||
from calibre.constants import (
|
from calibre.constants import is_running_from_develop, isosx, iswindows, plugins
|
||||||
is_running_from_develop, isosx, iswindows, plugins)
|
|
||||||
from calibre.db.legacy import LibraryDatabase
|
from calibre.db.legacy import LibraryDatabase
|
||||||
from calibre.srv.bonjour import BonJour
|
from calibre.srv.bonjour import BonJour
|
||||||
from calibre.srv.handler import Handler
|
from calibre.srv.handler import Handler
|
||||||
from calibre.srv.http_response import create_http_handler
|
from calibre.srv.http_response import create_http_handler
|
||||||
from calibre.srv.library_broker import load_gui_libraries
|
from calibre.srv.library_broker import load_gui_libraries
|
||||||
from calibre.srv.manage_users_cli import manage_users_cli
|
|
||||||
from calibre.srv.loop import ServerLoop
|
from calibre.srv.loop import ServerLoop
|
||||||
|
from calibre.srv.manage_users_cli import manage_users_cli
|
||||||
from calibre.srv.opts import opts_to_parser
|
from calibre.srv.opts import opts_to_parser
|
||||||
from calibre.srv.utils import RotatingLog
|
from calibre.srv.utils import RotatingLog
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs
|
||||||
@ -64,6 +64,9 @@ class Server(object):
|
|||||||
if opts.access_log:
|
if opts.access_log:
|
||||||
access_log = RotatingLog(opts.access_log, max_size=log_size)
|
access_log = RotatingLog(opts.access_log, max_size=log_size)
|
||||||
self.handler = Handler(libraries, opts)
|
self.handler = Handler(libraries, opts)
|
||||||
|
if opts.custom_list_template:
|
||||||
|
with lopen(opts.custom_list_template, 'rb') as f:
|
||||||
|
self.handler.router.ctx.custom_list_template = json.load(f)
|
||||||
plugins = []
|
plugins = []
|
||||||
if opts.use_bonjour:
|
if opts.use_bonjour:
|
||||||
plugins.append(BonJour())
|
plugins.append(BonJour())
|
||||||
@ -105,6 +108,13 @@ libraries that the main calibre program knows about will be used.
|
|||||||
'Path to the access log file. This log contains information'
|
'Path to the access log file. This log contains information'
|
||||||
' about clients connecting to the server and making requests. By'
|
' about clients connecting to the server and making requests. By'
|
||||||
' default no access logging is done.'))
|
' default no access logging is done.'))
|
||||||
|
parser.add_option(
|
||||||
|
'--custom-list-template', help=_(
|
||||||
|
'Path to a JSON file containing a template for the custom book list mode.'
|
||||||
|
' The easiest way to create such a template file is to go to Preferences->'
|
||||||
|
' Sharing over the net-> Book list template in calibre, create the'
|
||||||
|
' template and export it.'
|
||||||
|
))
|
||||||
if not iswindows and not isosx:
|
if not iswindows and not isosx:
|
||||||
# Does not work on macOS because if we fork() we cannot connect to Core
|
# Does not work on macOS because if we fork() we cannot connect to Core
|
||||||
# Serives which is needed by the QApplication() constructor, which in
|
# Serives which is needed by the QApplication() constructor, which in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user