Kumi
c4054c1374
Introduce a simple Flask app that proxies requests to cdn.jsdelivr.net. Includes basic routing for home and proxy endpoints, and a template render for the home page explaining usage. Added Flask to requirements.txt and updated .gitignore to exclude venv and __pycache__.
16 lines
No EOL
369 B
Python
16 lines
No EOL
369 B
Python
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() |