http tab more or less done
This commit is contained in:
parent
5aed9a20b8
commit
c4f83808b0
7 changed files with 310 additions and 0 deletions
46
src/components/settings_modal/admin_tabs/http_tab.js
Normal file
46
src/components/settings_modal/admin_tabs/http_tab.js
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
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 ListSetting from '../helpers/list_setting.vue'
|
||||||
|
import TupleSetting from '../helpers/tuple_setting.vue'
|
||||||
|
import MapSetting from '../helpers/map_setting.vue'
|
||||||
|
import ProxySetting from '../helpers/proxy_setting.vue'
|
||||||
|
|
||||||
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
import { get } from 'lodash'
|
||||||
|
|
||||||
|
const HTTPTab = {
|
||||||
|
provide () {
|
||||||
|
return {
|
||||||
|
defaultDraftMode: true,
|
||||||
|
defaultSource: 'admin'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
BooleanSetting,
|
||||||
|
ChoiceSetting,
|
||||||
|
IntegerSetting,
|
||||||
|
StringSetting,
|
||||||
|
AttachmentSetting,
|
||||||
|
MapSetting,
|
||||||
|
GroupSetting,
|
||||||
|
ListSetting,
|
||||||
|
TupleSetting,
|
||||||
|
ProxySetting
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...SharedComputedObject(),
|
||||||
|
sslOptions () {
|
||||||
|
const desc = get(this.$store.state.adminSettings.descriptions, ':pleroma.:http.:adapter.:ssl_options.:versions')
|
||||||
|
return new Set(desc.suggestions.map(option => ({
|
||||||
|
label: option.replace(':tlsv', 'TLS v'),
|
||||||
|
value: option
|
||||||
|
})))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HTTPTab
|
||||||
126
src/components/settings_modal/admin_tabs/http_tab.vue
Normal file
126
src/components/settings_modal/admin_tabs/http_tab.vue
Normal file
|
|
@ -0,0 +1,126 @@
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="LinksTab"
|
||||||
|
:label="$t('admin_dash.tabs.http')"
|
||||||
|
>
|
||||||
|
<div class="setting-item">
|
||||||
|
<h3>{{ $t('admin_dash.http.outbound') }}</h3>
|
||||||
|
<ul class="setting-list">
|
||||||
|
<li>
|
||||||
|
<ProxySetting
|
||||||
|
hide-description
|
||||||
|
path=":pleroma.:http.:proxy_url"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting path=":pleroma.:http.:send_user_agent" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<StringSetting path=":pleroma.:http.:user_agent" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ListSetting
|
||||||
|
override-available-options
|
||||||
|
:options="sslOptions"
|
||||||
|
path=":pleroma.:http.:adapter.:ssl_options.:versions"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<GroupSetting path=":pleroma.:http.:adapter" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="setting-item">
|
||||||
|
<h3>{{ $t('admin_dash.http.incoming') }}</h3>
|
||||||
|
<ul class="setting-list">
|
||||||
|
<h4>{{ $t('admin_dash.http.cors') }}</h4>
|
||||||
|
<li>
|
||||||
|
<IntegerSetting
|
||||||
|
:description-path-override="[':cors_plug', '<ROOT>', ':max_age']"
|
||||||
|
path=":cors_plug.:max_age"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting
|
||||||
|
:description-path-override="[':cors_plug', '<ROOT>', ':credentials']"
|
||||||
|
path=":cors_plug.:credentials"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ListSetting
|
||||||
|
path=":cors_plug.:methods"
|
||||||
|
:description-path-override="[':cors_plug', '<ROOT>', ':methods']"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ListSetting
|
||||||
|
:description-path-override="[':cors_plug', '<ROOT>', ':expose']"
|
||||||
|
path=":cors_plug.:expose"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<ListSetting
|
||||||
|
:description-path-override="[':cors_plug', '<ROOT>', ':headers']"
|
||||||
|
path=":cors_plug.:headers"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<h4>{{ $t('admin_dash.http.security') }}</h4>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting path=":pleroma.:http_security.:enabled" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting path=":pleroma.:http_security.:sts" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<IntegerSetting path=":pleroma.:http_security.:sts_max_age" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<IntegerSetting path=":pleroma.:http_security.:ct_max_age" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<StringSetting path=":pleroma.:http_security.:referrer_policy" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<BooleanSetting path=":pleroma.:http_security.:allow_unsafe_eval" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<StringSetting path=":pleroma.:http_security.:report_url" />
|
||||||
|
</li>
|
||||||
|
<h4>{{ $t('admin_dash.http.web_cache_ttl') }}</h4>
|
||||||
|
<p>{{ $t('admin_dash.http.web_cache_ttl_description') }}</p>
|
||||||
|
<li>
|
||||||
|
<StringSetting path=":pleroma.:web_cache_ttl.:activity_pub" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<StringSetting path=":pleroma.:web_cache_ttl.:activity_pub_question" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<h3>{{ $t('admin_dash.http.web_push') }}</h3>
|
||||||
|
<p>{{ $t('admin_dash.http.web_push_description') }}</p>
|
||||||
|
<ul class="setting-list">
|
||||||
|
<li>
|
||||||
|
<StringSetting
|
||||||
|
path=":web_push_encryption.:vapid_details.:subject"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<StringSetting
|
||||||
|
path=":web_push_encryption.:vapid_details.:public_key"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<StringSetting
|
||||||
|
path=":web_push_encryption.:vapid_details.:private_key"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- CONFIRM admin_token should go there but something is wrong with both data and description. -->
|
||||||
|
<!-- given the nature of the setting it's probably better to not expose it and deprecate it on backend side -->
|
||||||
|
<!-- CONFIRM :pleroma.:streamer should also PROBABLY? go here but it's completely MIA from backend besides references to config description -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!--<style lang="scss" src="./http_tab.scss"></style>-->
|
||||||
|
|
||||||
|
<script src="./http_tab.js"></script>
|
||||||
53
src/components/settings_modal/helpers/proxy_setting.js
Normal file
53
src/components/settings_modal/helpers/proxy_setting.js
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
||||||
|
import Setting from './setting.js'
|
||||||
|
|
||||||
|
const getUrl = state => state?.tuple ? state.tuple[1] + ':' + state.tuple[2] : state
|
||||||
|
const getSocks = state => state?.tuple
|
||||||
|
|
||||||
|
export default {
|
||||||
|
...Setting,
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
urlField: '',
|
||||||
|
socksField: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
Setting.created()
|
||||||
|
this.urlField = getUrl(this.realDraftMode ? this.draft : this.state)
|
||||||
|
this.socksField = getSocks(this.realDraftMode ? this.draft : this.state)
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...Setting.computed,
|
||||||
|
// state that we'll show in the UI, i.e. transforming map into list
|
||||||
|
displayState () {
|
||||||
|
if (this.visibleState?.tuple) {
|
||||||
|
return this.visibleState.tuple[1] + ':' + this.visibleState.tuple[2]
|
||||||
|
}
|
||||||
|
return this.visibleState
|
||||||
|
},
|
||||||
|
socksState () {
|
||||||
|
return getSocks(this.visibleState)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
...Setting.components,
|
||||||
|
Checkbox
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...Setting.methods,
|
||||||
|
getValue ({ event, isProxy}) {
|
||||||
|
if (isProxy) {
|
||||||
|
this.socksField = event
|
||||||
|
} else {
|
||||||
|
this.urlField = event.target.value
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.socksField) {
|
||||||
|
return { tuple: [ ':socks5', ...this.urlField.split(':') ] }
|
||||||
|
} else {
|
||||||
|
return this.urlField
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
57
src/components/settings_modal/helpers/proxy_setting.vue
Normal file
57
src/components/settings_modal/helpers/proxy_setting.vue
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
<template>
|
||||||
|
<label
|
||||||
|
v-if="matchesExpertLevel"
|
||||||
|
class="ProxySetting"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
v-if="!hideLabel"
|
||||||
|
:for="path"
|
||||||
|
class="setting-label"
|
||||||
|
:class="{ 'faint': shouldBeDisabled }"
|
||||||
|
>
|
||||||
|
<template v-if="backendDescriptionLabel">
|
||||||
|
{{ backendDescriptionLabel + ' ' }}
|
||||||
|
</template>
|
||||||
|
<template v-else-if="source === 'admin'">
|
||||||
|
MISSING LABEL FOR {{ path }}
|
||||||
|
</template>
|
||||||
|
<slot v-else />
|
||||||
|
</label>
|
||||||
|
{{ ' ' }}
|
||||||
|
<input
|
||||||
|
:id="path"
|
||||||
|
class="input string-input"
|
||||||
|
:class="{ disabled: shouldBeDisabled }"
|
||||||
|
:disabled="shouldBeDisabled"
|
||||||
|
:placeholder="backendDescriptionSuggestions[0]"
|
||||||
|
:value="displayState"
|
||||||
|
@change="event => update({ event })"
|
||||||
|
>
|
||||||
|
{{ ' ' }}
|
||||||
|
<Checkbox
|
||||||
|
:model-value="socksState"
|
||||||
|
:disabled="shouldBeDisabled"
|
||||||
|
:indeterminate="isIndeterminate"
|
||||||
|
@update:model-value="event => update({ event, isProxy: true})"
|
||||||
|
>
|
||||||
|
{{ $t('admin_dash.http.socks5') }}
|
||||||
|
{{ ' ' }}
|
||||||
|
</Checkbox>
|
||||||
|
{{ ' ' }}
|
||||||
|
<ModifiedIndicator
|
||||||
|
:changed="isChanged"
|
||||||
|
:onclick="reset"
|
||||||
|
/>
|
||||||
|
<ProfileSettingIndicator :is-profile="isProfileSetting" />
|
||||||
|
<DraftButtons v-if="!hideDraftButtons" />
|
||||||
|
<p
|
||||||
|
v-if="backendDescriptionDescription"
|
||||||
|
class="setting-description"
|
||||||
|
:class="{ 'faint': shouldBeDisabled }"
|
||||||
|
>
|
||||||
|
{{ backendDescriptionDescription + ' ' }}
|
||||||
|
</p>
|
||||||
|
</label>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./proxy_setting.js"></script>
|
||||||
|
|
@ -18,6 +18,10 @@ export default {
|
||||||
type: [String, Array],
|
type: [String, Array],
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
|
descriptionPathOverride: {
|
||||||
|
type: [String, Array],
|
||||||
|
required: false
|
||||||
|
},
|
||||||
suggestions: {
|
suggestions: {
|
||||||
type: [String, Array],
|
type: [String, Array],
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -236,7 +240,9 @@ export default {
|
||||||
},
|
},
|
||||||
descriptionPath () {
|
descriptionPath () {
|
||||||
if (this.path == null) return null
|
if (this.path == null) return null
|
||||||
|
if (this.descriptionPathOverride) return this.descriptionPathOverride
|
||||||
const path = Array.isArray(this.path) ? this.path : this.path.split('.')
|
const path = Array.isArray(this.path) ? this.path : this.path.split('.')
|
||||||
|
console.log(this.path, this.subgroup)
|
||||||
if (this.subgroup) {
|
if (this.subgroup) {
|
||||||
return [
|
return [
|
||||||
...path.slice(0, path.length - 1),
|
...path.slice(0, path.length - 1),
|
||||||
|
|
|
||||||
|
|
@ -1213,6 +1213,16 @@
|
||||||
"native": "Native",
|
"native": "Native",
|
||||||
"kocaptcha": "KoCaptcha"
|
"kocaptcha": "KoCaptcha"
|
||||||
},
|
},
|
||||||
|
"http": {
|
||||||
|
"outbound": "Outgoing connections",
|
||||||
|
"incoming": "Incoming connections",
|
||||||
|
"security": "HTTP Security",
|
||||||
|
"cors": "Cross-origin Resource Sharing (CORS)",
|
||||||
|
"web_cache_ttl": "Web Cache TTL",
|
||||||
|
"web_cache_ttl_description": "Amount of milliseconds until web response cache is cleared. Use `nil` to disable expiration entirely.",
|
||||||
|
"web_push": "Web Push",
|
||||||
|
"web_push_description": "Web Push VAPID settings. You can use the mix task web_push.gen.keypair to generate it."
|
||||||
|
},
|
||||||
"instance": {
|
"instance": {
|
||||||
"instance": "Instance information",
|
"instance": "Instance information",
|
||||||
"registrations": "User sign-ups",
|
"registrations": "User sign-ups",
|
||||||
|
|
@ -1249,6 +1259,7 @@
|
||||||
"uploads": {
|
"uploads": {
|
||||||
"attachments": "Attachments settings",
|
"attachments": "Attachments settings",
|
||||||
"upload": "Upload",
|
"upload": "Upload",
|
||||||
|
"local_uploader": "Local files",
|
||||||
"filenames": "Filenames, Titles and Descriptions",
|
"filenames": "Filenames, Titles and Descriptions",
|
||||||
"uploader_settings": "Uploader settings"
|
"uploader_settings": "Uploader settings"
|
||||||
},
|
},
|
||||||
|
|
@ -1427,6 +1438,16 @@
|
||||||
"label": "Background image",
|
"label": "Background image",
|
||||||
"description": "Background image (primarily used by PleromaFE)"
|
"description": "Background image (primarily used by PleromaFE)"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
":http_security": {
|
||||||
|
":allow_unsafe_eval": {
|
||||||
|
"label": "Allow unsafe-eval",
|
||||||
|
"description": "Allow unsafe evaluation of scripts (required for Flash support)"
|
||||||
|
},
|
||||||
|
":report_url": {
|
||||||
|
"label": "Report URL",
|
||||||
|
"description": "URL to report security violations to"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ const adminSettingsStorage = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const descriptions = {}
|
const descriptions = {}
|
||||||
|
|
||||||
backendDescriptions.forEach(d => convert(d, '', descriptions))
|
backendDescriptions.forEach(d => convert(d, '', descriptions))
|
||||||
console.log('DESCRIPTIONS', descriptions)
|
console.log('DESCRIPTIONS', descriptions)
|
||||||
commit('updateAdminDescriptions', { descriptions })
|
commit('updateAdminDescriptions', { descriptions })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue