##// END OF EJS Templates
Show image search only if there is a suitable host
neko259 -
r1814:fd74b4c5 default
parent child Browse files
Show More
@@ -45,4 +45,4 b' ArchiveThreads = true'
45 MaxItems = 20
45 MaxItems = 20
46
46
47 [External]
47 [External]
48 ImageSearchHost=http://127.0.0.1/
48 ImageSearchHost=
@@ -186,23 +186,25 b' class ImageViewer(AbstractViewer):'
186 def get_context_menu(self):
186 def get_context_menu(self):
187 items = super().get_context_menu()
187 items = super().get_context_menu()
188
188
189 image_url = settings.get('External', 'ImageSearchHost') + self.file.url
189 image_host = settings.get('External', 'ImageSearchHost')
190 if image_host:
191 image_url = image_host + self.file.url
190
192
191 items.append({
193 items.append({
192 'name': 'google',
194 'name': 'google',
193 'label': 'Google',
195 'label': 'Google',
194 'url': 'https://www.google.com/searchbyimage?image_url={}'.format(image_url),
196 'url': 'https://www.google.com/searchbyimage?image_url={}'.format(image_url),
195 })
197 })
196 items.append({
198 items.append({
197 'name': 'iqdb',
199 'name': 'iqdb',
198 'label': 'iqdb',
200 'label': 'iqdb',
199 'url': 'http://iqdb.org/?url={}'.format(image_url)
201 'url': 'http://iqdb.org/?url={}'.format(image_url)
200 })
202 })
201 items.append({
203 items.append({
202 'name': 'tineye',
204 'name': 'tineye',
203 'label': 'TinEye',
205 'label': 'TinEye',
204 'url': 'http://tineye.com/search?url={}'.format(image_url)
206 'url': 'http://tineye.com/search?url={}'.format(image_url)
205 })
207 })
206
208
207 return items
209 return items
208
210
General Comments 0
You need to be logged in to leave comments. Login now