who to follow panel uses /api/v1/suggestions
This commit is contained in:
parent
32fd108e97
commit
bcd499c372
|
@ -7,12 +7,12 @@ function showWhoToFollow (panel, reply, aHost, aUser) {
|
||||||
var user
|
var user
|
||||||
user = users[cn]
|
user = users[cn]
|
||||||
var img
|
var img
|
||||||
if (user.icon) {
|
if (user.avatar) {
|
||||||
img = user.icon
|
img = user.icon
|
||||||
} else {
|
} else {
|
||||||
img = '/images/avi.png'
|
img = '/images/avi.png'
|
||||||
}
|
}
|
||||||
var name = user.to_id
|
var name = user.acct
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
panel.img1 = img
|
panel.img1 = img
|
||||||
panel.name1 = name
|
panel.name1 = name
|
||||||
|
@ -52,17 +52,13 @@ function showWhoToFollow (panel, reply, aHost, aUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWhoToFollow (panel) {
|
function getWhoToFollow (panel) {
|
||||||
var user = panel.$store.state.users.currentUser.screen_name
|
var credentials = panel.$store.state.users.currentUser.credentials
|
||||||
if (user) {
|
if (credentials) {
|
||||||
panel.name1 = 'Loading...'
|
panel.name1 = 'Loading...'
|
||||||
panel.name2 = 'Loading...'
|
panel.name2 = 'Loading...'
|
||||||
panel.name3 = 'Loading...'
|
panel.name3 = 'Loading...'
|
||||||
var host = window.location.hostname
|
var url = '/api/v1/suggestions'
|
||||||
var whoToFollowProvider = panel.$store.state.config.whoToFollowProvider
|
window.fetch(url, {headers: authHeaders(credentials)}).then(function (response) {
|
||||||
var url
|
|
||||||
url = whoToFollowProvider.replace(/{{host}}/g, encodeURIComponent(host))
|
|
||||||
url = url.replace(/{{user}}/g, encodeURIComponent(user))
|
|
||||||
window.fetch(url, {mode: 'cors'}).then(function (response) {
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json()
|
return response.json()
|
||||||
} else {
|
} else {
|
||||||
|
|
13
src/main.js
13
src/main.js
|
@ -89,13 +89,10 @@ window.fetch('/api/statusnet/config.json')
|
||||||
window.fetch('/static/config.json')
|
window.fetch('/static/config.json')
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const {theme, background, logo, showWhoToFollowPanel, whoToFollowProvider, whoToFollowLink, showInstanceSpecificPanel, scopeOptionsEnabled} = data
|
const {theme, background, logo, showInstanceSpecificPanel, scopeOptionsEnabled} = data
|
||||||
store.dispatch('setOption', { name: 'theme', value: theme })
|
store.dispatch('setOption', { name: 'theme', value: theme })
|
||||||
store.dispatch('setOption', { name: 'background', value: background })
|
store.dispatch('setOption', { name: 'background', value: background })
|
||||||
store.dispatch('setOption', { name: 'logo', value: logo })
|
store.dispatch('setOption', { name: 'logo', value: logo })
|
||||||
store.dispatch('setOption', { name: 'showWhoToFollowPanel', value: showWhoToFollowPanel })
|
|
||||||
store.dispatch('setOption', { name: 'whoToFollowProvider', value: whoToFollowProvider })
|
|
||||||
store.dispatch('setOption', { name: 'whoToFollowLink', value: whoToFollowLink })
|
|
||||||
store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
|
store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
|
||||||
store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
|
store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
|
||||||
if (data['chatDisabled']) {
|
if (data['chatDisabled']) {
|
||||||
|
@ -144,6 +141,14 @@ window.fetch('/static/config.json')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
window.fetch('/nodeinfo/2.0.json')
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
const suggestions = data.metadata.suggestions
|
||||||
|
store.dispatch('setOption', { name: 'showWhoToFollowPanel', value: suggestions.enabled })
|
||||||
|
store.dispatch('setOption', { name: 'whoToFollowLink', value: suggestions.web })
|
||||||
|
})
|
||||||
|
|
||||||
window.fetch('/static/terms-of-service.html')
|
window.fetch('/static/terms-of-service.html')
|
||||||
.then((res) => res.text())
|
.then((res) => res.text())
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
|
|
|
@ -5,11 +5,6 @@
|
||||||
"redirectRootNoLogin": "/main/all",
|
"redirectRootNoLogin": "/main/all",
|
||||||
"redirectRootLogin": "/main/friends",
|
"redirectRootLogin": "/main/friends",
|
||||||
"chatDisabled": false,
|
"chatDisabled": false,
|
||||||
"showWhoToFollowPanel": false,
|
|
||||||
"whoToFollowProvider": "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}",
|
|
||||||
"whoToFollowProviderDummy2": "https://followlink.osa-p.net/api/get_recommend.json?acct=@{{user}}@{{host}}",
|
|
||||||
"whoToFollowLink": "https://vinayaka.distsn.org/?{{host}}+{{user}}",
|
|
||||||
"whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html",
|
|
||||||
"showInstanceSpecificPanel": false,
|
"showInstanceSpecificPanel": false,
|
||||||
"scopeOptionsEnabled": false
|
"scopeOptionsEnabled": false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue