From 280feb2564c3675a11b7f1b1d8915d157a9b273c Mon Sep 17 00:00:00 2001 From: Angus Whitehead Date: Thu, 14 Mar 2024 18:39:53 +0000 Subject: [PATCH 1/2] fix: set response header Access-Control-Allow-Private-Network to true This is a new cors header that is required when you set the chrome flag 'Experimental Web Platform features'. We may use that flag for bluetooth etc. This header isn't yet supported by our CORS lib etc, so this seems to be an OK way of adding it. --- further_link/__main__.py | 5 +++++ tests/e2e/test_http.py | 1 + 2 files changed, 6 insertions(+) diff --git a/further_link/__main__.py b/further_link/__main__.py index d1974427..2f1c4f08 100755 --- a/further_link/__main__.py +++ b/further_link/__main__.py @@ -43,6 +43,11 @@ async def create_bluetooth_app() -> Optional[BluetoothServer]: async def create_web_app(): app = web.Application() + async def set_extra_cors_headers(request, response): + response.headers["Access-Control-Allow-Private-Network"] = "true" + + app.on_response_prepare.append(set_extra_cors_headers) + cors = aiohttp_cors.setup( app, defaults={ diff --git a/tests/e2e/test_http.py b/tests/e2e/test_http.py index a88b39a5..15f8a42d 100644 --- a/tests/e2e/test_http.py +++ b/tests/e2e/test_http.py @@ -13,6 +13,7 @@ async def test_status(http_client): response = await http_client.get(STATUS_PATH) assert response.status == 200 + assert response.headers["Access-Control-Allow-Private-Network"] == "true" assert await response.text() == "OK" From 827ecb5c29e3b98f780cbea2dd710864b67fb83d Mon Sep 17 00:00:00 2001 From: Jorge Capona Date: Thu, 14 Mar 2024 16:16:18 -0300 Subject: [PATCH 2/2] fix: pi-topOS apt repo installation on Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 59c2f6e7..7e4ec17f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ RUN apt-get update && \ RUN git clone https://github.com/pi-top/pi-topOS-Apt-Source.git && \ cd pi-topOS-Apt-Source && \ cp keys/* /usr/share/keyrings/ && \ - cp sources/pi-top-os.list /etc/apt/sources.list.d/ && \ + usr/lib/pi-top-os-apt-installer/pi-top-apt-source-manager install pi-top-os && \ apt-get update && \ rm -rf /pi-topOS-Apt-Source