From 20ccd93a176f911a43b3db3d595f3fdb3491934f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Fri, 8 Nov 2019 23:21:07 -0600 Subject: about: add staff panel --- src/boot/after_store.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 80a55849..e96baaf0 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -184,6 +184,20 @@ const getAppSecret = async ({ store }) => { }) } +const resolveStaffAccounts = async ({ store, accounts }) => { + let nicknames = accounts.map(uri => uri.split('/').pop()) + const backendInteractor = store.state.api.backendInteractor + + nicknames = nicknames.map(id => { + console.log('resolving staff account:', id) + return backendInteractor.fetchUser({ id }) + }) + + nicknames = await Promise.all(nicknames) + + store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames }) +} + const getNodeInfo = async ({ store }) => { try { const res = await window.fetch('/nodeinfo/2.0.json') @@ -212,6 +226,9 @@ const getNodeInfo = async ({ store }) => { const frontendVersion = window.___pleromafe_commit_hash store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) + + const accounts = metadata.staffAccounts + await resolveStaffAccounts({ store, accounts }) } else { throw (res) } -- cgit v1.2.3-70-g09d2 From 90f764224d7518da08653db285c5343ca5d078ac Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 00:09:32 -0600 Subject: about: add MRF transparency panel --- src/boot/after_store.js | 3 + src/components/about/about.js | 4 +- src/components/about/about.vue | 1 + .../mrf_transparency_panel.js | 33 ++++++++ .../mrf_transparency_panel.vue | 91 ++++++++++++++++++++++ src/i18n/en.json | 18 ++++- 6 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 src/components/mrf_transparency_panel/mrf_transparency_panel.js create mode 100644 src/components/mrf_transparency_panel/mrf_transparency_panel.vue (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index e96baaf0..bba3288c 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -227,6 +227,9 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) + const federation = metadata.federation + store.dispatch('setInstanceOption', { name: 'federationPolicy', value: federation }) + const accounts = metadata.staffAccounts await resolveStaffAccounts({ store, accounts }) } else { diff --git a/src/components/about/about.js b/src/components/about/about.js index 5c95c079..1df25845 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -2,13 +2,15 @@ import InstanceSpecificPanel from '../instance_specific_panel/instance_specific_ import FeaturesPanel from '../features_panel/features_panel.vue' import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue' import StaffPanel from '../staff_panel/staff_panel.vue' +import MRFTransparencyPanel from '../mrf_transparency_panel/mrf_transparency_panel.vue' const About = { components: { InstanceSpecificPanel, FeaturesPanel, TermsOfServicePanel, - StaffPanel + StaffPanel, + MRFTransparencyPanel }, computed: { showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel }, diff --git a/src/components/about/about.vue b/src/components/about/about.vue index ad520d11..518f6184 100644 --- a/src/components/about/about.vue +++ b/src/components/about/about.vue @@ -3,6 +3,7 @@ + diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.js b/src/components/mrf_transparency_panel/mrf_transparency_panel.js new file mode 100644 index 00000000..3791dd12 --- /dev/null +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.js @@ -0,0 +1,33 @@ +const MRFTransparencyPanel = { + components: { + }, + computed: { + federationPolicy() { + return this.$store.state.instance.federationPolicy + }, + mrfPolicies() { + return this.$store.state.instance.federationPolicy.mrf_policies + }, + acceptInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.accept + }, + rejectInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.reject + }, + quarantineInstances() { + return this.$store.state.instance.federationPolicy.quarantined_instances + }, + ftlRemovalInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.federated_timeline_removal + }, + mediaNsfwInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.media_nsfw + }, + mediaRemovalInstances() { + return this.$store.state.instance.federationPolicy.mrf_simple.media_removal + } + } +} + +export default MRFTransparencyPanel + diff --git a/src/components/mrf_transparency_panel/mrf_transparency_panel.vue b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue new file mode 100644 index 00000000..f3507591 --- /dev/null +++ b/src/components/mrf_transparency_panel/mrf_transparency_panel.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/src/i18n/en.json b/src/i18n/en.json index 4cd66177..ead333c1 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1,6 +1,22 @@ { "about": { - "staff": "Staff" + "staff": "Staff", + "federation": "Federation", + "mrf_policies": "Enabled MRF Policies", + "mrf_policies_desc": "MRF policies manipulate the federation behaviour of the instance. The following policies are enabled:", + "mrf_policy_simple": "Instance-specific Policies", + "mrf_policy_simple_accept": "Accept", + "mrf_policy_simple_accept_desc": "This instance only accepts messages from the following instances:", + "mrf_policy_simple_reject": "Reject", + "mrf_policy_simple_reject_desc": "This instance will not accept messages from the following instances:", + "mrf_policy_simple_quarantine": "Quarantine", + "mrf_policy_simple_quarantine_desc": "This instance will send only public posts to the following instances:", + "mrf_policy_simple_ftl_removal": "Removal from \"The Whole Known Network\" Timeline", + "mrf_policy_simple_ftl_removal_desc": "This instance removes these instances from \"The Whole Known Network\" timeline:", + "mrf_policy_simple_media_removal": "Media Removal", + "mrf_policy_simple_media_removal_desc": "This instance removes media from posts on the following instances:", + "mrf_policy_simple_media_nsfw": "Media Force-set As Sensitive", + "mrf_policy_simple_media_nsfw_desc": "This instance forces media to be set sensitive in posts on the following instances:" }, "chat": { "title": "Chat" -- cgit v1.2.3-70-g09d2 From a4ae956a62f7d82db9da91c4f6516219599954f5 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 00:34:05 -0600 Subject: boot: cleanup resolveStaffAccounts --- src/boot/after_store.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index bba3288c..226b67d8 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -185,14 +185,9 @@ const getAppSecret = async ({ store }) => { } const resolveStaffAccounts = async ({ store, accounts }) => { - let nicknames = accounts.map(uri => uri.split('/').pop()) const backendInteractor = store.state.api.backendInteractor - - nicknames = nicknames.map(id => { - console.log('resolving staff account:', id) - return backendInteractor.fetchUser({ id }) - }) - + let nicknames = accounts.map(uri => uri.split('/').pop()) + .map(id => backendInteractor.fetchUser({ id })) nicknames = await Promise.all(nicknames) store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames }) -- cgit v1.2.3-70-g09d2 From 99fd096ddd1cc657a86c41e7e96344b8bb1dc4de Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 9 Nov 2019 19:53:03 -0600 Subject: boot: track whether private mode is enabled or not --- src/boot/after_store.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 226b67d8..cbe0c330 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -218,6 +218,9 @@ const getNodeInfo = async ({ store }) => { store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version }) store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: software.name === 'pleroma' }) + const priv = metadata.private + store.dispatch('setInstanceOption', { name: 'private', value: priv }) + const frontendVersion = window.___pleromafe_commit_hash store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion }) store.dispatch('setInstanceOption', { name: 'tagPolicyAvailable', value: metadata.federation.mrf_policies.includes('TagPolicy') }) -- cgit v1.2.3-70-g09d2 From d0c78989aa9e5f5142dbc09a8935c004a2050257 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sun, 1 Dec 2019 19:34:01 -0500 Subject: hide instance url/link/text in header using hideSitename option --- src/App.js | 1 + src/App.vue | 1 + src/boot/after_store.js | 1 + src/components/mobile_nav/mobile_nav.js | 1 + src/components/mobile_nav/mobile_nav.vue | 1 + src/components/side_drawer/side_drawer.js | 3 +++ src/components/side_drawer/side_drawer.vue | 2 +- src/modules/instance.js | 1 + 8 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/boot/after_store.js') diff --git a/src/App.js b/src/App.js index 04a40e30..78ff29da 100644 --- a/src/App.js +++ b/src/App.js @@ -90,6 +90,7 @@ export default { }, sitename () { return this.$store.state.instance.name }, chat () { return this.$store.state.chat.channel.state === 'joined' }, + hideSitename () { return this.$store.state.instance.hideSitename }, suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled }, showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel && diff --git a/src/App.vue b/src/App.vue index dbe842ec..c66df843 100644 --- a/src/App.vue +++ b/src/App.vue @@ -31,6 +31,7 @@
{ copyInstanceOption('alwaysShowSubjectInput') copyInstanceOption('noAttachmentLinks') copyInstanceOption('showFeaturesPanel') + copyInstanceOption('hideSitename') return store.dispatch('setTheme', config['theme']) } diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 5a90c31f..c1166a0c 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -29,6 +29,7 @@ const MobileNav = { unseenNotificationsCount () { return this.unseenNotifications.length }, + hideSitename () { return this.$store.state.instance.hideSitename }, sitename () { return this.$store.state.instance.name } }, methods: { diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index d1c24e56..51f1d636 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -17,6 +17,7 @@ - {{ sitename }} + {{ sitename }}
    diff --git a/src/modules/instance.js b/src/modules/instance.js index 96f14ed5..625323b9 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -27,6 +27,7 @@ const defaultState = { scopeCopy: true, subjectLineBehavior: 'email', postContentType: 'text/plain', + hideSitename: false, nsfwCensorImage: undefined, vapidPublicKey: undefined, noAttachmentLinks: false, -- cgit v1.2.3-70-g09d2 From d899d06973c7c46e77f9e47f480d6967e83b4adf Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 12 Dec 2019 15:29:50 -0600 Subject: Use a centralized fallback for missing values and use instance.federating instead of instance.federation.enabled --- src/boot/after_store.js | 6 ++++++ src/components/nav_panel/nav_panel.js | 2 +- src/components/side_drawer/side_drawer.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index f169d7ba..228a0497 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -228,6 +228,12 @@ const getNodeInfo = async ({ store }) => { const federation = metadata.federation store.dispatch('setInstanceOption', { name: 'federationPolicy', value: federation }) + store.dispatch('setInstanceOption', { + name: 'federating', + value: typeof federation.enabled === 'undefined' + ? true + : federation.enabled + }) const accounts = metadata.staffAccounts await resolveStaffAccounts({ store, accounts }) diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 515e47e6..d9268585 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -11,7 +11,7 @@ const NavPanel = { chat: state => state.chat.channel, followRequestCount: state => state.api.followRequests.length, privateMode: state => state.instance.private, - federating: state => state.instance.federationPolicy.enabled || state.instance.federationPolicy.enabled !== false + federating: state => state.instance.federating }) } diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index 670d28b4..2534eb8f 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -46,7 +46,7 @@ const SideDrawer = { return this.$store.state.instance.private }, federating () { - return this.$store.state.instance.federationPolicy.enabled || this.$store.state.instance.federationPolicy.enabled !== false + return this.$store.state.instance.federating } }, methods: { -- cgit v1.2.3-70-g09d2 From 54f692622ad4fe6c427ae6d67816be93a7644ac8 Mon Sep 17 00:00:00 2001 From: taehoon Date: Sun, 15 Dec 2019 14:29:45 -0500 Subject: wire up staff accounts with correct store data --- src/boot/after_store.js | 11 ++++------- src/components/staff_panel/staff_panel.js | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 228a0497..0bb1b2b4 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -185,12 +185,9 @@ const getAppSecret = async ({ store }) => { }) } -const resolveStaffAccounts = async ({ store, accounts }) => { - const backendInteractor = store.state.api.backendInteractor - let nicknames = accounts.map(uri => uri.split('/').pop()) - .map(id => backendInteractor.fetchUser({ id })) - nicknames = await Promise.all(nicknames) - +const resolveStaffAccounts = ({ store, accounts }) => { + const nicknames = accounts.map(uri => uri.split('/').pop()) + nicknames.map(nickname => store.dispatch('fetchUser', nickname)) store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames }) } @@ -236,7 +233,7 @@ const getNodeInfo = async ({ store }) => { }) const accounts = metadata.staffAccounts - await resolveStaffAccounts({ store, accounts }) + resolveStaffAccounts({ store, accounts }) } else { throw (res) } diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js index 93e950ad..4f98fff6 100644 --- a/src/components/staff_panel/staff_panel.js +++ b/src/components/staff_panel/staff_panel.js @@ -1,3 +1,4 @@ +import map from 'lodash/map' import BasicUserCard from '../basic_user_card/basic_user_card.vue' const StaffPanel = { @@ -6,7 +7,7 @@ const StaffPanel = { }, computed: { staffAccounts () { - return this.$store.state.instance.staffAccounts + return map(this.$store.state.instance.staffAccounts, nickname => this.$store.getters.findUser(nickname)).filter(_ => _) } } } -- cgit v1.2.3-70-g09d2 From 9336140486f50159b935001b7ebadf3d9bda89ec Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 22 Jan 2020 00:37:19 +0200 Subject: massively improved initial theme loading code, added checks and warnings when loading theme files (import/localStorage/defaults) --- src/boot/after_store.js | 32 +++-- src/components/style_switcher/style_switcher.js | 153 ++++++++++++++++++++-- src/components/style_switcher/style_switcher.scss | 4 + src/components/style_switcher/style_switcher.vue | 79 +++++++---- src/i18n/en.json | 12 +- src/modules/config.js | 7 +- src/modules/instance.js | 17 ++- src/services/style_setter/style_setter.js | 27 ++-- 8 files changed, 259 insertions(+), 72 deletions(-) (limited to 'src/boot/after_store.js') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 228a0497..6c4f0e1b 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -5,6 +5,8 @@ import App from '../App.vue' import { windowWidth } from '../services/window_utils/window_utils' import { getOrCreateApp, getClientToken } from '../services/new_api/oauth.js' import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' +import { CURRENT_VERSION } from '../services/theme_data/theme_data.service.js' +import { applyTheme } from '../services/style_setter/style_setter.js' const getStatusnetConfig = async ({ store }) => { try { @@ -261,7 +263,7 @@ const checkOAuthToken = async ({ store }) => { try { await store.dispatch('loginUser', store.getters.getUserToken()) } catch (e) { - console.log(e) + console.error(e) } } resolve() @@ -269,23 +271,29 @@ const checkOAuthToken = async ({ store }) => { } const afterStoreSetup = async ({ store, i18n }) => { - if (store.state.config.customTheme) { - // This is a hack to deal with async loading of config.json and themes - // See: style_setter.js, setPreset() - window.themeLoaded = true - store.dispatch('setOption', { - name: 'customTheme', - value: store.state.config.customTheme - }) - } - const width = windowWidth() store.dispatch('setMobileLayout', width <= 800) + await setConfig({ store }) + + const { customTheme, customThemeSource } = store.state.config + const { theme } = store.state.instance + const customThemePresent = customThemeSource || customTheme + + if (customThemePresent) { + if (customThemeSource && customThemeSource.version === CURRENT_VERSION) { + applyTheme(customThemeSource) + } else { + applyTheme(customTheme) + } + } else if (theme) { + // do nothing, it will load asynchronously + } else { + console.error('Failed to load any theme!') + } // Now we can try getting the server settings and logging in await Promise.all([ checkOAuthToken({ store }), - setConfig({ store }), getTOS({ store }), getInstancePanel({ store }), getStickers({ store }), diff --git a/src/components/style_switcher/style_switcher.js b/src/components/style_switcher/style_switcher.js index 799646b1..0ef02f39 100644 --- a/src/components/style_switcher/style_switcher.js +++ b/src/components/style_switcher/style_switcher.js @@ -57,6 +57,8 @@ export default { return { availableStyles: [], selected: this.$store.getters.mergedConfig.theme, + themeWarning: undefined, + tempImportFile: undefined, previewShadows: {}, previewColors: {}, @@ -120,12 +122,62 @@ export default { }) }, mounted () { - this.normalizeLocalState(this.$store.getters.mergedConfig.customTheme) + this.loadThemeFromLocalStorage() if (typeof this.shadowSelected === 'undefined') { this.shadowSelected = this.shadowsAvailable[0] } }, computed: { + themeWarningHelp () { + if (!this.themeWarning) return + const t = this.$t + const pre = 'settings.style.switcher.help.' + const { + origin, + themeEngineVersion, + type, + noActionsPossible + } = this.themeWarning + if (origin === 'file') { + // Loaded v2 theme from file + if (themeEngineVersion === 2 && type === 'wrong_version') { + return t(pre + 'v2_imported') + } + if (themeEngineVersion > CURRENT_VERSION) { + return t(pre + 'future_version_imported') + ' ' + + ( + noActionsPossible + ? t(pre + 'snapshot_missing') + : t(pre + 'snapshot_present') + ) + } + if (themeEngineVersion < CURRENT_VERSION) { + return t(pre + 'future_version_imported') + ' ' + + ( + noActionsPossible + ? t(pre + 'snapshot_missing') + : t(pre + 'snapshot_present') + ) + } + } else if (origin === 'localStorage') { + // FE upgraded from v2 + if (themeEngineVersion === 2) { + return 'upgraded_from_v2' + } + // Admin downgraded FE + if (themeEngineVersion > CURRENT_VERSION) { + return noActionsPossible + ? 'downgraded_theme' + : 'downgraded_theme_missing_snapshot' + } + // Admin upgraded FE + if (themeEngineVersion < CURRENT_VERSION) { + return noActionsPossible + ? 'upgraded_theme' + : 'upgraded_theme_missing_snapshot' + } + } + }, selectedVersion () { return Array.isArray(this.selected) ? 1 : 2 }, @@ -308,10 +360,96 @@ export default { Checkbox }, methods: { + loadTheme ( + { + theme, + source, + _pleroma_theme_version: fileVersion + }, + origin, + forceUseSource = false + ) { + if (!source && !theme) { + throw new Error('Can\'t load theme: empty') + } + const version = (origin === 'localstorage' && !theme.colors) + ? 'l1' + : fileVersion + const themeEngineVersion = (source || {}).themeEngineVersion || 2 + const versionsMatch = themeEngineVersion === CURRENT_VERSION + // Force loading of source if user requested it or if snapshot + // is unavailable + const forcedSourceLoad = (source && forceUseSource) || !theme + if (!versionsMatch && + !forcedSourceLoad && + version !== 'l1' && + origin !== 'defaults' + ) { + if (!theme) { + this.themeWarning = { + origin, + noActionsPossible: true, + themeEngineVersion, + type: 'no_snapshot_old_version' + } + } else if (!versionsMatch) { + this.themeWarning = { + origin, + noActionsPossible: !source, + themeEngineVersion, + type: 'wrong_version' + } + } + } + this.normalizeLocalState(theme, version, source, forcedSourceLoad) + }, + forceLoadLocalStorage () { + this.loadThemeFromLocalStorage(true) + }, + dismissWarning () { + this.themeWarning = undefined + this.tempImportFile = undefined + }, + forceLoad () { + const { origin } = this.themeWarning + switch (origin) { + case 'localstorage': + this.loadThemeFromLocalStorage(true) + break + case 'file': + this.onImport(this.tempImportFile, true) + break + } + }, + loadThemeFromLocalStorage (confirmLoadSource = false) { + const { + customTheme: theme, + customThemeSource: source + } = this.$store.getters.mergedConfig + if (!theme && !source) { + // Anon user or never touched themes + this.loadTheme( + this.$store.state.instance.themeData, + 'defaults', + confirmLoadSource + ) + } else { + this.loadTheme( + { theme, source }, + 'localStorage', + confirmLoadSource + ) + } + }, setCustomTheme () { this.$store.dispatch('setOption', { name: 'customTheme', + value: this.previewTheme + }) + this.$store.dispatch('setOption', { + name: 'customThemeSource', value: { + themeEngineVersion: CURRENT_VERSION, shadows: this.shadowsLocal, fonts: this.fontsLocal, opacity: this.currentOpacity, @@ -331,21 +469,16 @@ export default { this.previewColors.mod ) }, - onImport (parsed) { - if (parsed._pleroma_theme_version === 1) { - this.normalizeLocalState(parsed, 1) - } else if (parsed._pleroma_theme_version >= 2) { - this.normalizeLocalState(parsed.theme, 2, parsed.source) - } + onImport (parsed, forceSource = false) { + this.tempImportFile = parsed + this.loadTheme(parsed, 'file', forceSource) }, importValidator (parsed) { const version = parsed._pleroma_theme_version return version >= 1 || version <= 2 }, clearAll () { - const state = this.$store.getters.mergedConfig.customTheme - const version = state.colors ? 2 : 'l1' - this.normalizeLocalState(this.$store.getters.mergedConfig.customTheme, version, this.$store.getters.mergedConfig.customThemeSource) + this.loadThemeFromLocalStorage() }, // Clears all the extra stuff when loading V1 theme diff --git a/src/components/style_switcher/style_switcher.scss b/src/components/style_switcher/style_switcher.scss index 987245a2..71d0f05e 100644 --- a/src/components/style_switcher/style_switcher.scss +++ b/src/components/style_switcher/style_switcher.scss @@ -1,5 +1,9 @@ @import '../../_variables.scss'; .style-switcher { + .theme-warning { + display: flex; + align-items: baseline; + } .preset-switcher { margin-right: 1em; } diff --git a/src/components/style_switcher/style_switcher.vue b/src/components/style_switcher/style_switcher.vue index 287d31b7..61f8800a 100644 --- a/src/components/style_switcher/style_switcher.vue +++ b/src/components/style_switcher/style_switcher.vue @@ -1,31 +1,60 @@