2024-08-03 14:26:09 +00:00
|
|
|
from flask import Flask, render_template, request
|
|
|
|
|
|
|
|
from urllib.request import urlopen
|
2024-08-03 06:40:59 +00:00
|
|
|
|
|
|
|
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):
|
2024-08-03 14:12:47 +00:00
|
|
|
jsdelivr_url = f'https://cdnjs.cloudflare.com/{url}'
|
2024-08-03 14:26:09 +00:00
|
|
|
|
|
|
|
response = urlopen(jsdelivr_url)
|
|
|
|
content = response.read()
|
|
|
|
|
|
|
|
return content
|
2024-08-03 06:40:59 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run()
|