[enh] tidy: clean old morty, filtron, searx references

Everyone should have already switched from legacy methods
This commit is contained in:
Ivan Gabaldon 2025-04-05 10:59:07 +02:00
parent 9006866019
commit 2cfd3fc44b
No known key found for this signature in database
GPG key ID: 075587C93FA67582
26 changed files with 18 additions and 558 deletions

View file

@ -7,8 +7,6 @@
from __future__ import annotations
import inspect
import hashlib
import hmac
import json
import os
import sys
@ -261,24 +259,6 @@ def custom_url_for(endpoint: str, **values):
return url_for(endpoint, **values) + suffix
def morty_proxify(url: str):
if not url:
return url
if url.startswith('//'):
url = 'https:' + url
if not settings['result_proxy']['url']:
return url
url_params = dict(mortyurl=url)
if settings['result_proxy']['key']:
url_params['mortyhash'] = hmac.new(settings['result_proxy']['key'], url.encode(), hashlib.sha256).hexdigest()
return '{0}?{1}'.format(settings['result_proxy']['url'], urlencode(url_params))
def image_proxify(url: str):
if not url:
return url
@ -300,9 +280,6 @@ def image_proxify(url: str):
return url
return None
if settings['result_proxy']['url']:
return morty_proxify(url)
h = new_hmac(settings['server']['secret_key'], url.encode())
return '{0}?{1}'.format(url_for('image_proxy'), urlencode(dict(url=url.encode(), h=h)))
@ -424,8 +401,6 @@ def render(template_name: str, **kwargs):
kwargs['url_for'] = custom_url_for # override url_for function in templates
kwargs['image_proxify'] = image_proxify
kwargs['favicon_url'] = favicons.favicon_url
kwargs['proxify'] = morty_proxify if settings['result_proxy']['url'] is not None else None
kwargs['proxify_results'] = settings['result_proxy']['proxify_results']
kwargs['cache_url'] = settings['ui']['cache_url']
kwargs['get_result_template'] = get_result_template
kwargs['opensearch_url'] = (