refactor templates that have ssb uri links

This commit is contained in:
Andre Staltz 2021-04-16 18:31:32 +03:00
parent 26ce19f1eb
commit 7bbe33adab
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
6 changed files with 18 additions and 14 deletions

View File

@ -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);
};

View File

@ -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)
####################

View File

@ -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}}

View File

@ -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>

View File

@ -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 }}