diff --git a/changelog.d/profilebg.add b/changelog.d/profilebg.add new file mode 100644 index 000000000..a2c79074a --- /dev/null +++ b/changelog.d/profilebg.add @@ -0,0 +1 @@ +displaying other user's backgrounds (if supported by BE) diff --git a/src/App.js b/src/App.js index e2f6c6454..ea2271a75 100644 --- a/src/App.js +++ b/src/App.js @@ -158,13 +158,23 @@ export default { userBackground() { return this.currentUser.background_image }, + foreignProfileBackground() { + return ( + useMergedConfigStore().mergedConfig.allowForeignUserBackground && + useInterfaceStore().foreignProfileBackground + ) + }, instanceBackground() { return useMergedConfigStore().mergedConfig.hideInstanceWallpaper ? null : this.instanceBackgroundUrl }, background() { - return this.userBackground || this.instanceBackground + return ( + this.foreignProfileBackground || + this.userBackground || + this.instanceBackground + ) }, bgStyle() { if (this.background) { diff --git a/src/App.scss b/src/App.scss index 56fef9d11..952af5b47 100644 --- a/src/App.scss +++ b/src/App.scss @@ -200,6 +200,7 @@ nav { background-color: var(--wallpaper); background-image: var(--body-background-image); background-position: 50%; + transition: background-image 1s; } .underlay { diff --git a/src/components/settings_modal/tabs/appearance_tab.vue b/src/components/settings_modal/tabs/appearance_tab.vue index f0ccf71f3..1343a36d5 100644 --- a/src/components/settings_modal/tabs/appearance_tab.vue +++ b/src/components/settings_modal/tabs/appearance_tab.vue @@ -263,6 +263,11 @@ {{ $t('settings.hide_wallpaper') }} +
  • + + {{ $t('settings.foreign_user_background') }} + +
  • {{ $t('settings.compact_profiles') }} diff --git a/src/components/status/status.js b/src/components/status/status.js index 8608969ea..acd25b512 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -262,7 +262,7 @@ const Status = { }, muteFilterHits() { return muteFilterHits( - Object.values(useSyncConfigStore().prefsStorage.simple.muteFilters), + Object.values(useSyncConfigStore().prefsStorage.simple.muteFilters || {}), this.status, ) }, diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 8995503fe..2c3878292 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -11,6 +11,7 @@ import withLoadMore from '../../hocs/with_load_more/with_load_more' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' +import { useInterfaceStore } from 'src/stores/interface.js' import { useMergedConfigStore } from 'src/stores/merged_config.js' import { library } from '@fortawesome/fontawesome-svg-core' @@ -55,9 +56,14 @@ const UserProfile = { const routeParams = this.$route.params this.load({ name: routeParams.name, id: routeParams.id }) this.tab = get(this.$route, 'query.tab', defaultTabKey) + useInterfaceStore().setForeignProfileBackground(this.user?.background_image) + }, + updated() { + useInterfaceStore().setForeignProfileBackground(this.user?.background_image) }, unmounted() { this.stopFetching() + useInterfaceStore().setForeignProfileBackground(null) }, computed: { timeline() { diff --git a/src/i18n/en.json b/src/i18n/en.json index 95f02507b..e03e21403 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -636,6 +636,7 @@ "navbar_column_stretch": "Stretch navbar to columns width", "always_show_post_button": "Always show floating New Post button", "hide_wallpaper": "Hide instance wallpaper", + "foreign_user_background": "Allow other user's profiles to override wallpaper", "preload_images": "Preload images", "use_one_click_nsfw": "Open NSFW attachments with just one click", "hide_post_stats": "Hide post statistics (e.g. the number of favorites)", diff --git a/src/modules/default_config_state.js b/src/modules/default_config_state.js index 233e15ca1..6a970ef0f 100644 --- a/src/modules/default_config_state.js +++ b/src/modules/default_config_state.js @@ -140,6 +140,10 @@ export const INSTANCE_DEFAULT_CONFIG_DEFINITIONS = { description: 'Hide Instance-specific panel', default: false, }, + allowForeignUserBackground: { + description: "Allow other user's profiles to override wallpaper", + default: true, + }, hideInstanceWallpaper: { description: 'Hide Instance default background', default: false, @@ -631,7 +635,7 @@ export const LOCAL_DEFAULT_CONFIG_DEFINITIONS = { }, imageCompression: { description: 'Image compression (WebP/JPEG)', - default: false, + default: true, }, alwaysUseJpeg: { description: 'Compress images using JPEG only', diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 30ff13c3f..1d90617fc 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -302,7 +302,8 @@ export const parseAttachment = (data) => { } if (data.type !== 'unknown') { - output.type = data.type + // treat gifv like it is "video" + output.type = data.type === 'gifv' ? 'video' : data.type } else { output.type = fileType(output.mimetype) } diff --git a/src/stores/interface.js b/src/stores/interface.js index 111700fbb..01ff07533 100644 --- a/src/stores/interface.js +++ b/src/stores/interface.js @@ -60,6 +60,7 @@ export const useInterfaceStore = defineStore('interface', { globalNotices: [], layoutHeight: 0, lastTimeline: null, + foreignProfileBackground: null, }), actions: { setTemporaryChanges({ confirm, revert }) { @@ -96,6 +97,9 @@ export const useInterfaceStore = defineStore('interface', { console.error(`${error}`) } }, + setForeignProfileBackground(url) { + this.foreignProfileBackground = url + }, settingsSaved({ success, error }) { if (success) { if (this.noticeClearTimeout) { diff --git a/src/stores/sync_config.js b/src/stores/sync_config.js index 1caa2b030..3010fc738 100644 --- a/src/stores/sync_config.js +++ b/src/stores/sync_config.js @@ -796,11 +796,12 @@ export const useSyncConfigStore = defineStore('sync_config', { afterLoad(state) { console.debug('Validating persisted state of SyncConfig') const newState = { ...state } + newState.prefsStorage = newState.prefsStorage || {} const newEntries = Object.entries(ROOT_CONFIG).map(([path, value]) => { const definition = ROOT_CONFIG_DEFINITIONS[path] const finalValue = validateSetting({ path, - value: newState.prefsStorage.simple[path], + value: newState.prefsStorage.simple?.[path], definition, throwError: false, validateObjects: false,