aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/search.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-08-14 18:36:17 -0500
committerJesús <heckyel@hyperbola.info>2021-08-14 18:36:17 -0500
commit06315e3e0207f2ba7cbeb01134824b149095d8a4 (patch)
treebc68741f24ffcc4cbab88d7efc6a39f59c26b606 /youtube/search.py
parentef66da4d2736c6eaf2b462aae55dfc19a037bd06 (diff)
downloadyt-local-06315e3e0207f2ba7cbeb01134824b149095d8a4.tar.lz
yt-local-06315e3e0207f2ba7cbeb01134824b149095d8a4.tar.xz
yt-local-06315e3e0207f2ba7cbeb01134824b149095d8a4.zip
[opensearch]: improve
Diffstat (limited to 'youtube/search.py')
-rw-r--r--youtube/search.py8
1 files changed, 7 insertions, 1 deletions
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')