use fediversearch to suggest

This commit is contained in:
cutls 2021-02-14 11:21:29 +09:00
parent 7281db2375
commit d2c9917b7f

View File

@ -1107,13 +1107,11 @@ input.addEventListener(
var new_val = input.value
if (prev_val != new_val) {
if (new_val.length > 3) {
var start = 'https://instances.social/api/1.0/instances/search?q=' + new_val
var start = 'https://www.fediversesearch.com/search?keyword=' + new_val
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
Authorization:
'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M'
}
})
.then(function (response) {
@ -1132,11 +1130,11 @@ input.addEventListener(
.then(function (json) {
if (!json.error) {
var urls = 'Suggest:'
Object.keys(json.instances).forEach(function (key) {
var url = json.instances[key]
Object.keys(json.data).forEach(function (key) {
var url = json.data[key]
urls =
urls +
` <a onclick="login('${url.name}')" class="pointer">${escapeHTML(url.name)}</a>`
` <a onclick="login('${url.url}')" class="pointer" title="${url.uri}">${escapeHTML(url.title)}</a>`
})
$('#ins-suggest').html(urls)
} else {