mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-10 11:36:55 +00:00
Compare commits
2 Commits
simple-mem
...
feature/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5051e0a8c2 | ||
|
|
63321b3885 |
1
changedetectionio/.gitignore
vendored
1
changedetectionio/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
test-datastore
|
test-datastore
|
||||||
|
package-lock.json
|
||||||
|
|||||||
@@ -580,6 +580,9 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
if request.method == 'POST' and form.validate():
|
if request.method == 'POST' and form.validate():
|
||||||
extra_update_obj = {}
|
extra_update_obj = {}
|
||||||
|
|
||||||
|
if request.args.get('unpause_on_save'):
|
||||||
|
extra_update_obj['paused'] = False
|
||||||
|
|
||||||
# Re #110, if they submit the same as the default value, set it to None, so we continue to follow the default
|
# Re #110, if they submit the same as the default value, set it to None, so we continue to follow the default
|
||||||
# Assume we use the default value, unless something relevant is different, then use the form value
|
# Assume we use the default value, unless something relevant is different, then use the form value
|
||||||
# values could be None, 0 etc.
|
# values could be None, 0 etc.
|
||||||
@@ -619,7 +622,10 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
datastore.data['watching'][uuid].update(form.data)
|
datastore.data['watching'][uuid].update(form.data)
|
||||||
datastore.data['watching'][uuid].update(extra_update_obj)
|
datastore.data['watching'][uuid].update(extra_update_obj)
|
||||||
|
|
||||||
flash("Updated watch.")
|
if request.args.get('unpause_on_save'):
|
||||||
|
flash("Updated watch - unpaused!.")
|
||||||
|
else:
|
||||||
|
flash("Updated watch.")
|
||||||
|
|
||||||
# Re #286 - We wait for syncing new data to disk in another thread every 60 seconds
|
# Re #286 - We wait for syncing new data to disk in another thread every 60 seconds
|
||||||
# But in the case something is added we should save straight away
|
# But in the case something is added we should save straight away
|
||||||
@@ -1063,9 +1069,9 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@app.route("/api/add", methods=['POST'])
|
@app.route("/form/add/quickwatch", methods=['POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def form_watch_add():
|
def form_quick_watch_add():
|
||||||
from changedetectionio import forms
|
from changedetectionio import forms
|
||||||
form = forms.quickWatchForm(request.form)
|
form = forms.quickWatchForm(request.form)
|
||||||
|
|
||||||
@@ -1078,13 +1084,19 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
flash('The URL {} already exists'.format(url), "error")
|
flash('The URL {} already exists'.format(url), "error")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
# @todo add_watch should throw a custom Exception for validation etc
|
add_paused = request.form.get('edit_and_watch_submit_button') != None
|
||||||
new_uuid = datastore.add_watch(url=url, tag=request.form.get('tag').strip())
|
new_uuid = datastore.add_watch(url=url, tag=request.form.get('tag').strip(), extras={'paused': add_paused})
|
||||||
if new_uuid:
|
|
||||||
|
|
||||||
|
if not add_paused and new_uuid:
|
||||||
# Straight into the queue.
|
# Straight into the queue.
|
||||||
update_q.put(new_uuid)
|
update_q.put(new_uuid)
|
||||||
flash("Watch added.")
|
flash("Watch added.")
|
||||||
|
|
||||||
|
if add_paused:
|
||||||
|
flash('Watch added in Paused state, saving will unpause.')
|
||||||
|
return redirect(url_for('edit_page', uuid=new_uuid, unpause_on_save=1))
|
||||||
|
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -308,6 +308,9 @@ class ValidateCSSJSONXPATHInput(object):
|
|||||||
class quickWatchForm(Form):
|
class quickWatchForm(Form):
|
||||||
url = fields.URLField('URL', validators=[validateURL()])
|
url = fields.URLField('URL', validators=[validateURL()])
|
||||||
tag = StringField('Group tag', [validators.Optional()])
|
tag = StringField('Group tag', [validators.Optional()])
|
||||||
|
watch_submit_button = SubmitField('Watch', render_kw={"class": "pure-button pure-button-primary"})
|
||||||
|
edit_and_watch_submit_button = SubmitField('Edit > Watch', render_kw={"class": "pure-button pure-button-primary"})
|
||||||
|
|
||||||
|
|
||||||
# Common to a single watch and the global settings
|
# Common to a single watch and the global settings
|
||||||
class commonSettingsForm(Form):
|
class commonSettingsForm(Form):
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* -- BASE STYLES --
|
* -- BASE STYLES --
|
||||||
* Most of these are inherited from Base, but I want to change a few.
|
* Most of these are inherited from Base, but I want to change a few.
|
||||||
* nvm use v14.18.1
|
* nvm use v14.18.1 && npm install && npm run build
|
||||||
* npm install
|
|
||||||
* npm run build
|
|
||||||
* or npm run watch
|
* or npm run watch
|
||||||
*/
|
*/
|
||||||
body {
|
body {
|
||||||
@@ -203,13 +201,18 @@ body:after, body:before {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-bottom: 1em; }
|
margin-bottom: 1em; }
|
||||||
#new-watch-form input {
|
#new-watch-form input {
|
||||||
width: auto !important;
|
display: inline-block;
|
||||||
display: inline-block; }
|
margin-bottom: 5px; }
|
||||||
#new-watch-form .label {
|
#new-watch-form .label {
|
||||||
display: none; }
|
display: none; }
|
||||||
#new-watch-form legend {
|
#new-watch-form legend {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: bold; }
|
font-weight: bold; }
|
||||||
|
#new-watch-form #watch-add-wrapper-zone > div {
|
||||||
|
display: inline-block; }
|
||||||
|
@media only screen and (max-width: 760px) {
|
||||||
|
#new-watch-form #watch-add-wrapper-zone #url {
|
||||||
|
width: 100%; } }
|
||||||
|
|
||||||
#diff-col {
|
#diff-col {
|
||||||
padding-left: 40px; }
|
padding-left: 40px; }
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* -- BASE STYLES --
|
* -- BASE STYLES --
|
||||||
* Most of these are inherited from Base, but I want to change a few.
|
* Most of these are inherited from Base, but I want to change a few.
|
||||||
* nvm use v14.18.1
|
* nvm use v14.18.1 && npm install && npm run build
|
||||||
* npm install
|
|
||||||
* npm run build
|
|
||||||
* or npm run watch
|
* or npm run watch
|
||||||
*/
|
*/
|
||||||
body {
|
body {
|
||||||
@@ -269,8 +267,8 @@ body:after, body:before {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
input {
|
input {
|
||||||
width: auto !important;
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
.label {
|
.label {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -279,6 +277,17 @@ body:after, body:before {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#watch-add-wrapper-zone {
|
||||||
|
> div {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 760px) {
|
||||||
|
#url {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<div class="box-wrap inner">
|
<div class="box-wrap inner">
|
||||||
<form class="pure-form pure-form-stacked"
|
<form class="pure-form pure-form-stacked"
|
||||||
action="{{ url_for('edit_page', uuid=uuid, next = request.args.get('next') ) }}" method="POST">
|
action="{{ url_for('edit_page', uuid=uuid, next = request.args.get('next'), unpause_on_save = request.args.get('unpause_on_save')) }}" method="POST">
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||||
|
|
||||||
<div class="tab-pane-inner" id="general">
|
<div class="tab-pane-inner" id="general">
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from '_helpers.jinja' import render_simple_field %}
|
{% from '_helpers.jinja' import render_simple_field, render_field %}
|
||||||
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='jquery-3.6.0.min.js')}}"></script>
|
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='jquery-3.6.0.min.js')}}"></script>
|
||||||
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='watch-overview.js')}}" defer></script>
|
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='watch-overview.js')}}" defer></script>
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
||||||
<form class="pure-form" action="{{ url_for('form_watch_add') }}" method="POST" id="new-watch-form">
|
<form class="pure-form" action="{{ url_for('form_quick_watch_add') }}" method="POST" id="new-watch-form">
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Add a new change detection watch</legend>
|
<legend>Add a new change detection watch</legend>
|
||||||
{{ render_simple_field(form.url, placeholder="https://...", required=true) }}
|
<div id="watch-add-wrapper-zone">
|
||||||
{{ render_simple_field(form.tag, value=active_tag if active_tag else '', placeholder="watch group") }}
|
<div>
|
||||||
<button type="submit" class="pure-button pure-button-primary">Watch</button>
|
{{ render_simple_field(form.url, placeholder="https://...", required=true) }}
|
||||||
|
{{ render_simple_field(form.tag, value=active_tag if active_tag else '', placeholder="watch group") }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ render_simple_field(form.watch_submit_button, title="Watch this URL!" ) }}
|
||||||
|
{{ render_simple_field(form.edit_and_watch_submit_button, title="Edit first then Watch") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<span style="color:#eee; font-size: 80%;"><img style="height: 1em;display:inline-block;" src="{{url_for('static_content', group='images', filename='spread-white.svg')}}" /> Tip: You can also add 'shared' watches. <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Sharing-a-Watch">More info</a></a></span>
|
<span style="color:#eee; font-size: 80%;"><img style="height: 1em;display:inline-block;" src="{{url_for('static_content', group='images', filename='spread-white.svg')}}" /> Tip: You can also add 'shared' watches. <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Sharing-a-Watch">More info</a></a></span>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def run_filter_test(client, content_filter):
|
|||||||
# Add our URL to the import page
|
# Add our URL to the import page
|
||||||
test_url = url_for('test_endpoint', _external=True)
|
test_url = url_for('test_endpoint', _external=True)
|
||||||
res = client.post(
|
res = client.post(
|
||||||
url_for("form_watch_add"),
|
url_for("form_quick_watch_add"),
|
||||||
data={"url": test_url, "tag": ''},
|
data={"url": test_url, "tag": ''},
|
||||||
follow_redirects=True
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ def test_check_notification(client, live_server):
|
|||||||
# Add our URL to the import page
|
# Add our URL to the import page
|
||||||
test_url = url_for('test_endpoint', _external=True)
|
test_url = url_for('test_endpoint', _external=True)
|
||||||
res = client.post(
|
res = client.post(
|
||||||
url_for("form_watch_add"),
|
url_for("form_quick_watch_add"),
|
||||||
data={"url": test_url, "tag": ''},
|
data={"url": test_url, "tag": ''},
|
||||||
follow_redirects=True
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
@@ -172,7 +172,7 @@ def test_notification_validation(client, live_server):
|
|||||||
# Add our URL to the import page
|
# Add our URL to the import page
|
||||||
test_url = url_for('test_endpoint', _external=True)
|
test_url = url_for('test_endpoint', _external=True)
|
||||||
res = client.post(
|
res = client.post(
|
||||||
url_for("form_watch_add"),
|
url_for("form_quick_watch_add"),
|
||||||
data={"url": test_url, "tag": 'nice one'},
|
data={"url": test_url, "tag": 'nice one'},
|
||||||
follow_redirects=True
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def test_check_notification_error_handling(client, live_server):
|
|||||||
# use a different URL so that it doesnt interfere with the actual check until we are ready
|
# use a different URL so that it doesnt interfere with the actual check until we are ready
|
||||||
test_url = url_for('test_endpoint', _external=True)
|
test_url = url_for('test_endpoint', _external=True)
|
||||||
res = client.post(
|
res = client.post(
|
||||||
url_for("form_watch_add"),
|
url_for("form_quick_watch_add"),
|
||||||
data={"url": "https://changedetection.io/CHANGELOG.txt", "tag": ''},
|
data={"url": "https://changedetection.io/CHANGELOG.txt", "tag": ''},
|
||||||
follow_redirects=True
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user