kopia lustrzana https://github.com/dgtlmoon/changedetection.io
* Re #65 - Append BASE_URL env var to the notification if it is setpull/70/head
rodzic
395a6fca62
commit
d50ff0b31c
|
@ -798,8 +798,15 @@ def notification_runner():
|
||||||
for url in n_object['notification_urls']:
|
for url in n_object['notification_urls']:
|
||||||
apobj.add(url.strip())
|
apobj.add(url.strip())
|
||||||
|
|
||||||
|
n_body = n_object['watch_url']
|
||||||
|
|
||||||
|
# 65 - Append URL of instance to the notification if it is set.
|
||||||
|
base_url = os.getenv('BASE_URL')
|
||||||
|
if base_url != None:
|
||||||
|
n_body += "\n" + base_url
|
||||||
|
|
||||||
apobj.notify(
|
apobj.notify(
|
||||||
body=n_object['watch_url'],
|
body=n_body,
|
||||||
# @todo This should be configurable.
|
# @todo This should be configurable.
|
||||||
title="ChangeDetection.io Notification - {}".format(n_object['watch_url'])
|
title="ChangeDetection.io Notification - {}".format(n_object['watch_url'])
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
# exit when any command fails
|
# exit when any command fails
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Re #65 - Ability to include a link back to the installation, in the notification.
|
||||||
|
export BASE_URL="https://foobar.com"
|
||||||
|
|
||||||
find tests/test_*py -type f|while read test_name
|
find tests/test_*py -type f|while read test_name
|
||||||
do
|
do
|
||||||
echo "TEST RUNNING $test_name"
|
echo "TEST RUNNING $test_name"
|
||||||
|
|
|
@ -54,6 +54,7 @@ def test_check_notification(client, live_server):
|
||||||
# Did the front end see it?
|
# Did the front end see it?
|
||||||
res = client.get(
|
res = client.get(
|
||||||
url_for("index"))
|
url_for("index"))
|
||||||
|
|
||||||
assert bytes("just now".encode('utf-8')) in res.data
|
assert bytes("just now".encode('utf-8')) in res.data
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,6 +62,11 @@ def test_check_notification(client, live_server):
|
||||||
res = client.get(
|
res = client.get(
|
||||||
url_for("test_notification_counter"),
|
url_for("test_notification_counter"),
|
||||||
)
|
)
|
||||||
print (res.data)
|
|
||||||
|
|
||||||
assert bytes("we hit it".encode('utf-8')) in res.data
|
assert bytes("we hit it".encode('utf-8')) in res.data
|
||||||
|
|
||||||
|
# Did we see the URL that had a change, in the notification?
|
||||||
|
assert bytes("test-endpoint".encode('utf-8')) in res.data
|
||||||
|
|
||||||
|
# Re #65 - did we see our foobar.com BASE_URL ?
|
||||||
|
assert bytes("https://foobar.com".encode('utf-8')) in res.data
|
||||||
|
|
|
@ -43,8 +43,15 @@ def live_server_setup(live_server):
|
||||||
|
|
||||||
@live_server.app.route('/test_notification_endpoint', methods=['POST'])
|
@live_server.app.route('/test_notification_endpoint', methods=['POST'])
|
||||||
def test_notification_endpoint():
|
def test_notification_endpoint():
|
||||||
|
from flask import request
|
||||||
|
|
||||||
with open("test-datastore/count.txt", "w") as f:
|
with open("test-datastore/count.txt", "w") as f:
|
||||||
f.write("we hit it")
|
f.write("we hit it\n")
|
||||||
|
# Debug method, dump all POST to file also, used to prove #65
|
||||||
|
data = request.stream.read()
|
||||||
|
if data != None:
|
||||||
|
f.write(str(data))
|
||||||
|
|
||||||
print("\n>> Test notification endpoint was hit.\n")
|
print("\n>> Test notification endpoint was hit.\n")
|
||||||
return "Text was set"
|
return "Text was set"
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,14 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- changedetection-data:/datastore
|
- changedetection-data:/datastore
|
||||||
|
|
||||||
# Proxy support example.
|
|
||||||
# environment:
|
# environment:
|
||||||
|
# Proxy support example.
|
||||||
# - HTTP_PROXY="socks5h://10.10.1.10:1080"
|
# - HTTP_PROXY="socks5h://10.10.1.10:1080"
|
||||||
# - HTTPS_PROXY="socks5h://10.10.1.10:1080"
|
# - HTTPS_PROXY="socks5h://10.10.1.10:1080"
|
||||||
# An exclude list (useful for notifcation URLs above) can be specified by following
|
# An exclude list (useful for notification URLs above) can be specified by with
|
||||||
# - NO_PROXY="localhost,192.168.0.0/24"
|
# - NO_PROXY="localhost,192.168.0.0/24"
|
||||||
|
# Base URL of your changedetection.io install (Added to notification alert
|
||||||
|
# - BASE_URL="https://mysite.com"
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- 5000:5000
|
- 5000:5000
|
||||||
|
|
Ładowanie…
Reference in New Issue