From ac55fc2c50466d34821b1e11438840c0ea151014 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Fri, 24 Feb 2023 16:47:28 -0800 Subject: [PATCH] Experiment to see if iOS devices can connect better w/ JWT auth --- web/static/js/BareRTC.js | 6 ++++++ web/templates/chat.html | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 621b1c0..1ce919c 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -44,6 +44,7 @@ const app = Vue.createApp({ channel: "lobby", username: "", //"test", + autoLogin: false, // e.g. from JWT auth message: "", typingNotifDebounce: null, @@ -180,16 +181,21 @@ const app = Vue.createApp({ // TODO: JWT validation on the WebSocket as well. if (this.jwt.valid && this.jwt.claims.sub) { this.username = this.jwt.claims.sub; + this.autoLogin = true; } // Scrub JWT token from query string parameters. history.pushState(null, "", location.href.split("?")[0]); + // XX: always show login dialog to test if this helps iOS devices. + this.loginModal.visible = true; + /* if (!this.username) { this.loginModal.visible = true; } else { this.signIn(); } + */ }, computed: { chatHistory() { diff --git a/web/templates/chat.html b/web/templates/chat.html index 6761e45..b322b00 100644 --- a/web/templates/chat.html +++ b/web/templates/chat.html @@ -24,6 +24,21 @@
+
+

+ Welcome to {{AsHTML .Config.Branding}}! Please just click on the "Enter Chat" + button below to log on. Your username has been pre-filled from the website that + sent you here. +

+ +

+ This dialog box is added as an experiment to see whether it + helps iOS devices (iPads and iPhones) to log in to the chat more reliably, by + having you interact with the page before it connects to the server. Let us + know in chat if your iPhone or iPad is able to log in this way! +

+
+
- +