Compare commits
7 Commits
featured-s
...
tweak-boot
Author | SHA1 | Date | |
---|---|---|---|
![]() |
216be5e209 | ||
![]() |
40dd443f41 | ||
![]() |
043ab1f69b | ||
![]() |
21a3095eb0 | ||
![]() |
1b5f0571f7 | ||
![]() |
59e83605ac | ||
![]() |
130ff361c3 |
@@ -65,21 +65,21 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|||||||
this.followingsRepository.createQueryBuilder('following')
|
this.followingsRepository.createQueryBuilder('following')
|
||||||
.select('COUNT(DISTINCT following.followeeHost)')
|
.select('COUNT(DISTINCT following.followeeHost)')
|
||||||
.where('following.followeeHost IS NOT NULL')
|
.where('following.followeeHost IS NOT NULL')
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then(x => parseInt(x.count, 10)),
|
.then(x => parseInt(x.count, 10)),
|
||||||
this.followingsRepository.createQueryBuilder('following')
|
this.followingsRepository.createQueryBuilder('following')
|
||||||
.select('COUNT(DISTINCT following.followerHost)')
|
.select('COUNT(DISTINCT following.followerHost)')
|
||||||
.where('following.followerHost IS NOT NULL')
|
.where('following.followerHost IS NOT NULL')
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followerHost NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followerHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere(`following.followerHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
.andWhere(`following.followerHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then(x => parseInt(x.count, 10)),
|
.then(x => parseInt(x.count, 10)),
|
||||||
this.followingsRepository.createQueryBuilder('following')
|
this.followingsRepository.createQueryBuilder('following')
|
||||||
.select('COUNT(DISTINCT following.followeeHost)')
|
.select('COUNT(DISTINCT following.followeeHost)')
|
||||||
.where('following.followeeHost IS NOT NULL')
|
.where('following.followeeHost IS NOT NULL')
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'following.followeeHost NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
.andWhere(`following.followeeHost NOT IN (${ suspendedInstancesQuery.getQuery() })`)
|
||||||
.andWhere(`following.followeeHost IN (${ pubsubSubQuery.getQuery() })`)
|
.andWhere(`following.followeeHost IN (${ pubsubSubQuery.getQuery() })`)
|
||||||
.setParameters(pubsubSubQuery.getParameters())
|
.setParameters(pubsubSubQuery.getParameters())
|
||||||
@@ -88,7 +88,7 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|||||||
this.instancesRepository.createQueryBuilder('instance')
|
this.instancesRepository.createQueryBuilder('instance')
|
||||||
.select('COUNT(instance.id)')
|
.select('COUNT(instance.id)')
|
||||||
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
.where(`instance.host IN (${ subInstancesQuery.getQuery() })`)
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere('instance.suspensionState = \'none\'')
|
.andWhere('instance.suspensionState = \'none\'')
|
||||||
.andWhere('instance.isNotResponding = false')
|
.andWhere('instance.isNotResponding = false')
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
@@ -96,7 +96,7 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|||||||
this.instancesRepository.createQueryBuilder('instance')
|
this.instancesRepository.createQueryBuilder('instance')
|
||||||
.select('COUNT(instance.id)')
|
.select('COUNT(instance.id)')
|
||||||
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
.where(`instance.host IN (${ pubInstancesQuery.getQuery() })`)
|
||||||
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ANY(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
.andWhere(meta.blockedHosts.length === 0 ? '1=1' : 'instance.host NOT ILIKE ALL(ARRAY[:...blocked])', { blocked: meta.blockedHosts.flatMap(x => [x, `%.${x}`]) })
|
||||||
.andWhere('instance.suspensionState = \'none\'')
|
.andWhere('instance.suspensionState = \'none\'')
|
||||||
.andWhere('instance.isNotResponding = false')
|
.andWhere('instance.isNotResponding = false')
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
|
@@ -33,59 +33,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region Detect language & fetch translations
|
|
||||||
if (!localStorage.hasOwnProperty('locale')) {
|
|
||||||
const supportedLangs = LANGS;
|
|
||||||
let lang = localStorage.getItem('lang');
|
|
||||||
if (lang == null || !supportedLangs.includes(lang)) {
|
|
||||||
if (supportedLangs.includes(navigator.language)) {
|
|
||||||
lang = navigator.language;
|
|
||||||
} else {
|
|
||||||
lang = supportedLangs.find(x => x.split('-')[0] === navigator.language);
|
|
||||||
|
|
||||||
// Fallback
|
|
||||||
if (lang == null) lang = 'en-US';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for https://github.com/misskey-dev/misskey/issues/10202
|
|
||||||
if (lang == null || lang.toString == null || lang.toString() === 'null') {
|
|
||||||
console.error('invalid lang value detected!!!', typeof lang, lang);
|
|
||||||
lang = 'en-US';
|
|
||||||
}
|
|
||||||
|
|
||||||
const localRes = await window.fetch(`/assets/locales/${lang}.${v}.json`);
|
|
||||||
if (localRes.status === 200) {
|
|
||||||
localStorage.setItem('lang', lang);
|
|
||||||
localStorage.setItem('locale', await localRes.text());
|
|
||||||
localStorage.setItem('localeVersion', v);
|
|
||||||
} else {
|
|
||||||
renderError('LOCALE_FETCH');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region Script
|
//#region Script
|
||||||
async function importAppScript() {
|
async function importAppScript() {
|
||||||
await import(`/vite/${CLIENT_ENTRY}`)
|
await import(`/vite/${CLIENT_ENTRY}`)
|
||||||
@@ -176,10 +123,10 @@
|
|||||||
<span class="button-label-big">Reload / リロード</span>
|
<span class="button-label-big">Reload / リロード</span>
|
||||||
</button>
|
</button>
|
||||||
<p><b>The following actions may solve the problem. / 以下を行うと解決する可能性があります。</b></p>
|
<p><b>The following actions may solve the problem. / 以下を行うと解決する可能性があります。</b></p>
|
||||||
<p>Clear the browser cache / ブラウザのキャッシュをクリアする</p>
|
|
||||||
<p>Update your os and browser / ブラウザおよびOSを最新バージョンに更新する</p>
|
<p>Update your os and browser / ブラウザおよびOSを最新バージョンに更新する</p>
|
||||||
<p>Disable an adblocker / アドブロッカーを無効にする</p>
|
<p>Disable an adblocker / アドブロッカーを無効にする</p>
|
||||||
<p>(Tor Browser) Set dom.webaudio.enabled to true / dom.webaudio.enabledをtrueに設定する</p>
|
<p>Clear the browser cache / ブラウザのキャッシュをクリアする</p>
|
||||||
|
<p>(Tor Browser) Set dom.webaudio.enabled to true / dom.webaudio.enabledをtrueに設定する</p>
|
||||||
<details style="color: #86b300;">
|
<details style="color: #86b300;">
|
||||||
<summary>Other options / その他のオプション</summary>
|
<summary>Other options / その他のオプション</summary>
|
||||||
<a href="/flush">
|
<a href="/flush">
|
||||||
@@ -212,7 +159,7 @@
|
|||||||
<summary>
|
<summary>
|
||||||
<code>ERROR CODE: ${code}</code>
|
<code>ERROR CODE: ${code}</code>
|
||||||
</summary>
|
</summary>
|
||||||
<code>${JSON.stringify(details)}</code>`;
|
<code>${details.toString()} ${JSON.stringify(details)}</code>`;
|
||||||
errorsElement.appendChild(detailsElement);
|
errorsElement.appendChild(detailsElement);
|
||||||
addStyle(`
|
addStyle(`
|
||||||
* {
|
* {
|
||||||
@@ -320,6 +267,6 @@
|
|||||||
#errorInfo {
|
#errorInfo {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
}`)
|
}`);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@@ -23,27 +23,6 @@ async function main() {
|
|||||||
|
|
||||||
//#region Detect language & fetch translations
|
//#region Detect language & fetch translations
|
||||||
|
|
||||||
// dev-modeの場合は常に取り直す
|
|
||||||
const supportedLangs = _LANGS_.map(it => it[0]);
|
|
||||||
let lang: string | null | undefined = localStorage.getItem('lang');
|
|
||||||
if (lang == null || !supportedLangs.includes(lang)) {
|
|
||||||
if (supportedLangs.includes(navigator.language)) {
|
|
||||||
lang = navigator.language;
|
|
||||||
} else {
|
|
||||||
lang = supportedLangs.find(x => x.split('-')[0] === navigator.language);
|
|
||||||
|
|
||||||
// Fallback
|
|
||||||
if (lang == null) lang = 'en-US';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO:今のままだと言語ファイル変更後はpnpm devをリスタートする必要があるので、chokidarを使ったり等で対応できるようにする
|
|
||||||
const locale = _LANGS_FULL_.find(it => it[0] === lang);
|
|
||||||
localStorage.setItem('lang', lang);
|
|
||||||
localStorage.setItem('locale', JSON.stringify(locale[1]));
|
|
||||||
localStorage.setItem('localeVersion', _VERSION_);
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region Theme
|
//#region Theme
|
||||||
const theme = localStorage.getItem('theme');
|
const theme = localStorage.getItem('theme');
|
||||||
if (theme) {
|
if (theme) {
|
||||||
|
@@ -8,10 +8,10 @@ import { compareVersions } from 'compare-versions';
|
|||||||
import widgets from '@/widgets/index.js';
|
import widgets from '@/widgets/index.js';
|
||||||
import directives from '@/directives/index.js';
|
import directives from '@/directives/index.js';
|
||||||
import components from '@/components/index.js';
|
import components from '@/components/index.js';
|
||||||
import { version, lang, updateLocale, locale } from '@/config.js';
|
import { version, lang } from '@/config.js';
|
||||||
import { applyTheme } from '@/scripts/theme.js';
|
import { applyTheme } from '@/scripts/theme.js';
|
||||||
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
|
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode.js';
|
||||||
import { updateI18n } from '@/i18n.js';
|
import { locale, updateI18n, updateLocale } from '@/i18n.js';
|
||||||
import { $i, refreshAccount, login } from '@/account.js';
|
import { $i, refreshAccount, login } from '@/account.js';
|
||||||
import { defaultStore, ColdDeviceStorage } from '@/store.js';
|
import { defaultStore, ColdDeviceStorage } from '@/store.js';
|
||||||
import { fetchInstance, instance } from '@/instance.js';
|
import { fetchInstance, instance } from '@/instance.js';
|
||||||
@@ -78,22 +78,6 @@ export async function common(createVue: () => App<Element>) {
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Detect language & fetch translations
|
|
||||||
const localeVersion = miLocalStorage.getItem('localeVersion');
|
|
||||||
const localeOutdated = (localeVersion == null || localeVersion !== version || locale == null);
|
|
||||||
if (localeOutdated) {
|
|
||||||
const res = await window.fetch(`/assets/locales/${lang}.${version}.json`);
|
|
||||||
if (res.status === 200) {
|
|
||||||
const newLocale = await res.text();
|
|
||||||
const parsedNewLocale = JSON.parse(newLocale);
|
|
||||||
miLocalStorage.setItem('locale', newLocale);
|
|
||||||
miLocalStorage.setItem('localeVersion', version);
|
|
||||||
updateLocale(parsedNewLocale);
|
|
||||||
updateI18n(parsedNewLocale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
// タッチデバイスでCSSの:hoverを機能させる
|
// タッチデバイスでCSSの:hoverを機能させる
|
||||||
document.addEventListener('touchend', () => {}, { passive: true });
|
document.addEventListener('touchend', () => {}, { passive: true });
|
||||||
|
|
||||||
|
@@ -171,11 +171,11 @@ function onMousedown(evt: MouseEvent): void {
|
|||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: var(--X8);
|
background: hsl(from var(--accent) h s calc(l + 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: var(--X8);
|
background: hsl(from var(--accent) h s calc(l + 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,11 +220,11 @@ function onMousedown(evt: MouseEvent): void {
|
|||||||
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -117,7 +117,7 @@ const bannerStyle = computed(() => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
> .name {
|
> .name {
|
||||||
|
@@ -216,7 +216,7 @@ onUnmounted(() => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
> .fadeLabel {
|
> .fadeLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@@ -859,7 +859,7 @@ function emitUpdReaction(emoji: string, delta: number) {
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
&:hover > .collapsedLabel {
|
&:hover > .collapsedLabel {
|
||||||
background: var(--panelHighlight);
|
background: var(--panelHighlight);
|
||||||
|
@@ -62,7 +62,7 @@ onUnmounted(() => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
> .fadeLabel {
|
> .fadeLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@@ -1128,13 +1128,13 @@ defineExpose({
|
|||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
> .inner {
|
> .inner {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
> .inner {
|
> .inner {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ const collapsed = ref(isLong);
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
|
|
||||||
> .fadeLabel {
|
> .fadeLabel {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<template v-if="showDecoration">
|
<template v-if="showDecoration">
|
||||||
<img
|
<img
|
||||||
v-for="decoration in decorations ?? user.avatarDecorations"
|
v-for="decoration in decorations ?? user.avatarDecorations"
|
||||||
:class="[$style.decoration]"
|
:class="[$style.decoration, { [$style.decorationBlink]: decoration.blink }]"
|
||||||
:src="getDecorationUrl(decoration)"
|
:src="getDecorationUrl(decoration)"
|
||||||
:style="{
|
:style="{
|
||||||
rotate: getDecorationAngle(decoration),
|
rotate: getDecorationAngle(decoration),
|
||||||
@@ -60,7 +60,7 @@ const props = withDefaults(defineProps<{
|
|||||||
link?: boolean;
|
link?: boolean;
|
||||||
preview?: boolean;
|
preview?: boolean;
|
||||||
indicator?: boolean;
|
indicator?: boolean;
|
||||||
decorations?: Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'>[];
|
decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[];
|
||||||
forceShowDecoration?: boolean;
|
forceShowDecoration?: boolean;
|
||||||
}>(), {
|
}>(), {
|
||||||
target: null,
|
target: null,
|
||||||
@@ -330,4 +330,17 @@ watch(() => props.user.avatarBlurhash, () => {
|
|||||||
width: 200%;
|
width: 200%;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.decorationBlink {
|
||||||
|
animation: blink 1s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
0%, 100% {
|
||||||
|
filter: brightness(2);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
filter: brightness(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -5,6 +5,28 @@
|
|||||||
|
|
||||||
import { miLocalStorage } from '@/local-storage.js';
|
import { miLocalStorage } from '@/local-storage.js';
|
||||||
|
|
||||||
|
//#region language detection
|
||||||
|
const supportedLangs = _LANGS_.map(it => it[0]);
|
||||||
|
let _lang = miLocalStorage.getItem('lang');
|
||||||
|
if (_lang == null || !supportedLangs.includes(_lang)) {
|
||||||
|
if (supportedLangs.includes(navigator.language)) {
|
||||||
|
_lang = navigator.language;
|
||||||
|
} else {
|
||||||
|
_lang = supportedLangs.find(x => x.split('-')[0] === navigator.language) ?? null;
|
||||||
|
|
||||||
|
// Fallback
|
||||||
|
if (_lang == null) _lang = 'en-US';
|
||||||
|
}
|
||||||
|
miLocalStorage.setItem('lang', _lang);
|
||||||
|
}
|
||||||
|
// for https://github.com/misskey-dev/misskey/issues/10202
|
||||||
|
if (_lang.toString == null || _lang.toString() === 'null') {
|
||||||
|
console.error('invalid lang value detected!!!', typeof _lang, _lang);
|
||||||
|
_lang = 'en-US';
|
||||||
|
miLocalStorage.setItem('lang', _lang);
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
const address = new URL(document.querySelector<HTMLMetaElement>('meta[property="instance_url"]')?.content || location.href);
|
const address = new URL(document.querySelector<HTMLMetaElement>('meta[property="instance_url"]')?.content || location.href);
|
||||||
const siteName = document.querySelector<HTMLMetaElement>('meta[property="og:site_name"]')?.content;
|
const siteName = document.querySelector<HTMLMetaElement>('meta[property="og:site_name"]')?.content;
|
||||||
|
|
||||||
@@ -13,15 +35,9 @@ export const hostname = address.hostname;
|
|||||||
export const url = address.origin;
|
export const url = address.origin;
|
||||||
export const apiUrl = location.origin + '/api';
|
export const apiUrl = location.origin + '/api';
|
||||||
export const wsOrigin = location.origin;
|
export const wsOrigin = location.origin;
|
||||||
export const lang = miLocalStorage.getItem('lang') ?? 'en-US';
|
export const lang = _lang;
|
||||||
export const langs = _LANGS_;
|
export const langs = _LANGS_;
|
||||||
const preParseLocale = miLocalStorage.getItem('locale');
|
|
||||||
export let locale = preParseLocale ? JSON.parse(preParseLocale) : null;
|
|
||||||
export const version = _VERSION_;
|
export const version = _VERSION_;
|
||||||
export const instanceName = siteName === 'Misskey' || siteName == null ? host : siteName;
|
export const instanceName = siteName === 'Misskey' || siteName == null ? host : siteName;
|
||||||
export const ui = miLocalStorage.getItem('ui');
|
export const ui = miLocalStorage.getItem('ui');
|
||||||
export const debug = miLocalStorage.getItem('debug') === 'true';
|
export const debug = miLocalStorage.getItem('debug') === 'true';
|
||||||
|
|
||||||
export function updateLocale(newLocale): void {
|
|
||||||
locale = newLocale;
|
|
||||||
}
|
|
||||||
|
@@ -5,8 +5,50 @@
|
|||||||
|
|
||||||
import { markRaw } from 'vue';
|
import { markRaw } from 'vue';
|
||||||
import type { Locale } from '../../../locales/index.js';
|
import type { Locale } from '../../../locales/index.js';
|
||||||
import { locale } from '@/config.js';
|
|
||||||
import { I18n } from '@/scripts/i18n.js';
|
import { I18n } from '@/scripts/i18n.js';
|
||||||
|
import { miLocalStorage } from '@/local-storage.js';
|
||||||
|
import { version, lang } from '@/config.js';
|
||||||
|
|
||||||
|
const preParseLocale = miLocalStorage.getItem('locale');
|
||||||
|
export let locale = preParseLocale ? JSON.parse(preParseLocale) : null;
|
||||||
|
|
||||||
|
if (locale == null) {
|
||||||
|
const localRes = await window.fetch(`/assets/locales/${lang}.${version}.json`);
|
||||||
|
if (localRes.status === 200) {
|
||||||
|
locale = await localRes.json();
|
||||||
|
localStorage.setItem('locale', JSON.stringify(locale));
|
||||||
|
localStorage.setItem('localeVersion', version);
|
||||||
|
} else {
|
||||||
|
throw new Error('Failed to fetch locale file');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#region Detect language & fetch translations
|
||||||
|
const localeVersion = miLocalStorage.getItem('localeVersion');
|
||||||
|
const localeOutdated = (localeVersion == null || localeVersion !== version);
|
||||||
|
if (localeOutdated) {
|
||||||
|
const res = await window.fetch(`/assets/locales/${lang}.${version}.json`);
|
||||||
|
if (res.status === 200) {
|
||||||
|
const newLocale = await res.text();
|
||||||
|
const parsedNewLocale = JSON.parse(newLocale);
|
||||||
|
miLocalStorage.setItem('locale', newLocale);
|
||||||
|
miLocalStorage.setItem('localeVersion', version);
|
||||||
|
locale = parsedNewLocale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
// dev-modeの場合は常に取り直す
|
||||||
|
if (_DEV_) {
|
||||||
|
const x = _LANGS_FULL_.find(it => it[0] === lang)!;
|
||||||
|
localStorage.setItem('locale', JSON.stringify(x[1]));
|
||||||
|
localStorage.setItem('localeVersion', version);
|
||||||
|
locale = x[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateLocale(newLocale): void {
|
||||||
|
locale = newLocale;
|
||||||
|
}
|
||||||
|
|
||||||
export const i18n = markRaw(new I18n<Locale>(locale));
|
export const i18n = markRaw(new I18n<Locale>(locale));
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<MkSpacer :contentMax="900">
|
<MkSpacer :contentMax="900">
|
||||||
<div :class="$style.root" class="_gaps">
|
<div :class="$style.root" class="_gaps">
|
||||||
<div :class="$style.subMenus" class="_gaps">
|
<div :class="$style.subMenus" class="_gaps">
|
||||||
<MkButton link to="/admin/abuse-report-notification-recipient" primary>{{ "通知設定" }}</MkButton>
|
<MkButton link to="/admin/abuse-report-notification-recipient" primary>{{ i18n.ts.notificationSetting }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :class="$style.inputs" class="_gaps">
|
<div :class="$style.inputs" class="_gaps">
|
||||||
|
@@ -310,7 +310,7 @@ definePageMetadata(() => ({
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
.bannerStatus {
|
.bannerStatus {
|
||||||
|
@@ -96,6 +96,7 @@ const decorationsForPreview = computed(() => {
|
|||||||
flipH: flipH.value,
|
flipH: flipH.value,
|
||||||
offsetX: offsetX.value,
|
offsetX: offsetX.value,
|
||||||
offsetY: offsetY.value,
|
offsetY: offsetY.value,
|
||||||
|
blink: true,
|
||||||
};
|
};
|
||||||
const decorations = [...$i.avatarDecorations];
|
const decorations = [...$i.avatarDecorations];
|
||||||
if (props.usingIndex != null) {
|
if (props.usingIndex != null) {
|
||||||
|
@@ -84,7 +84,7 @@ onUpdated(() => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: linear-gradient(0deg, var(--panel), var(--X15));
|
background: linear-gradient(0deg, var(--panel), color(from var(--panel) srgb r g b / 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -255,11 +255,11 @@ rt {
|
|||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: var(--X8);
|
background: hsl(from var(--accent) h s calc(l + 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: var(--X9);
|
background: hsl(from var(--accent) h s calc(l - 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,11 +269,11 @@ rt {
|
|||||||
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
background: linear-gradient(90deg, var(--buttonGradateA), var(--buttonGradateB));
|
||||||
|
|
||||||
&:not(:disabled):hover {
|
&:not(:disabled):hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled):active {
|
&:not(:disabled):active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,21 +77,14 @@
|
|||||||
codeBoolean: '#c59eff',
|
codeBoolean: '#c59eff',
|
||||||
deckBg: '#000',
|
deckBg: '#000',
|
||||||
htmlThemeColor: '@bg',
|
htmlThemeColor: '@bg',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.3)',
|
X11: 'rgba(0, 0, 0, 0.3)',
|
||||||
X12: 'rgba(255, 255, 255, 0.1)',
|
X12: 'rgba(255, 255, 255, 0.1)',
|
||||||
X13: 'rgba(255, 255, 255, 0.15)',
|
X13: 'rgba(255, 255, 255, 0.15)',
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
X17: ':alpha<0.8<@bg',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
codeHighlighter: {
|
codeHighlighter: {
|
||||||
|
@@ -77,21 +77,14 @@
|
|||||||
codeBoolean: '#62b70c',
|
codeBoolean: '#62b70c',
|
||||||
deckBg: ':darken<3<@bg',
|
deckBg: ':darken<3<@bg',
|
||||||
htmlThemeColor: '@bg',
|
htmlThemeColor: '@bg',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(0, 0, 0, 0.05)',
|
X3: 'rgba(0, 0, 0, 0.05)',
|
||||||
X4: 'rgba(0, 0, 0, 0.1)',
|
X4: 'rgba(0, 0, 0, 0.1)',
|
||||||
X5: 'rgba(0, 0, 0, 0.05)',
|
X5: 'rgba(0, 0, 0, 0.05)',
|
||||||
X6: 'rgba(0, 0, 0, 0.25)',
|
X6: 'rgba(0, 0, 0, 0.25)',
|
||||||
X7: 'rgba(0, 0, 0, 0.05)',
|
X7: 'rgba(0, 0, 0, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.1)',
|
X11: 'rgba(0, 0, 0, 0.1)',
|
||||||
X12: 'rgba(0, 0, 0, 0.1)',
|
X12: 'rgba(0, 0, 0, 0.1)',
|
||||||
X13: 'rgba(0, 0, 0, 0.15)',
|
X13: 'rgba(0, 0, 0, 0.15)',
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
X17: ':alpha<0.8<@bg',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
codeHighlighter: {
|
codeHighlighter: {
|
||||||
|
@@ -57,20 +57,13 @@
|
|||||||
wallpaperOverlay: 'rgba(0, 0, 0, 0.5)',
|
wallpaperOverlay: 'rgba(0, 0, 0, 0.5)',
|
||||||
panelHeaderDivider: 'rgba(0, 0, 0, 0)',
|
panelHeaderDivider: 'rgba(0, 0, 0, 0)',
|
||||||
scrollbarHandleHover: 'rgba(255, 255, 255, 0.4)',
|
scrollbarHandleHover: 'rgba(255, 255, 255, 0.4)',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.3)',
|
X11: 'rgba(0, 0, 0, 0.3)',
|
||||||
X12: 'rgba(255, 255, 255, 0.1)',
|
X12: 'rgba(255, 255, 255, 0.1)',
|
||||||
X13: 'rgba(255, 255, 255, 0.15)',
|
X13: 'rgba(255, 255, 255, 0.15)',
|
||||||
X14: ':alpha<0.5<@navBg',
|
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -3,14 +3,11 @@
|
|||||||
base: 'dark',
|
base: 'dark',
|
||||||
name: 'Mi U0 Dark',
|
name: 'Mi U0 Dark',
|
||||||
props: {
|
props: {
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
bg: '#172426',
|
bg: '#172426',
|
||||||
fg: '#dadada',
|
fg: '#dadada',
|
||||||
X10: ':alpha<0.4<@accent',
|
X10: ':alpha<0.4<@accent',
|
||||||
|
@@ -3,14 +3,11 @@
|
|||||||
base: 'light',
|
base: 'light',
|
||||||
name: 'Mi U0 Light',
|
name: 'Mi U0 Light',
|
||||||
props: {
|
props: {
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(255, 255, 255, 0.05)',
|
X3: 'rgba(255, 255, 255, 0.05)',
|
||||||
X4: 'rgba(255, 255, 255, 0.1)',
|
X4: 'rgba(255, 255, 255, 0.1)',
|
||||||
X5: 'rgba(255, 255, 255, 0.05)',
|
X5: 'rgba(255, 255, 255, 0.05)',
|
||||||
X6: 'rgba(255, 255, 255, 0.15)',
|
X6: 'rgba(255, 255, 255, 0.15)',
|
||||||
X7: 'rgba(255, 255, 255, 0.05)',
|
X7: 'rgba(255, 255, 255, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
bg: '#e7e7eb',
|
bg: '#e7e7eb',
|
||||||
fg: '#5f5f5f',
|
fg: '#5f5f5f',
|
||||||
X10: ':alpha<0.4<@accent',
|
X10: ':alpha<0.4<@accent',
|
||||||
|
@@ -60,21 +60,13 @@
|
|||||||
fgTransparentWeak: ':alpha<0.75<@fg',
|
fgTransparentWeak: ':alpha<0.75<@fg',
|
||||||
panelHeaderDivider: '@divider',
|
panelHeaderDivider: '@divider',
|
||||||
scrollbarHandleHover: 'rgba(0, 0, 0, 0.4)',
|
scrollbarHandleHover: 'rgba(0, 0, 0, 0.4)',
|
||||||
X2: ':darken<2<@panel',
|
|
||||||
X3: 'rgba(0, 0, 0, 0.05)',
|
X3: 'rgba(0, 0, 0, 0.05)',
|
||||||
X4: 'rgba(0, 0, 0, 0.1)',
|
X4: 'rgba(0, 0, 0, 0.1)',
|
||||||
X5: 'rgba(0, 0, 0, 0.05)',
|
X5: 'rgba(0, 0, 0, 0.05)',
|
||||||
X6: 'rgba(0, 0, 0, 0.25)',
|
X6: 'rgba(0, 0, 0, 0.25)',
|
||||||
X7: 'rgba(0, 0, 0, 0.05)',
|
X7: 'rgba(0, 0, 0, 0.05)',
|
||||||
X8: ':lighten<5<@accent',
|
|
||||||
X9: ':darken<5<@accent',
|
|
||||||
X10: ':alpha<0.4<@accent',
|
|
||||||
X11: 'rgba(0, 0, 0, 0.1)',
|
X11: 'rgba(0, 0, 0, 0.1)',
|
||||||
X12: 'rgba(0, 0, 0, 0.1)',
|
X12: 'rgba(0, 0, 0, 0.1)',
|
||||||
X13: 'rgba(0, 0, 0, 0.15)',
|
X13: 'rgba(0, 0, 0, 0.15)',
|
||||||
X14: ':alpha<0.5<@navBg',
|
|
||||||
X15: ':alpha<0<@panel',
|
|
||||||
X16: ':alpha<0.7<@panel',
|
|
||||||
X17: ':alpha<0.8<@bg',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -450,7 +450,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: var(--X2);
|
background: hsl(from var(--panel) h s calc(l - 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,11 +460,11 @@ body {
|
|||||||
color: var(--fgOnAccent);
|
color: var(--fgOnAccent);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -427,7 +427,7 @@ $widgets-hide-threshold: 1090px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: var(--X2);
|
background: hsl(from var(--panel) h s calc(l - 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,11 +437,11 @@ $widgets-hide-threshold: 1090px;
|
|||||||
color: var(--fgOnAccent);
|
color: var(--fgOnAccent);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background: linear-gradient(90deg, var(--X8), var(--X8));
|
background: linear-gradient(90deg, hsl(from var(--accent) h s calc(l + 5)), hsl(from var(--accent) h s calc(l + 5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user