aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/settings_modal/admin_tabs/instance_tab.vue51
-rw-r--r--src/components/settings_modal/helpers/choice_setting.js27
-rw-r--r--src/components/settings_modal/helpers/choice_setting.vue18
-rw-r--r--src/components/settings_modal/helpers/number_setting.vue15
-rw-r--r--src/components/settings_modal/helpers/setting.js7
-rw-r--r--src/components/settings_modal/helpers/shared_computed_object.js3
6 files changed, 114 insertions, 7 deletions
diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue
index ad271293..ff784287 100644
--- a/src/components/settings_modal/admin_tabs/instance_tab.vue
+++ b/src/components/settings_modal/admin_tabs/instance_tab.vue
@@ -111,6 +111,57 @@
APPROVAL REQUIRED
</BooleanSetting>
</li>
+ <li>
+ <h3>{{ $t('admin_dash.captcha.header') }}</h3>
+ </li>
+ <li>
+ <BooleanSetting
+ source="admin"
+ :path="[':pleroma', 'Pleroma.Captcha', ':enabled']"
+ draft-mode
+ >
+ CAPTCHA
+ </BooleanSetting>
+ <ul class="setting-list suboptions">
+ <li>
+ <ChoiceSetting
+ source="admin"
+ :path="[':pleroma', 'Pleroma.Captcha', ':method']"
+ :parent-path="[':pleroma', 'Pleroma.Captcha', ':enabled']"
+ :option-label-map="{
+ 'Pleroma.Captcha.Native': $t('admin_dash.captcha.native'),
+ 'Pleroma.Captcha.Kocaptcha': $t('admin_dash.captcha.kocaptcha')
+ }"
+ draft-mode
+ >
+ CAPTCHA TYPE
+ </ChoiceSetting>
+ <IntegerSetting
+ source="admin"
+ :path="[':pleroma', 'Pleroma.Captcha', ':seconds_valid']"
+ :parent-path="[':pleroma', 'Pleroma.Captcha', ':enabled']"
+ draft-mode
+ >
+ VALID
+ </IntegerSetting>
+ </li>
+ </ul>
+ <ul
+ v-if="adminConfig[':pleroma']['Pleroma.Captcha'][':enabled'] && adminConfig[':pleroma']['Pleroma.Captcha'][':method'] === 'Pleroma.Captcha.Kocaptcha'"
+ class="setting-list suboptions"
+ >
+ <h4>{{ $t('admin_dash.kocaptcha') }}</h4>
+ <li>
+ <StringSetting
+ source="admin"
+ :path="[':pleroma', 'Pleroma.Captcha.Kocaptcha', ':endpoint']"
+ draft-mode
+ >
+ cockAPTCHA ENDPOINT
+ </StringSetting>
+ </li>
+ </ul>
+ </li>
</ul>
</div>
</div>
diff --git a/src/components/settings_modal/helpers/choice_setting.js b/src/components/settings_modal/helpers/choice_setting.js
index a3c3bf44..3ff81bc9 100644
--- a/src/components/settings_modal/helpers/choice_setting.js
+++ b/src/components/settings_modal/helpers/choice_setting.js
@@ -11,7 +11,32 @@ export default {
...Setting.props,
options: {
type: Array,
- required: true
+ required: false
+ },
+ optionLabelMap: {
+ type: Object,
+ required: false,
+ default: {}
+ }
+ },
+ computed: {
+ ...Setting.computed,
+ realOptions () {
+ if (this.source === 'admin') {
+ console.log(this.backendDescriptionSuggestions)
+ return this.backendDescriptionSuggestions.map(x => ({
+ key: x,
+ value: x,
+ label: this.optionLabelMap[x] || x
+ }))
+ }
+ return this.options
+ }
+ },
+ methods: {
+ ...Setting.methods,
+ getValue (e) {
+ return e
}
}
}
diff --git a/src/components/settings_modal/helpers/choice_setting.vue b/src/components/settings_modal/helpers/choice_setting.vue
index 4c4cdefe..55f9a62c 100644
--- a/src/components/settings_modal/helpers/choice_setting.vue
+++ b/src/components/settings_modal/helpers/choice_setting.vue
@@ -3,15 +3,20 @@
v-if="matchesExpertLevel"
class="ChoiceSetting"
>
- <slot />
+ <template v-if="backendDescription">
+ {{ backendDescriptionLabel }}
+ </template>
+ <template v-else>
+ <slot />
+ </template>
{{ ' ' }}
<Select
- :model-value="state"
+ :model-value="draftMode ? draft :state"
:disabled="disabled"
@update:modelValue="update"
>
<option
- v-for="option in options"
+ v-for="option in realOptions"
:key="option.key"
:value="option.value"
>
@@ -24,6 +29,13 @@
:onclick="reset"
/>
<ProfileSettingIndicator :is-profile="isProfileSetting" />
+ <DraftButtons />
+ <p
+ v-if="backendDescriptionDescription"
+ class="setting-description"
+ >
+ {{ backendDescriptionDescription + ' ' }}
+ </p>
</label>
</template>
diff --git a/src/components/settings_modal/helpers/number_setting.vue b/src/components/settings_modal/helpers/number_setting.vue
index 81335762..93a7a79a 100644
--- a/src/components/settings_modal/helpers/number_setting.vue
+++ b/src/components/settings_modal/helpers/number_setting.vue
@@ -4,7 +4,12 @@
class="NumberSetting"
>
<label :for="path">
- <slot />
+ <template v-if="backendDescription">
+ {{ backendDescriptionLabel + ' ' }}
+ </template>
+ <template v-else>
+ <slot />
+ </template>
</label>
<input
:id="path"
@@ -21,6 +26,14 @@
:changed="isChanged"
:onclick="reset"
/>
+ <ProfileSettingIndicator :is-profile="isProfileSetting" />
+ <DraftButtons />
+ <p
+ v-if="backendDescriptionDescription"
+ class="setting-description"
+ >
+ {{ backendDescriptionDescription + ' ' }}
+ </p>
</span>
</template>
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
index 8c7074a5..a6d35fb9 100644
--- a/src/components/settings_modal/helpers/setting.js
+++ b/src/components/settings_modal/helpers/setting.js
@@ -13,7 +13,7 @@ export default {
},
props: {
path: {
- type: String,
+ type: [String, Array],
required: true
},
disabled: {
@@ -21,7 +21,7 @@ export default {
default: false
},
parentPath: {
- type: String
+ type: [String, Array]
},
parentInvert: {
type: Boolean,
@@ -68,6 +68,9 @@ export default {
backendDescriptionDescription () {
return this.backendDescription?.description
},
+ backendDescriptionSuggestions () {
+ return this.backendDescription?.suggestions
+ },
shouldBeDisabled () {
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
diff --git a/src/components/settings_modal/helpers/shared_computed_object.js b/src/components/settings_modal/helpers/shared_computed_object.js
index 912999ce..d02db542 100644
--- a/src/components/settings_modal/helpers/shared_computed_object.js
+++ b/src/components/settings_modal/helpers/shared_computed_object.js
@@ -7,6 +7,9 @@ const SharedComputedObject = () => ({
},
mergedConfig () {
return this.$store.getters.mergedConfig
+ },
+ adminConfig () {
+ return this.$store.state.adminSettings.config
}
})