Skip to content

Commit 011f99a

Browse files
committed
adding CORS headers
1 parent 6b75485 commit 011f99a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

CIRCUITPY/code.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def tv_power(request) -> Tuple[str, List[Tuple[str, str]], List[str]]:
214214
Power On command: <a href="?enable=1">Enable</a> <a href="?enable=0">Disable</a><br>
215215
<a href="/tv/" id="tv">Back to tv</a>""")
216216
print(response_html)
217-
return "200 OK", [], [response_html]
217+
return "200 OK", [('Access-Control-Allow-Origin', '*')], [response_html]
218218

219219

220220
@web_app.route("/tv/volume/")
@@ -252,7 +252,7 @@ def tv_volume(request) -> Tuple[str, List[Tuple[str, str]], List[str]]:
252252
Mute: <a href="?m=0">Toggle</a> <a href="?m=1">Mute</a> <a href="?m=2">Unmute</a> <a href="?m=s">Status</a><br>
253253
<a href="/tv/" id="tv">Back to tv</a>""")
254254
print(response_html)
255-
return "200 OK", [], [response_html]
255+
return "200 OK", [('Access-Control-Allow-Origin', '*')], [response_html]
256256

257257

258258
@web_app.route("/tv/input/")
@@ -290,7 +290,7 @@ def tv_input(request) -> Tuple[str, List[Tuple[str, str]], List[str]]:
290290
<a href="?i=x">Toggle</a><br>
291291
<a href="/tv/" id="tv">Back to tv</a>""")
292292
print(response_html)
293-
return "200 OK", [], [response_html]
293+
return "200 OK", [('Access-Control-Allow-Origin', '*')], [response_html]
294294

295295

296296
@web_app.route("/tv/channel/")
@@ -320,7 +320,7 @@ def tv_channel(request) -> Tuple[str, List[Tuple[str, str]], List[str]]:
320320
<a href="?c=u">Up</a> <a href="?c=d">Down</a><br>
321321
<a href="/tv/" id="tv">Back to tv</a>""")
322322
print(response_html)
323-
return "200 OK", [], [response_html]
323+
return "200 OK", [('Access-Control-Allow-Origin', '*')], [response_html]
324324

325325

326326
def html_doc(title: str, body: str) -> str:

0 commit comments

Comments
 (0)