|
|
@ -1,13 +1,15 @@ |
|
|
|
from utils import clean_articles |
|
|
|
import ldap as l |
|
|
|
from ldap3 import Server, Connection, ALL, MODIFY_REPLACE |
|
|
|
from flask import Flask, g, request, session, redirect, url_for, render_template |
|
|
|
from flask import Flask, g, request, session, redirect, url_for, render_template, send_from_directory |
|
|
|
from flask_simpleldap import LDAP |
|
|
|
from flask_bootstrap import Bootstrap |
|
|
|
import os |
|
|
|
import sqlite3 |
|
|
|
import requests |
|
|
|
from utils import clean_articles, get_article |
|
|
|
from flask_cache_buster import CacheBuster |
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
|
Bootstrap(app) |
|
|
@ -30,6 +32,14 @@ short_domain = os.environ.get('SHORT_DOMAIN') |
|
|
|
|
|
|
|
ldap = LDAP(app) |
|
|
|
|
|
|
|
config = { |
|
|
|
'extensions': ['.js', '.css', '.csv'], |
|
|
|
'hash_size': 10 |
|
|
|
} |
|
|
|
|
|
|
|
cache_buster = CacheBuster(config=config) |
|
|
|
cache_buster.register_cache_buster(app) |
|
|
|
|
|
|
|
server = Server(app.config['LDAP_HOST']) |
|
|
|
conn = Connection(server, app.config['LDAP_USERNAME'], app.config['LDAP_PASSWORD'], auto_bind=True) |
|
|
|
|
|
|
@ -41,6 +51,11 @@ def before_request(): |
|
|
|
g.user = {} |
|
|
|
|
|
|
|
|
|
|
|
@app.route("/manifest.json") |
|
|
|
def manifest(): |
|
|
|
return send_from_directory('./', 'manifest.json') |
|
|
|
|
|
|
|
|
|
|
|
@app.route('/') |
|
|
|
@ldap.login_required |
|
|
|
def index(): |
|
|
|