From 75ac15236e1be00f7c9699f67403c1eced53f678 Mon Sep 17 00:00:00 2001 From: 132ikl <132@ikl.sh> Date: Sun, 24 Feb 2019 23:31:39 -0500 Subject: [PATCH] Fix favicon for subdomains --- liteshort.py | 9 ++++++++- templates/main.html | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/liteshort.py b/liteshort.py index 0a6673b..865da3a 100644 --- a/liteshort.py +++ b/liteshort.py @@ -3,8 +3,9 @@ # This software is license under the MIT license. It should be included in your copy of this software. # A copy of the MIT license can be obtained at https://mit-license.org/ -from flask import Flask, current_app, flash, g, jsonify, redirect, render_template, request, url_for +from flask import Flask, current_app, flash, g, jsonify, redirect, render_template, request, send_from_directory, url_for import bcrypt +import os import random import sqlite3 import time @@ -193,6 +194,12 @@ app.secret_key = app.config['secret_key'] app.config['SERVER_NAME'] = app.config['site_domain'] +@app.route('/favicon.ico', subdomain=app.config['subdomain']) +def favicon(): + return send_from_directory(os.path.join(app.root_path, 'static'), + 'favicon.ico', mimetype='image/vnd.microsoft.icon') + + @app.route('/', subdomain=app.config['subdomain']) def main(): return response(request, True) diff --git a/templates/main.html b/templates/main.html index 10812ba..5ae9901 100644 --- a/templates/main.html +++ b/templates/main.html @@ -9,7 +9,6 @@ A copy of the MIT license can be obtained at https://mit-license.org/