add Akkoma compatibility (tested on IceShrimp)
This commit is contained in:
parent
60e5c3b042
commit
f36f11045e
13 changed files with 28 additions and 12 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
|
||||||
<link rel="preload" href="/static/config.json" as="fetch" crossorigin />
|
<link rel="preload" href="/static/config.json" as="fetch" crossorigin />
|
||||||
<link rel="preload" href="/api/pleroma/frontend_configurations" as="fetch" crossorigin />
|
<link rel="preload" href="/api/pleroma/frontend_configurations" as="fetch" crossorigin />
|
||||||
|
<link rel="preload" href="/nodeinfo/2.0.json" as="fetch" crossorigin />
|
||||||
<link rel="preload" href="/nodeinfo/2.1.json" as="fetch" crossorigin />
|
<link rel="preload" href="/nodeinfo/2.1.json" as="fetch" crossorigin />
|
||||||
<link rel="preload" href="/api/v1/instance" as="fetch" crossorigin />
|
<link rel="preload" href="/api/v1/instance" as="fetch" crossorigin />
|
||||||
<link rel="preload" href="/static/pleromatan_apology_fox_small.webp" as="image" />
|
<link rel="preload" href="/static/pleromatan_apology_fox_small.webp" as="image" />
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,8 @@ const resolveStaffAccounts = ({ store, accounts }) => {
|
||||||
|
|
||||||
const getNodeInfo = async ({ store }) => {
|
const getNodeInfo = async ({ store }) => {
|
||||||
try {
|
try {
|
||||||
const res = await preloadFetch('/nodeinfo/2.1.json')
|
let res = await preloadFetch('/nodeinfo/2.1.json')
|
||||||
|
if (!res.ok) res = await preloadFetch('/nodeinfo/2.0.json')
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
const metadata = data.metadata
|
const metadata = data.metadata
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const Announcement = {
|
||||||
currentUser: state => state.users.currentUser
|
currentUser: state => state.users.currentUser
|
||||||
}),
|
}),
|
||||||
canEditAnnouncement () {
|
canEditAnnouncement () {
|
||||||
return this.currentUser && this.currentUser.privileges.includes('announcements_manage_announcements')
|
return this.currentUser && this.currentUser.privileges?.includes('announcements_manage_announcements')
|
||||||
},
|
},
|
||||||
content () {
|
content () {
|
||||||
return this.announcement.content
|
return this.announcement.content
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ const Interactions = {
|
||||||
return {
|
return {
|
||||||
allowFollowingMove: this.$store.state.users.currentUser.allow_following_move,
|
allowFollowingMove: this.$store.state.users.currentUser.allow_following_move,
|
||||||
filterMode: tabModeDict.mentions,
|
filterMode: tabModeDict.mentions,
|
||||||
canSeeReports: this.$store.state.users.currentUser.privileges.includes('reports_manage_reports')
|
canSeeReports: this.$store.state.users.currentUser.privileges?.includes('reports_manage_reports')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ const ModerationTools = {
|
||||||
return this.tagsSet.has(tagName)
|
return this.tagsSet.has(tagName)
|
||||||
},
|
},
|
||||||
privileged (privilege) {
|
privileged (privilege) {
|
||||||
return this.$store.state.users.currentUser.privileges.includes(privilege)
|
return this.$store.state.users.currentUser.privileges?.includes(privilege)
|
||||||
},
|
},
|
||||||
toggleTag (tag) {
|
toggleTag (tag) {
|
||||||
const store = this.$store
|
const store = this.$store
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ export const getListEntries = store => store.allLists.map(list => ({
|
||||||
iconLetter: list.title[0]
|
iconLetter: list.title[0]
|
||||||
}))
|
}))
|
||||||
|
|
||||||
export const getBookmarkFolderEntries = store => store.allFolders.map(folder => ({
|
export const getBookmarkFolderEntries = store => store.allFolders ? store.allFolders.map(folder => ({
|
||||||
name: 'bookmark-folder-' + folder.id,
|
name: 'bookmark-folder-' + folder.id,
|
||||||
routeObject: { name: 'bookmark-folder', params: { id: folder.id } },
|
routeObject: { name: 'bookmark-folder', params: { id: folder.id } },
|
||||||
labelRaw: folder.name,
|
labelRaw: folder.name,
|
||||||
iconEmoji: folder.emoji,
|
iconEmoji: folder.emoji,
|
||||||
iconEmojiUrl: folder.emoji_url,
|
iconEmojiUrl: folder.emoji_url,
|
||||||
iconLetter: folder.name[0]
|
iconLetter: folder.name[0]
|
||||||
}))
|
})) : []
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ const NotificationsTab = {
|
||||||
},
|
},
|
||||||
canReceiveReports () {
|
canReceiveReports () {
|
||||||
if (!this.user) { return false }
|
if (!this.user) { return false }
|
||||||
return this.user.privileges.includes('reports_manage_reports')
|
return this.user.privileges?.includes('reports_manage_reports')
|
||||||
},
|
},
|
||||||
...SharedComputedObject()
|
...SharedComputedObject()
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ export const BUTTONS = [{
|
||||||
if ({ status, loggedIn, currentUser }) {
|
if ({ status, loggedIn, currentUser }) {
|
||||||
return loggedIn && (
|
return loggedIn && (
|
||||||
status.user.id === currentUser.id ||
|
status.user.id === currentUser.id ||
|
||||||
currentUser.privileges.includes('messages_delete')
|
currentUser.privileges?.includes('messages_delete')
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
confirm: ({ getters }) => getters.mergedConfig.modalOnDelete,
|
confirm: ({ getters }) => getters.mergedConfig.modalOnDelete,
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,10 @@ export default {
|
||||||
},
|
},
|
||||||
showModerationMenu () {
|
showModerationMenu () {
|
||||||
const privileges = this.loggedIn.privileges
|
const privileges = this.loggedIn.privileges
|
||||||
return this.loggedIn.role === 'admin' || privileges.includes('users_manage_activation_state') || privileges.includes('users_delete') || privileges.includes('users_manage_tags')
|
return this.loggedIn.role === 'admin' ||
|
||||||
|
privileges?.includes('users_manage_activation_state') ||
|
||||||
|
privileges?.includes('users_delete')||
|
||||||
|
privileges?.includes('users_manage_tags')
|
||||||
},
|
},
|
||||||
hasNote () {
|
hasNote () {
|
||||||
return this.relationship.note
|
return this.relationship.note
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ const api = {
|
||||||
// Bookmark folders
|
// Bookmark folders
|
||||||
startFetchingBookmarkFolders (store) {
|
startFetchingBookmarkFolders (store) {
|
||||||
if (store.state.fetchers.bookmarkFolders) return
|
if (store.state.fetchers.bookmarkFolders) return
|
||||||
|
if (!store.rootState.instance.pleromaBookmarkFoldersAvailable) return
|
||||||
const fetcher = store.state.backendInteractor.startFetchingBookmarkFolders({ store })
|
const fetcher = store.state.backendInteractor.startFetchingBookmarkFolders({ store })
|
||||||
store.commit('addFetcher', { fetcherName: 'bookmarkFolders', fetcher })
|
store.commit('addFetcher', { fetcherName: 'bookmarkFolders', fetcher })
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export const defaultState = () => ({
|
||||||
allStatusesObject: {},
|
allStatusesObject: {},
|
||||||
conversationsObject: {},
|
conversationsObject: {},
|
||||||
maxId: 0,
|
maxId: 0,
|
||||||
|
scrobblesUnsupported: false,
|
||||||
favorites: new Set(),
|
favorites: new Set(),
|
||||||
timelines: {
|
timelines: {
|
||||||
mentions: emptyTl(),
|
mentions: emptyTl(),
|
||||||
|
|
@ -112,8 +113,14 @@ const getLatestScrobble = (state, user) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.scrobblesUnsupported) return
|
||||||
|
|
||||||
state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000
|
state.scrobblesNextFetch[user.id] = Date.now() + 24 * 60 * 60 * 1000
|
||||||
apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => {
|
apiService.fetchScrobbles({ accountId: user.id }).then((scrobbles) => {
|
||||||
|
if (scrobbles?.error?.status === 501) {
|
||||||
|
state.scrobblesUnsupported = true
|
||||||
|
}
|
||||||
|
|
||||||
if (scrobbles.length > 0) {
|
if (scrobbles.length > 0) {
|
||||||
user.latestScrobble = scrobbles[0]
|
user.latestScrobble = scrobbles[0]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -599,6 +599,7 @@ const users = {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const commit = store.commit
|
const commit = store.commit
|
||||||
const dispatch = store.dispatch
|
const dispatch = store.dispatch
|
||||||
|
const rootState = store.rootState
|
||||||
commit('beginLogin')
|
commit('beginLogin')
|
||||||
store.rootState.api.backendInteractor.verifyCredentials(accessToken)
|
store.rootState.api.backendInteractor.verifyCredentials(accessToken)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|
@ -665,9 +666,11 @@ const users = {
|
||||||
// Start fetching notifications
|
// Start fetching notifications
|
||||||
dispatch('startFetchingNotifications')
|
dispatch('startFetchingNotifications')
|
||||||
|
|
||||||
|
if (rootState.instance.pleromaChatMessagesAvailable) {
|
||||||
// Start fetching chats
|
// Start fetching chats
|
||||||
dispatch('startFetchingChats')
|
dispatch('startFetchingChats')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dispatch('startFetchingLists')
|
dispatch('startFetchingLists')
|
||||||
dispatch('startFetchingBookmarkFolders')
|
dispatch('startFetchingBookmarkFolders')
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentUser = window.vuex.state.users.currentUser
|
const currentUser = window.vuex.state.users.currentUser
|
||||||
const isAdmin = currentUser && currentUser.privileges.includes('announcements_manage_announcements')
|
const isAdmin = currentUser && currentUser.privileges?.includes('announcements_manage_announcements')
|
||||||
|
|
||||||
const getAnnouncements = async () => {
|
const getAnnouncements = async () => {
|
||||||
if (!isAdmin) {
|
if (!isAdmin) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue