mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-15 09:15:44 +01:00
8a34d8e9d2
# Conflicts: # locales/en-US.yml # locales/ja-JP.yml # packages/backend/src/core/NoteCreateService.ts # packages/backend/src/core/NoteDeleteService.ts # packages/backend/src/core/NoteEditService.ts # packages/frontend-shared/js/config.ts # packages/frontend/src/boot/common.ts # packages/frontend/src/pages/following-feed.vue # packages/misskey-js/src/autogen/endpoint.ts
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import type { Locale } from '../../../locales/index.js';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
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;
|
|
|
|
export const host = address.host;
|
|
export const hostname = address.hostname;
|
|
export const url = address.origin;
|
|
export const apiUrl = location.origin + '/api';
|
|
export const wsOrigin = location.origin;
|
|
export const lang = localStorage.getItem('lang') ?? 'en-US';
|
|
export const langs = _LANGS_;
|
|
export const langsVersion = _LANGS_VERSION_;
|
|
const preParseLocale = localStorage.getItem('locale');
|
|
export let locale: Locale = preParseLocale ? JSON.parse(preParseLocale) : null;
|
|
export const version = _VERSION_;
|
|
export const instanceName = (siteName === 'Sharkey' || siteName == null) ? host : siteName;
|
|
export const ui = localStorage.getItem('ui');
|
|
export const debug = localStorage.getItem('debug') === 'true';
|
|
|
|
export function updateLocale(newLocale: Locale): void {
|
|
locale = newLocale;
|
|
}
|