Allow configuration of upstream pgweb address
authorMagnus Hagander <magnus@hagander.net>
Sat, 15 Jan 2022 17:36:29 +0000 (18:36 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sat, 15 Jan 2022 17:36:29 +0000 (18:36 +0100)
Search forms currently point to the hardcoded address of www.postgresql.org.
Add a parameter in the settings to make it possible to configure the domain
hosting the /search/ function.

Originally from CĂ©lestin Matte, but in the end not his patch

django/archives/mailarchives/templates/base.html
django/archives/mailarchives/templates/searchform.html
django/archives/mailarchives/views.py
django/archives/settings.py

index b0aa4de8979311a470221e2989b55cc5563b9596..23d137e069c8408841b832af7feea16d7b5a1b8b 100644 (file)
@@ -53,7 +53,7 @@
                 <li class="nav-item p-2"><a href="/about/donate/" title="Donate">Donate</a></li>
                 <li class="nav-item p-2"><a href="/account/" title="Your account">Your account</a></li>
               </ul>
-             <form role="search" method="get" action="/search/">
+             <form role="search" method="get" action="{{ PGWEB_ADDRESS }}/search/">
                <div class="input-group">
                  <input id="q" name="q" type="text" size="20" maxlength="255" accesskey="s"  class="form-control" placeholder="Search for...">
                  <span class="input-group-btn">
index 4855de265ab8d7f1e707f23ea4abe81eda00999b..1e5b4a22b17478675681d9ab2115b935dd29e831 100644 (file)
@@ -1,6 +1,6 @@
 <h3>Search the Archives</h3>
 
-<form method="get" action="/search/">
+<form method="get" action="{{ PGWEB_ADDRESS }}/search/">
   <input type="hidden" name="m" value="1">
   {%if searchform_listname%} <input type="hidden" name="ln" value="{{searchform_listname}}"/>{%endif%}
   <div class="row">
@@ -17,7 +17,7 @@
         <small class="form-text text-muted">(enter a message-id to go directly to that message)</small>
       </div>
       <div class="input-group">
-        <a href="https://www.postgresql.org/search/?m=1{%if searchform_listname%}&amp;ln={{searchform_listname}}{%endif%}">Advanced Search</a>
+        <a href="{{ PGWEB_ADDRESS }}/search/?m=1{%if searchform_listname%}&amp;ln={{searchform_listname}}{%endif%}">Advanced Search</a>
       </div>
     </div><!-- /.col-lg-6 -->
   </div><!-- /.row -->
index 885f80875f98b315eb4dd6b9ad85822450f9d19c..e5bbe5102990c9cef9ebbf23c981457fb383c2bb 100644 (file)
@@ -174,6 +174,7 @@ class NavContext(object):
         self.request = request
         self.ctx = {
             'allow_resend': settings.ALLOW_RESEND,
+            'PGWEB_ADDRESS': settings.PGWEB_ADDRESS,
         }
 
         if all_groups:
index bb97bb89b45d7380877596bf89b2c14721b19038..4eed26c080c85ba76b10f0943df444477d0395c1 100644 (file)
@@ -145,6 +145,8 @@ API_CLIENTS = ('127.0.0.1',)
 PUBLIC_ARCHIVES = False
 ALLOW_RESEND = False
 
+PGWEB_ADDRESS = 'https://www.postgresql.org'
+
 try:
     from .settings_local import *
 except ImportError: