From d97dfafaa768baa45c9350cbbd1f8571a4fec5a2 Mon Sep 17 00:00:00 2001 From: Louis Gallet Date: Mon, 1 Jul 2024 18:01:04 +0200 Subject: [PATCH] fix: :bug: Fix a bug with the QR code that always generate a QR code for localhost Add an env variable and change README --- .env.example | 1 + README.md | 1 + main.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index f4920ae..39634bb 100644 --- a/.env.example +++ b/.env.example @@ -2,4 +2,5 @@ client_id= client_secret= n8n_webhook_add_tracks= n8n_webhook_create_playlist= +hostname= environment=production \ No newline at end of file diff --git a/README.md b/README.md index d4abc29..8326dea 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ docker run -d \ -e n8n_webhook_create_playlist=N8N_WEBHOOK_URL \ -e n8n_webhook_add_tracks=N8N_WEBHOOK_URL \ -e environment=production \ + -e hostname=https://example.com gitea.louisgallet.fr/lgallet/makethisplaylist:latest ``` diff --git a/main.py b/main.py index 9cdc9ac..a6b2e82 100644 --- a/main.py +++ b/main.py @@ -44,7 +44,7 @@ def create_playlist(): cursor.execute("INSERT INTO rooms (roomid, spotify_id, playlist_name, spotify_URL) VALUES (?, ?, ?, ?)", (roomid, playlistID, playlistName, spotifyURL)) database.commit() - qrcode = generateQRCode("http://localhost:3000/search/" + str(roomid)) + qrcode = generateQRCode(os.getenv("hostname") + "/search/" + str(roomid)) return render_template("create.html", response="Playlist created successfully", comment="Enjoy the night \U0001f57a (and share this QRCode with your friends)", image=qrcode, type="success", roomid=roomid)