diff options
| author | Hakaba Hitoyo <hakabahitoyo@example.com> | 2018-10-26 10:13:53 +0900 |
|---|---|---|
| committer | Hakaba Hitoyo <hakabahitoyo@example.com> | 2018-10-26 10:13:53 +0900 |
| commit | 01aba3f9c6fa89106cf5b6322b7919f26e92b21d (patch) | |
| tree | 69d55b6d00afa62626498d63fea0e8b96b67d906 /src | |
| parent | 20e4ec4979afdc0a4317e5239e3394dbf4613cf5 (diff) | |
adapt to destructive change of api
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.js b/src/main.js index 1b1780df..53cee313 100644 --- a/src/main.js +++ b/src/main.js @@ -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 }) |
