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
1 changed files with 14 additions and 3 deletions

View File

@ -217,9 +217,20 @@ window.fetch('/nodeinfo/2.0.json')
.then((res) => res.json())
.then((data) => {
const metadata = data.metadata
store.dispatch('setInstanceOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
store.dispatch('setInstanceOption', { name: 'chatAvailable', value: data.metadata.chat })
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: data.metadata.gopher })
const features = metadata.features
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
store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })