Update RemoteProfile.vue, add profile permalinks & redirect handler

This commit is contained in:
Daniel Supernault 2020-07-20 08:52:23 -06:00
parent bafe52efbb
commit 62b84fe9a3
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -33,7 +33,7 @@
</span>
</div>
<p class="pl-2 h4 font-weight-bold mb-1">{{profile.display_name}}</p>
<p class="pl-2 font-weight-bold mb-2 text-muted">{{profile.acct}}</p>
<p class="pl-2 font-weight-bold mb-2"><a class="text-muted" :href="profile.url" @click.prevent="urlRedirectHandler(profile.url)">{{profile.acct}}</a></p>
<p class="pl-2 text-muted small d-flex justify-content-between">
<span>
<span class="font-weight-bold text-dark">{{profile.statuses_count}}</span>
@ -481,6 +481,18 @@
suffix = suffix ? ' ' + suffix : '';
return App.util.format.timeAgo(ts) + suffix;
},
urlRedirectHandler(url) {
let p = new URL(url);
let path = '';
if(p.hostname == window.location.hostname) {
path = url;
} else {
path = '/i/redirect?url=';
path += encodeURI(url);
}
window.location.href = path;
}
}
}
</script>