fix: Update some routes
All checks were successful
Build Docker / Build Image (push) Successful in 31s
All checks were successful
Build Docker / Build Image (push) Successful in 31s
This commit is contained in:
36
server.py
36
server.py
@@ -5,24 +5,56 @@ import dotenv
|
||||
app = Flask(__name__)
|
||||
dotenv.load_dotenv()
|
||||
|
||||
#Assets routes
|
||||
@app.route('/assets/<path:path>')
|
||||
def send_report(path):
|
||||
return send_from_directory('templates/assets', path)
|
||||
|
||||
|
||||
# Special routes
|
||||
@app.route('/links')
|
||||
def links():
|
||||
return render_template('link.html')
|
||||
|
||||
@app.route('/sitemap')
|
||||
@app.route('/sitemap.xml')
|
||||
def sitemap():
|
||||
# Remove all .html from sitemap
|
||||
with open('templates/sitemap.xml') as file:
|
||||
sitemap = file.read()
|
||||
|
||||
sitemap = sitemap.replace('.html', '')
|
||||
return make_response(sitemap, 200, {'Content-Type': 'application/xml'})
|
||||
|
||||
@app.route('/favicon.png')
|
||||
def faviconPNG():
|
||||
return send_from_directory('templates/assets/img', 'android-chrome-512x512.png')
|
||||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
return send_from_directory('templates/assets/img', 'favicon.ico')
|
||||
|
||||
@app.route('/favicon.svg')
|
||||
def faviconSVG():
|
||||
return send_from_directory('templates/assets/img', 'favicon.svg')
|
||||
|
||||
|
||||
# Main routes
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
handshake_scripts = "<script src=\"https://nathan.woodburn/handshake.js\" domain=\"nathan.woodburn\"></script><script src=\"https://nathan.woodburn/https.js\"></script>"
|
||||
# If localhost, don't load handshake
|
||||
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000":
|
||||
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true":
|
||||
handshake_scripts = ""
|
||||
return render_template('index.html', handshake_scripts=handshake_scripts)
|
||||
|
||||
|
||||
@app.route('/<path:path>')
|
||||
def catch_all(path):
|
||||
handshake_scripts = "<script src=\"https://nathan.woodburn/handshake.js\" domain=\"nathan.woodburn\"></script><script src=\"https://nathan.woodburn/https.js\"></script>"
|
||||
# If localhost, don't load handshake
|
||||
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000":
|
||||
if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true":
|
||||
handshake_scripts = ""
|
||||
# If file exists, load it
|
||||
if os.path.isfile('templates/' + path):
|
||||
|
||||
Reference in New Issue
Block a user