Merge branch 'develop' into setttingssync

This commit is contained in:
Henry Jameson 2026-02-12 17:16:18 +02:00
commit 3530830b07
134 changed files with 1411 additions and 1299 deletions

View file

@ -15,6 +15,9 @@ const defaultState = {
emoji: {},
emojiFetched: false,
unicodeEmojiAnnotations: {},
// Stickers
stickers: null,
}
const SORTED_EMOJI_GROUP_IDS = [
@ -128,6 +131,9 @@ export const useEmojiStore = defineStore('emoji', {
},
},
actions: {
setStickers(stickers) {
this.stickers = stickers
},
async getStaticEmoji() {
try {
// See build/emojis_plugin for more details

View file

@ -20,7 +20,7 @@ const defaultState = {
registrationOpen: true,
server: 'http://localhost:4040/',
textlimit: 5000,
private: false,
privateMode: false,
federating: true,
federationPolicy: null,
themesIndex: null,
@ -69,35 +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
},
// Html stuff
instanceSpecificPanelContent: '',
tos: '',
// Version Information
backendVersion: '',
backendRepository: '',
@ -115,36 +86,17 @@ export const useInstanceStore = defineStore('instance', {
instanceDomain(state) {
return new URL(this.server).hostname
},
remoteInteractionLink(state) {
const server = this.server.endsWith('/')
? this.server.slice(0, -1)
: this.server
const link = server + REMOTE_INTERACTION_URL
return ({ statusId, nickname }) => {
if (statusId) {
return `${link}?status_id=${statusId}`
} else {
return `${link}?nickname=${nickname}`
}
}
},
},
actions: {
set({ path, value }) {
if (get(defaultState, path) === undefined)
console.error(`Unknown instance option ${path}, value: ${value}`)
set(this, path, value)
switch (name) {
case 'name':
useInterfaceStore().setPageTitle()
break
case 'shoutAvailable':
if (value) {
window.vuex.dispatch('initializeSocket')
}
break
}
set({ path, name, value }) {
if (get(defaultState, path ?? name) === undefined)
console.error(
`Unknown instance option ${path ?? name}, value: ${value}`,
)
set(this, path ?? name, value)
if ((path ?? name) === 'name') useInterfaceStore().setPageTitle()
},
async getKnownDomains() {
try {
@ -155,5 +107,17 @@ export const useInstanceStore = defineStore('instance', {
console.warn("Can't load known domains\n", e)
}
},
getRemoteInteractionLink({ statusId, nickname }) {
const server = this.server.endsWith('/')
? this.server.slice(0, -1)
: this.server
const link = server + REMOTE_INTERACTION_URL
if (statusId) {
return `${link}?status_id=${statusId}`
} else {
return `${link}?nickname=${nickname}`
}
},
},
})

View file

@ -0,0 +1,48 @@
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
scrobblesSupport: false,
}
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')
}
},
},
},
)

View file

@ -8,7 +8,6 @@ import {
import { deserialize } from '../services/theme_data/iss_deserializer.js'
import { useInstanceStore } from 'src/stores/instance.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
import {
CURRENT_VERSION,
@ -66,7 +65,7 @@ export const useInterfaceStore = defineStore('interface', {
this.temporaryChangesConfirm = confirm
this.temporaryChangesRevert = revert
const countdownFunc = () => {
if (this.temporaryChangesCountdown <= 1) {
if (this.temporaryChangesCountdown === 1) {
this.temporaryChangesRevert()
this.clearTemporaryChanges()
} else {
@ -186,7 +185,7 @@ export const useInterfaceStore = defineStore('interface', {
const mobileLayout = width <= 800
const normalOrMobile = mobileLayout ? 'mobile' : 'normal'
const { thirdColumnMode } = useSyncConfigStore().mergedConfig
const { thirdColumnMode } = window.vuex.getters.mergedConfig
if (thirdColumnMode === 'none' || !window.vuex.state.users.currentUser) {
this.layoutType = normalOrMobile
} else {
@ -226,14 +225,14 @@ export const useInterfaceStore = defineStore('interface', {
try {
const value = await getResourcesIndex('/static/palettes/index.json')
useInstanceStore().set({
path: 'palettesIndex',
name: 'palettesIndex',
value,
})
return value
} catch (e) {
console.error('Could not fetch palettes index', e)
useInstanceStore().set({
path: 'palettesIndex',
name: 'palettesIndex',
value: { _error: e },
})
return Promise.resolve({})
@ -243,8 +242,7 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
useSyncConfigStore().setPreference({ path: 'simple.palette', value })
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'palette', value })
this.applyTheme({ recompile: true })
},
@ -252,11 +250,7 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
useSyncConfigStore().setPreference({
path: 'simple.paletteCustomData',
value,
})
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'paletteCustomData', value })
this.applyTheme({ recompile: true })
},
@ -266,12 +260,12 @@ export const useInterfaceStore = defineStore('interface', {
'/static/styles/index.json',
deserialize,
)
useInstanceStore().set({ path: 'stylesIndex', value })
useInstanceStore().set({ name: 'stylesIndex', value })
return value
} catch (e) {
console.error('Could not fetch styles index', e)
useInstanceStore().set({
path: 'stylesIndex',
name: 'stylesIndex',
value: { _error: e },
})
return Promise.resolve({})
@ -282,8 +276,7 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV2()
this.resetThemeV3Palette()
useSyncConfigStore().setPreference({ path: 'simple.style', value })
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'style', value })
this.useStylePalette = true
this.applyTheme({ recompile: true }).then(() => {
@ -295,11 +288,7 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV2()
this.resetThemeV3Palette()
useSyncConfigStore().setPreference({
path: 'simple.styleCustomData',
value,
})
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'styleCustomData', value })
this.useStylePalette = true
this.applyTheme({ recompile: true }).then(() => {
@ -309,12 +298,12 @@ export const useInterfaceStore = defineStore('interface', {
async fetchThemesIndex() {
try {
const value = await getResourcesIndex('/static/styles.json')
useInstanceStore().set({ path: 'themesIndex', value })
useInstanceStore().set({ name: 'themesIndex', value })
return value
} catch (e) {
console.error('Could not fetch themes index', e)
useInstanceStore().set({
path: 'themesIndex',
name: 'themesIndex',
value: { _error: e },
})
return Promise.resolve({})
@ -325,8 +314,7 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
useSyncConfigStore().setPreference({ path: 'simple.theme', value })
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'theme', value })
this.applyTheme({ recompile: true })
},
@ -335,45 +323,29 @@ export const useInterfaceStore = defineStore('interface', {
this.resetThemeV3Palette()
this.resetThemeV2()
useSyncConfigStore().setPreference({ path: 'simple.customTheme', value })
useSyncConfigStore().setPreference({
path: 'simple.customThemeSource',
value,
})
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'customTheme', value })
window.vuex.commit('setOption', { name: 'customThemeSource', value })
this.applyTheme({ recompile: true })
},
resetThemeV3() {
useSyncConfigStore().setPreference({ path: 'simple.style', value: null })
useSyncConfigStore().setPreference({
path: 'simple.styleCustomData',
value: null,
})
useSyncConfigStore().pushSyncConfig()
window.vuex.commit('setOption', { name: 'style', value: null })
window.vuex.commit('setOption', { name: 'styleCustomData', value: null })
},
resetThemeV3Palette() {
useSyncConfigStore().setPreference({
path: 'simple.palette',
window.vuex.commit('setOption', { name: 'palette', value: null })
window.vuex.commit('setOption', {
name: 'paletteCustomData',
value: null,
})
useSyncConfigStore().setPreference({
path: 'simple.paletteCustomData',
value: null,
})
useSyncConfigStore().pushSyncConfig()
},
resetThemeV2() {
useSyncConfigStore().setPreference({ path: 'simple.theme', value: null })
useSyncConfigStore().setPreference({
path: 'simple.customTheme',
window.vuex.commit('setOption', { name: 'theme', value: null })
window.vuex.commit('setOption', { name: 'customTheme', value: null })
window.vuex.commit('setOption', {
name: 'customThemeSource',
value: null,
})
useSyncConfigStore().setPreference({
path: 'simple.customThemeSource',
value: null,
})
useSyncConfigStore().pushSyncConfig()
},
async getThemeData() {
const getData = async (resource, index, customData, name) => {
@ -430,13 +402,13 @@ export const useInterfaceStore = defineStore('interface', {
styleCustomData: userStyleCustomData,
palette: userPaletteName,
paletteCustomData: userPaletteCustomData,
} = useSyncConfigStore().mergedConfig
} = window.vuex.state.config
let {
theme: userThemeV2Name,
customTheme: userThemeV2Snapshot,
customThemeSource: userThemeV2Source,
} = useSyncConfigStore().mergedConfig
} = window.vuex.state.config
let majorVersionUsed
@ -539,11 +511,10 @@ export const useInterfaceStore = defineStore('interface', {
)
if (this.useStylePalette) {
useSyncConfigStore().setPreference({
path: 'path.palette',
window.vuex.commit('setOption', {
name: 'palette',
value: firstStylePaletteName,
})
useSyncConfigStore().pushSyncConfig()
}
this.paletteNameUsed = palette.nameUsed
@ -602,7 +573,7 @@ export const useInterfaceStore = defineStore('interface', {
},
async applyTheme({ recompile = false } = {}) {
const { forceThemeRecompilation, themeDebug, theme3hacks } =
useSyncConfigStore().mergedConfig
window.vuex.state.config
this.themeChangeInProgress = true
// If we're not forced to recompile try using
// cache (tryLoadCache return true if load successful)

View file

@ -44,6 +44,9 @@ export const useOAuthStore = defineStore('oauth', {
getToken() {
return this.userToken || this.appToken
},
getUserToken() {
return this.userToken
},
},
actions: {
setClientData({ clientId, clientSecret }) {
@ -80,6 +83,7 @@ export const useOAuthStore = defineStore('oauth', {
},
async getAppToken() {
const instance = useInstanceStore().server
console.log(this.clientId)
const res = await getClientToken({
clientId: this.clientId,
clientSecret: this.clientSecret,

View file

@ -1,7 +1,7 @@
import filter from 'lodash/filter'
import { defineStore } from 'pinia'
import { useInterfaceStore } from 'src/stores/interface'
import { useInterfaceStore } from 'src/stores/interface.js'
export const useReportsStore = defineStore('reports', {
state: () => ({