From 06315e3e0207f2ba7cbeb01134824b149095d8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sat, 14 Aug 2021 18:36:17 -0500 Subject: [opensearch]: improve --- youtube/search.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'youtube/search.py') diff --git a/youtube/search.py b/youtube/search.py index 33e9251..7057747 100644 --- a/youtube/search.py +++ b/youtube/search.py @@ -108,5 +108,11 @@ def get_search_page(): @yt_app.route('/opensearch.xml') def get_search_engine_xml(): with open(os.path.join(settings.program_directory, 'youtube/opensearch.xml'), 'rb') as f: - content = f.read().replace(b'$port_number', str(settings.port_number).encode()) + if settings.app_public: + main_url = '%s' % settings.app_url + else: + main_url = '%s:%s' % (settings.app_url, settings.port_number) + content = f.read().replace( + b'$main_url', str(main_url).encode() + ) return flask.Response(content, mimetype='application/xml') -- cgit v1.2.3