disable nav elements that don't work
This commit is contained in:
parent
00b523ddac
commit
8a77bbccc0
8 changed files with 161 additions and 147 deletions
|
@ -55,18 +55,18 @@
|
|||
:title="$t('nav.public_tl')"
|
||||
/>
|
||||
</router-link>
|
||||
<router-link
|
||||
v-if="bubbleTimelineVisible"
|
||||
:to="{ name: 'bubble-timeline' }"
|
||||
class="nav-icon"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110 fa-old-padding"
|
||||
icon="circle"
|
||||
:title="$t('nav.bubble_timeline')"
|
||||
/>
|
||||
</router-link>
|
||||
<!-- <router-link -->
|
||||
<!-- v-if="bubbleTimelineVisible" -->
|
||||
<!-- :to="{ name: 'bubble-timeline' }" -->
|
||||
<!-- class="nav-icon" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110 fa-old-padding" -->
|
||||
<!-- icon="circle" -->
|
||||
<!-- :title="$t('nav.bubble_timeline')" -->
|
||||
<!-- /> -->
|
||||
<!-- </router-link> -->
|
||||
<router-link
|
||||
v-if="federatedTimelineVisible"
|
||||
:to="{ name: 'public-external-timeline' }"
|
||||
|
@ -130,18 +130,18 @@
|
|||
<!-- :title="$t('nav.lists')" -->
|
||||
<!-- /> -->
|
||||
<!-- </router-link> -->
|
||||
<router-link
|
||||
v-if="currentUser"
|
||||
:to="{ name: 'bookmarks' }"
|
||||
class="nav-icon"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110 fa-old-padding"
|
||||
icon="bookmark"
|
||||
:title="$t('nav.bookmarks')"
|
||||
/>
|
||||
</router-link>
|
||||
<!-- <router-link -->
|
||||
<!-- v-if="currentUser" -->
|
||||
<!-- :to="{ name: 'bookmarks' }" -->
|
||||
<!-- class="nav-icon" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110 fa-old-padding" -->
|
||||
<!-- icon="bookmark" -->
|
||||
<!-- :title="$t('nav.bookmarks')" -->
|
||||
<!-- /> -->
|
||||
<!-- </router-link> -->
|
||||
</div>
|
||||
<button
|
||||
class="button-unstyled nav-icon"
|
||||
|
|
|
@ -30,8 +30,7 @@
|
|||
v-if="!mergedConfig.hidePostStats && status.fave_num > 0"
|
||||
class="action-counter"
|
||||
>
|
||||
<!-- SHARKEY-SPECIFIC: disable favorite count because devs make them hearts for some reason -->
|
||||
<!-- {{ status.fave_num }} -->
|
||||
{{ status.fave_num }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -26,18 +26,18 @@
|
|||
</div>
|
||||
</li>
|
||||
<!-- disabled: lists don't work -->
|
||||
<!-- <li v-if="currentUser"> -->
|
||||
<!-- <router-link -->
|
||||
<!-- class="menu-item" -->
|
||||
<!-- :to="{ name: 'lists' }" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110" -->
|
||||
<!-- icon="list" -->
|
||||
<!-- />{{ $t("nav.lists") }} -->
|
||||
<!-- </router-link> -->
|
||||
<!-- </li> -->
|
||||
<li v-if="currentUser">
|
||||
<router-link
|
||||
class="menu-item"
|
||||
:to="{ name: 'lists' }"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110"
|
||||
icon="list"
|
||||
/>{{ $t("nav.lists") }}
|
||||
</router-link>
|
||||
</li>
|
||||
<!-- <li v-if="currentUser"> -->
|
||||
<!-- <router-link -->
|
||||
<!-- class="menu-item" -->
|
||||
|
|
|
@ -560,52 +560,48 @@ const Status = {
|
|||
},
|
||||
'isSuspendable': function (val) {
|
||||
this.suspendable = val
|
||||
},
|
||||
'status.emoji_reactions': {
|
||||
|
||||
// since the sharkey mastoapi doesn't support reactions we have to do an additional fetch to origin server for every note. not good!
|
||||
async handler (reactions) {
|
||||
for (let reaction of reactions) {
|
||||
if (reaction.name.startsWith(':')) continue;
|
||||
let codepoint = reaction.name.codePointAt(0);
|
||||
|
||||
const hexCode = codepoint.toString(16).toLowerCase();
|
||||
const baseUrl = "https://twemoji.maxcdn.com/v/latest/72x72/";
|
||||
const url = `${baseUrl}${hexCode}.png`;
|
||||
reaction.url = url;
|
||||
}
|
||||
console.log(reactions);
|
||||
|
||||
if (reactions.some(reaction => reaction.name.startsWith(':'))) {
|
||||
let data = await fetch("/api/notes/show", {
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
"referrer": "https://grimgreenfo.rest/",
|
||||
"body": JSON.stringify({ "noteId": this.status.id, }),
|
||||
"method": "POST",
|
||||
"mode": "cors"
|
||||
});
|
||||
if (data.ok) {
|
||||
let json = await data.json();
|
||||
|
||||
for (let reaction of reactions) {
|
||||
if (!reaction.name.startsWith(':')) continue;
|
||||
let image = json.reactionEmojis[reaction.name.substring(1).substring(0, reaction.name.length - 2)];
|
||||
reaction.url = image;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
async mounted () {
|
||||
if (this.status.refetched) return;
|
||||
|
||||
if (this.status.emoji_reactions.length > 1 && this.status.emoji_reactions.some(reaction => reaction.name.startsWith(':'))) {
|
||||
let data = await fetch("/api/notes/show", {
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
"referrer": "https://grimgreenfo.rest/",
|
||||
"body": JSON.stringify({ "noteId": this.status.id, }),
|
||||
"method": "POST",
|
||||
"mode": "cors"
|
||||
});
|
||||
if (data.ok) {
|
||||
let json = await data.json();
|
||||
|
||||
for (let reaction of this.status.emoji_reactions) {
|
||||
|
||||
let image = json.reactionEmojis[reaction.name.substring(1).substring(0, reaction.name.length - 2)];
|
||||
if (image) {
|
||||
reaction.url = image;
|
||||
}else {
|
||||
|
||||
let codepoint = reaction.name.codePointAt(0);
|
||||
|
||||
const hexCode = codepoint.toString(16).toLowerCase();
|
||||
const baseUrl = "https://twemoji.maxcdn.com/v/latest/72x72/";
|
||||
const url = `${baseUrl}${hexCode}.png`;
|
||||
reaction.url = url;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let reaction of this.status.emoji_reactions) {
|
||||
let codepoint = reaction.name.codePointAt(0);
|
||||
|
||||
const hexCode = codepoint.toString(16).toLowerCase();
|
||||
const baseUrl = "https://twemoji.maxcdn.com/v/latest/72x72/";
|
||||
const url = `${baseUrl}${hexCode}.png`;
|
||||
reaction.url = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Status
|
||||
|
|
|
@ -32,22 +32,23 @@
|
|||
>{{ $t("nav.public_tl") }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li v-if="bubbleTimelineVisible">
|
||||
<router-link
|
||||
class="menu-item"
|
||||
:to="{ name: 'bubble-timeline' }"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110 fa-old-padding "
|
||||
icon="circle"
|
||||
/>
|
||||
<span
|
||||
:title="$t('nav.bubble_timeline_description')"
|
||||
:aria-label="$t('nav.bubble_timeline_description')"
|
||||
>{{ $t("nav.bubble_timeline") }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<!-- no bubble timeline in mastoapi -->
|
||||
<!-- <li v-if="bubbleTimelineVisible"> -->
|
||||
<!-- <router-link -->
|
||||
<!-- class="menu-item" -->
|
||||
<!-- :to="{ name: 'bubble-timeline' }" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||
<!-- icon="circle" -->
|
||||
<!-- /> -->
|
||||
<!-- <span -->
|
||||
<!-- :title="$t('nav.bubble_timeline_description')" -->
|
||||
<!-- :aria-label="$t('nav.bubble_timeline_description')" -->
|
||||
<!-- >{{ $t("nav.bubble_timeline") }}</span> -->
|
||||
<!-- </router-link> -->
|
||||
<!-- </li> -->
|
||||
<li v-if="federatedTimelineVisible">
|
||||
<router-link
|
||||
class="menu-item"
|
||||
|
@ -64,38 +65,38 @@
|
|||
>{{ $t("nav.twkn") }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li v-if="currentUser">
|
||||
<router-link
|
||||
class="menu-item"
|
||||
:to="{ name: 'bookmarks'}"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110 fa-old-padding "
|
||||
icon="bookmark"
|
||||
/>
|
||||
<span
|
||||
:title="$t('nav.bookmarks')"
|
||||
:aria-label="$t('nav.bookmarks')"
|
||||
>{{ $t("nav.bookmarks") }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li v-if="currentUser">
|
||||
<router-link
|
||||
class="menu-item"
|
||||
:to="{ name: 'dms', params: { username: currentUser.screen_name } }"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110 fa-old-padding "
|
||||
icon="envelope"
|
||||
/>
|
||||
<span
|
||||
:title="$t('nav.dms')"
|
||||
:aria-label="$t('nav.dms')"
|
||||
>{{ $t("nav.dms") }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<!-- <li v-if="currentUser"> -->
|
||||
<!-- <router-link -->
|
||||
<!-- class="menu-item" -->
|
||||
<!-- :to="{ name: 'bookmarks'}" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||
<!-- icon="bookmark" -->
|
||||
<!-- /> -->
|
||||
<!-- <span -->
|
||||
<!-- :title="$t('nav.bookmarks')" -->
|
||||
<!-- :aria-label="$t('nav.bookmarks')" -->
|
||||
<!-- >{{ $t("nav.bookmarks") }}</span> -->
|
||||
<!-- </router-link> -->
|
||||
<!-- </li> -->
|
||||
<!-- <li v-if="currentUser"> -->
|
||||
<!-- <router-link -->
|
||||
<!-- class="menu-item" -->
|
||||
<!-- :to="{ name: 'dms', params: { username: currentUser.screen_name } }" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||
<!-- icon="envelope" -->
|
||||
<!-- /> -->
|
||||
<!-- <span -->
|
||||
<!-- :title="$t('nav.dms')" -->
|
||||
<!-- :aria-label="$t('nav.dms')" -->
|
||||
<!-- >{{ $t("nav.dms") }}</span> -->
|
||||
<!-- </router-link> -->
|
||||
<!-- </li> -->
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -81,20 +81,20 @@
|
|||
</router-link>
|
||||
</li>
|
||||
<li v-if="currentUser">
|
||||
<router-link
|
||||
class="menu-item"
|
||||
:to="{ name: 'bookmarks'}"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
class="fa-scale-110 fa-old-padding "
|
||||
icon="bookmark"
|
||||
/>
|
||||
<span
|
||||
:title="$t('nav.bookmarks')"
|
||||
:aria-label="$t('nav.bookmarks')"
|
||||
>{{ $t("nav.bookmarks") }}</span>
|
||||
</router-link>
|
||||
<!-- <router-link -->
|
||||
<!-- class="menu-item" -->
|
||||
<!-- :to="{ name: 'bookmarks'}" -->
|
||||
<!-- > -->
|
||||
<!-- <FAIcon -->
|
||||
<!-- fixed-width -->
|
||||
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||
<!-- icon="bookmark" -->
|
||||
<!-- /> -->
|
||||
<!-- <span -->
|
||||
<!-- :title="$t('nav.bookmarks')" -->
|
||||
<!-- :aria-label="$t('nav.bookmarks')" -->
|
||||
<!-- >{{ $t("nav.bookmarks") }}</span> -->
|
||||
<!-- </router-link> -->
|
||||
</li>
|
||||
<li v-if="currentUser">
|
||||
<router-link
|
||||
|
|
|
@ -50,10 +50,10 @@ const MASTODON_FOLLOWERS_URL = id => `/api/v1/accounts/${id}/followers`
|
|||
const MASTODON_FOLLOW_REQUESTS_URL = '/api/v1/follow_requests'
|
||||
const MASTODON_APPROVE_USER_URL = id => `/api/v1/follow_requests/${id}/authorize`
|
||||
const MASTODON_DENY_USER_URL = id => `/api/v1/follow_requests/${id}/reject`
|
||||
const MASTODON_DIRECT_MESSAGES_TIMELINE_URL = '/api/v1/timelines/direct'
|
||||
const MASTODON_DIRECT_MESSAGES_TIMELINE_URL = '/api/v1/conversations'
|
||||
const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
|
||||
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
|
||||
const AKKOMA_BUBBLE_TIMELINE_URL = 'api/notes/bubble-timeline'
|
||||
const AKKOMA_BUBBLE_TIMELINE_URL = '/api/v1/timelines/bubble'
|
||||
const MASTODON_STATUS_URL = id => `/api/v1/statuses/${id}`
|
||||
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
|
||||
const MASTODON_STATUS_SOURCE_URL = id => `/api/v1/statuses/${id}/source`
|
||||
|
|
|
@ -286,7 +286,14 @@ export const parseStatus = (data_in) => {
|
|||
output.type = data.reblog ? 'retweet' : 'status'
|
||||
output.nsfw = data.sensitive
|
||||
|
||||
output.raw_html = data.content
|
||||
function escapeHtml(html){
|
||||
var text = document.createTextNode(html);
|
||||
var p = document.createElement('p');
|
||||
p.appendChild(text);
|
||||
return p.innerHTML;
|
||||
}
|
||||
|
||||
output.raw_html = escapeHtml(data.text)
|
||||
output.emojis = data.emojis
|
||||
|
||||
output.tags = data.tags
|
||||
|
@ -411,6 +418,17 @@ export const parseStatus = (data_in) => {
|
|||
if (data.hasOwnProperty('originalStatus')) {
|
||||
Object.assign(output, data.originalStatus)
|
||||
}
|
||||
|
||||
|
||||
// sharkey stuff
|
||||
output.fave_num = 0;
|
||||
for (let emoji of output.emoji_reactions) {
|
||||
if (emoji.name == '❤' || emoji.name == '⭐') {
|
||||
output.fave_num += emoji.count;
|
||||
}
|
||||
}
|
||||
output.emoji_reactions = output.emoji_reactions.filter(emoji => emoji.name != '❤' && emoji.name != '⭐');
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue