|
|
@ -6,6 +6,7 @@ from flask import (Flask, request, render_template, send_from_directory, abort, |
|
|
|
from flask_sqlalchemy import SQLAlchemy |
|
|
|
from flask_limiter import Limiter |
|
|
|
from flask_limiter.util import get_remote_address |
|
|
|
from flask_caching import Cache |
|
|
|
from mastodon import Mastodon |
|
|
|
import random |
|
|
|
from config import C |
|
|
@ -29,6 +30,8 @@ app = Flask(__name__) |
|
|
|
app.config.from_object('config.C') |
|
|
|
app.secret_key = C.session_key |
|
|
|
|
|
|
|
cache = Cache(config={'CACHE_TYPE': 'SimpleCache'}) |
|
|
|
cache.init_app(app) |
|
|
|
|
|
|
|
MAST_LOGIN_URL = Mastodon(api_base_url=C.mast_base_uri).auth_request_url( |
|
|
|
client_id = C.mast_client_id, |
|
|
@ -203,6 +206,7 @@ def logout(): |
|
|
|
|
|
|
|
|
|
|
|
@bp.route('/') |
|
|
|
@cache.cached(timeout=10) |
|
|
|
def home(): |
|
|
|
stories = Story.query.order_by(Story.total_like_num.desc()).all() |
|
|
|
return render_template('home.html', **locals()) |
|
|
|