Compare commits
	
		
			2 Commits
		
	
	
		
			e65047fead
			...
			2e2c9ae837
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2e2c9ae837 | |||
| 61021d8f91 | 
@@ -53,7 +53,7 @@ def put_story(story):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def search(q):
 | 
					def search(q):
 | 
				
			||||||
    if not SEARCH_ENABLED: return []
 | 
					    if not SEARCH_ENABLED: return []
 | 
				
			||||||
    params = dict(q=q, limit=100)
 | 
					    params = dict(q=q, limit=settings.FEED_LENGTH)
 | 
				
			||||||
    r = meili_api(requests.get, 'indexes/qotnews/search', params=params, parse_json=False)
 | 
					    r = meili_api(requests.get, 'indexes/qotnews/search', params=params, parse_json=False)
 | 
				
			||||||
    return r
 | 
					    return r
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ import traceback
 | 
				
			|||||||
import time
 | 
					import time
 | 
				
			||||||
from urllib.parse import urlparse, parse_qs
 | 
					from urllib.parse import urlparse, parse_qs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import settings
 | 
				
			||||||
import database
 | 
					import database
 | 
				
			||||||
import search
 | 
					import search
 | 
				
			||||||
import feed
 | 
					import feed
 | 
				
			||||||
@@ -27,7 +28,6 @@ from flask_cors import CORS
 | 
				
			|||||||
database.init()
 | 
					database.init()
 | 
				
			||||||
search.init()
 | 
					search.init()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FEED_LENGTH = 75
 | 
					 | 
				
			||||||
news_index = 0
 | 
					news_index = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def new_id():
 | 
					def new_id():
 | 
				
			||||||
@@ -43,7 +43,7 @@ cors = CORS(flask_app)
 | 
				
			|||||||
@flask_app.route('/api')
 | 
					@flask_app.route('/api')
 | 
				
			||||||
def api():
 | 
					def api():
 | 
				
			||||||
    skip = request.args.get('skip', 0)
 | 
					    skip = request.args.get('skip', 0)
 | 
				
			||||||
    limit = request.args.get('limit', FEED_LENGTH)
 | 
					    limit = request.args.get('limit', settings.FEED_LENGTH)
 | 
				
			||||||
    stories = database.get_stories(limit, skip)
 | 
					    stories = database.get_stories(limit, skip)
 | 
				
			||||||
    # hacky nested json
 | 
					    # hacky nested json
 | 
				
			||||||
    res = Response('{"stories":[' + ','.join(stories) + ']}')
 | 
					    res = Response('{"stories":[' + ','.join(stories) + ']}')
 | 
				
			||||||
@@ -177,7 +177,7 @@ def feed_thread():
 | 
				
			|||||||
                        logging.info('Already have ID / ref, skipping.')
 | 
					                        logging.info('Already have ID / ref, skipping.')
 | 
				
			||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ref_list = database.get_reflist(FEED_LENGTH)
 | 
					            ref_list = database.get_reflist(settings.FEED_LENGTH)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # update current stories
 | 
					            # update current stories
 | 
				
			||||||
            if news_index < len(ref_list):
 | 
					            if news_index < len(ref_list):
 | 
				
			||||||
@@ -204,7 +204,7 @@ def feed_thread():
 | 
				
			|||||||
            gevent.sleep(6)
 | 
					            gevent.sleep(6)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            news_index += 1
 | 
					            news_index += 1
 | 
				
			||||||
            if news_index == FEED_LENGTH: news_index = 0
 | 
					            if news_index == settings.FEED_LENGTH: news_index = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    except KeyboardInterrupt:
 | 
					    except KeyboardInterrupt:
 | 
				
			||||||
        logging.info('Ending feed thread...')
 | 
					        logging.info('Ending feed thread...')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@
 | 
				
			|||||||
# Feed Lengths
 | 
					# Feed Lengths
 | 
				
			||||||
# Number of top items from each site to pull
 | 
					# Number of top items from each site to pull
 | 
				
			||||||
# set to 0 to disable that site
 | 
					# set to 0 to disable that site
 | 
				
			||||||
 | 
					FEED_LENGTH = 75
 | 
				
			||||||
NUM_HACKERNEWS = 15
 | 
					NUM_HACKERNEWS = 15
 | 
				
			||||||
NUM_LOBSTERS = 10
 | 
					NUM_LOBSTERS = 10
 | 
				
			||||||
NUM_REDDIT = 15
 | 
					NUM_REDDIT = 15
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ class App extends React.Component {
 | 
				
			|||||||
						<p>
 | 
											<p>
 | 
				
			||||||
							<Link to='/'>QotNews</Link>
 | 
												<Link to='/'>QotNews</Link>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							<span className='theme'>Theme: <a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a></span>
 | 
												<span className='theme'><a href='#' onClick={() => this.light()}>Light</a> - <a href='#' onClick={() => this.dark()}>Dark</a></span>
 | 
				
			||||||
							<br />
 | 
												<br />
 | 
				
			||||||
							<span className='slogan'>Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode.</span>
 | 
												<span className='slogan'>Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode.</span>
 | 
				
			||||||
						</p>
 | 
											</p>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@ class Submit extends Component {
 | 
				
			|||||||
			<span className='search'>
 | 
								<span className='search'>
 | 
				
			||||||
				<form onSubmit={this.submitArticle}>
 | 
									<form onSubmit={this.submitArticle}>
 | 
				
			||||||
					<input
 | 
										<input
 | 
				
			||||||
						placeholder='Submit Article'
 | 
											placeholder='Submit URL'
 | 
				
			||||||
						ref={this.inputRef}
 | 
											ref={this.inputRef}
 | 
				
			||||||
					/>
 | 
										/>
 | 
				
			||||||
				</form>
 | 
									</form>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user