Add: identity_proof

This commit is contained in:
Cutls 2019-09-05 23:55:34 +09:00
parent 2b84a27cdc
commit 38cff550e1
3 changed files with 12 additions and 13 deletions

View File

@ -643,6 +643,7 @@ audio {
.vis-data { .vis-data {
font-size: 1rem !important; font-size: 1rem !important;
margin: 5px; margin: 5px;
user-select: none;
} }
@keyframes jump { @keyframes jump {
0% { 0% {

View File

@ -554,11 +554,15 @@ function showFrl(more, acct_id) {
}); });
} }
//Keybase //Keybase
function udAdd(start) { function udAdd(acct_id, id, start) {
fetch(start, { var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at");
var proof = "https://" + domain + "/api/v1/accounts/" + id + "/identity_proofs"
fetch(proof, {
method: 'GET', method: 'GET',
headers: { headers: {
'Accept': 'application/json' 'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}, },
//body: JSON.stringify({}) //body: JSON.stringify({})
}).then(function (response) { }).then(function (response) {
@ -567,17 +571,11 @@ function udAdd(start) {
todo(error); todo(error);
console.error(error); console.error(error);
}).then(function (json) { }).then(function (json) {
var fields = json.attachment; var fields = json;
for (var i = 0; i < fields.length; i++) { for (var i = 0; i < fields.length; i++) {
if (fields[i].type == "IdentityProof") { var html = '<a href="' + fields[i].proof_url + '" target="_blank" class="cbadge teal waves-effect" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].provider)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].provider) + ':' + escapeHTML(fields[i].provider_username) + '</a>';
if (fields[i].signatureAlgorithm == "keybase") {
var html = '<a href="https://keybase.io/' + fields[i].name + '" target="_blank" class="cbadge teal waves-effect" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].signatureAlgorithm)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].signatureAlgorithm) + ':' + escapeHTML(fields[i].name) + '</a>';
} else {
var html = '<span class="cbadge teal" style="max-width:200px;" title="' + lang.lang_hisdata_key.replace("{{set}}", escapeHTML(fields[i].signatureAlgorithm)) + '"><i class="fas fa-key" aria-hidden="true"></i>' + escapeHTML(fields[i].signatureAlgorithm) + ':' + escapeHTML(fields[i].name) + '</span>';
}
$("#his-proof-prof").append(html) $("#his-proof-prof").append(html)
} }
}
}); });
fetch("https://notestock.osa-p.net/api/v1/isstock.json?id=" + start.replace("@", "users/"), { fetch("https://notestock.osa-p.net/api/v1/isstock.json?id=" + start.replace("@", "users/"), {
method: 'GET', method: 'GET',

View File

@ -205,7 +205,7 @@ function udg(user, acct_id) {
} }
todc(); todc();
//外部データ取得(死かもしれないので) //外部データ取得(死かもしれないので)
udAdd(json.url); udAdd(acct_id, user, json.url);
}); });
} }
function misskeyUdg(user, acct_id) { function misskeyUdg(user, acct_id) {