From b245755fced85617600cc8dca98af3bfdc3009b3 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Thu, 7 Feb 2019 21:38:13 +0100 Subject: [PATCH] Try to build a better redirect url --- indieauth.html | 16 +++++++++++++++- indieauth.js | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/indieauth.html b/indieauth.html index fd8ba49..0f26b2b 100644 --- a/indieauth.html +++ b/indieauth.html @@ -19,8 +19,17 @@ oneditprepare: function () { var id = this.id; + var pathname = document.location.pathname; + if (pathname.slice(-1) != "/") { + pathname += "/"; + } + + var callback = location.protocol + "//" + + location.hostname + + (location.port?":"+location.port:"")+ + pathname + "indieauth/auth/callback"; + $('#node-config-start-auth').mousedown(function () { - var callback = 'https://localhost:1881/indieauth/auth/callback'; var clientId = $("#node-config-input-client_id").val(); var me = $("#node-config-input-me").val(); var url = 'indieauth/auth?id=' + id + '&client_id=' + clientId + "&me=" + me + "&callback=" + encodeURIComponent(callback); @@ -31,6 +40,11 @@