2020-10-01 01:43:07 +03:00
|
|
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
2021-03-11 16:55:14 +02:00
|
|
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
2022-02-22 23:31:40 +02:00
|
|
|
import ScopeSelector from 'src/components/scope_selector/scope_selector.vue'
|
2022-03-07 20:02:53 -05:00
|
|
|
import IntegerSetting from '../helpers/integer_setting.vue'
|
2020-05-10 06:46:06 +03:00
|
|
|
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
|
|
|
|
|
|
2024-04-20 16:07:03 +03:00
|
|
|
import { usePostLanguageOptions } from 'src/lib/post_language'
|
2020-06-07 00:15:10 +03:00
|
|
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
2022-02-22 23:31:40 +02:00
|
|
|
import ServerSideIndicator from '../helpers/server_side_indicator.vue'
|
2020-10-20 21:03:46 +03:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import {
|
2022-10-06 15:59:16 +00:00
|
|
|
faGlobe, faSync
|
2020-10-20 21:03:46 +03:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
|
|
library.add(
|
2022-10-06 15:59:16 +00:00
|
|
|
faGlobe,
|
|
|
|
|
faSync
|
2020-10-20 21:03:46 +03:00
|
|
|
)
|
2020-05-10 06:46:06 +03:00
|
|
|
|
|
|
|
|
const GeneralTab = {
|
2024-04-20 16:07:03 +03:00
|
|
|
setup() {
|
|
|
|
|
const {postLanguageOptions} = usePostLanguageOptions()
|
|
|
|
|
|
|
|
|
|
return {postLanguageOptions}
|
|
|
|
|
},
|
2020-05-10 06:46:06 +03:00
|
|
|
data () {
|
|
|
|
|
return {
|
2021-03-11 16:55:14 +02:00
|
|
|
subjectLineOptions: ['email', 'noop', 'masto'].map(mode => ({
|
|
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
|
|
|
|
label: this.$t(`settings.subject_line_${mode === 'masto' ? 'mastodon' : mode}`)
|
|
|
|
|
})),
|
2022-03-06 13:57:48 -05:00
|
|
|
conversationDisplayOptions: ['tree', 'linear'].map(mode => ({
|
2021-08-06 20:18:27 -04:00
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
|
|
|
|
label: this.$t(`settings.conversation_display_${mode}`)
|
|
|
|
|
})),
|
2021-09-05 16:35:47 -04:00
|
|
|
conversationOtherRepliesButtonOptions: ['below', 'inside'].map(mode => ({
|
|
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
|
|
|
|
label: this.$t(`settings.conversation_other_replies_button_${mode}`)
|
|
|
|
|
})),
|
2022-01-10 01:16:33 -05:00
|
|
|
mentionLinkDisplayOptions: ['short', 'full_for_remote', 'full'].map(mode => ({
|
|
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
|
|
|
|
label: this.$t(`settings.mention_link_display_${mode}`)
|
|
|
|
|
})),
|
2022-04-12 21:18:06 +03:00
|
|
|
thirdColumnModeOptions: ['none', 'notifications', 'postform'].map(mode => ({
|
|
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
2022-04-12 22:01:04 +03:00
|
|
|
label: this.$t(`settings.third_column_mode_${mode}`)
|
2022-04-12 21:18:06 +03:00
|
|
|
})),
|
2022-09-05 17:02:16 +00:00
|
|
|
userProfileDefaultTabOptions: ['statuses', 'replies'].map(tab => ({
|
|
|
|
|
key: tab,
|
|
|
|
|
value: tab,
|
|
|
|
|
label: this.$t(`user_card.${tab}`)
|
|
|
|
|
})),
|
2025-07-30 14:46:59 -04:00
|
|
|
timelineStyleOptions: ['classic', 'chostlike'].map(mode => ({
|
|
|
|
|
key: mode,
|
|
|
|
|
value: mode,
|
|
|
|
|
label: this.$t(`settings.timeline_${mode}`)
|
|
|
|
|
})),
|
2022-10-06 15:59:16 +00:00
|
|
|
profilesExpanded: false,
|
|
|
|
|
newProfileName: '',
|
2020-05-10 06:46:06 +03:00
|
|
|
loopSilentAvailable:
|
|
|
|
|
// Firefox
|
|
|
|
|
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||
|
|
|
|
|
// Chrome-likes
|
|
|
|
|
Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'webkitAudioDecodedByteCount') ||
|
|
|
|
|
// Future spec, still not supported in Nightly 63 as of 08/2018
|
2020-05-25 03:43:55 +03:00
|
|
|
Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'audioTracks')
|
2022-08-29 22:16:59 +01:00
|
|
|
|
2020-05-10 06:46:06 +03:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
2020-10-01 01:43:07 +03:00
|
|
|
BooleanSetting,
|
2021-03-11 16:55:14 +02:00
|
|
|
ChoiceSetting,
|
2022-03-07 20:02:53 -05:00
|
|
|
IntegerSetting,
|
2022-02-22 23:31:40 +02:00
|
|
|
InterfaceLanguageSwitcher,
|
|
|
|
|
ScopeSelector,
|
2022-02-28 18:23:32 +02:00
|
|
|
ServerSideIndicator
|
2020-05-10 06:46:06 +03:00
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
postFormats () {
|
|
|
|
|
return this.$store.state.instance.postFormats || []
|
|
|
|
|
},
|
2021-03-11 16:55:14 +02:00
|
|
|
postContentOptions () {
|
|
|
|
|
return this.postFormats.map(format => ({
|
|
|
|
|
key: format,
|
|
|
|
|
value: format,
|
|
|
|
|
label: this.$t(`post_status.content_type["${format}"]`)
|
|
|
|
|
}))
|
|
|
|
|
},
|
2020-05-10 06:46:06 +03:00
|
|
|
instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
|
2020-12-16 18:25:07 +02:00
|
|
|
instanceWallpaperUsed () {
|
|
|
|
|
return this.$store.state.instance.background &&
|
|
|
|
|
!this.$store.state.users.currentUser.background_image
|
|
|
|
|
},
|
2022-05-22 16:40:59 +00:00
|
|
|
language: {
|
|
|
|
|
get: function () { return this.$store.getters.mergedConfig.interfaceLanguage },
|
|
|
|
|
set: function (val) {
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-10-06 15:59:16 +00:00
|
|
|
settingsProfiles () {
|
|
|
|
|
return (this.$store.state.instance.settingsProfiles || [])
|
|
|
|
|
},
|
|
|
|
|
settingsProfile: {
|
|
|
|
|
get: function () { return this.$store.getters.mergedConfig.profile },
|
|
|
|
|
set: function (val) {
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'profile', value: val })
|
|
|
|
|
this.$store.dispatch('getSettingsProfile')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
settingsVersion () {
|
|
|
|
|
return this.$store.getters.mergedConfig.profileVersion
|
|
|
|
|
},
|
2022-08-30 14:37:36 +01:00
|
|
|
translationLanguages () {
|
2022-11-12 19:06:39 +00:00
|
|
|
const langs = this.$store.state.instance.supportedTranslationLanguages
|
|
|
|
|
if (langs && langs.source) {
|
|
|
|
|
return langs.source.map(lang => ({ key: lang.code, value: lang.code, label: lang.name }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return []
|
2022-08-30 14:37:36 +01:00
|
|
|
},
|
2022-08-29 22:16:59 +01:00
|
|
|
translationLanguage: {
|
|
|
|
|
get: function () { return this.$store.getters.mergedConfig.translationLanguage },
|
|
|
|
|
set: function (val) {
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'translationLanguage', value: val })
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-20 16:07:03 +03:00
|
|
|
postLanguage: {
|
|
|
|
|
get: function () { return this.$store.getters.mergedConfig.postLanguage },
|
|
|
|
|
set: function (val) {
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'postLanguage', value: val })
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-05-10 06:46:06 +03:00
|
|
|
...SharedComputedObject()
|
2022-02-22 23:31:40 +02:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
changeDefaultScope (value) {
|
|
|
|
|
this.$store.dispatch('setServerSideOption', { name: 'defaultScope', value })
|
2022-08-29 22:16:59 +01:00
|
|
|
},
|
|
|
|
|
setTranslationLanguage (value) {
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'translationLanguage', value })
|
2022-10-06 15:59:16 +00:00
|
|
|
},
|
|
|
|
|
toggleExpandedSettings () {
|
|
|
|
|
this.profilesExpanded = !this.profilesExpanded
|
|
|
|
|
},
|
|
|
|
|
loadSettingsProfile (name) {
|
|
|
|
|
this.$store.commit('setOption', { name: 'profile', value: name })
|
|
|
|
|
this.$store.dispatch('getSettingsProfile', true)
|
|
|
|
|
},
|
|
|
|
|
createSettingsProfile () {
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'profile', value: this.newProfileName })
|
|
|
|
|
this.$store.dispatch('setOption', { name: 'profileVersion', value: 1 })
|
|
|
|
|
this.$store.dispatch('syncSettings')
|
|
|
|
|
this.newProfileName = ''
|
|
|
|
|
},
|
|
|
|
|
forceSync () {
|
|
|
|
|
this.$store.dispatch('getSettingsProfile')
|
|
|
|
|
},
|
|
|
|
|
refreshProfiles () {
|
|
|
|
|
this.$store.dispatch('listSettingsProfiles')
|
|
|
|
|
},
|
|
|
|
|
deleteSettingsProfile (name) {
|
|
|
|
|
if (confirm(this.$t('settings.settings_profile_delete_confirm'))) {
|
|
|
|
|
this.$store.dispatch('deleteSettingsProfile', name)
|
|
|
|
|
}
|
2025-04-01 18:04:20 -04:00
|
|
|
},
|
|
|
|
|
checkAutoReload () {
|
|
|
|
|
if (this.$store.getters.mergedConfig.autoRefreshOnRequired)
|
|
|
|
|
location.reload()
|
2022-02-22 23:31:40 +02:00
|
|
|
}
|
2020-05-10 06:46:06 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default GeneralTab
|