adapt to destructive change of api

This commit is contained in:
Hakaba Hitoyo 2018-10-26 10:13:53 +09:00
parent 20e4ec4979
commit 01aba3f9c6

View file

@ -217,9 +217,20 @@ window.fetch('/nodeinfo/2.0.json')
.then((res) => res.json()) .then((res) => res.json())
.then((data) => { .then((data) => {
const metadata = data.metadata const metadata = data.metadata
store.dispatch('setInstanceOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
store.dispatch('setInstanceOption', { name: 'chatAvailable', value: data.metadata.chat }) const features = metadata.features
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: data.metadata.gopher }) store.dispatch('setInstanceOption', {
name: 'mediaProxyAvailable',
value: features.findIndex((element, index, array) => (element === 'media_proxy')) >= 0
})
store.dispatch('setInstanceOption', {
name: 'chatAvailable',
value: features.findIndex((element, index, array) => (element === 'chat')) >= 0
})
store.dispatch('setInstanceOption', {
name: 'gopherAvailable',
value: features.findIndex((element, index, array) => (element === 'gopher')) >= 0
})
const suggestions = metadata.suggestions const suggestions = metadata.suggestions
store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled }) store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })