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

View File

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