diff --git a/charts/huesoporro/Chart.yaml b/charts/huesoporro/Chart.yaml index 3d392ad..22ca75f 100644 --- a/charts/huesoporro/Chart.yaml +++ b/charts/huesoporro/Chart.yaml @@ -21,4 +21,4 @@ version: 0.2.4 # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.2.5" +appVersion: "0.2.4" diff --git a/charts/huesoporro/values.yaml b/charts/huesoporro/values.yaml index ea27e5a..48b749a 100644 --- a/charts/huesoporro/values.yaml +++ b/charts/huesoporro/values.yaml @@ -11,7 +11,7 @@ image: # This sets the pull policy for images. pullPolicy: Always # Overrides the image tag whose default is the chart appVersion. - tag: "0.2.5" + tag: "0.2.4" # This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ imagePullSecrets: [] diff --git a/pyproject.toml b/pyproject.toml index 1da3c58..5b913bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "huesoporro" -version = "0.2.5" +version = "0.2.4" description = "Misc Twitch bots" readme = "README.md" authors = [ diff --git a/src/huesoporro/api/routes/api.py b/src/huesoporro/api/routes/api.py index 9412598..d427cde 100644 --- a/src/huesoporro/api/routes/api.py +++ b/src/huesoporro/api/routes/api.py @@ -19,7 +19,7 @@ class ManageBotDTO(BaseModel): "/tts", media_type=MediaType.HTML, ) -async def get_tts_overlay(user: User) -> Template: +async def get_tts_overlay() -> Template: return Template(template_name="tts.html") diff --git a/src/huesoporro/static/js/utils.js b/src/huesoporro/static/js/utils.js index 9bb1116..e014ab2 100644 --- a/src/huesoporro/static/js/utils.js +++ b/src/huesoporro/static/js/utils.js @@ -7,3 +7,36 @@ function getWebsocketProtocol() { return "wss://"; } } + +function addLogoutEvent() { + const logoutButton = document.getElementById("logoutButton"); + logoutButton.addEventListener("click", () => { + document.cookie = "twitchLoginData=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; + window.location.href = "/"; + }); + +} + +function setCookie(name, value, days) { + const date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + const expires = `expires=${date.toUTCString()}`; + document.cookie = `${name}=${value};${expires};path=/;SameSite=Strict`; +} + +function getCookie(name) { + const cookieName = `${name}=`; + const decodedCookie = decodeURIComponent(document.cookie); + const cookieArray = decodedCookie.split(';'); + + for (let i = 0; i < cookieArray.length; i++) { + let cookie = cookieArray[i]; + while (cookie.charAt(0) === ' ') { + cookie = cookie.substring(1); + } + if (cookie.indexOf(cookieName) === 0) { + return cookie.substring(cookieName.length, cookie.length); + } + } + return null; +} diff --git a/src/huesoporro/templates/index.html b/src/huesoporro/templates/index.html index b17419f..bdf08ee 100644 --- a/src/huesoporro/templates/index.html +++ b/src/huesoporro/templates/index.html @@ -5,10 +5,12 @@
@@ -176,7 +178,7 @@ }) const data = await response.json() console.log(data); - if (response.ok) { + if (response.ok){ alert("Settings saved successfully") } } @@ -184,6 +186,8 @@ const chatbotManager = new ChatbotManager(); chatbotManager.setEvents(); + + addLogoutEvent() }); diff --git a/src/huesoporro/templates/login.html b/src/huesoporro/templates/login.html index 3a3181a..00e0a38 100644 --- a/src/huesoporro/templates/login.html +++ b/src/huesoporro/templates/login.html @@ -6,8 +6,7 @@
- Login + Login with Twitch @@ -15,7 +14,66 @@
diff --git a/src/huesoporro/templates/logout.html b/src/huesoporro/templates/logout.html deleted file mode 100644 index 61f189c..0000000 --- a/src/huesoporro/templates/logout.html +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/src/huesoporro/templates/sentences.html b/src/huesoporro/templates/sentences.html index e390f79..7a0b611 100644 --- a/src/huesoporro/templates/sentences.html +++ b/src/huesoporro/templates/sentences.html @@ -1,14 +1,17 @@ + {% include 'header.html' %}

Huesoporro🦴🍃

@@ -17,18 +20,14 @@ - + {% for sentence in sentences %} - + {% endfor %}
SentenceSentence Action
{{ sentence.sentence }} - -
diff --git a/src/huesoporro/templates/tts.html b/src/huesoporro/templates/tts.html index 5a7843e..a0f3266 100644 --- a/src/huesoporro/templates/tts.html +++ b/src/huesoporro/templates/tts.html @@ -8,7 +8,10 @@
  • TTS
  • Le Funny
  • - {% include 'logout.html' %} + +

    Huesoporro🦴🍃

    @@ -183,7 +186,7 @@ // generate /tts/permalink?access_token= // the access token is available in the twitchLoginData cookie - const cookie = JSON.parse(getCookie("huesoporroAuth")) + const cookie = JSON.parse(getCookie("twitchLoginData")) const permalinkUrl = `${window.location.origin}/tts/permalink?access_token=${cookie.access_token}`; navigator.clipboard.writeText(permalinkUrl); alert('OBS link copied to clipboard ' + permalinkUrl); diff --git a/uv.lock b/uv.lock index d861103..c6caf63 100644 --- a/uv.lock +++ b/uv.lock @@ -460,7 +460,7 @@ wheels = [ [[package]] name = "huesoporro" -version = "0.2.5" +version = "0.2.4" source = { virtual = "." } dependencies = [ { name = "aiosqlite" },