fix listsetting & http ssl options

This commit is contained in:
Henry Jameson 2025-12-08 13:50:08 +02:00
commit 5aed9a20b8
4 changed files with 30 additions and 14 deletions

View file

@ -57,7 +57,6 @@ export default {
}, },
suggestionsSet () { suggestionsSet () {
const suggestions = this.backendDescriptionSuggestions const suggestions = this.backendDescriptionSuggestions
console.log(suggestions)
if (suggestions) { if (suggestions) {
return new Set(suggestions) return new Set(suggestions)
} else { } else {
@ -68,7 +67,7 @@ export default {
if (this.ignoreSuggestions) return [...this.valueSet.values()] if (this.ignoreSuggestions) return [...this.valueSet.values()]
if (!this.suggestionsSet) return [] if (!this.suggestionsSet) return []
return [...this.valueSet.values()].filter((x) => { return [...this.valueSet.values()].filter((x) => {
return !this.suggestionsSet?.has(x) return !this.builtinEntriesValueSet.has(x)
}) })
}, },
builtinEntries () { builtinEntries () {
@ -81,8 +80,11 @@ export default {
const builtins = [...this.suggestionsSet.values()] const builtins = [...this.suggestionsSet.values()]
return builtins.map((option) => ({ return builtins.map((option) => ({
label: option, label: option,
value: this.valueSet.has(option) value: option
})) }))
},
builtinEntriesValueSet () {
return new Set(this.builtinEntries.map(x => x.value))
} }
}, },
methods: { methods: {
@ -90,32 +92,38 @@ export default {
optionPresent (option) { optionPresent (option) {
return this.valueSet.has(option) return this.valueSet.has(option)
}, },
getValue ({ event, index, eventType }) { getValue ({ event, value, index, eventType }) {
switch (eventType) { switch (eventType) {
case 'toggle': { case 'toggle': {
this.newValue = '' this.newValue = ''
return [...this.visibleState, event] const newSet = new Set(this.valueSet.values())
if (event) {
newSet.add(value)
} else {
newSet.delete(value)
}
return [...newSet.values()]
} }
case 'add': { case 'add': {
if (!this.newValue) return this.visibleState if (!this.newValue) return this.valueSet.values()
const res = [...this.visibleState, this.newValue] const res = [...this.valueSet.values(), this.newValue]
this.newValue = '' this.newValue = ''
return res return res
} }
case 'remove': { case 'remove': {
const pre = this.visibleState.slice(0, index) const pre = [...this.valueSet.values()].slice(0, index)
const post = this.visibleState.slice(index + 1) const post = [...this.valueSet.values()].slice(index + 1)
return [...pre, ...post] return [...pre, ...post]
} }
case 'edit': { case 'edit': {
const pre = this.visibleState.slice(0, index) const pre = [...this.valueSet.values()].slice(0, index)
const post = this.visibleState.slice(index + 1) const post = [...this.valueSet.values()].slice(index + 1)
const string = event.target.value const string = event.target.value
if (!string) return this.visibleState if (!string) return [...this.valueSet.values()]
return [...pre, string, ...post] return [...pre, string, ...post]
} }

View file

@ -27,7 +27,7 @@
<Checkbox <Checkbox
:disabled="shouldBeDisabled" :disabled="shouldBeDisabled"
:model-value="optionPresent(item.value)" :model-value="optionPresent(item.value)"
@update:model-value="e => update({ event, eventType: 'toggle' })" @update:model-value="event => update({ event, value: item.value, eventType: 'toggle' })"
> >
{{ item.label }} {{ item.label }}
</Checkbox> </Checkbox>

View file

@ -255,7 +255,6 @@ export default {
} }
}, },
canHardReset () { canHardReset () {
console.log('MP', this.$store.state.adminSettings.modifiedPaths.has)
return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths?.has(this.canonPath.join(' -> ')) return this.realSource === 'admin' && this.$store.state.adminSettings.modifiedPaths?.has(this.canonPath.join(' -> '))
}, },
matchesExpertLevel () { matchesExpertLevel () {

View file

@ -106,6 +106,15 @@ const adminSettingsStorage = {
set(config, path, convert(c.value)) set(config, path, convert(c.value))
}) })
console.log('CONFIG', JSON.parse(JSON.stringify(config))) console.log('CONFIG', JSON.parse(JSON.stringify(config)))
// patching http adapter config to be easier to handle
const adapter = config[':pleroma'][':http'][':adapter']
if (Array.isArray(adapter)) {
config[':pleroma'][':http'][':adapter'] = {
[':ssl_options']: {
[':versions']: []
}
}
}
commit('updateAdminSettings', { config, modifiedPaths }) commit('updateAdminSettings', { config, modifiedPaths })
commit('resetAdminDraft') commit('resetAdminDraft')
}, },