feat: Add reset button and improve error handling for RSSticker
This commit is contained in:
23
rss_ticker_overlay/cors_proxy.py
Normal file
23
rss_ticker_overlay/cors_proxy.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from flask import Flask, request, Response
|
||||
import requests
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/proxy')
|
||||
def proxy():
|
||||
url = request.args.get('url')
|
||||
if not url:
|
||||
return "Missing URL parameter", 400
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': response.headers['Content-Type']
|
||||
}
|
||||
return Response(response.content, response.status_code, headers)
|
||||
except requests.exceptions.RequestException as e:
|
||||
return str(e), 500
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8001)
|
||||
Reference in New Issue
Block a user