Просмотр исходного кода

Fixes hardcoded href for OpenSearch xml

Kadin Buckton 6 лет назад
Родитель
Сommit
39d824787a
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      src/views/general.nim

+ 7 - 1
src/views/general.nim

@@ -35,6 +35,12 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
     elif images.len > 0: "photo"
     else: "article"
 
+  var opensearchUrl = ""
+  if cfg.useHttps:
+    opensearchUrl = "https://" & cfg.hostname & "/opensearch"
+  else:
+    opensearchUrl = "http://" & cfg.hostname & "/opensearch"
+
   buildHtml(head):
     link(rel="stylesheet", `type`="text/css", href="/css/style.css")
     link(rel="stylesheet", `type`="text/css", href="/css/fontello.css")
@@ -44,7 +50,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
     link(rel="manifest", href="/site.webmanifest")
     link(rel="mask-icon", href="/safari-pinned-tab.svg", color="#ff6c60")
     link(rel="search", type="application/opensearchdescription+xml", title=cfg.title,
-                            href="http://localhost:8080/opensearch")
+                            href=opensearchUrl)
 
     if prefs.hlsPlayback:
       script(src="/js/hls.light.min.js")