diff options
author | Vitaly Takmazov | 2022-12-24 03:28:02 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-24 04:12:58 +0300 |
commit | 36ebeb217326c6bc23dedfde1e028ae2286afe02 (patch) | |
tree | dcd0156bcabd3b1e92dd7da48a386975a34b676f /src/main/assets | |
parent | 354988a7078a54bccf8afc8b49d3a178ae42789f (diff) |
Cacheable ActivityPub profiles
Diffstat (limited to 'src/main/assets')
-rw-r--r-- | src/main/assets/scripts.js | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js index bf74cfb5..b204766d 100644 --- a/src/main/assets/scripts.js +++ b/src/main/assets/scripts.js @@ -512,29 +512,22 @@ function addTag(tag) { return false; } -var users = {}; - function fetchUserUri(dataUri, callback) { - if (users[dataUri]) { - callback(users[dataUri]); - } else { - let data = new FormData(); - data.append('uri', dataUri); - fetch('/u/', { - method: 'POST', - body: data - }).then(handleErrors) - .then(response => { - return response.json(); - }) - .then(json => { - users[dataUri] = json; - callback(json); - }) - .catch(e => { - callback({ preferredUsername: dataUri }); - }); - } + let data = new FormData(); + data.append('uri', dataUri); + fetch('/api/u/', { + method: 'POST', + body: data + }).then(handleErrors) + .then(response => { + return response.json(); + }) + .then(json => { + callback(json); + }) + .catch(e => { + callback({ uname: dataUri, uri: dataUri }); + }); } function notificationsCheckPermissions(button) { |