From b38343705cf554e10e2db1d7e39716811f64c1d5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 27 Nov 2025 18:18:03 +0200 Subject: [PATCH 01/40] mailer tab + beginning of monitoring tab --- .../settings_modal/admin_tabs/mailer_tab.js | 68 ++++++++ .../settings_modal/admin_tabs/mailer_tab.vue | 146 ++++++++++++++++++ .../admin_tabs/monitoring_tab.js | 40 +++++ .../admin_tabs/monitoring_tab.vue | 14 ++ .../settings_modal/helpers/setting.js | 18 ++- .../settings_modal_admin_content.js | 20 ++- .../settings_modal_admin_content.vue | 16 ++ src/i18n/en.json | 10 ++ src/modules/adminSettings.js | 2 + 9 files changed, 322 insertions(+), 12 deletions(-) create mode 100644 src/components/settings_modal/admin_tabs/mailer_tab.js create mode 100644 src/components/settings_modal/admin_tabs/mailer_tab.vue create mode 100644 src/components/settings_modal/admin_tabs/monitoring_tab.js create mode 100644 src/components/settings_modal/admin_tabs/monitoring_tab.vue diff --git a/src/components/settings_modal/admin_tabs/mailer_tab.js b/src/components/settings_modal/admin_tabs/mailer_tab.js new file mode 100644 index 000000000..b1b3d1590 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/mailer_tab.js @@ -0,0 +1,68 @@ +import BooleanSetting from '../helpers/boolean_setting.vue' +import ChoiceSetting from '../helpers/choice_setting.vue' +import IntegerSetting from '../helpers/integer_setting.vue' +import StringSetting from '../helpers/string_setting.vue' +import GroupSetting from '../helpers/group_setting.vue' +import AttachmentSetting from '../helpers/attachment_setting.vue' + +import SharedComputedObject from '../helpers/shared_computed_object.js' +import { library } from '@fortawesome/fontawesome-svg-core' +import { + faGlobe +} from '@fortawesome/free-solid-svg-icons' + +library.add( + faGlobe +) + +const MailerTab = { + provide () { + return { + defaultDraftMode: true, + defaultSource: 'admin' + } + }, + components: { + BooleanSetting, + ChoiceSetting, + IntegerSetting, + StringSetting, + AttachmentSetting, + GroupSetting + }, + computed: { + adaptersLabels () { + const prefix = 'Swoosh.Adapters.' + const descriptions = this.$store.state.adminSettings.descriptions + const options = descriptions[':pleroma']['Pleroma.Emails.Mailer'][':adapter'].suggestions + + return Object.fromEntries(options.map(value => [ + value, value.replace(prefix, '') + ])) + }, + startTLSLabels () { + return { + ':always': this.$t('admin_dash.generic_enforcement.always'), + ':if_available': this.$t('admin_dash.generic_enforcement.if_available'), + ':never': this.$t('admin_dash.generic_enforcement.never') + } + // return Object.fromEntries(options.map(value => [ + // value, value.replace(prefix, '') + // ])) + }, + adapter () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Emails.Mailer'][':adapter'] + }, + ...SharedComputedObject() + }, + methods: { + adapterHasKey (key) { + const descriptions = this.$store.state.adminSettings.descriptions + const mailerStuff = descriptions[':pleroma']['Pleroma.Emails.Mailer'] + const adapterStuff = mailerStuff[':subgroup,' + this.adapter] + return Object.prototype.hasOwnProperty.call(adapterStuff, key) + } + } +} + +export default MailerTab diff --git a/src/components/settings_modal/admin_tabs/mailer_tab.vue b/src/components/settings_modal/admin_tabs/mailer_tab.vue new file mode 100644 index 000000000..b6d3dc496 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/mailer_tab.vue @@ -0,0 +1,146 @@ + + + diff --git a/src/components/settings_modal/admin_tabs/monitoring_tab.js b/src/components/settings_modal/admin_tabs/monitoring_tab.js new file mode 100644 index 000000000..8bde81377 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/monitoring_tab.js @@ -0,0 +1,40 @@ +import BooleanSetting from '../helpers/boolean_setting.vue' +import ChoiceSetting from '../helpers/choice_setting.vue' +import IntegerSetting from '../helpers/integer_setting.vue' +import StringSetting from '../helpers/string_setting.vue' +import GroupSetting from '../helpers/group_setting.vue' +import AttachmentSetting from '../helpers/attachment_setting.vue' + +import SharedComputedObject from '../helpers/shared_computed_object.js' +import { library } from '@fortawesome/fontawesome-svg-core' +import { + faGlobe +} from '@fortawesome/free-solid-svg-icons' + +library.add( + faGlobe +) + +const MonitoringTab = { + provide () { + return { + defaultDraftMode: true, + defaultSource: 'admin' + } + }, + components: { + BooleanSetting, + ChoiceSetting, + IntegerSetting, + StringSetting, + AttachmentSetting, + GroupSetting + }, + computed: { + ...SharedComputedObject() + }, + methods: { + } +} + +export default MonitoringTab diff --git a/src/components/settings_modal/admin_tabs/monitoring_tab.vue b/src/components/settings_modal/admin_tabs/monitoring_tab.vue new file mode 100644 index 000000000..6b09989cd --- /dev/null +++ b/src/components/settings_modal/admin_tabs/monitoring_tab.vue @@ -0,0 +1,14 @@ + + + diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index df137157a..c11de6a2f 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -18,6 +18,10 @@ export default { type: [String, Array], required: false }, + subgroup: { + type: String, + required: false + }, disabled: { type: Boolean, default: false @@ -114,7 +118,7 @@ export default { return typeof this.draftMode === 'undefined' ? this.defaultDraftMode : this.draftMode }, backendDescription () { - return get(this.$store.state.adminSettings.descriptions, this.path) + return get(this.$store.state.adminSettings.descriptions, this.descriptionPath) }, backendDescriptionLabel () { if (this.realSource !== 'admin') return '' @@ -209,6 +213,18 @@ export default { if (this.path == null) return null return Array.isArray(this.path) ? this.path : this.path.split('.') }, + descriptionPath () { + if (this.path == null) return null + const path = Array.isArray(this.path) ? this.path : this.path.split('.') + if (this.subgroup) { + return [ + ...path.slice(0, path.length - 1), + ':subgroup,' + this.subgroup, + ...path.slice(path.length - 1) + ] + } + return path + }, isDirty () { if (this.path == null) return false if (this.realSource === 'admin' && this.canonPath.length > 3) { diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js index bc0039118..42dee7adb 100644 --- a/src/components/settings_modal/settings_modal_admin_content.js +++ b/src/components/settings_modal/settings_modal_admin_content.js @@ -4,6 +4,8 @@ import InstanceTab from './admin_tabs/instance_tab.vue' import LimitsTab from './admin_tabs/limits_tab.vue' import FrontendsTab from './admin_tabs/frontends_tab.vue' import EmojiTab from './admin_tabs/emoji_tab.vue' +import MailerTab from './admin_tabs/mailer_tab.vue' +import MonitoringTab from './admin_tabs/monitoring_tab.vue' import { useInterfaceStore } from 'src/stores/interface' import { library } from '@fortawesome/fontawesome-svg-core' @@ -11,22 +13,16 @@ import { faWrench, faHand, faLaptopCode, - faPaintBrush, - faBell, - faDownload, - faEyeSlash, - faInfo + faEnvelope, + faChartLine } from '@fortawesome/free-solid-svg-icons' library.add( faWrench, faHand, faLaptopCode, - faPaintBrush, - faBell, - faDownload, - faEyeSlash, - faInfo + faEnvelope, + faChartLine ) const SettingsModalAdminContent = { @@ -36,7 +32,9 @@ const SettingsModalAdminContent = { InstanceTab, LimitsTab, FrontendsTab, - EmojiTab + MailerTab, + EmojiTab, + MonitoringTab }, computed: { user () { diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue index 501a3acf6..8e5aee049 100644 --- a/src/components/settings_modal/settings_modal_admin_content.vue +++ b/src/components/settings_modal/settings_modal_admin_content.vue @@ -71,6 +71,22 @@ > + +
+ +
+ +
+ +
diff --git a/src/i18n/en.json b/src/i18n/en.json index e1f5fb23d..4f1a9a4dc 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -1152,6 +1152,7 @@ "instance": "Instance", "limits": "Limits", "frontends": "Front-ends", + "mailer": "EMails", "emoji": "Emoji" }, "nodb": { @@ -1178,6 +1179,10 @@ "activities": "Statuses/activities access" } }, + "mailer": { + "adapter": "Mailing Adapter", + "auth": "Authentication" + }, "limits": { "arbitrary_limits": "Arbitrary limits", "posts": "Post limits", @@ -1257,6 +1262,11 @@ "replace_warning": "This will REPLACE the local pack of the same name", "copied_successfully": "Successfully copied emoji \"{0}\" to pack \"{1}\"" }, + "generic_enforcement": { + "if_available": "If available", + "always": "Always", + "never": "Never" + }, "temp_overrides": { ":pleroma": { ":instance": { diff --git a/src/modules/adminSettings.js b/src/modules/adminSettings.js index 38fb5305a..a6729f645 100644 --- a/src/modules/adminSettings.js +++ b/src/modules/adminSettings.js @@ -105,6 +105,7 @@ const adminSettingsStorage = { } set(config, path, convert(c.value)) }) + console.log('CONFIG', config) commit('updateAdminSettings', { config, modifiedPaths }) commit('resetAdminDraft') }, @@ -122,6 +123,7 @@ const adminSettingsStorage = { const descriptions = {} backendDescriptions.forEach(d => convert(d, '', descriptions)) + console.log('DESCRIPTIONS', descriptions) commit('updateAdminDescriptions', { descriptions }) }, From eae09226b5afe1d03985b36957f0063fe1ccd7d0 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 27 Nov 2025 20:28:58 +0200 Subject: [PATCH 02/40] registrations tab --- .../admin_tabs/instance_tab.vue | 72 +------- .../admin_tabs/registrations_tab.js | 38 +++++ .../admin_tabs/registrations_tab.vue | 158 ++++++++++++++++++ .../settings_modal_admin_content.js | 10 +- .../settings_modal_admin_content.vue | 28 +++- src/i18n/en.json | 13 +- 6 files changed, 236 insertions(+), 83 deletions(-) create mode 100644 src/components/settings_modal/admin_tabs/registrations_tab.js create mode 100644 src/components/settings_modal/admin_tabs/registrations_tab.vue diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue index 32e8df259..fe96329bb 100644 --- a/src/components/settings_modal/admin_tabs/instance_tab.vue +++ b/src/components/settings_modal/admin_tabs/instance_tab.vue @@ -1,7 +1,7 @@ + + diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js index 42dee7adb..3d355a09c 100644 --- a/src/components/settings_modal/settings_modal_admin_content.js +++ b/src/components/settings_modal/settings_modal_admin_content.js @@ -6,6 +6,7 @@ import FrontendsTab from './admin_tabs/frontends_tab.vue' import EmojiTab from './admin_tabs/emoji_tab.vue' import MailerTab from './admin_tabs/mailer_tab.vue' import MonitoringTab from './admin_tabs/monitoring_tab.vue' +import RegistrationsTab from './admin_tabs/registrations_tab.vue' import { useInterfaceStore } from 'src/stores/interface' import { library } from '@fortawesome/fontawesome-svg-core' @@ -14,7 +15,8 @@ import { faHand, faLaptopCode, faEnvelope, - faChartLine + faChartLine, + faDoorOpen } from '@fortawesome/free-solid-svg-icons' library.add( @@ -22,7 +24,8 @@ library.add( faHand, faLaptopCode, faEnvelope, - faChartLine + faChartLine, + faDoorOpen ) const SettingsModalAdminContent = { @@ -34,7 +37,8 @@ const SettingsModalAdminContent = { FrontendsTab, MailerTab, EmojiTab, - MonitoringTab + MonitoringTab, + RegistrationsTab }, computed: { user () { diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue index 8e5aee049..0c5184b01 100644 --- a/src/components/settings_modal/settings_modal_admin_content.vue +++ b/src/components/settings_modal/settings_modal_admin_content.vue @@ -48,14 +48,23 @@ > +
- +
+ +
+ +
+
- +
Date: Fri, 28 Nov 2025 02:02:29 +0200 Subject: [PATCH 03/40] cleanup --- .../settings_modal/admin_tabs/limits_tab.js | 8 -------- .../settings_modal/admin_tabs/limits_tab.vue | 12 ++++++------ .../settings_modal/admin_tabs/mailer_tab.js | 8 -------- .../settings_modal/admin_tabs/registrations_tab.js | 8 -------- .../settings_modal/admin_tabs/registrations_tab.vue | 2 -- .../settings_modal/helpers/choice_setting.vue | 2 +- src/components/settings_modal/helpers/setting.js | 2 +- 7 files changed, 8 insertions(+), 34 deletions(-) diff --git a/src/components/settings_modal/admin_tabs/limits_tab.js b/src/components/settings_modal/admin_tabs/limits_tab.js index acf7d3436..c1126f49c 100644 --- a/src/components/settings_modal/admin_tabs/limits_tab.js +++ b/src/components/settings_modal/admin_tabs/limits_tab.js @@ -4,14 +4,6 @@ import IntegerSetting from '../helpers/integer_setting.vue' import StringSetting from '../helpers/string_setting.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' -import { library } from '@fortawesome/fontawesome-svg-core' -import { - faGlobe -} from '@fortawesome/free-solid-svg-icons' - -library.add( - faGlobe -) const LimitsTab = { components: { diff --git a/src/components/settings_modal/admin_tabs/limits_tab.vue b/src/components/settings_modal/admin_tabs/limits_tab.vue index ef4b9271d..d45b14c8a 100644 --- a/src/components/settings_modal/admin_tabs/limits_tab.vue +++ b/src/components/settings_modal/admin_tabs/limits_tab.vue @@ -1,10 +1,10 @@ {{ ' ' }} + + +
  • + + +
  • + + + + +
    - + + diff --git a/src/components/settings_modal/helpers/multicheckbox_setting.js b/src/components/settings_modal/helpers/multicheckbox_setting.js new file mode 100644 index 000000000..3d64a8a56 --- /dev/null +++ b/src/components/settings_modal/helpers/multicheckbox_setting.js @@ -0,0 +1,47 @@ +import Checkbox from 'src/components/checkbox/checkbox.vue' +import Setting from './setting.js' + +export default { + ...Setting, + props: { + ...Setting.props, + overrideAvailableOptions: { + required: false, + type: Set + } + }, + components: { + ...Setting.components, + Checkbox + }, + computed: { + ...Setting.computed, + availableOptions () { + if (this.overrideAvailableOptions) { + return new Set(this.overrideAvailableOptions) + } + return new Set(this.backendDescription?.suggestions.map((option) => ({ + label: option, + value: option + }))) + }, + valueSet () { + return new Set(this.visibleState) + } + }, + methods: { + ...Setting.methods, + optionPresent (option) { + return this.valueSet.has(option) + }, + getValue ({ event, option }) { + const set = new Set(this.visibleState) + if (event) { + set.add(option) + } else { + set.delete(option) + } + return [...set] + } + } +} diff --git a/src/components/settings_modal/helpers/multicheckbox_setting.vue b/src/components/settings_modal/helpers/multicheckbox_setting.vue new file mode 100644 index 000000000..083f568c1 --- /dev/null +++ b/src/components/settings_modal/helpers/multicheckbox_setting.vue @@ -0,0 +1,48 @@ + + + diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index d4a0dff56..4e1e12e13 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -1,7 +1,7 @@ import ModifiedIndicator from './modified_indicator.vue' import ProfileSettingIndicator from './profile_setting_indicator.vue' import DraftButtons from './draft_buttons.vue' -import { get, set, cloneDeep } from 'lodash' +import { get, set, cloneDeep, isEqual } from 'lodash' export default { components: { @@ -237,7 +237,7 @@ export default { if (this.realSource === 'admin' && this.canonPath.length > 3) { return false // should not show draft buttons for "grouped" values } else { - return this.realDraftMode && this.draft !== this.state + return this.realDraftMode && !isEqual(this.draft, this.state) } }, canHardReset () { diff --git a/src/components/settings_modal/settings_modal_admin_content.js b/src/components/settings_modal/settings_modal_admin_content.js index 50db2bb3b..4d89aefad 100644 --- a/src/components/settings_modal/settings_modal_admin_content.js +++ b/src/components/settings_modal/settings_modal_admin_content.js @@ -1,6 +1,7 @@ import VerticalTabSwitcher from './helpers/vertical_tab_switcher.jsx' import InstanceTab from './admin_tabs/instance_tab.vue' +import LinksTab from './admin_tabs/links_tab.vue' import LimitsTab from './admin_tabs/limits_tab.vue' import FrontendsTab from './admin_tabs/frontends_tab.vue' import MediaProxyTab from './admin_tabs/media_proxy_tab.vue' @@ -15,6 +16,7 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { faWrench, faHand, + faChain, faLaptopCode, faTowerBroadcast, faEnvelope, @@ -26,6 +28,7 @@ import { library.add( faWrench, faHand, + faChain, faLaptopCode, faTowerBroadcast, faEnvelope, @@ -45,6 +48,7 @@ const SettingsModalAdminContent = { MailerTab, EmojiTab, UploadsTab, + LinksTab, MonitoringTab, RegistrationsTab }, diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue index bc2438b8b..572cc3a2c 100644 --- a/src/components/settings_modal/settings_modal_admin_content.vue +++ b/src/components/settings_modal/settings_modal_admin_content.vue @@ -106,6 +106,14 @@
    +
    + +
    +
    Date: Tue, 2 Dec 2025 20:44:14 +0200 Subject: [PATCH 12/40] merge multicheckbox and list inputs --- .../settings_modal/admin_tabs/instance_tab.js | 22 ++--- .../admin_tabs/instance_tab.vue | 3 +- .../settings_modal/admin_tabs/links_tab.js | 6 +- .../settings_modal/admin_tabs/links_tab.vue | 9 +- .../settings_modal/helpers/list_setting.js | 97 +++++++++++++++---- .../settings_modal/helpers/list_setting.vue | 68 +++++++------ .../helpers/multicheckbox_setting.js | 47 --------- .../helpers/multicheckbox_setting.vue | 48 --------- 8 files changed, 138 insertions(+), 162 deletions(-) delete mode 100644 src/components/settings_modal/helpers/multicheckbox_setting.js delete mode 100644 src/components/settings_modal/helpers/multicheckbox_setting.vue diff --git a/src/components/settings_modal/admin_tabs/instance_tab.js b/src/components/settings_modal/admin_tabs/instance_tab.js index 4c4203c60..119c7cd35 100644 --- a/src/components/settings_modal/admin_tabs/instance_tab.js +++ b/src/components/settings_modal/admin_tabs/instance_tab.js @@ -4,17 +4,10 @@ import IntegerSetting from '../helpers/integer_setting.vue' import StringSetting from '../helpers/string_setting.vue' import GroupSetting from '../helpers/group_setting.vue' import AttachmentSetting from '../helpers/attachment_setting.vue' -import MultiCheckboxSetting from '../helpers/multicheckbox_setting.vue' +import ListSetting from '../helpers/list_setting.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' -import { library } from '@fortawesome/fontawesome-svg-core' -import { - faGlobe -} from '@fortawesome/free-solid-svg-icons' - -library.add( - faGlobe -) +import { get } from 'lodash' const InstanceTab = { provide () { @@ -29,11 +22,18 @@ const InstanceTab = { IntegerSetting, StringSetting, AttachmentSetting, - MultiCheckboxSetting, + ListSetting, GroupSetting }, computed: { - ...SharedComputedObject() + ...SharedComputedObject(), + providersOptions () { + const desc = get(this.$store.state.adminSettings.descriptions, [':pleroma', 'Pleroma.Web.Metadata', ':providers']) + return new Set(desc.suggestions.map(option => ({ + label: option.replace('Pleroma.Web.Metadata.Providers.', ''), + value: option + }))) + }, } } diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue index d8d5ae889..a46686029 100644 --- a/src/components/settings_modal/admin_tabs/instance_tab.vue +++ b/src/components/settings_modal/admin_tabs/instance_tab.vue @@ -134,7 +134,8 @@

    {{ $t('admin_dash.instance.rich_metadata') }}

    • -
    • diff --git a/src/components/settings_modal/admin_tabs/links_tab.js b/src/components/settings_modal/admin_tabs/links_tab.js index 9bd58344c..1bf626643 100644 --- a/src/components/settings_modal/admin_tabs/links_tab.js +++ b/src/components/settings_modal/admin_tabs/links_tab.js @@ -5,7 +5,6 @@ import StringSetting from '../helpers/string_setting.vue' import GroupSetting from '../helpers/group_setting.vue' import AttachmentSetting from '../helpers/attachment_setting.vue' import ListSetting from '../helpers/list_setting.vue' -import MultiCheckboxSetting from '../helpers/multicheckbox_setting.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' import { get } from 'lodash' @@ -24,13 +23,12 @@ const MediaProxyTab = { StringSetting, AttachmentSetting, GroupSetting, - ListSetting, - MultiCheckboxSetting + ListSetting }, computed: { ttlSettersOptions () { const desc = get(this.$store.state.adminSettings.descriptions, ':pleroma.:rich_media.:ttl_setters') - return new Set([...desc.suggestions, 'Pleroma.Web.RichMedia.Parser.TTL.Opengraph'].map(option => ({ + return new Set(desc.suggestions.map(option => ({ label: option.replace('Pleroma.Web.RichMedia.Parser.TTL.', ''), value: option }))) diff --git a/src/components/settings_modal/admin_tabs/links_tab.vue b/src/components/settings_modal/admin_tabs/links_tab.vue index 11559c61d..c4677ee63 100644 --- a/src/components/settings_modal/admin_tabs/links_tab.vue +++ b/src/components/settings_modal/admin_tabs/links_tab.vue @@ -7,7 +7,7 @@
    • - @@ -18,13 +18,16 @@ />
    • -
    • - +
    • diff --git a/src/components/settings_modal/helpers/list_setting.js b/src/components/settings_modal/helpers/list_setting.js index f744e925b..3ce7e5bef 100644 --- a/src/components/settings_modal/helpers/list_setting.js +++ b/src/components/settings_modal/helpers/list_setting.js @@ -1,41 +1,100 @@ +import Checkbox from 'src/components/checkbox/checkbox.vue' import Setting from './setting.js' export default { ...Setting, data () { return { - newValue: '' + newValue: '', } }, components: { - ...Setting.components + ...Setting.components, + Checkbox }, props: { - ...Setting.props + ...Setting.props, + ignoreSuggestions: { + required: false, + type: Boolean + }, + overrideAvailableOptions: { + required: false, + type: Set + }, + allowNew: { + required: false, + type: Set, + default: true + } }, computed: { - ...Setting.computed + ...Setting.computed, + valueSet () { + return new Set(this.visibleState) + }, + suggestions () { + const suggestions = this.backendDescription?.suggestions + if (suggestions) { + return new Set(this.backendDescription.suggestions) + } else { + return new Set() + } + }, + extraEntries () { + if (this.ignoreSuggestions) return [...this.valueSet.values()] + return [...this.valueSet.values()].filter((x) => { + return !this.suggestions.has(x) + }) + }, + builtinEntries () { + if (this.ignoreSuggestions) return [] + if (this.overrideAvailableOptions) { + return [...this.overrideAvailableOptions] + } + + const builtins = [...this.valueSet.values()].filter((x) => { + return this.suggestions.has(x) + }) + + return builtins.map((option) => ({ + label: option, + value: option + })) + } }, methods: { ...Setting.methods, - addNew () { - this.update({ newValue: this.newValue }) + optionPresent (option) { + return this.valueSet.has(option) }, - getValue ({ event, index, newValue, remove }) { - if (newValue) { - this.newValue = '' - return [...this.visibleState, newValue] - } else if (remove) { - const pre = this.visibleState.slice(0, index) - const post = this.visibleState.slice(index + 1) + getValue ({ event, index, eventType }) { + switch (eventType) { + case 'toggle': { + this.newValue = '' + return [...this.visibleState, event] + } - return [...pre, ...post] - } else { - const pre = this.visibleState.slice(0, index) - const post = this.visibleState.slice(index + 1) - const string = event?.target?.value + case 'add': { + const res = [...this.visibleState, this.newValue] + this.newValue = '' + return res + } - return [...pre, string, ...post] + case 'remove': { + const pre = this.visibleState.slice(0, index) + const post = this.visibleState.slice(index + 1) + + return [...pre, ...post] + } + + case 'edit': { + const pre = this.visibleState.slice(0, index) + const post = this.visibleState.slice(index + 1) + const string = event?.target?.value + + return [...pre, string, ...post] + } } } } diff --git a/src/components/settings_modal/helpers/list_setting.vue b/src/components/settings_modal/helpers/list_setting.vue index ef3315a14..364766e63 100644 --- a/src/components/settings_modal/helpers/list_setting.vue +++ b/src/components/settings_modal/helpers/list_setting.vue @@ -23,36 +23,46 @@ {{ backendDescriptionDescription + ' ' }}

        -
      • - - -
      • -
      • - + - + {{ item.label }} + +
      • +
      • +
        + + +
        +
      • +
      • +
        + + +
      .ListSetting { - li.btn-group { + .btn-group { display: flex } } diff --git a/src/components/settings_modal/helpers/multicheckbox_setting.js b/src/components/settings_modal/helpers/multicheckbox_setting.js deleted file mode 100644 index 3d64a8a56..000000000 --- a/src/components/settings_modal/helpers/multicheckbox_setting.js +++ /dev/null @@ -1,47 +0,0 @@ -import Checkbox from 'src/components/checkbox/checkbox.vue' -import Setting from './setting.js' - -export default { - ...Setting, - props: { - ...Setting.props, - overrideAvailableOptions: { - required: false, - type: Set - } - }, - components: { - ...Setting.components, - Checkbox - }, - computed: { - ...Setting.computed, - availableOptions () { - if (this.overrideAvailableOptions) { - return new Set(this.overrideAvailableOptions) - } - return new Set(this.backendDescription?.suggestions.map((option) => ({ - label: option, - value: option - }))) - }, - valueSet () { - return new Set(this.visibleState) - } - }, - methods: { - ...Setting.methods, - optionPresent (option) { - return this.valueSet.has(option) - }, - getValue ({ event, option }) { - const set = new Set(this.visibleState) - if (event) { - set.add(option) - } else { - set.delete(option) - } - return [...set] - } - } -} diff --git a/src/components/settings_modal/helpers/multicheckbox_setting.vue b/src/components/settings_modal/helpers/multicheckbox_setting.vue deleted file mode 100644 index 083f568c1..000000000 --- a/src/components/settings_modal/helpers/multicheckbox_setting.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - From 42a5da93ea14186b50c8612a8ef2d86e0079c0e8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 3 Dec 2025 12:19:20 +0200 Subject: [PATCH 13/40] links tab done (finally) --- .../settings_modal/admin_tabs/links_tab.js | 58 ++++++++++- .../settings_modal/admin_tabs/links_tab.scss | 32 ++++++ .../settings_modal/admin_tabs/links_tab.vue | 98 ++++++++++++++++++- .../settings_modal/helpers/choice_setting.js | 5 +- .../settings_modal/helpers/draft_buttons.vue | 7 +- .../settings_modal/helpers/number_setting.vue | 4 +- .../settings_modal/helpers/setting.js | 7 ++ .../settings_modal/helpers/string_setting.vue | 3 +- .../settings_modal/settings_modal.scss | 11 ++- src/i18n/en.json | 21 +++- 10 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 src/components/settings_modal/admin_tabs/links_tab.scss diff --git a/src/components/settings_modal/admin_tabs/links_tab.js b/src/components/settings_modal/admin_tabs/links_tab.js index 1bf626643..da70889ac 100644 --- a/src/components/settings_modal/admin_tabs/links_tab.js +++ b/src/components/settings_modal/admin_tabs/links_tab.js @@ -6,6 +6,8 @@ import GroupSetting from '../helpers/group_setting.vue' import AttachmentSetting from '../helpers/attachment_setting.vue' import ListSetting from '../helpers/list_setting.vue' +import Checkbox from 'src/components/checkbox/checkbox.vue' + import SharedComputedObject from '../helpers/shared_computed_object.js' import { get } from 'lodash' @@ -23,9 +25,22 @@ const MediaProxyTab = { StringSetting, AttachmentSetting, GroupSetting, - ListSetting + ListSetting, + Checkbox }, computed: { + classIsPresent () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Formatter'][':class'] !== false + }, + relIsPresent () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Formatter'][':rel'] !== false + }, + truncateIsPresent () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Formatter'][':truncate'] !== false + }, + truncateDescription () { + return get(this.$store.state.adminSettings.descriptions, [':pleroma', 'Pleroma.Formatter', ':truncate']) + }, ttlSettersOptions () { const desc = get(this.$store.state.adminSettings.descriptions, ':pleroma.:rich_media.:ttl_setters') return new Set(desc.suggestions.map(option => ({ @@ -40,6 +55,18 @@ const MediaProxyTab = { value: option }))) }, + validateTLDOptions () { + return [{ + label: this.$t('general.yes'), + value: true + }, { + label: this.$t('general.no'), + value: false + }, { + label: this.$t('admin_dash.links.no_scheme'), + value: ':no_scheme' + }] + }, mediaProxyEnabled () { return this.$store.state.adminSettings.draft[':pleroma'][':media_proxy'][':enabled'] }, @@ -47,6 +74,35 @@ const MediaProxyTab = { return this.$store.state.adminSettings.draft[':pleroma'][':media_proxy'][':invalidation'][':provider'] }, ...SharedComputedObject() + }, + methods: { + checkRel (e) { + this.$store.commit( + 'updateAdminDraft', + { + path: [':pleroma','Pleroma.Formatter',':rel'], + value: e ? '' : false + } + ) + }, + checkClass (e) { + this.$store.commit( + 'updateAdminDraft', + { + path: [':pleroma','Pleroma.Formatter',':class'], + value: e ? '' : false + } + ) + }, + checkTruncate (e) { + this.$store.commit( + 'updateAdminDraft', + { + path: [':pleroma','Pleroma.Formatter',':truncate'], + value: e ? 20 : false + } + ) + } } } diff --git a/src/components/settings_modal/admin_tabs/links_tab.scss b/src/components/settings_modal/admin_tabs/links_tab.scss new file mode 100644 index 000000000..eb56cd9f5 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/links_tab.scss @@ -0,0 +1,32 @@ +.LinksTab { + // awkward "disable = false" backend options + .weird-options { + .checkbox { + margin: 0; + } + } + + .setting-list.suboptions.weird-suboptions { + display: flex; + flex-direction: column; + gap: 0.5em; + margin: 0; + + li { + margin: 0; + display: flex; + } + + .GroupSetting { + display: inline-block; + margin: 0; + padding: 0; + } + } + + .btn-group { + .button-default { + flex: 0 1 auto; + } + } +} diff --git a/src/components/settings_modal/admin_tabs/links_tab.vue b/src/components/settings_modal/admin_tabs/links_tab.vue index c4677ee63..5e4598c08 100644 --- a/src/components/settings_modal/admin_tabs/links_tab.vue +++ b/src/components/settings_modal/admin_tabs/links_tab.vue @@ -1,5 +1,8 @@ + + diff --git a/src/components/settings_modal/helpers/choice_setting.js b/src/components/settings_modal/helpers/choice_setting.js index c36b870a6..ed54e67be 100644 --- a/src/components/settings_modal/helpers/choice_setting.js +++ b/src/components/settings_modal/helpers/choice_setting.js @@ -23,7 +23,10 @@ export default { ...Setting.computed, realOptions () { if (this.realSource === 'admin') { - if (!(this.backendDescriptionSuggestions?.length !== 0)) { + if ( + !this.backendDescriptionSuggestions?.length || + this.backendDescriptionSuggestions?.length === 0 + ) { return this.options } return this.backendDescriptionSuggestions.map(x => ({ diff --git a/src/components/settings_modal/helpers/draft_buttons.vue b/src/components/settings_modal/helpers/draft_buttons.vue index 46a70e866..2cb4594db 100644 --- a/src/components/settings_modal/helpers/draft_buttons.vue +++ b/src/components/settings_modal/helpers/draft_buttons.vue @@ -3,6 +3,7 @@