mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-25 19:03:22 +00:00
Support for custom headers per watch
This commit is contained in:
@@ -107,7 +107,6 @@ def edit_page():
|
||||
global messages
|
||||
|
||||
uuid = request.args.get('uuid')
|
||||
|
||||
output = render_template("edit.html", uuid=uuid, watch=datastore.data['watching'][uuid], messages=messages)
|
||||
return output
|
||||
|
||||
@@ -186,9 +185,20 @@ def api_update():
|
||||
url = request.form.get('url').strip()
|
||||
tag = request.form.get('tag').strip()
|
||||
|
||||
form_headers = request.form.get('headers').strip().split("\n")
|
||||
extra_headers = {}
|
||||
if form_headers:
|
||||
for header in form_headers:
|
||||
if len(header):
|
||||
parts = header.split(':', 1)
|
||||
extra_headers.update({parts[0].strip(): parts[1].strip()})
|
||||
|
||||
|
||||
|
||||
validators.url(url) #@todo switch to prop/attr/observer
|
||||
datastore.data['watching'][uuid].update({'url': url,
|
||||
'tag': tag})
|
||||
'tag': tag,
|
||||
'headers':extra_headers})
|
||||
|
||||
#@todo switch to prop/attr/observer
|
||||
datastore.sync_to_json()
|
||||
|
||||
Reference in New Issue
Block a user