v/pol
1
0
mirror of https://github.com/taroved/pol synced 2025-05-18 07:10:09 -07:00
This commit is contained in:
Alexandr Nesterenko 2018-02-01 19:29:08 +03:00
parent b468a66316
commit aa5c6e294a
3 changed files with 11 additions and 10 deletions

View File

@ -168,8 +168,10 @@ PIPELINE_JS = {
} }
DOWNLOADER_PAGE_URL = '/downloader?url=' DOWNLOADER_PAGE_URL = '/downloader?url='
FEED_PAGE_URL = '/feed/'
FEED1_PAGE_URL = '/feed1/' # replace 127.0.0.1 with your VPS server IP or domain.name
FEED_PAGE_URL = '//127.0.0.1/feed/'
DOWNLOADER_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36' DOWNLOADER_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36'
# limit of seconds in which user can access separate feed # limit of seconds in which user can access separate feed
FEED_REQUEST_PERIOD_LIMIT = 0 FEED_REQUEST_PERIOD_LIMIT = 0

View File

@ -18,7 +18,7 @@
<div class="media-body"> <div class="media-body">
<h4 class="media-heading">{% trans 'subscribe.your_feed' %}:</h4> <h4 class="media-heading">{% trans 'subscribe.your_feed' %}:</h4>
<h3> <h3>
<a href="{{ feed_url }}" target="_blank">http://politepol.com{{ feed_url }}</a> <a href="{{ feed_url }}" target="_blank">{{ feed_url }}</a>
</h3> </h3>
</div> </div>
@ -28,7 +28,7 @@
<script type="text/javascript"> <script type="text/javascript">
function tryGetFeed() { function tryGetFeed() {
$.getFeed({ $.getFeed({
url: '{{ feed1_url }}', url: '{{ feed_url }}',
success: function (feed) { success: function (feed) {
if ('items' in feed) { if ('items' in feed) {
$('#preview').empty() $('#preview').empty()
@ -59,10 +59,10 @@
} }
}, },
failure: function () { failure: function () {
$('#preview').text('Something wrong. Reloaad the page or contact us by email: politepol.com@gmail.com'); $('#preview').text('Something wrong. Reload the page or contact us by email: politepol.com@gmail.com');
}, },
error: function () { error: function () {
$('#preview').text('Something wrong. Reloaad the page or contact us by email: politepol.com@gmail.com'); $('#preview').text('Something wrong. Reload the page or contact us by email: politepol.com@gmail.com');
} }
}); });
} }

View File

@ -10,7 +10,7 @@ from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from .forms import IndexForm from .forms import IndexForm
from .settings import DOWNLOADER_PAGE_URL, FEED_PAGE_URL, FEED1_PAGE_URL from .settings import DOWNLOADER_PAGE_URL, FEED_PAGE_URL
from .setup_tool import get_selection_tag_ids, build_xpathes_for_items from .setup_tool import get_selection_tag_ids, build_xpathes_for_items
from .setup_tool_ext import build_xpath_results from .setup_tool_ext import build_xpath_results
@ -204,8 +204,7 @@ def preview(request, feed_id):
if request.method == 'GET': if request.method == 'GET':
return render(request, 'frontend/preview.html', return render(request, 'frontend/preview.html',
{ {
'feed_url': FEED_PAGE_URL + feed_id, 'feed_url': request.build_absolute_uri(FEED_PAGE_URL + feed_id)
'feed1_url': FEED1_PAGE_URL + feed_id,
}) })
return HttpResponseBadRequest('Only GET method supported') return HttpResponseBadRequest('Only GET method supported')