 463446795d
			
		
	
	463446795d
	
	
	
		
			
			* refactor/miLocalStorageのメソッドに戻り値追加 * refactor/miLocalStorageのキーとしてdebugがconfig.tsに存在するので追加 * fix/JSON.parseにnullは入らないのでnullの時は分岐させてnullにする * refactor/修正したファイルの型調整+記法の統一 * fix/型のためにlangがnullの時はhtmlの言語の設定をしない * refactor/catchで何もしないと警告が出るので修正 * refactor/細かい点の修正 * refactor/変数の二重定義になっていた二重定義になっていたので修正 * refactor/importの整理(通常のimportは最初に処理されるので影響はない想定) * fix/vueファイルに型を与えてインポート時の型エラーを防ぐ * refactor/開発環境のみで利用するので,eslintの設定を変更する * fix/vueの定義を最小限にする * fallback language to 'en-US' * remove accounts migration * fix:vueの型定義ファイルを消す --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
		
			
				
	
	
		
			23 lines
		
	
	
		
			949 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			949 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { miLocalStorage } from './local-storage';
 | |
| 
 | |
| const address = new URL(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 = url + '/api';
 | |
| export const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://') + '/streaming';
 | |
| export const lang = miLocalStorage.getItem('lang') ?? 'en-US';
 | |
| export const langs = _LANGS_;
 | |
| const preParseLocale = miLocalStorage.getItem('locale');
 | |
| export let locale = preParseLocale ? JSON.parse(preParseLocale) : null;
 | |
| export const version = _VERSION_;
 | |
| export const instanceName = siteName === 'Misskey' ? host : siteName;
 | |
| export const ui = miLocalStorage.getItem('ui');
 | |
| export const debug = miLocalStorage.getItem('debug') === 'true';
 | |
| 
 | |
| export function updateLocale(newLocale): void {
 | |
| 	locale = newLocale;
 | |
| }
 |