mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-31 04:59:29 +02:00
gzip responses
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
flask
|
flask
|
||||||
pygithub
|
pygithub
|
||||||
|
Flask-gzip
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
# non standards, in requirements.txt
|
# non standards, in requirements.txt
|
||||||
from flask import Flask, request, Markup, render_template, redirect, url_for, send_from_directory
|
from flask import Flask, request, Markup, render_template, redirect, url_for, send_from_directory
|
||||||
|
from flask_gzip import Gzip
|
||||||
import github
|
import github
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +89,7 @@ class Anonymous_Github:
|
|||||||
|
|
||||||
def create_flask_application(self):
|
def create_flask_application(self):
|
||||||
application = Flask(__name__)
|
application = Flask(__name__)
|
||||||
|
gzip = Gzip(application)
|
||||||
application.log = {}
|
application.log = {}
|
||||||
application.killurl = str(uuid.uuid4())
|
application.killurl = str(uuid.uuid4())
|
||||||
application.jinja_env.add_extension('jinja2.ext.do')
|
application.jinja_env.add_extension('jinja2.ext.do')
|
||||||
@@ -395,7 +397,6 @@ class Anonymous_Github:
|
|||||||
|
|
||||||
cache_path = os.path.join(self.config_dir, id, "cache")
|
cache_path = os.path.join(self.config_dir, id, "cache")
|
||||||
if os.path.isfile(os.path.join(cache_path, path)):
|
if os.path.isfile(os.path.join(cache_path, path)):
|
||||||
print("here", path)
|
|
||||||
return send_from_directory(os.path.dirname(os.path.join(cache_path, path)),
|
return send_from_directory(os.path.dirname(os.path.join(cache_path, path)),
|
||||||
os.path.basename(os.path.join(cache_path, path)),
|
os.path.basename(os.path.join(cache_path, path)),
|
||||||
mimetype=get_type_content(path, path, repository_configuration, g_repo, is_website(path, repository_configuration, g_repo)).replace("; charset=utf-8", ""))
|
mimetype=get_type_content(path, path, repository_configuration, g_repo, is_website(path, repository_configuration, g_repo)).replace("; charset=utf-8", ""))
|
||||||
|
|||||||
Reference in New Issue
Block a user