@@ -15,6 +15,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
1515(C) 2015 by Adam Tauber, <asciimoo@gmail.com>
1616'''
1717
18+from hashlib import sha256
1819from importlib import import_module
1920from os.path import abspath, basename, dirname, exists, join
2021from shutil import copyfile
@@ -109,7 +110,7 @@ def check_resource(base_path, resource_path, name, dir_prefix):
109110 file_name = basename(dep_path)
110111 resource_name = '{0}_{1}'.format('_'.join(name.split()), file_name)
111112 resource_path = join(static_path, 'plugins', dir_prefix, resource_name)
112− if not exists(resource_path):
113+ if not exists(resource_path) or sha_sum(dep_path) != sha_sum(resource_path):
113114 try:
114115 copyfile(dep_path, resource_path)
115116 except:
@@ -133,6 +134,12 @@ def fix_package_resources(pkg, name):
133134 ])
134135
135136
137+def sha_sum(filename):
138+ with open(filename,"rb") as f:
139+ bytes = f.read() # read entire file as bytes
140+ return sha256(bytes).hexdigest()
141+
142+
136143plugins = PluginStore()
137144plugins.register(oa_doi_rewrite)
138145plugins.register(https_rewrite)