Kumi
8076dcd937
Updated the proxy route to fetch and return the content from jsdelivr instead of just redirecting to the URL. This change allows the application to handle and manipulate the content before sending it to the client, which provides more control over the data flow.
22 lines
No EOL
459 B
Python
22 lines
No EOL
459 B
Python
from flask import Flask, redirect, render_template, request
|
|
|
|
from urllib.request import urlopen
|
|
|
|
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}'
|
|
|
|
response = urlopen(jsdelivr_url)
|
|
content = response.read()
|
|
|
|
return content
|
|
|
|
if __name__ == '__main__':
|
|
app.run() |