|
@ -1,13 +1,15 @@ |
|
|
from utils import clean_articles |
|
|
from utils import clean_articles |
|
|
import ldap as l |
|
|
import ldap as l |
|
|
from ldap3 import Server, Connection, ALL, MODIFY_REPLACE |
|
|
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_simpleldap import LDAP |
|
|
from flask_bootstrap import Bootstrap |
|
|
from flask_bootstrap import Bootstrap |
|
|
import os |
|
|
import os |
|
|
import sqlite3 |
|
|
import sqlite3 |
|
|
import requests |
|
|
import requests |
|
|
from utils import clean_articles, get_article |
|
|
from utils import clean_articles, get_article |
|
|
|
|
|
from flask_cache_buster import CacheBuster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
app = Flask(__name__) |
|
|
Bootstrap(app) |
|
|
Bootstrap(app) |
|
@ -30,6 +32,14 @@ short_domain = os.environ.get('SHORT_DOMAIN') |
|
|
|
|
|
|
|
|
ldap = LDAP(app) |
|
|
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']) |
|
|
server = Server(app.config['LDAP_HOST']) |
|
|
conn = Connection(server, app.config['LDAP_USERNAME'], app.config['LDAP_PASSWORD'], auto_bind=True) |
|
|
conn = Connection(server, app.config['LDAP_USERNAME'], app.config['LDAP_PASSWORD'], auto_bind=True) |
|
|
|
|
|
|
|
@ -41,6 +51,11 @@ def before_request(): |
|
|
g.user = {} |
|
|
g.user = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/manifest.json") |
|
|
|
|
|
def manifest(): |
|
|
|
|
|
return send_from_directory('./', 'manifest.json') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/') |
|
|
@app.route('/') |
|
|
@ldap.login_required |
|
|
@ldap.login_required |
|
|
def index(): |
|
|
def index(): |
|
|