From 03aaaacc691a086391451dcb98260818cfbd942c Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Oct 2022 00:40:06 +0200
Subject: [PATCH 1/8] add $UNIQUE_ID to PWC_HOTSPOT_SSID

---
 .github/workflows/balena-deploy.yml | 22 ----------------------
 .github/workflows/deploy.yml        | 12 ++++++------
 src/config.py                       |  8 ++++++++
 3 files changed, 14 insertions(+), 28 deletions(-)
 delete mode 100644 .github/workflows/balena-deploy.yml

diff --git a/.github/workflows/balena-deploy.yml b/.github/workflows/balena-deploy.yml
deleted file mode 100644
index efcca1f..0000000
--- a/.github/workflows/balena-deploy.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Deploy to BCR
-
-on:
-  push:
-    tags:
-      - "*"
-
-jobs:
-  deploy-to-bcr:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-
-      - name: Deploy to Balena
-        uses: balena-io/deploy-to-balena-action@master
-        id: build
-        with:
-          balena_token: ${{ secrets.BALENA_TOKEN }}
-          fleet: maggie0002/python-wifi-connect
-
-      - name: Log release ID built
-        run: echo "Built release ID ${{ steps.build.outputs.release_id }}"
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 8266d4c..d0b7d94 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -9,7 +9,7 @@ on:
 
 env:
   REGISTRY: ghcr.io
-  IMAGE_NAME: balena-labs-research/python-wifi-connect
+  IMAGE_NAME: coderbotorg/python-wifi-connect
 
 jobs:
   build-and-push-image:
@@ -20,20 +20,20 @@ jobs:
 
     steps:
       - name: Checkout repository
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
       - name: Set up QEMU
-        uses: docker/setup-qemu-action@v1
+        uses: docker/setup-qemu-action@v2
 
       - name: Set up Docker Buildx
         id: buildx
-        uses: docker/setup-buildx-action@v1
+        uses: docker/setup-buildx-action@v3
 
       - name: Available platforms
         run: echo ${{ steps.buildx.outputs.platforms }}
 
       - name: Log in to the Container registry
-        uses: docker/login-action@v1
+        uses: docker/login-action@v2
         with:
           registry: ${{ env.REGISTRY }}
           username: ${{ github.actor }}
@@ -54,7 +54,7 @@ jobs:
         with:
           context: .
           file: ./Dockerfile
-          platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386
+          platforms: linux/arm64,linux/arm/v7,linux/arm/v6
           push: true
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
diff --git a/src/config.py b/src/config.py
index b9c6bb9..b26e2d4 100644
--- a/src/config.py
+++ b/src/config.py
@@ -25,6 +25,14 @@
 else:
     hotspot_ssid = "Python Wi-Fi Connect"
 
+if "$UNIQUE_ID" in hotspot_ssid:
+    with open("/proc/cpuinfo") as f:
+        for line in f:
+            if "Serial" in line:
+                serial = line.replace(" ","").split(":")[1]
+                hotspot_ssid.replace("$UNIQUE_ID", serial[-5:-1])
+
+hotspot_ssid.replace("$UNIQUE_ID", ) 
 # Set default hotspot password.
 if "PWC_HOTSPOT_PASSWORD" in env_file:
     hotspot_password = env_file["PWC_HOTSPOT_PASSWORD"]

From d10214dcd8b973f4bdb04f17229a3e21ce2dd4ea Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Oct 2022 00:44:21 +0200
Subject: [PATCH 2/8] add $UNIQUE_ID to hotspot_ssid

---
 src/config.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/config.py b/src/config.py
index b26e2d4..b9c85d3 100644
--- a/src/config.py
+++ b/src/config.py
@@ -29,8 +29,11 @@
     with open("/proc/cpuinfo") as f:
         for line in f:
             if "Serial" in line:
-                serial = line.replace(" ","").split(":")[1]
-                hotspot_ssid.replace("$UNIQUE_ID", serial[-5:-1])
+                serial = line.replace(" ", "").split(":")[1]
+                hotspot_ssid.replace(
+                    "$UNIQUE_ID", 
+                    serial[-5:-1]
+                )
 
 hotspot_ssid.replace("$UNIQUE_ID", ) 
 # Set default hotspot password.

From b8e61cfec9e3355d58afd2e04fff7226bc32a664 Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Oct 2022 00:46:52 +0200
Subject: [PATCH 3/8] fix build container

---
 .github/workflows/deploy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index d0b7d94..472510c 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -27,7 +27,7 @@ jobs:
 
       - name: Set up Docker Buildx
         id: buildx
-        uses: docker/setup-buildx-action@v3
+        uses: docker/setup-buildx-action@v2
 
       - name: Available platforms
         run: echo ${{ steps.buildx.outputs.platforms }}

From 23ebecb5d8d3ba2f064238db7b5c23037d3e5bb3 Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Oct 2022 00:49:00 +0200
Subject: [PATCH 4/8] add $UNIQUE_ID to hotspot_ssid

---
 src/config.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/config.py b/src/config.py
index b9c85d3..88865e0 100644
--- a/src/config.py
+++ b/src/config.py
@@ -30,12 +30,8 @@
         for line in f:
             if "Serial" in line:
                 serial = line.replace(" ", "").split(":")[1]
-                hotspot_ssid.replace(
-                    "$UNIQUE_ID", 
-                    serial[-5:-1]
-                )
+                hotspot_ssid.replace("$UNIQUE_ID", serial[-5:-1])
 
-hotspot_ssid.replace("$UNIQUE_ID", ) 
 # Set default hotspot password.
 if "PWC_HOTSPOT_PASSWORD" in env_file:
     hotspot_password = env_file["PWC_HOTSPOT_PASSWORD"]

From 9f53e750f411d5a68fff8fc6479e37f38ef2d7b1 Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Oct 2022 01:33:39 +0200
Subject: [PATCH 5/8] add $UNIQUE_ID to hotspot_ssid

---
 src/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/config.py b/src/config.py
index 88865e0..a1bd28e 100644
--- a/src/config.py
+++ b/src/config.py
@@ -30,7 +30,7 @@
         for line in f:
             if "Serial" in line:
                 serial = line.replace(" ", "").split(":")[1]
-                hotspot_ssid.replace("$UNIQUE_ID", serial[-5:-1])
+                hotspot_ssid = hotspot_ssid.replace("$UNIQUE_ID", serial[-5:-1])
 
 # Set default hotspot password.
 if "PWC_HOTSPOT_PASSWORD" in env_file:

From 36b15761e1ef31f6fb5bf96de6b19b9ebef6d116 Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Oct 2022 01:37:21 +0200
Subject: [PATCH 6/8] lint

---
 src/config.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/config.py b/src/config.py
index a1bd28e..73475d8 100644
--- a/src/config.py
+++ b/src/config.py
@@ -30,7 +30,9 @@
         for line in f:
             if "Serial" in line:
                 serial = line.replace(" ", "").split(":")[1]
-                hotspot_ssid = hotspot_ssid.replace("$UNIQUE_ID", serial[-5:-1])
+                hotspot_ssid = hotspot_ssid.replace(
+                    "$UNIQUE_ID", serial[-5:-1]
+                )
 
 # Set default hotspot password.
 if "PWC_HOTSPOT_PASSWORD" in env_file:

From 3afb5731af22f1b00da76365241351e26c83063f Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Jun 2024 16:55:43 +0200
Subject: [PATCH 7/8] bump python to 3.9

---
 Dockerfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 72fd7b3..c95b966 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
 ## Build Python packages to avoid need for builds in main image
-FROM python:3.8.10-alpine3.14 AS python-buildstep
+FROM python:3.9.19-alpine3.20 AS python-buildstep
 
 # Prevent pip 'warn script location' warnings. Equivalent to --no-warn-script-location
 ENV PATH=/root/.local/bin:$PATH
@@ -20,7 +20,7 @@ RUN pip install --user -r /tmp/requirements.txt --no-cache-dir
 
 
 ## Compile container
-FROM python:3.8.10-alpine3.14
+FROM python:3.9.19-alpine3.20
 
 # Set system environment variables
 ENV FLASK_APP=run

From 8dce53b01bd1a2209bbb6eca23bcb1e30a101fa3 Mon Sep 17 00:00:00 2001
From: previ <roberto.previtera@gmail.com>
Date: Sat, 22 Jun 2024 17:35:21 +0200
Subject: [PATCH 8/8] fix python-networkmanager

---
 src/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/requirements.txt b/src/requirements.txt
index 4e9e991..a3434bc 100644
--- a/src/requirements.txt
+++ b/src/requirements.txt
@@ -26,7 +26,7 @@ markupsafe==2.1.0
     # via jinja2
 python-dotenv==0.19.2
     # via -r requirements.in
-python-networkmanager @ git+https://github.com/balena-io-experimental/python-networkmanager
+python-networkmanager @ git+https://github.com/CoderBotOrg/python-networkmanager
     # via -r requirements.in
 pytz==2021.3
     # via flask-restful
