separate featureset into instancecapabilites store
This commit is contained in:
parent
848d48e404
commit
1e93e0a9c3
40 changed files with 239 additions and 247 deletions
|
|
@ -69,31 +69,6 @@ const defaultState = {
|
|||
restrictedNicknames: [],
|
||||
localBubbleInstances: [], // Akkoma
|
||||
|
||||
// Feature-set, apparently, not everything here is reported...
|
||||
featureSet: {
|
||||
postFormats: [],
|
||||
mailerEnabled: false,
|
||||
safeDM: true,
|
||||
shoutAvailable: false,
|
||||
pleromaExtensionsAvailable: true,
|
||||
pleromaChatMessagesAvailable: false,
|
||||
pleromaCustomEmojiReactionsAvailable: false,
|
||||
pleromaBookmarkFoldersAvailable: false,
|
||||
pleromaPublicFavouritesAvailable: true,
|
||||
statusNotificationTypeAvailable: true,
|
||||
gopherAvailable: false,
|
||||
editingAvailable: false,
|
||||
mediaProxyAvailable: false,
|
||||
suggestionsEnabled: false,
|
||||
suggestionsWeb: '',
|
||||
quotingAvailable: false,
|
||||
groupActorAvailable: false,
|
||||
blockExpiration: false,
|
||||
tagPolicyAvailable: false,
|
||||
pollsAvailable: false,
|
||||
localBubble: false, // Akkoma
|
||||
},
|
||||
|
||||
// Version Information
|
||||
backendVersion: '',
|
||||
backendRepository: '',
|
||||
|
|
@ -118,17 +93,10 @@ export const useInstanceStore = defineStore('instance', {
|
|||
console.error(
|
||||
`Unknown instance option ${path ?? name}, value: ${value}`,
|
||||
)
|
||||
|
||||
set(this, path ?? name, value)
|
||||
switch (name) {
|
||||
case 'name':
|
||||
useInterfaceStore().setPageTitle()
|
||||
break
|
||||
case 'shoutAvailable':
|
||||
if (value) {
|
||||
window.vuex.dispatch('initializeSocket')
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if ((path ?? name) === 'name') useInterfaceStore().setPageTitle()
|
||||
},
|
||||
async getKnownDomains() {
|
||||
try {
|
||||
|
|
|
|||
47
src/stores/instance_capabilities.js
Normal file
47
src/stores/instance_capabilities.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
const defaultState = {
|
||||
postFormats: [],
|
||||
mailerEnabled: false,
|
||||
safeDM: true,
|
||||
shoutAvailable: false,
|
||||
pleromaExtensionsAvailable: true,
|
||||
pleromaChatMessagesAvailable: false,
|
||||
pleromaCustomEmojiReactionsAvailable: false,
|
||||
pleromaBookmarkFoldersAvailable: false,
|
||||
pleromaPublicFavouritesAvailable: true,
|
||||
statusNotificationTypeAvailable: true,
|
||||
gopherAvailable: false,
|
||||
editingAvailable: false,
|
||||
mediaProxyAvailable: false,
|
||||
suggestionsEnabled: false,
|
||||
suggestionsWeb: '',
|
||||
quotingAvailable: false,
|
||||
groupActorAvailable: false,
|
||||
blockExpiration: false,
|
||||
tagPolicyAvailable: false,
|
||||
pollsAvailable: false,
|
||||
localBubble: false, // Akkoma
|
||||
}
|
||||
|
||||
export const useInstanceCapabilitiesStore = defineStore(
|
||||
'instance-capabilities',
|
||||
{
|
||||
state: () => ({ ...defaultState }),
|
||||
actions: {
|
||||
set(capability, value) {
|
||||
if (!Object.hasOwn(defaultState, capability)) {
|
||||
console.error(
|
||||
`Unknown instance capability ${capability}, value: ${value}`,
|
||||
)
|
||||
}
|
||||
|
||||
this[capability] = value
|
||||
|
||||
if (capability === 'shoutAvailable') {
|
||||
window.vuex.dispatch('initializeSocket')
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue