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')"
|
:title="$t('nav.public_tl')"
|
||||||
/>
|
/>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link
|
<!-- <router-link -->
|
||||||
v-if="bubbleTimelineVisible"
|
<!-- v-if="bubbleTimelineVisible" -->
|
||||||
:to="{ name: 'bubble-timeline' }"
|
<!-- :to="{ name: 'bubble-timeline' }" -->
|
||||||
class="nav-icon"
|
<!-- class="nav-icon" -->
|
||||||
>
|
<!-- > -->
|
||||||
<FAIcon
|
<!-- <FAIcon -->
|
||||||
fixed-width
|
<!-- fixed-width -->
|
||||||
class="fa-scale-110 fa-old-padding"
|
<!-- class="fa-scale-110 fa-old-padding" -->
|
||||||
icon="circle"
|
<!-- icon="circle" -->
|
||||||
:title="$t('nav.bubble_timeline')"
|
<!-- :title="$t('nav.bubble_timeline')" -->
|
||||||
/>
|
<!-- /> -->
|
||||||
</router-link>
|
<!-- </router-link> -->
|
||||||
<router-link
|
<router-link
|
||||||
v-if="federatedTimelineVisible"
|
v-if="federatedTimelineVisible"
|
||||||
:to="{ name: 'public-external-timeline' }"
|
:to="{ name: 'public-external-timeline' }"
|
||||||
|
@ -130,18 +130,18 @@
|
||||||
<!-- :title="$t('nav.lists')" -->
|
<!-- :title="$t('nav.lists')" -->
|
||||||
<!-- /> -->
|
<!-- /> -->
|
||||||
<!-- </router-link> -->
|
<!-- </router-link> -->
|
||||||
<router-link
|
<!-- <router-link -->
|
||||||
v-if="currentUser"
|
<!-- v-if="currentUser" -->
|
||||||
:to="{ name: 'bookmarks' }"
|
<!-- :to="{ name: 'bookmarks' }" -->
|
||||||
class="nav-icon"
|
<!-- class="nav-icon" -->
|
||||||
>
|
<!-- > -->
|
||||||
<FAIcon
|
<!-- <FAIcon -->
|
||||||
fixed-width
|
<!-- fixed-width -->
|
||||||
class="fa-scale-110 fa-old-padding"
|
<!-- class="fa-scale-110 fa-old-padding" -->
|
||||||
icon="bookmark"
|
<!-- icon="bookmark" -->
|
||||||
:title="$t('nav.bookmarks')"
|
<!-- :title="$t('nav.bookmarks')" -->
|
||||||
/>
|
<!-- /> -->
|
||||||
</router-link>
|
<!-- </router-link> -->
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
class="button-unstyled nav-icon"
|
class="button-unstyled nav-icon"
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
v-if="!mergedConfig.hidePostStats && status.fave_num > 0"
|
v-if="!mergedConfig.hidePostStats && status.fave_num > 0"
|
||||||
class="action-counter"
|
class="action-counter"
|
||||||
>
|
>
|
||||||
<!-- SHARKEY-SPECIFIC: disable favorite count because devs make them hearts for some reason -->
|
{{ status.fave_num }}
|
||||||
<!-- {{ status.fave_num }} -->
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -26,18 +26,18 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<!-- disabled: lists don't work -->
|
<!-- disabled: lists don't work -->
|
||||||
<!-- <li v-if="currentUser"> -->
|
<li v-if="currentUser">
|
||||||
<!-- <router-link -->
|
<router-link
|
||||||
<!-- class="menu-item" -->
|
class="menu-item"
|
||||||
<!-- :to="{ name: 'lists' }" -->
|
:to="{ name: 'lists' }"
|
||||||
<!-- > -->
|
>
|
||||||
<!-- <FAIcon -->
|
<FAIcon
|
||||||
<!-- fixed-width -->
|
fixed-width
|
||||||
<!-- class="fa-scale-110" -->
|
class="fa-scale-110"
|
||||||
<!-- icon="list" -->
|
icon="list"
|
||||||
<!-- />{{ $t("nav.lists") }} -->
|
/>{{ $t("nav.lists") }}
|
||||||
<!-- </router-link> -->
|
</router-link>
|
||||||
<!-- </li> -->
|
</li>
|
||||||
<!-- <li v-if="currentUser"> -->
|
<!-- <li v-if="currentUser"> -->
|
||||||
<!-- <router-link -->
|
<!-- <router-link -->
|
||||||
<!-- class="menu-item" -->
|
<!-- class="menu-item" -->
|
||||||
|
|
|
@ -560,52 +560,48 @@ const Status = {
|
||||||
},
|
},
|
||||||
'isSuspendable': function (val) {
|
'isSuspendable': function (val) {
|
||||||
this.suspendable = 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
|
export default Status
|
||||||
|
|
|
@ -32,22 +32,23 @@
|
||||||
>{{ $t("nav.public_tl") }}</span>
|
>{{ $t("nav.public_tl") }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="bubbleTimelineVisible">
|
<!-- no bubble timeline in mastoapi -->
|
||||||
<router-link
|
<!-- <li v-if="bubbleTimelineVisible"> -->
|
||||||
class="menu-item"
|
<!-- <router-link -->
|
||||||
:to="{ name: 'bubble-timeline' }"
|
<!-- class="menu-item" -->
|
||||||
>
|
<!-- :to="{ name: 'bubble-timeline' }" -->
|
||||||
<FAIcon
|
<!-- > -->
|
||||||
fixed-width
|
<!-- <FAIcon -->
|
||||||
class="fa-scale-110 fa-old-padding "
|
<!-- fixed-width -->
|
||||||
icon="circle"
|
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||||
/>
|
<!-- icon="circle" -->
|
||||||
<span
|
<!-- /> -->
|
||||||
:title="$t('nav.bubble_timeline_description')"
|
<!-- <span -->
|
||||||
:aria-label="$t('nav.bubble_timeline_description')"
|
<!-- :title="$t('nav.bubble_timeline_description')" -->
|
||||||
>{{ $t("nav.bubble_timeline") }}</span>
|
<!-- :aria-label="$t('nav.bubble_timeline_description')" -->
|
||||||
</router-link>
|
<!-- >{{ $t("nav.bubble_timeline") }}</span> -->
|
||||||
</li>
|
<!-- </router-link> -->
|
||||||
|
<!-- </li> -->
|
||||||
<li v-if="federatedTimelineVisible">
|
<li v-if="federatedTimelineVisible">
|
||||||
<router-link
|
<router-link
|
||||||
class="menu-item"
|
class="menu-item"
|
||||||
|
@ -64,38 +65,38 @@
|
||||||
>{{ $t("nav.twkn") }}</span>
|
>{{ $t("nav.twkn") }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="currentUser">
|
<!-- <li v-if="currentUser"> -->
|
||||||
<router-link
|
<!-- <router-link -->
|
||||||
class="menu-item"
|
<!-- class="menu-item" -->
|
||||||
:to="{ name: 'bookmarks'}"
|
<!-- :to="{ name: 'bookmarks'}" -->
|
||||||
>
|
<!-- > -->
|
||||||
<FAIcon
|
<!-- <FAIcon -->
|
||||||
fixed-width
|
<!-- fixed-width -->
|
||||||
class="fa-scale-110 fa-old-padding "
|
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||||
icon="bookmark"
|
<!-- icon="bookmark" -->
|
||||||
/>
|
<!-- /> -->
|
||||||
<span
|
<!-- <span -->
|
||||||
:title="$t('nav.bookmarks')"
|
<!-- :title="$t('nav.bookmarks')" -->
|
||||||
:aria-label="$t('nav.bookmarks')"
|
<!-- :aria-label="$t('nav.bookmarks')" -->
|
||||||
>{{ $t("nav.bookmarks") }}</span>
|
<!-- >{{ $t("nav.bookmarks") }}</span> -->
|
||||||
</router-link>
|
<!-- </router-link> -->
|
||||||
</li>
|
<!-- </li> -->
|
||||||
<li v-if="currentUser">
|
<!-- <li v-if="currentUser"> -->
|
||||||
<router-link
|
<!-- <router-link -->
|
||||||
class="menu-item"
|
<!-- class="menu-item" -->
|
||||||
:to="{ name: 'dms', params: { username: currentUser.screen_name } }"
|
<!-- :to="{ name: 'dms', params: { username: currentUser.screen_name } }" -->
|
||||||
>
|
<!-- > -->
|
||||||
<FAIcon
|
<!-- <FAIcon -->
|
||||||
fixed-width
|
<!-- fixed-width -->
|
||||||
class="fa-scale-110 fa-old-padding "
|
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||||
icon="envelope"
|
<!-- icon="envelope" -->
|
||||||
/>
|
<!-- /> -->
|
||||||
<span
|
<!-- <span -->
|
||||||
:title="$t('nav.dms')"
|
<!-- :title="$t('nav.dms')" -->
|
||||||
:aria-label="$t('nav.dms')"
|
<!-- :aria-label="$t('nav.dms')" -->
|
||||||
>{{ $t("nav.dms") }}</span>
|
<!-- >{{ $t("nav.dms") }}</span> -->
|
||||||
</router-link>
|
<!-- </router-link> -->
|
||||||
</li>
|
<!-- </li> -->
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -81,20 +81,20 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="currentUser">
|
<li v-if="currentUser">
|
||||||
<router-link
|
<!-- <router-link -->
|
||||||
class="menu-item"
|
<!-- class="menu-item" -->
|
||||||
:to="{ name: 'bookmarks'}"
|
<!-- :to="{ name: 'bookmarks'}" -->
|
||||||
>
|
<!-- > -->
|
||||||
<FAIcon
|
<!-- <FAIcon -->
|
||||||
fixed-width
|
<!-- fixed-width -->
|
||||||
class="fa-scale-110 fa-old-padding "
|
<!-- class="fa-scale-110 fa-old-padding " -->
|
||||||
icon="bookmark"
|
<!-- icon="bookmark" -->
|
||||||
/>
|
<!-- /> -->
|
||||||
<span
|
<!-- <span -->
|
||||||
:title="$t('nav.bookmarks')"
|
<!-- :title="$t('nav.bookmarks')" -->
|
||||||
:aria-label="$t('nav.bookmarks')"
|
<!-- :aria-label="$t('nav.bookmarks')" -->
|
||||||
>{{ $t("nav.bookmarks") }}</span>
|
<!-- >{{ $t("nav.bookmarks") }}</span> -->
|
||||||
</router-link>
|
<!-- </router-link> -->
|
||||||
</li>
|
</li>
|
||||||
<li v-if="currentUser">
|
<li v-if="currentUser">
|
||||||
<router-link
|
<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_FOLLOW_REQUESTS_URL = '/api/v1/follow_requests'
|
||||||
const MASTODON_APPROVE_USER_URL = id => `/api/v1/follow_requests/${id}/authorize`
|
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_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_PUBLIC_TIMELINE = '/api/v1/timelines/public'
|
||||||
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
|
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_URL = id => `/api/v1/statuses/${id}`
|
||||||
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
|
const MASTODON_STATUS_CONTEXT_URL = id => `/api/v1/statuses/${id}/context`
|
||||||
const MASTODON_STATUS_SOURCE_URL = id => `/api/v1/statuses/${id}/source`
|
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.type = data.reblog ? 'retweet' : 'status'
|
||||||
output.nsfw = data.sensitive
|
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.emojis = data.emojis
|
||||||
|
|
||||||
output.tags = data.tags
|
output.tags = data.tags
|
||||||
|
@ -411,6 +418,17 @@ export const parseStatus = (data_in) => {
|
||||||
if (data.hasOwnProperty('originalStatus')) {
|
if (data.hasOwnProperty('originalStatus')) {
|
||||||
Object.assign(output, data.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
|
return output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue