Merge upstream

This commit is contained in:
ASTRO:? 2024-12-22 12:44:09 +09:00
commit 29c25555b8
No known key found for this signature in database
GPG key ID: 8947F3AF5B0B4BFE
40 changed files with 1183 additions and 667 deletions

View file

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