mirror of
https://git.youjo.love/youjo/youjo-fe.git
synced 2024-11-20 13:59:55 +01:00
osa-compatible who to follow provider
This commit is contained in:
parent
0691af1367
commit
2471b71aab
2 changed files with 38 additions and 51 deletions
|
@ -1,59 +1,48 @@
|
|||
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))) {
|
||||
if (index === 0) {
|
||||
panel.img1 = img
|
||||
panel.name1 = name
|
||||
panel.$store.state.api.backendInteractor.externalProfile(name)
|
||||
.then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
panel.id1 = externalUser.id
|
||||
}
|
||||
})
|
||||
} else if (index === 1) {
|
||||
panel.img2 = img
|
||||
panel.name2 = name
|
||||
panel.$store.state.api.backendInteractor.externalProfile(name)
|
||||
.then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
panel.id2 = externalUser.id
|
||||
}
|
||||
})
|
||||
} else if (index === 2) {
|
||||
panel.img3 = img
|
||||
panel.name3 = name
|
||||
panel.$store.state.api.backendInteractor.externalProfile(name)
|
||||
.then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
panel.id3 = externalUser.id
|
||||
}
|
||||
})
|
||||
}
|
||||
var name = user.to_id
|
||||
if (index === 0) {
|
||||
panel.img1 = img
|
||||
panel.name1 = name
|
||||
panel.$store.state.api.backendInteractor.externalProfile(name)
|
||||
.then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
panel.id1 = externalUser.id
|
||||
}
|
||||
})
|
||||
} else if (index === 1) {
|
||||
panel.img2 = img
|
||||
panel.name2 = name
|
||||
panel.$store.state.api.backendInteractor.externalProfile(name)
|
||||
.then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
panel.id2 = externalUser.id
|
||||
}
|
||||
})
|
||||
} else if (index === 2) {
|
||||
panel.img3 = img
|
||||
panel.name3 = name
|
||||
panel.$store.state.api.backendInteractor.externalProfile(name)
|
||||
.then((externalUser) => {
|
||||
if (!externalUser.error) {
|
||||
panel.$store.commit('addNewUsers', [externalUser])
|
||||
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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue