osa-compatible who to follow provider

This commit is contained in:
Hakaba Hitoyo 2018-05-05 00:53:40 +09:00
parent 0691af1367
commit 2471b71aab
2 changed files with 38 additions and 51 deletions

View file

@ -1,28 +1,18 @@
function showWhoToFollow (panel, users, aHost, aUser) {
function showWhoToFollow (panel, reply, aHost, aUser) {
var users = reply.ids
var cn
var index = 0
var random = Math.floor(Math.random() * 10)
for (cn = random; cn < users.length; cn = cn + 10) {
var user
user = users[cn]
var host
host = user.host
var username
if (user.username) {
username = user.username
} else {
username = user.user
}
var img
if (user.avatar) {
img = user.avatar
if (user.icon) {
img = user.icon
} else {
img = '/images/avi.png'
}
var name = username + '@' + host
if ((!user.following) &&
(!user.blacklisted) &&
(!(host === aHost && username === aUser))) {
var name = user.to_id
if (index === 0) {
panel.img1 = img
panel.name1 = name
@ -53,7 +43,6 @@ function showWhoToFollow (panel, users, aHost, aUser) {
panel.id3 = externalUser.id
}
})
}
index = index + 1
if (index > 2) {
break
@ -81,8 +70,8 @@ function getWhoToFollow (panel) {
panel.name2 = ''
panel.name3 = ''
}
}).then(function (users) {
showWhoToFollow(panel, users, host, user)
}).then(function (reply) {
showWhoToFollow(panel, reply, host, user)
})
}
}

View file

@ -6,11 +6,9 @@
"redirectRootLogin": "/main/friends",
"chatDisabled": false,
"showWhoToFollowPanel": false,
"whoToFollowProvider": "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-simple-api.cgi?{{host}}+{{user}}",
"whoToFollowProviderDummy1": "https://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}}",
"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}}",
"whoToFollowLinkDummy1": "https://vinayaka.distsn.org/?{{host}}+{{user}}",
"whoToFollowLinkDummy2": "https://followlink.osa-p.net/recommend.html",
"showInstanceSpecificPanel": false
}