features panes supports chat & gopher

This commit is contained in:
Hakaba Hitoyo 2018-09-04 10:44:25 +09:00
parent fa477dd41f
commit 65115bfc7f
3 changed files with 14 additions and 5 deletions

View file

@ -1,7 +1,11 @@
const FeaturesPanel = {
computed: {
mediaProxy: function () { return this.$store.state.config.mediaProxyAvailable },
chat: function () {
return this.$store.state.config.chatAvailable && (!this.$store.state.chatDisabled)
},
gopher: function () { return this.$store.state.config.gopherAvailable },
whoToFollow: function () { return this.$store.state.config.suggestionsEnabled },
mediaProxy: function () { return this.$store.state.config.mediaProxyAvailable },
scopeOptions: function () { return this.$store.state.config.scopeOptionsEnabled },
formattingOptions: function () { return this.$store.state.config.formattingOptionsEnabled },
textlimit: function () { return this.$store.state.config.textlimit }

View file

@ -8,8 +8,10 @@
</div>
<div class="panel-body features-panel">
<ul>
<li v-if="mediaProxy">Media proxy</li>
<li v-if="chat">Chat</li>
<li v-if="gopher">Gopher</li>
<li v-if="whoToFollow">Who to follow</li>
<li v-if="mediaProxy">Media proxy</li>
<li v-if="scopeOptions">Scope options</li>
<li v-if="formattingOptions">Formatting options</li>
<li>Text limit = {{textlimit}}</li>

View file

@ -222,9 +222,12 @@ window.fetch('/instance/panel.html')
window.fetch('/nodeinfo/2.0.json')
.then((res) => res.json())
.then((data) => {
const suggestions = data.metadata.suggestions
const metadata = data.metadata
store.dispatch('setOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
store.dispatch('setOption', { name: 'chatAvailable', value: data.metadata.chat })
store.dispatch('setOption', { name: 'gopherAvailable', value: data.metadata.gopher })
const suggestions = metadata.suggestions
store.dispatch('setOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
store.dispatch('setOption', { name: 'suggestionsWeb', value: suggestions.web })
store.dispatch('setOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
})