spec(api): 一部APIをGETに対応・認証情報をヘッダーに (MisskeyIO#837)

This commit is contained in:
あわわわとーにゅ 2024-12-22 03:08:34 +09:00 committed by GitHub
parent 58513c1b81
commit 3362c464c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 155 additions and 26 deletions

View file

@ -32,6 +32,11 @@
renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.')
}
if (localStorage.getItem('id') === null) {
localStorage.setItem('id', crypto.randomUUID().replaceAll('-', ''));
}
let id = localStorage.getItem('id');
//#region Detect language & fetch translations
if (!Object.hasOwn(localStorage, 'locale')) {
let lang = localStorage.getItem('lang');
@ -40,12 +45,11 @@
}
const metaRes = await window.fetch('/api/meta', {
method: 'POST',
body: JSON.stringify({}),
method: 'GET',
credentials: 'omit',
cache: 'no-cache',
headers: {
'Content-Type': 'application/json',
'X-Client-Transaction-Id': `${id}-misskey-${crypto.randomUUID().replaceAll('-', '')}`
},
});
if (metaRes.status !== 200) {