This commit is contained in:
cutls 2021-04-01 14:48:54 +09:00
parent f80b8d031e
commit 5cb184505c

View File

@ -286,7 +286,7 @@ function getdataAdv(domain, at) {
} }
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')
var obj = JSON.parse(multi) var obj = JSON.parse(multi)
var target = obj.lengtth var target = obj.length
obj.push(add) obj.push(add)
localStorage.setItem('name_' + target, json['display_name']) localStorage.setItem('name_' + target, json['display_name'])
localStorage.setItem('user_' + target, json['acct']) localStorage.setItem('user_' + target, json['acct'])
@ -309,6 +309,8 @@ async function refresh(target, loadskip) {
console.log('refresh access token') console.log('refresh access token')
at = await refreshPleromaAt(obj[target]) at = await refreshPleromaAt(obj[target])
localStorage.setItem(`acct_${target}_at`, at) localStorage.setItem(`acct_${target}_at`, at)
obj[target].at = at
localStorage.setItem(`multi`, JSON.stringify(obj))
} }
var start = 'https://' + obj[target].domain + '/api/v1/accounts/verify_credentials' var start = 'https://' + obj[target].domain + '/api/v1/accounts/verify_credentials'
fetch(start, { fetch(start, {
@ -384,7 +386,7 @@ async function refreshPleromaAt(obj) {
'content-type': 'application/json' 'content-type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
grant_type : 'refresh_token', grant_type: 'refresh_token',
refresh_token: rt[0], refresh_token: rt[0],
client_id: rt[1], client_id: rt[1],
client_secret: rt[2] client_secret: rt[2]