Re #269 - Show current/correct BASE_URL information (#271)

* Re #269 - Show current/correct BASE_URL information
pull/299/head
dgtlmoon 3 years ago committed by GitHub
parent 61c1d213d0
commit 3956b3fd68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -482,7 +482,8 @@ def changedetection_app(config=None, datastore_o=None):
uuid=uuid,
watch=datastore.data['watching'][uuid],
form=form,
using_default_minutes=using_default_minutes
using_default_minutes=using_default_minutes,
current_base_url = datastore.data['settings']['application']['base_url']
)
return output
@ -548,7 +549,7 @@ def changedetection_app(config=None, datastore_o=None):
if request.method == 'POST' and not form.validate():
flash("An error occurred, please see below.", "error")
output = render_template("settings.html", form=form)
output = render_template("settings.html", form=form, current_base_url = datastore.data['settings']['application']['base_url'])
return output

@ -208,7 +208,7 @@ class ChangeDetectionStore:
# Re #152, Return env base_url if not overriden, @todo also prefer the proxy pass url
env_base_url = os.getenv('BASE_URL','')
if self.__data['settings']['application']['base_url'] is None and len(env_base_url) >0:
if not self.__data['settings']['application']['base_url']:
self.__data['settings']['application']['base_url'] = env_base_url.strip('" ')
self.__data['has_unviewed'] = has_unviewed

@ -1,7 +1,7 @@
{% from '_helpers.jinja' import render_field %}
{% macro render_notifications_field(form) %}
{% macro render_common_settings_form(form, current_base_url) %}
<div class="pure-control-group">
{{ render_field(form.notification_urls, rows=5, placeholder="Examples:
@ -78,7 +78,7 @@
</table>
<span class="pure-form-message-inline">
URLs generated by changedetection.io (such as <code>{diff_url}</code>) require the <code>BASE_URL</code> environment variable set.<br/>
Your <code>BASE_URL</code> var is currently "{{base_url}}"
Your <code>BASE_URL</code> var is currently "{{current_base_url}}"
</span>
</div>
</div>

@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block content %}
{% from '_helpers.jinja' import render_field %}
{% from '_common_fields.jinja' import render_notifications_field %}
{% from '_common_fields.jinja' import render_common_settings_form %}
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script>
<div class="edit-form monospaced-textarea">
@ -66,7 +66,7 @@ User-Agent: wonderbra 1.0") }}
<strong>Note: <i>These settings override the global settings.</i></strong>
<fieldset>
<div class="field-group">
{{ render_notifications_field(form) }}
{{ render_common_settings_form(form, current_base_url) }}
</div>
</fieldset>
</div>

@ -2,7 +2,7 @@
{% block content %}
{% from '_helpers.jinja' import render_field %}
{% from '_common_fields.jinja' import render_notifications_field %}
{% from '_common_fields.jinja' import render_common_settings_form %}
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='settings.js')}}" defer></script>
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script>
@ -36,7 +36,7 @@
{{ render_field(form.base_url, placeholder="http://yoursite.com:5000/",
class="m-d") }}
<span class="pure-form-message-inline">
Base URL used for the {base_url} token in notifications, default value is the ENV var 'BASE_URL',
Base URL used for the {base_url} token in notifications, default value is the ENV var 'BASE_URL' (Currently "{{current_base_url}}"),
<a href="https://github.com/dgtlmoon/changedetection.io/wiki/Configurable-BASE_URL-setting">read more here</a>.
</span>
</div>
@ -51,7 +51,7 @@
<div class="tab-pane-inner" id="notifications">
<fieldset>
<div class="field-group">
{{ render_notifications_field(form) }}
{{ render_common_settings_form(form, current_base_url) }}
</div>
</fieldset>
</div>

Loading…
Cancel
Save