forked from tanner/qotnews
hostname from settings.
This commit is contained in:
parent
d588a60930
commit
3169af3002
|
@ -7,6 +7,8 @@ import requests
|
|||
import time
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
import settings
|
||||
|
||||
USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0'
|
||||
|
||||
def api(route):
|
||||
|
@ -33,7 +35,7 @@ def story(ref):
|
|||
|
||||
s = {}
|
||||
s['author'] = 'manual submission'
|
||||
s['author_link'] = 'https://news.t0.vc'
|
||||
s['author_link'] = 'https://{}'.format(settings.HOSTNAME)
|
||||
s['score'] = 0
|
||||
s['date'] = int(time.time())
|
||||
s['title'] = str(soup.title.string) if soup.title else ref
|
||||
|
|
|
@ -70,7 +70,7 @@ def submit():
|
|||
elif 'reddit.com' in parse.hostname and 'comments' in url:
|
||||
source = 'reddit'
|
||||
ref = parse.path.split('/')[4]
|
||||
elif 'news.t0.vc' in parse.hostname:
|
||||
elif settings.HOSTNAME in parse.hostname:
|
||||
raise Exception('Invalid article')
|
||||
else:
|
||||
source = 'manual'
|
||||
|
@ -112,7 +112,7 @@ def story(sid):
|
|||
def index():
|
||||
return render_template('index.html',
|
||||
title='Feed',
|
||||
url='news.t0.vc',
|
||||
url=settings.HOSTNAME,
|
||||
description='Reddit, Hacker News, and Tildes combined, then pre-rendered in reader mode')
|
||||
|
||||
@flask_app.route('/<sid>', strict_slashes=False)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# QotNews settings
|
||||
# edit this file and save it as settings.py
|
||||
|
||||
HOSTNAME = 'news.t0.vc'
|
||||
MAX_STORY_AGE = 3*24*60*60
|
||||
|
||||
# Feed Lengths
|
||||
|
|
Loading…
Reference in New Issue
Block a user