-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: init.ts周りのeslintエラーと型の修正 (#10157)
* 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 <[email protected]>
- Loading branch information
Showing
3 changed files
with
27 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { miLocalStorage } from "./local-storage"; | ||
import { miLocalStorage } from './local-storage'; | ||
|
||
const address = new URL(location.href); | ||
const siteName = (document.querySelector('meta[property="og:site_name"]') as HTMLMetaElement)?.content; | ||
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'); | ||
export const lang = miLocalStorage.getItem('lang') ?? 'en-US'; | ||
export const langs = _LANGS_; | ||
export let locale = JSON.parse(miLocalStorage.getItem('locale')); | ||
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) { | ||
export function updateLocale(newLocale): void { | ||
locale = newLocale; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters