nobsdelivr/app.py

16 lines
369 B
Python
Raw Normal View History

from flask import Flask, redirect, render_template, request
app = Flask(__name__)
@app.route('/')
def home():
domain = request.url_root
return render_template('index.html', domain=domain)
@app.route('/<path:url>')
def proxy(url):
jsdelivr_url = f'https://cdn.jsdelivr.net/{url}'
return redirect(jsdelivr_url)
if __name__ == '__main__':
app.run()