fix(boot): meta fetch problem
This commit is contained in:
parent
277afa312e
commit
3ea35434db
1 changed files with 23 additions and 23 deletions
|
@ -37,6 +37,25 @@
|
||||||
}
|
}
|
||||||
let id = localStorage.getItem('id');
|
let id = localStorage.getItem('id');
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//#region Detect language & fetch translations
|
//#region Detect language & fetch translations
|
||||||
if (!localStorage.hasOwnProperty('locale')) {
|
if (!localStorage.hasOwnProperty('locale')) {
|
||||||
const supportedLangs = LANGS;
|
const supportedLangs = LANGS;
|
||||||
|
@ -58,25 +77,6 @@
|
||||||
lang = 'ko-KR';
|
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`);
|
const localRes = await window.fetch(`/assets/locales/${lang}.${v}.json`);
|
||||||
if (localRes.status === 200) {
|
if (localRes.status === 200) {
|
||||||
localStorage.setItem('lang', lang);
|
localStorage.setItem('lang', lang);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue