mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not allow users to override the builtin recipe files
This commit is contained in:
parent
5bb81ed5a5
commit
2dd8ff2c44
@ -85,7 +85,7 @@ def serialize_builtin_recipes():
|
|||||||
return serialize_collection(recipe_mapping)
|
return serialize_collection(recipe_mapping)
|
||||||
|
|
||||||
def get_builtin_recipe_collection():
|
def get_builtin_recipe_collection():
|
||||||
return etree.parse(P('builtin_recipes.xml')).getroot()
|
return etree.parse(P('builtin_recipes.xml', allow_user_override=False)).getroot()
|
||||||
|
|
||||||
def get_custom_recipe_collection(*args):
|
def get_custom_recipe_collection(*args):
|
||||||
from calibre.web.feeds.recipes import compile_recipe, \
|
from calibre.web.feeds.recipes import compile_recipe, \
|
||||||
@ -179,7 +179,7 @@ def download_builtin_recipe(urn):
|
|||||||
return br.open_novisit('http://status.calibre-ebook.com/recipe/'+urn).read()
|
return br.open_novisit('http://status.calibre-ebook.com/recipe/'+urn).read()
|
||||||
|
|
||||||
def get_builtin_recipe(urn):
|
def get_builtin_recipe(urn):
|
||||||
with zipfile.ZipFile(P('builtin_recipes.zip'), 'r') as zf:
|
with zipfile.ZipFile(P('builtin_recipes.zip', allow_user_override=False), 'r') as zf:
|
||||||
return zf.read(urn+'.recipe')
|
return zf.read(urn+'.recipe')
|
||||||
|
|
||||||
def get_builtin_recipe_by_title(title, log=None, download_recipe=False):
|
def get_builtin_recipe_by_title(title, log=None, download_recipe=False):
|
||||||
|
@ -140,7 +140,8 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
|
|||||||
self.builtin_recipe_collection = get_builtin_recipe_collection()
|
self.builtin_recipe_collection = get_builtin_recipe_collection()
|
||||||
self.scheduler_config = SchedulerConfig()
|
self.scheduler_config = SchedulerConfig()
|
||||||
try:
|
try:
|
||||||
with zipfile.ZipFile(P('builtin_recipes.zip'), 'r') as zf:
|
with zipfile.ZipFile(P('builtin_recipes.zip',
|
||||||
|
allow_user_override=False), 'r') as zf:
|
||||||
self.favicons = dict([(x.filename, x) for x in zf.infolist() if
|
self.favicons = dict([(x.filename, x) for x in zf.infolist() if
|
||||||
x.filename.endswith('.png')])
|
x.filename.endswith('.png')])
|
||||||
except:
|
except:
|
||||||
@ -181,7 +182,7 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
|
|||||||
|
|
||||||
def do_refresh(self, restrict_to_urns=set([])):
|
def do_refresh(self, restrict_to_urns=set([])):
|
||||||
self.custom_recipe_collection = get_custom_recipe_collection()
|
self.custom_recipe_collection = get_custom_recipe_collection()
|
||||||
zf = P('builtin_recipes.zip')
|
zf = P('builtin_recipes.zip', allow_user_override=False)
|
||||||
|
|
||||||
def factory(cls, parent, *args):
|
def factory(cls, parent, *args):
|
||||||
args = list(args)
|
args = list(args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user