Merge branch 'setttingssync' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-03-13 12:01:29 +02:00
commit ca4604602d
7 changed files with 220 additions and 45 deletions

View file

@ -11,7 +11,7 @@ import { faTimes } from '@fortawesome/free-solid-svg-icons'
library.add(faTimes)
export const CURRENT_UPDATE_COUNTER = 1
export const CURRENT_UPDATE_COUNTER = 2
const pleromaTan = '/static/pleromatan_apology.png'
const pleromaTanFox = '/static/pleromatan_apology_fox.png'

View file

@ -6,6 +6,7 @@
--__top-fringe: 15em; // how much pleroma-tan should stick her head above
--__bottom-fringe: 80em; // just reserving as much as we can, number is mostly irrelevant
--__right-fringe: 8em;
--__panel-background: rgb(0,255,255 / 80%);
font-size: 15px;
position: relative;
@ -18,6 +19,29 @@
padding-left: 1em;
}
.footer-buttons {
--panel-heading-height-padding: calc(var(--panel-header-height) * 0.2);
--__panel-heading-gap: calc(var(--panel-header-height) * 0.1565);
--__panel-heading-height: var(--panel-header-height);
--__panel-heading-height-inner: calc(var(--__panel-heading-height) - 2 * var(--panel-heading-height-padding, 0));
box-sizing: border-box;
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: grid;
z-index: 20;
grid-auto-flow: column;
grid-template-columns: auto;
grid-auto-columns: auto;
grid-column-gap: var(--__panel-heading-gap);
padding: var(--panel-heading-height-padding);
height: var(--__panel-heading-height);
line-height: var(--__panel-heading-height-inner);
font-size: calc(var(--panelHeaderSize) / 3.2);
}
@media all and (width <= 800px) {
/* For mobile, the modal takes 100% of the available screen.
This ensures the minimized modal is always 50px above the browser
@ -50,10 +74,13 @@
}
.panel-footer {
z-index: 22;
z-index: 10;
position: relative;
border-width: 0;
grid-template-columns: auto;
.button-default {
z-index: 2;
}
}
.pleroma-tan {
@ -76,7 +103,7 @@
}
.spacer-bottom {
min-height: var(--__bottom-fringe);
min-height: calc(var(--__bottom-fringe) + var(--panel-header-height));
}
.extra-info-group {

View file

@ -27,7 +27,7 @@
<div class="spacer-top" />
<div class="text">
<p>
{{ $t('update.big_update_content') }}
{{ $t('update.big_update_content2') }}
</p>
<div
ref="animatedText"
@ -35,14 +35,14 @@
>
<i18n-t
scope="global"
keypath="update.update_bugs"
keypath="update.update_bugs2"
tag="p"
>
<template #pleromaGitlab>
<template #pleromaForgejo>
<a
target="_blank"
href="https://git.pleroma.social/"
>{{ $t('update.update_bugs_gitlab') }}</a>
>{{ $t('update.update_bugs_forgejo') }}</a>
</template>
</i18n-t>
<i18n-t
@ -73,30 +73,30 @@
</p>
</div>
</div>
<div class="footer-buttons">
<button
class="button-default"
@click.prevent="neverShowAgain"
>
{{ $t("general.never_show_again") }}
</button>
<button
v-if="!showingMore"
class="button-default"
@click.prevent="toggleShow"
>
{{ $t("general.show_more") }}
</button>
<button
class="button-default"
@click.prevent="dismiss"
>
{{ $t("general.dismiss") }}
</button>
</div>
<div class="spacer-bottom" />
</div>
</div>
<div class="panel-footer">
<button
class="button-default"
@click.prevent="neverShowAgain"
>
{{ $t("general.never_show_again") }}
</button>
<button
v-if="!showingMore"
class="button-default"
@click.prevent="toggleShow"
>
{{ $t("general.show_more") }}
</button>
<button
class="button-default"
@click.prevent="dismiss"
>
{{ $t("general.dismiss") }}
</button>
</div>
</div>
</Modal>
</template>

View file

@ -1857,8 +1857,11 @@
"update": {
"big_update_title": "Please bear with us",
"big_update_content": "We haven't had a release in a while, so things might look and feel different than what you're used to.",
"update_bugs": "Please report any issues and bugs on {pleromaGitlab}, as we have changed a lot, and although we test thoroughly and use development versions ourselves, we may have missed some things. We welcome your feedback and suggestions on issues you might encounter, or how to improve Pleroma and Pleroma-FE.",
"big_update_content2": "We implemented synchronized settings! This means (nearly) all your settings are now properly synchronized between devices and sessions. We try to migrate settings from old config but migration is performed only once, so some settings might be incorrect.",
"update_bugs": "Please report any issues and bugs on {pleromaForgejo}, as we have changed a lot, and although we test thoroughly and use development versions ourselves, we may have missed some things. We welcome your feedback and suggestions on issues you might encounter, or how to improve Pleroma and Pleroma-FE.",
"update_bugs2": "Let us know if you don't want certain setting synchronized on {pleromaForgejo}.",
"update_bugs_gitlab": "Pleroma GitLab",
"update_bugs_forgejo": "Pleroma Forgejo",
"update_changelog": "For more details on what's changed, see {theFullChangelog}.",
"update_changelog_here": "the full changelog",
"art_by": "Art by {linkToArtist}"

View file

@ -0,0 +1,129 @@
// this is a snapshot of config keys used prior to sync config.
// used to migrate from old config.
export const defaultStateKeys = [
'expertLevel',
'hideISP',
'hideInstanceWallpaper',
'hideShoutbox',
'hideMutedPosts',
'hideMutedThreads',
'hideWordFilteredPosts',
'muteBotStatuses',
'muteSensitiveStatuses',
'collapseMessageWithSubject',
'padEmoji',
'hideAttachments',
'hideAttachmentsInConv',
'hideScrobbles',
'hideScrobblesAfter',
'maxThumbnails',
'hideNsfw',
'preloadImage',
'loopVideo',
'loopVideoSilentOnly',
'streaming',
'emojiReactionsOnTimeline',
'alwaysShowNewPostButton',
'autohideFloatingPostButton',
'pauseOnUnfocused',
'stopGifs',
'replyVisibility',
'thirdColumnMode',
'notificationVisibility',
'notificationNative',
'webPushNotifications',
'webPushAlwaysShowNotifications',
'interfaceLanguage',
'hideScopeNotice',
'useStreamingApi',
'sidebarRight',
'scopeCopy',
'subjectLineBehavior',
'alwaysShowSubjectInput',
'postContentType',
'minimalScopesMode',
'hideFilteredStatuses',
'modalOnRepeat',
'modalOnUnfollow',
'modalOnBlock',
'modalOnMute',
'modalOnMuteConversation',
'modalOnMuteDomain',
'modalOnDelete',
'modalOnLogout',
'modalOnApproveFollow',
'modalOnDenyFollow',
'modalOnRemoveUserFromFollowers',
'onMuteDefaultAction',
'onBlockDefaultAction',
'modalMobileCenter',
'playVideosInModal',
'useOneClickNsfw',
'useContainFit',
'disableStickyHeaders',
'showScrollbars',
'userPopoverAvatarAction',
'userPopoverOverlay',
'userCardLeftJustify',
'userCardHidePersonalMarks',
'sidebarColumnWidth',
'contentColumnWidth',
'notifsColumnWidth',
'themeEditorMinWidth',
'emojiReactionsScale',
'textSize',
'emojiSize',
'navbarSize',
'panelHeaderSize',
'forcedRoundness',
'navbarColumnStretch',
'greentext',
'mentionLinkDisplay',
'mentionLinkShowTooltip',
'mentionLinkShowAvatar',
'mentionLinkFadeDomain',
'mentionLinkShowYous',
'mentionLinkBoldenYou',
'hidePostStats',
'hideBotIndication',
'hideUserStats',
'virtualScrolling',
'sensitiveByDefault',
'conversationDisplay',
'conversationTreeAdvanced',
'conversationOtherRepliesButton',
'conversationTreeFadeAncestors',
'showExtraNotifications',
'showExtraNotificationsTip',
'showChatsInExtraNotifications',
'showAnnouncementsInExtraNotifications',
'showFollowRequestsInExtraNotifications',
'maxDepthInThread',
'autocompleteSelect',
'closingDrawerMarksAsSeen',
'unseenAtTop',
'ignoreInactionableSeen',
'unsavedPostAction',
'autoSaveDraft',
'useAbsoluteTimeFormat',
'absoluteTimeFormatMinAge',
'absoluteTime12h',
'imageCompression',
'alwaysUseJpeg',
'theme',
'colors',
'customTheme',
'customThemeSource',
'style',
'styleCustomData',
'palette',
'paletteCustomData',
'themeDebug',
'forceThemeRecompilation',
'theme3hacks',
// 'muteWords', // mutes migrated separately
// 'highlight', // highlight migration is done separately
]

View file

@ -20,7 +20,9 @@ import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/updat
import { useInstanceStore } from 'src/stores/instance.js'
import { useLocalConfigStore } from 'src/stores/local_config.js'
import { defaultState as configDefaultState } from 'src/modules/default_config_state'
import { defaultState as configDefaultState } from 'src/modules/default_config_state.js'
import { defaultStateKeys } from 'src/modules/old_default_config_state.js'
import { storage } from 'src/lib/storage.js'
export const VERSION = 2
export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically
@ -411,16 +413,21 @@ export const _resetPrefs = (
return totalPrefs
}
export const _doMigrations = (cache, live) => {
const data = cache ?? live
export const _doMigrations = async (data) => {
console.log('TEST', data._version)
if (data._version < VERSION) {
console.debug(
'Data has older version, seeing if there any migrations that can be applied',
)
// no migrations right now since we only have one version
console.debug('No migrations found')
if (data._version === 1) {
// Migrate old config to sync config
const vuexState = await storage.getItem('vuex-lz')
defaultStateKeys.forEach(key => {
this.setPreference({ path: `simple.${key}`, value: vuexState.config[key] })
})
}
}
if (data._version > VERSION) {
@ -442,7 +449,7 @@ export const _doMigrations = (cache, live) => {
}
}
return cache
return data
}
export const useSyncConfigStore = defineStore('sync_config', {
@ -602,8 +609,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
})
this.flagStorage.reset = COMMAND_WIPE_JOURNAL_AND_STORAGE
},
initSyncConfig(userData) {
console.log(userData)
async initSyncConfig(userData) {
const live = userData.storage
this.raw = live
let cache = this.cache
@ -630,8 +636,8 @@ export const useSyncConfigStore = defineStore('sync_config', {
})
}
recent = recent && _doMigrations(recent)
stale = stale && _doMigrations(stale)
recent = recent && await _doMigrations(recent)
stale = stale && await _doMigrations(stale)
if (!needUpload && recent && stale) {
console.debug('Checking if data needs merging...')
@ -671,6 +677,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
}
this.flagStorage = this.cache.flagStorage
this.prefsStorage = this.cache.prefsStorage
this.pushSyncConfig()
},
pushSyncConfig({ force = false } = {}) {
const needPush = this.dirty || force

View file

@ -12,6 +12,7 @@ import {
} from 'lodash'
import { defineStore } from 'pinia'
import { toRaw } from 'vue'
import { storage } from 'src/lib/storage.js'
import { defaultState as configDefaultState } from 'src/modules/default_config_state'
@ -169,7 +170,6 @@ export const _mergePrefs = (recent, stale) => {
`journal contains entry to edit internal (starts with _) field '${user}', something is incorrect here, ignoring.`,
)
}
console.log(resultOutput)
switch (operation) {
case 'set':
resultOutput.highlight[user] = args[0]
@ -180,7 +180,6 @@ export const _mergePrefs = (recent, stale) => {
default:
return console.error(`Unknown journal operation: '${operation}'`)
}
console.log(resultOutput)
})
return { ...resultOutput, _journal: totalJournal }
}
@ -219,9 +218,7 @@ export const useUserHighlightStore = defineStore('user_highlight', {
...oldValue,
...value,
}
console.log(oldValue, newValue, value)
this.highlight[user] = newValue
console.log(this.highlight)
this.highlight._journal = [
...this.highlight._journal,
{ operation: 'set', user, args: [newValue], timestamp: Date.now() },
@ -262,7 +259,7 @@ export const useUserHighlightStore = defineStore('user_highlight', {
this.raw.highlight._journal = []
this.pushSyncConfig()
},
initUserHighlight(userData) {
async initUserHighlight(userData) {
const live = userData.user_highlight
this.raw = live
let cache = this.cache
@ -275,6 +272,18 @@ export const useUserHighlightStore = defineStore('user_highlight', {
let { recent, stale, needUpload } = _getRecentData(cache, live)
const vuexState = await storage.getItem('vuex-lz')
const { highlight } = vuexState.config
Object.entries(highlight).forEach(([user, value]) => {
if ((highlight[user]._migrated || 0) < 1) {
vuexState.config.highlight[user]._migrated = 1
this.set({ user, value })
console.log(user, value, this.highlight[user])
}
})
storage.setItem('vuex-lz', vuexState)
this.pushHighlight()
const userNew = userData.created_at > NEW_USER_DATE
let dirty = false