Prepare: use officail API instead of instances.social

This commit is contained in:
cutls
2018-09-01 22:02:15 +09:00
parent 0ef0c80ac8
commit 25b385b77c
2 changed files with 34 additions and 5 deletions

View File

@@ -75,7 +75,7 @@ function load() {
load();
support();
//instances.social
//instances.social/instances API
function data(domain) {
$("#ins-upd").text("Loading...");
$("#ins-add").text("Loading...");
@@ -114,6 +114,30 @@ function data(domain) {
$("#ins-prof").attr('src', json.thumbnail);
}
});
var start = "https://" + domain +"/api/v1/instance";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
},
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
if (!json.error) {
$("#ins-name").text(json.title);
$("#ins-desc").text(text.description);
$("#ins-email").text(json.email);
$("#ins-toot").text(json.stats.status_count);
$("#ins-user").text(json.stats.user_count);
$("#ins-ver").text(json.version);
$("#ins-prof").attr('src', json.thumbnail);
$("#ins-admin").text(json.contanct_acount.username);
}
});
}
//アカウントデータ 消す