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 = { const FeaturesPanel = {
computed: { 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 }, whoToFollow: function () { return this.$store.state.config.suggestionsEnabled },
mediaProxy: function () { return this.$store.state.config.mediaProxyAvailable },
scopeOptions: function () { return this.$store.state.config.scopeOptionsEnabled }, scopeOptions: function () { return this.$store.state.config.scopeOptionsEnabled },
formattingOptions: function () { return this.$store.state.config.formattingOptionsEnabled }, formattingOptions: function () { return this.$store.state.config.formattingOptionsEnabled },
textlimit: function () { return this.$store.state.config.textlimit } textlimit: function () { return this.$store.state.config.textlimit }

View File

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

View File

@ -222,9 +222,12 @@ window.fetch('/instance/panel.html')
window.fetch('/nodeinfo/2.0.json') window.fetch('/nodeinfo/2.0.json')
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .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: 'suggestionsEnabled', value: suggestions.enabled })
store.dispatch('setOption', { name: 'suggestionsWeb', value: suggestions.web }) store.dispatch('setOption', { name: 'suggestionsWeb', value: suggestions.web })
store.dispatch('setOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
}) })