From d00830af39c15f412d33059080f957b245d1282e Mon Sep 17 00:00:00 2001 From: hunsh Date: Wed, 24 Mar 2021 21:20:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20python=E7=89=88=E6=9C=AC=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close #22 --- app/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/main.py b/app/main.py index d489423..5ec99ec 100644 --- a/app/main.py +++ b/app/main.py @@ -23,6 +23,7 @@ ASSET_URL = 'https://hunshcn.github.io/gh-proxy' # 主页 app = Flask(__name__) CHUNK_SIZE = 1024 * 10 index_html = requests.get(ASSET_URL, timeout=10).text +icon_r = requests.get(ASSET_URL + '/favicon.ico', timeout=10).content exp1 = re.compile(r'^(?:https?://)?github\.com/.+?/.+?/(?:releases|archive)/.*$') exp2 = re.compile(r'^(?:https?://)?github\.com/.+?/.+?/(?:blob)/.*$') exp3 = re.compile(r'^(?:https?://)?github\.com/.+?/.+?/(?:info|git-).*$') @@ -37,6 +38,11 @@ def index(): return index_html +@app.route('/favicon.ico') +def icon(): + return Response(icon_r, content_type='image/vnd.microsoft.icon') + + def iter_content(self, chunk_size=1, decode_unicode=False): """rewrite requests function, set decode_content with False"""