diff options
Diffstat (limited to 'searx')
| -rw-r--r-- | searx/__init__.py | 46 | ||||
| -rw-r--r-- | searx/brand.py | 7 | ||||
| -rw-r--r-- | searx/settings.yml | 10 | ||||
| -rwxr-xr-x | searx/webapp.py | 1 |
4 files changed, 57 insertions, 7 deletions
diff --git a/searx/__init__.py b/searx/__init__.py index 08e67f69d..11adbba73 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -60,3 +60,49 @@ if 'SEARX_SECRET' in environ: settings['server']['secret_key'] = environ['SEARX_SECRET'] if 'SEARX_BIND_ADDRESS' in environ: settings['server']['bind_address'] = environ['SEARX_BIND_ADDRESS'] + + +class _brand_namespace: + + @classmethod + def get_val(cls, group, name, default=''): + return settings.get(group, {}).get(name) or default + + @property + def SEARX_URL(self): + return self.get_val('server', 'base_url') + + @property + def CONTACT_URL(self): + return self.get_val('general', 'contact_url') + + @property + def GIT_URL(self): + return self.get_val('brand', 'git_url') + + @property + def GIT_BRANCH(self): + return self.get_val('brand', 'git_branch') + + @property + def ISSUE_URL(self): + return self.get_val('brand', 'issue_url') + + @property + def DOCS_URL(self): + return self.get_val('brand', 'docs_url') + + @property + def PUBLIC_INSTANCES(self): + return self.get_val('brand', 'public_instances') + + @property + def WIKI_URL(self): + return self.get_val('brand', 'wiki_url') + + @property + def TWITTER_URL(self): + return self.get_val('brand', 'twitter_url') + + +brand = _brand_namespace() diff --git a/searx/brand.py b/searx/brand.py deleted file mode 100644 index 7fcab6fad..000000000 --- a/searx/brand.py +++ /dev/null @@ -1,7 +0,0 @@ -GIT_URL = 'https://github.com/searx/searx' -GIT_BRANCH = 'master' -ISSUE_URL = 'https://github.com/searx/searx/issues' -SEARX_URL = 'https://searx.me' -DOCS_URL = 'https://searx.github.io/searx' -PUBLIC_INSTANCES = 'https://searx.space' -CONTACT_URL = '' diff --git a/searx/settings.yml b/searx/settings.yml index 0a569e59c..30afbf957 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -1,6 +1,16 @@ general: debug : False # Debug mode, only for development instance_name : "searx" # displayed name + contact_url: False # mailto:contact@example.com + +brand: + git_url: https://github.com/searx/searx + git_branch: master + issue_url: https://github.com/searx/searx/issues + docs_url: https://searx.github.io/searx + public_instances: https://searx.space + wiki_url: https://github.com/searx/searx/wiki + twitter_url: https://twitter.com/Searx_engine search: safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict diff --git a/searx/webapp.py b/searx/webapp.py index 49750d210..10f4ce78c 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1071,6 +1071,7 @@ def config(): 'default_theme': settings['ui']['default_theme'], 'version': VERSION_STRING, 'brand': { + 'CONTACT_URL': brand.CONTACT_URL, 'GIT_URL': brand.GIT_URL, 'DOCS_URL': brand.DOCS_URL }, |