scuffed reaction emoji support and a lot of jank

This commit is contained in:
CoolElectronics 2024-06-11 16:57:23 -04:00
parent b07659f474
commit 8a17e3f95e
No known key found for this signature in database
GPG key ID: F63593D168636C50
7 changed files with 178 additions and 104 deletions

View file

@ -72,8 +72,10 @@ const getInstanceConfig = async ({ store }) => {
const data = await metares.json(); const data = await metares.json();
console.log(data)
store.dispatch('setInstanceOption', { name: 'iconUrl', value: data.iconUrl }); store.dispatch('setInstanceOption', { name: 'iconUrl', value: data.iconUrl });
store.dispatch('setInstanceOption', { name: 'logo', value: data.iconUrl });
store.dispatch('setInstanceOption', { name: 'ads', value: data.ads });
store.dispatch('setInstanceOption', { name: 'background', value: data.backgroundImageUrl });
} else { } else {
throw (metares) throw (metares)
} }
@ -86,6 +88,7 @@ const getInstanceConfig = async ({ store }) => {
// Get this from /api/meta // Get this from /api/meta
const vapidPublicKey = "" const vapidPublicKey = ""
store.dispatch('setInstanceOption', { name: 'textlimit', value: textlimit }) store.dispatch('setInstanceOption', { name: 'textlimit', value: textlimit })
store.dispatch('setInstanceOption', { name: 'accountApprovalRequired', value: data.approval_required }) store.dispatch('setInstanceOption', { name: 'accountApprovalRequired', value: data.approval_required })
// don't override cookie if set // don't override cookie if set
if (!Cookies.get('userLanguage')) { if (!Cookies.get('userLanguage')) {
@ -105,11 +108,45 @@ const getInstanceConfig = async ({ store }) => {
} }
const getBackendProvidedConfig = async ({ store }) => { const getBackendProvidedConfig = async ({ store }) => {
// get instance conf
try { try {
//const res = await window.fetch('/api/pleroma/frontend_configurations') console.log(store._state.data.instance)
// const res = await window.fetch('/api/meta')
if (true) { if (true) {
//const data = await res.json() //const data = await res.json()
const data = { "masto_fe": { "showInstanceSpecificPanel": true }, "pleroma_fe": { "alwaysShowSubjectInput": true, "background": "/images/city.jpg", "collapseMessageWithSubject": true, "conversationDisplay": "linear", "disableChat": false, "greentext": false, "hideFilteredStatuses": true, "hideMutedPosts": true, "hidePostStats": false, "hideSitename": false, "hideUserStats": false, "loginMethod": "token", "logo": "/static/logo.svg", "logoMargin": ".1em", "logoMask": true, "noAttachmentLinks": false, "nsfwCensorImage": "", "postContentType": "text/plain", "redirectRootLogin": "/main/friends", "redirectRootNoLogin": "/main/public", "renderMisskeyMarkdown": true, "scopeCopy": true, "showFeaturesPanel": true, "showInstanceSpecificPanel": false, "sidebarRight": false, "subjectLineBehavior": "email", "theme": "pleroma-dark", "webPushNotifications": false } } const data = {
"masto_fe": { "showInstanceSpecificPanel": true },
"pleroma_fe": {
"alwaysShowSubjectInput": true,
// "background": store._state.data.instance.backgroundUrl,
"collapseMessageWithSubject": true, "conversationDisplay": "linear",
"disableChat": false,
"greentext": false,
"hideFilteredStatuses": true,
"hideMutedPosts": true,
"hidePostStats": false,
"hideSitename": false,
"hideUserStats": false,
"loginMethod": "token",
"logo": undefined,
"logoMargin": ".1em",
"logoMask": false,
"noAttachmentLinks": false,
"nsfwCensorImage": "",
"postContentType": "text/plain",
"redirectRootLogin": "/main/friends",
"redirectRootNoLogin": "/main/public",
"renderMisskeyMarkdown": true,
"scopeCopy": true,
"showFeaturesPanel": true,
"showInstanceSpecificPanel": false,
"sidebarRight": false,
"subjectLineBehavior": "email",
"theme": "pleroma-dark",
"webPushNotifications": false
}
}
return data.pleroma_fe return data.pleroma_fe
} else { } else {
throw (res) throw (res)

View file

@ -76,6 +76,8 @@ export default {
} }
}, },
instanceFavicon(){ instanceFavicon(){
// TODO: hack hack hack bad
document.querySelector('link[rel="icon"]').href = this.$store.state.instance.iconUrl;
return this.$store.state.instance.iconUrl return this.$store.state.instance.iconUrl
}, },
logoBgStyle () { logoBgStyle () {

View file

@ -81,54 +81,55 @@
</router-link> </router-link>
</div> </div>
</div> </div>
<router-link <!-- this isn't broken it's just ugly as fuck -->
class="logo" <!-- <router-link -->
:to="{ name: 'root' }" <!-- class="logo" -->
:style="logoBgStyle" <!-- :to="{ name: 'root' }" -->
> <!-- :style="logoBgStyle" -->
<div <!-- > -->
class="mask" <!-- <div -->
:style="logoMaskStyle" <!-- class="mask" -->
/> <!-- :style="logoMaskStyle" -->
<img <!-- /> -->
:src="logo" <!-- <img -->
:style="logoStyle" <!-- :src="logo" -->
> <!-- :style="logoStyle" -->
</router-link> <!-- > -->
<!-- </router-link> -->
<div class="item right actions"> <div class="item right actions">
<search-bar <!-- <search-bar -->
v-if="currentUser || !privateMode" <!-- v-if="currentUser || !privateMode" -->
@toggled="onSearchBarToggled" <!-- @toggled="onSearchBarToggled" -->
@click.stop <!-- @click.stop -->
/> <!-- /> -->
<div <div
v-if="(currentUser || !privateMode) && showNavShortcuts" v-if="(currentUser || !privateMode) && showNavShortcuts"
class="nav-items right" class="nav-items right"
> >
<router-link <!-- <router-link -->
v-if="currentUser" <!-- v-if="currentUser" -->
class="nav-icon" <!-- class="nav-icon" -->
:to="{ name: 'interactions', params: { username: currentUser.screen_name } }" <!-- :to="{ name: 'interactions', 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="bolt" <!-- icon="bolt" -->
:title="$t('nav.interactions')" <!-- :title="$t('nav.interactions')" -->
/> <!-- /> -->
</router-link> <!-- </router-link> -->
<router-link <!-- <router-link -->
v-if="currentUser" <!-- v-if="currentUser" -->
:to="{ name: 'lists' }" <!-- :to="{ name: 'lists' }" -->
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="list" <!-- icon="list" -->
: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' }"

View file

@ -60,6 +60,7 @@ const EmojiReactions = {
} }
}, },
reactWith (emoji) { reactWith (emoji) {
console.log(this.status)
this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji })
const emojiObject = findEmojiByReplacement(this.$store.state, emoji) const emojiObject = findEmojiByReplacement(this.$store.state, emoji)
this.$store.commit('emojiUsed', emojiObject) this.$store.commit('emojiUsed', emojiObject)

View file

@ -25,30 +25,31 @@
<TimelineMenuContent class="timelines" /> <TimelineMenuContent class="timelines" />
</div> </div>
</li> </li>
<li v-if="currentUser"> <!-- disabled: lists don't work -->
<router-link <!-- <li v-if="currentUser"> -->
class="menu-item" <!-- <router-link -->
:to="{ name: 'lists' }" <!-- class="menu-item" -->
> <!-- :to="{ name: 'lists' }" -->
<FAIcon <!-- > -->
fixed-width <!-- <FAIcon -->
class="fa-scale-110" <!-- fixed-width -->
icon="list" <!-- class="fa-scale-110" -->
/>{{ $t("nav.lists") }} <!-- icon="list" -->
</router-link> <!-- />{{ $t("nav.lists") }} -->
</li> <!-- </router-link> -->
<li v-if="currentUser"> <!-- </li> -->
<router-link <!-- <li v-if="currentUser"> -->
class="menu-item" <!-- <router-link -->
:to="{ name: 'interactions', params: { username: currentUser.screen_name } }" <!-- class="menu-item" -->
> <!-- :to="{ name: 'interactions', params: { username: currentUser.screen_name } }" -->
<FAIcon <!-- > -->
fixed-width <!-- <FAIcon -->
class="fa-scale-110" <!-- fixed-width -->
icon="bolt" <!-- class="fa-scale-110" -->
/>{{ $t("nav.interactions") }} <!-- icon="bolt" -->
</router-link> <!-- />{{ $t("nav.interactions") }} -->
</li> <!-- </router-link> -->
<!-- </li> -->
<li v-if="currentUser && currentUser.locked"> <li v-if="currentUser && currentUser.locked">
<router-link <router-link
class="menu-item" class="menu-item"
@ -67,36 +68,36 @@
</span> </span>
</router-link> </router-link>
</li> </li>
<li> <!-- <li> -->
<router-link <!-- <router-link -->
class="menu-item" <!-- class="menu-item" -->
:to="{ name: 'about' }" <!-- :to="{ name: 'about' }" -->
> <!-- > -->
<FAIcon <!-- <FAIcon -->
fixed-width <!-- fixed-width -->
class="fa-scale-110" <!-- class="fa-scale-110" -->
icon="info-circle" <!-- icon="info-circle" -->
/>{{ $t("nav.about") }} <!-- />{{ $t("nav.about") }} -->
</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: 'announcements' }" <!-- :to="{ name: 'announcements' }" -->
> <!-- > -->
<FAIcon <!-- <FAIcon -->
fixed-width <!-- fixed-width -->
class="fa-scale-110" <!-- class="fa-scale-110" -->
icon="bullhorn" <!-- icon="bullhorn" -->
/>{{ $t('nav.announcements') }} <!-- />{{ $t('nav.announcements') }} -->
<span <!-- <span -->
v-if="unreadAnnouncementCount > 0" <!-- v-if="unreadAnnouncementCount > 0" -->
class="badge badge-notification" <!-- class="badge badge-notification" -->
> <!-- > -->
{{ unreadAnnouncementCount }} <!-- {{ unreadAnnouncementCount }} -->
</span> <!-- </span> -->
</router-link> <!-- </router-link> -->
</li> <!-- </li> -->
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -561,6 +561,38 @@ const Status = {
'isSuspendable': function (val) { 'isSuspendable': function (val) {
this.suspendable = val this.suspendable = val
} }
},
async mounted () {
if (this.status.refetched) return;
let data = await fetch("/api/notes/show", {
"headers": {
"Content-Type": "application/json",
},
"referrer": "https://grimgreenfo.rest/",
"body": JSON.stringify({ "noteId": this.status.id, i: "JEg68SCqcTaFpvF5" }),
"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;
}
}
}
} }
} }

View file

@ -310,10 +310,10 @@ const api = {
}, },
getSupportedTranslationlanguages (store) { getSupportedTranslationlanguages (store) {
store.state.backendInteractor.getSupportedTranslationlanguages({ store }) // store.state.backendInteractor.getSupportedTranslationlanguages({ store })
.then((data) => { // .then((data) => {
store.dispatch('setInstanceOption', { name: 'supportedTranslationLanguages', value: data }) // store.dispatch('setInstanceOption', { name: 'supportedTranslationLanguages', value: data })
}) // })
}, },
listSettingsProfiles (store) { listSettingsProfiles (store) {
// store.state.backendInteractor.listSettingsProfiles({ store }) // store.state.backendInteractor.listSettingsProfiles({ store })