diff --git a/apps/push/models.py b/apps/push/models.py index 03cb40c28..2db0eafba 100644 --- a/apps/push/models.py +++ b/apps/push/models.py @@ -7,7 +7,7 @@ import re from django.conf import settings from django.db import models -from django.utils.hashcompat import sha_constructor +import hashlib from apps.push import signals from apps.rss_feeds.models import Feed @@ -120,7 +120,7 @@ class PushSubscription(models.Model): def generate_token(self, mode): assert self.pk is not None, \ 'Subscription must be saved before generating token' - token = mode[:20] + sha_constructor('%s%i%s' % ( + token = mode[:20] + haslib.sha1('%s%i%s' % ( settings.SECRET_KEY, self.pk, mode)).hexdigest() self.verify_token = token self.save() diff --git a/config/requirements.txt b/config/requirements.txt index 26e4eb32b..548a35fc3 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -1,5 +1,5 @@ fabric -django==1.3.1 +django==1.5 readline chardet pyflakes diff --git a/fabfile.py b/fabfile.py index 420f15683..933be167f 100644 --- a/fabfile.py +++ b/fabfile.py @@ -74,7 +74,12 @@ env.roledefs ={ 'db10.newsblur.com', 'db11.newsblur.com', 'db12.newsblur.com', + 'db20.newsblur.com', + 'db21.newsblur.com', ], + 'dbdo':['198.211.115.113', + '198.211.115.153', + ], 'task': ['task01.newsblur.com', 'task02.newsblur.com', 'task03.newsblur.com', @@ -342,6 +347,7 @@ def setup_common(): setup_installs() setup_user() setup_sudoers() + setup_ulimit() setup_repo() setup_repo_local_settings() setup_local_files() @@ -435,7 +441,7 @@ def setup_installs(): sudo('chsh %s -s /bin/zsh' % env.user) with settings(warn_only=True): sudo('mkdir -p %s' % env.VENDOR_PATH) - sudo('chown %s.%s %s' % (env.user, env.user, env.VENDOR_PATH)) + sudo('chown %s.%s %s' % (env.user, env.user, env.VENDOR_PATH)) def setup_user(): # run('useradd -c "NewsBlur" -m newsblur -s /bin/zsh') @@ -457,8 +463,8 @@ def setup_repo(): with settings(warn_only=True): run('git clone https://github.com/samuelclay/NewsBlur.git ~/newsblur') sudo('mkdir -p /srv') - with settings(warn_only=True): - sudo('ln -f -s /home/%s/code /srv/' % env.user) + # with settings(warn_only=True): + # sudo('ln -f -s /home/%s/code /srv/' % env.user) sudo('ln -f -s /home/%s/newsblur /srv/' % env.user) def setup_repo_local_settings(): @@ -596,15 +602,15 @@ def setup_logrotate(): def setup_ulimit(): # Increase File Descriptor limits. - run('export FILEMAX=`sysctl -n fs.file-max`') - sudo('mv /etc/security/limits.conf /etc/security/limits.conf.bak') - sudo('touch /etc/security/limits.conf') - sudo('chmod 666 /etc/security/limits.conf') - run('echo "root soft nofile $FILEMAX" >> /etc/security/limits.conf') - run('"root hard nofile $FILEMAX" >> /etc/security/limits.conf') - run('echo "* soft nofile $FILEMAX" >> /etc/security/limits.conf') - run('echo "* hard nofile $FILEMAX" >> /etc/security/limits.conf') - sudo('chmod 644 /etc/security/limits.conf') + run('export FILEMAX=`sysctl -n fs.file-max`', pty=False) + sudo('mv /etc/security/limits.conf /etc/security/limits.conf.bak', pty=False) + sudo('touch /etc/security/limits.conf', pty=False) + sudo('chmod 666 /etc/security/limits.conf', pty=False) + run('echo "root soft nofile $FILEMAX" >> /etc/security/limits.conf', pty=False) + run('echo "root hard nofile $FILEMAX" >> /etc/security/limits.conf', pty=False) + run('echo "* soft nofile $FILEMAX" >> /etc/security/limits.conf', pty=False) + run('echo "* hard nofile $FILEMAX" >> /etc/security/limits.conf', pty=False) + sudo('chmod 644 /etc/security/limits.conf', pty=False) # run('touch /home/ubuntu/.bash_profile') # run('echo "ulimit -n $FILEMAX" >> /home/ubuntu/.bash_profile') @@ -780,7 +786,7 @@ def setup_db_firewall(): sudo('ufw allow proto tcp from 199.15.248.0/21 to any port %s ' % ','.join(map(str, ports))) # DigitalOcean - for ip in set(env.roledefs['app']): + for ip in set(env.roledefs['app'] + env.roledefs['dbdo']): if 'newsblur.com' in ip: continue sudo('ufw allow proto tcp from %s to any port %s' % ( ip, @@ -844,7 +850,7 @@ def setup_mongo(): # sudo('echo "deb http://downloads.mongodb.org/distros/ubuntu 10.10 10gen" >> /etc/apt/sources.list.d/10gen.list') sudo('echo "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen" >> /etc/apt/sources.list') sudo('apt-get update') - sudo('apt-get -y install mongodb-10gen numactl') + sudo('apt-get -y install mongodb-10gen') put('config/mongodb.%s.conf' % ('prod' if env.user != 'ubuntu' else 'ec2'), '/etc/mongodb.conf', use_sudo=True) sudo('/etc/init.d/mongodb restart') diff --git a/settings.py b/settings.py index 0a1909fb5..949bf1640 100644 --- a/settings.py +++ b/settings.py @@ -144,6 +144,7 @@ LOGGING = { 'mail_admins': { 'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', + 'filters': ['require_debug_false'], 'include_html': True, } }, @@ -168,7 +169,12 @@ LOGGING = { 'level': 'INFO', 'propagate': True, }, - } + }, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, } # ========================== diff --git a/templates/404.html b/templates/404.html index 9ca2ac906..9245222c8 100644 --- a/templates/404.html +++ b/templates/404.html @@ -66,7 +66,7 @@

404 · NewsBlur can't find that page

Either the URL you accessed doesn't point to anything or there is no site, story, or data with these parameters.

-

Return to NewsBlur

+

Return to NewsBlur

diff --git a/templates/500.html b/templates/500.html index fba2ae5f8..a5fa285f4 100644 --- a/templates/500.html +++ b/templates/500.html @@ -63,7 +63,7 @@

NewsBlur experienced an error

The error has been logged and will be fixed soon so you won't have to see this message again.

-

Return to NewsBlur

+

Return to NewsBlur

diff --git a/templates/api/share_bookmarklet.js b/templates/api/share_bookmarklet.js index 00e7e267c..6542b9fad 100644 --- a/templates/api/share_bookmarklet.js +++ b/templates/api/share_bookmarklet.js @@ -215,7 +215,7 @@ var self = this; var $submit = $('.NB-bookmarklet-button-subscribe', this.$modal); var folder = $('.NB-folders').val(); - var add_site_url = "http://"+this.domain+"{% url api-add-site token %}?callback=?"; + var add_site_url = "http://"+this.domain+"{% url "api-add-site" token %}?callback=?"; $submit.addClass('NB-disabled').text('Fetching and parsing...'); @@ -272,7 +272,7 @@ var $comments = $('textarea[name=newsblur_comment]', this.$modal); var $content_wrapper = $('.NB-bookmarklet-page-content-wrapper', this.$modal); var $content = $('.NB-bookmarklet-page-content', this.$modal); - var check_story_url = "http://"+this.domain+"{% url api-check-share-on-site token %}?callback=?"; + var check_story_url = "http://"+this.domain+"{% url "api-check-share-on-site" token %}?callback=?"; var data = { story_url: window.location.href, rss_url: this.get_page_rss_url() @@ -416,7 +416,7 @@ $.ajax({ - url: '//'+this.domain+"{% url api-share-story token %}", + url: '//'+this.domain+"{% url "api-share-story" token %}", type: 'POST', data: { title: $(".NB-bookmarklet-page-title", this.$modal).html() || this.story_title, diff --git a/templates/base.html b/templates/base.html index 4cffa75ed..c61aa4e88 100644 --- a/templates/base.html +++ b/templates/base.html @@ -72,13 +72,13 @@ 'story_share_email' : true }; NEWSBLUR.URLs = { - 'google-reader-authorize' : "{% url google-reader-authorize %}", - 'upload-avatar' : "{% url upload-avatar %}", - 'opml-upload' : "{% url opml-upload %}", - 'opml-export' : "{% url opml-export %}", + 'google-reader-authorize' : "{% url "google-reader-authorize" %}", + 'upload-avatar' : "{% url "upload-avatar" %}", + 'opml-upload' : "{% url "opml-upload" %}", + 'opml-export' : "{% url "opml-export" %}", 'domain' : "{% current_domain %}", 'favicon' : "/rss_feeds/icon/{id}", - 'delete-account' : "{% url profile-delete-account %}" + 'delete-account' : "{% url "profile-delete-account" %}" }; NEWSBLUR.Models = {}; NEWSBLUR.Collections = {}; @@ -112,18 +112,18 @@
- +
{% block content %}{% endblock %}