aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-10-06 14:16:58 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-10-06 14:16:58 +0200
commit0a7f69cc1fc0e068c66ca34b3f4a44067cfe9761 (patch)
tree5212bc56c32c7f307ae642f877ab01aa70d43230 /src/web
parentUpdated CHANGELOG. (diff)
downloadnewspipe-0a7f69cc1fc0e068c66ca34b3f4a44067cfe9761.tar.gz
newspipe-0a7f69cc1fc0e068c66ca34b3f4a44067cfe9761.tar.bz2
newspipe-0a7f69cc1fc0e068c66ca34b3f4a44067cfe9761.zip
Fetch feeds only if the user do not want to use its own crawler.
Diffstat (limited to 'src/web')
-rw-r--r--src/web/forms.py2
-rwxr-xr-xsrc/web/lib/misc_utils.py2
-rw-r--r--src/web/models/user.py2
-rw-r--r--src/web/templates/profile.html4
-rw-r--r--src/web/views/user.py1
5 files changed, 10 insertions, 1 deletions
diff --git a/src/web/forms.py b/src/web/forms.py
index 69abac46..033ccbbe 100644
--- a/src/web/forms.py
+++ b/src/web/forms.py
@@ -156,6 +156,8 @@ class ProfileForm(Form):
validators.Required(lazy_gettext("Please enter your email."))])
password = PasswordField(lazy_gettext("Password"))
password_conf = PasswordField(lazy_gettext("Password Confirmation"))
+ automatic_crawling = BooleanField(lazy_gettext("Automatic crawling"),
+ default=True)
webpage = URLField(lazy_gettext("Webpage"))
twitter = URLField(lazy_gettext("Twitter"))
is_public_profile = BooleanField(lazy_gettext("Public profile"),
diff --git a/src/web/lib/misc_utils.py b/src/web/lib/misc_utils.py
index fc49dd6d..8166df29 100755
--- a/src/web/lib/misc_utils.py
+++ b/src/web/lib/misc_utils.py
@@ -108,7 +108,7 @@ def fetch(id, feed_id=None):
The "asyncio" crawler is launched with the manager.
"""
cmd = [sys.executable, conf.BASE_DIR + '/manager.py', 'fetch_asyncio',
- str(id), str(feed_id)]
+ '--user_id='+str(id)]
return subprocess.Popen(cmd, stdout=subprocess.PIPE)
def history(user_id, year=None, month=None):
diff --git a/src/web/models/user.py b/src/web/models/user.py
index 59c4ad38..2b069728 100644
--- a/src/web/models/user.py
+++ b/src/web/models/user.py
@@ -48,6 +48,8 @@ class User(db.Model, UserMixin, RightMixin):
email = db.Column(db.String(254), index=True, unique=True)
pwdhash = db.Column(db.String())
+ automatic_crawling = db.Column(db.Boolean(), default=True)
+
is_public_profile = db.Column(db.Boolean(), default=False)
webpage = db.Column(db.String(), default="")
twitter = db.Column(db.String(), default="")
diff --git a/src/web/templates/profile.html b/src/web/templates/profile.html
index d21608cf..39834ca5 100644
--- a/src/web/templates/profile.html
+++ b/src/web/templates/profile.html
@@ -42,6 +42,10 @@
{{ form.is_public_profile.label }}
{{ form.is_public_profile(class_="form-control") }} {% for error in form.is_public_profile.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
<p>{{ _('Your profile will be available <a href="%(url)s">here</a>.', url=url_for('user.profile_public', nickname=user.nickname) ) }}</p>
+
+ {{ form.automatic_crawling.label }}
+ {{ form.automatic_crawling(class_="form-control") }} {% for error in form.automatic_crawling.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ <p>{{ _('Uncheck if you are using your own crawler.') }}</p>
</div>
</div>
<div class="row">
diff --git a/src/web/views/user.py b/src/web/views/user.py
index bf568d69..26d65de3 100644
--- a/src/web/views/user.py
+++ b/src/web/views/user.py
@@ -107,6 +107,7 @@ def profile():
{'nickname': form.nickname.data,
'email': form.email.data,
'password': form.password.data,
+ 'automatic_crawling': form.automatic_crawling.data,
'is_public_profile': form.is_public_profile.data,
'webpage': form.webpage.data,
'twitter': form.twitter.data})
bgstack15