Merge pull request #163 from ssb-ngi-pointer/ssb-uri-tmpl
refactor templates that have ssb uri links
This commit is contained in:
commit
0e5b2f3843
|
@ -9,11 +9,12 @@ window.addEventListener('focus', () => {
|
|||
const waitingElem = document.getElementById('waiting');
|
||||
const anchorElem = document.getElementById('join-room-uri');
|
||||
anchorElem.onclick = function handleURI(ev) {
|
||||
const ssbUri = ev.target.dataset.href;
|
||||
const fallbackUrl = ev.target.dataset.hrefFallback;
|
||||
ev.preventDefault();
|
||||
const ssbUri = anchorElem.href;
|
||||
const fallbackUrl = anchorElem.dataset.hrefFallback;
|
||||
waitingElem.classList.remove('hidden');
|
||||
setTimeout(function () {
|
||||
if (hasFocus) window.location = fallbackUrl;
|
||||
if (hasFocus) window.location.replace(fallbackUrl);
|
||||
}, 5000);
|
||||
window.location = ssbUri;
|
||||
window.location.replace(ssbUri);
|
||||
};
|
|
@ -424,7 +424,7 @@ func TestAuthWithSSBServerInitHappyPath(t *testing.T) {
|
|||
|
||||
jsFile, has := html.Find("script").Attr("src")
|
||||
a.True(has, "should have client code")
|
||||
a.Equal("/assets/login-events.js", jsFile)
|
||||
a.Equal("/assets/auth-withssb-uri.js", jsFile)
|
||||
|
||||
serverChallenge, has := html.Find("#challenge").Attr("data-sc")
|
||||
a.True(has, "should have server challenge")
|
||||
|
|
|
@ -76,11 +76,6 @@ func TestInviteShowAcceptForm(t *testing.T) {
|
|||
{"title", "InviteFacadeTitle"},
|
||||
})
|
||||
|
||||
// Empty href
|
||||
joinHref, ok := doc.Find("#join-room-uri").Attr("href")
|
||||
a.Equal("#", joinHref)
|
||||
a.True(ok)
|
||||
|
||||
// Fallback URL in data-href-fallback
|
||||
fallbackURL := ts.URLTo(router.CompleteInviteFacadeFallback, "token", testToken)
|
||||
want := fallbackURL.Path + "?" + fallbackURL.RawQuery
|
||||
|
@ -88,8 +83,8 @@ func TestInviteShowAcceptForm(t *testing.T) {
|
|||
a.Equal(want, joinDataHrefFallback)
|
||||
a.True(ok)
|
||||
|
||||
// ssb-uri in data-href
|
||||
joinDataHref, ok := doc.Find("#join-room-uri").Attr("data-href")
|
||||
// ssb-uri in href
|
||||
joinDataHref, ok := doc.Find("#join-room-uri").Attr("href")
|
||||
a.True(ok)
|
||||
joinURI, err := url.Parse(joinDataHref)
|
||||
r.NoError(err)
|
||||
|
|
|
@ -152,11 +152,8 @@ InviteFacadeTitle = "Join Room"
|
|||
InviteFacadeWelcome = "You have permission to become a member of this room because someone has shared this invite with you."
|
||||
InviteFacadeInstruct = "To claim the invite, press the button below which will open a compatible SSB app, if it's installed."
|
||||
InviteFacadeJoin = "Join this room"
|
||||
InviteFacadeWaiting = "Opening SSB app"
|
||||
InviteFacadeInstructQR = "If your SSB app is on another device, you can scan the following QR code to claim your invite on that device:"
|
||||
|
||||
InviteFacadeFallbackWelcome = "Are you new to SSB? It seems you don't have an SSB app capable of understanding that link. You can install one of these apps:"
|
||||
InviteFacadeFallbackManyverse = "Install Manyverse"
|
||||
InviteFacadeFallbackInsertID = "Insert SSB ID"
|
||||
|
||||
InviteInsertWelcome = "You can claim your invite by inserting your SSB ID below. After that, you'll be able to connect to the room in your SSB app."
|
||||
|
@ -164,6 +161,13 @@ InviteInsertWelcome = "You can claim your invite by inserting your SSB ID below.
|
|||
InviteConsumedTitle = "Invite accepted!"
|
||||
InviteConsumedWelcome = "You are now a member of this room. If you need a multiserver address to connect to the room, you can copy-paste the one below:"
|
||||
|
||||
# ssb uri links
|
||||
###############
|
||||
|
||||
SSBURIOpening = "Opening SSB app"
|
||||
SSBURIFailureWelcome = "Are you new to SSB? It seems you don't have an SSB app capable of understanding that link. You can install one of these apps:"
|
||||
SSBURIFailureInstallManyverse = "Install Manyverse"
|
||||
|
||||
# notices (mini-CMS)
|
||||
####################
|
||||
|
||||
|
|
|
@ -34,6 +34,6 @@
|
|||
|
||||
{{if not .IsSolvingRemotely}}
|
||||
<div id="challenge" class="hidden" data-sc="{{.ServerChallenge}}"></div>
|
||||
<script src="/assets/login-events.js"></script>
|
||||
<script src="/assets/auth-withssb-uri.js"></script>
|
||||
{{end}}
|
||||
{{end}}
|
|
@ -1,13 +1,13 @@
|
|||
{{ define "title" }}{{ i18n "InviteFacadeTitle" }}{{ end }}
|
||||
{{ define "content" }}
|
||||
<div class="flex flex-col justify-center items-center self-center max-w-lg">
|
||||
<p class="text-center mt-8">{{i18n "InviteFacadeFallbackWelcome"}}</p>
|
||||
<p class="text-center mt-8">{{i18n "SSBURIFailureWelcome"}}</p>
|
||||
|
||||
<div class="flex flex-col sm:flex-row items-center mt-8">
|
||||
<a
|
||||
href="https://manyver.se"
|
||||
class="shadow rounded flex flex-row justify-center items-center px-4 h-8 text-gray-100 bg-purple-500 hover:bg-purple-600 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-opacity-50"
|
||||
>{{i18n "InviteFacadeFallbackManyverse"}}</a>
|
||||
>{{i18n "SSBURIFailureInstallManyverse"}}</a>
|
||||
</div>
|
||||
|
||||
<hr class="mt-8 w-64 h-px bg-gray-200"></hr>
|
||||
|
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
<a
|
||||
id="join-room-uri"
|
||||
href="#"
|
||||
data-href="{{.JoinRoomURI}}"
|
||||
href="{{.JoinRoomURI}}"
|
||||
data-href-fallback="{{.FallbackURL}}"
|
||||
class="shadow rounded flex flex-row justify-center items-center mt-8 px-4 h-8 text-gray-100 bg-purple-500 hover:bg-purple-600 focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-opacity-50"
|
||||
>{{i18n "InviteFacadeJoin"}}</a>
|
||||
|
||||
<p id="waiting" class="hidden mt-8 animate-pulse text-green-500">{{i18n "InviteFacadeWaiting"}}</p>
|
||||
<p id="waiting" class="hidden mt-8 animate-pulse text-green-500">{{i18n "SSBURIOpening"}}</p>
|
||||
|
||||
<hr class="mt-8 w-64 h-px bg-gray-200"></hr>
|
||||
|
||||
|
@ -27,6 +26,6 @@
|
|||
class="mt-8"
|
||||
/>
|
||||
|
||||
<script src="/assets/autoredirect.js"></script>
|
||||
<script src="/assets/invite-uri.js"></script>
|
||||
</div>
|
||||
{{ end }}
|
Loading…
Reference in New Issue