feat: Add Google verification route to serve verification HTML files

This commit is contained in:
2026-05-07 18:30:15 +02:00
parent cad005f37a
commit 78863980a4
+11 -1
View File
@@ -1,4 +1,4 @@
from flask import Flask, render_template, request, jsonify, flash, redirect, url_for, get_flashed_messages, session, send_file, after_this_request
from flask import Flask, render_template, request, jsonify, flash, redirect, url_for, get_flashed_messages, session, send_file, after_this_request, abort
import os
import json
import atexit
@@ -1632,6 +1632,16 @@ def robots_txt():
)
@app.route('/google<int:token>.html')
def google_verification(token: int):
# Serve files named like google1234567890.html from the static/ directory
filename = f"google{token}.html"
path = os.path.join(BASE_DIR, 'static', filename)
if os.path.exists(path):
return send_file(path, mimetype='text/html')
abort(404)
@app.route('/sitemap.xml')
def sitemap_xml():
site_root = request.url_root.rstrip('/')