From 3b199acdd24057f1de3bc5d102c999bfcd56768f Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Thu, 14 Jul 2022 21:32:21 +0900
Subject: [PATCH] debug

---
 packages/client/src/init.ts | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts
index 98f69c701..243d28754 100644
--- a/packages/client/src/init.ts
+++ b/packages/client/src/init.ts
@@ -74,12 +74,14 @@ if (_DEV_) {
 
 // タッチデバイスでCSSの:hoverを機能させる
 document.addEventListener('touchend', () => {}, { passive: true });
+console.info('1');
 
 // 一斉リロード
 reloadChannel.addEventListener('message', path => {
 	if (path !== null) location.href = path;
 	else location.reload();
 });
+console.info('2');
 
 //#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
 // TODO: いつの日にか消したい
@@ -90,6 +92,7 @@ window.addEventListener('resize', () => {
 	document.documentElement.style.setProperty('--vh', `${vh}px`);
 });
 //#endregion
+console.info('3');
 
 // If mobile, insert the viewport meta tag
 if (['smartphone', 'tablet'].includes(deviceKind)) {
@@ -97,15 +100,18 @@ if (['smartphone', 'tablet'].includes(deviceKind)) {
 	viewport.setAttribute('content',
 		`${viewport.getAttribute('content')}, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover`);
 }
+console.info('4');
 
 //#region Set lang attr
 const html = document.documentElement;
 html.setAttribute('lang', lang);
 //#endregion
+console.info('5');
 
 //#region loginId
 const params = new URLSearchParams(location.search);
 const loginId = params.get('loginId');
+console.info('6', loginId);
 
 if (loginId) {
 	const target = getUrlWithoutLoginId(location.href);
@@ -119,6 +125,7 @@ if (loginId) {
 
 	history.replaceState({ misskey: 'loginId' }, '', target);
 }
+console.info('7');
 
 //#endregion
 
@@ -127,12 +134,14 @@ if ($i && $i.token) {
 	if (_DEV_) {
 		console.log('account cache found. refreshing...');
 	}
+	console.info('8');
 
 	refreshAccount();
 } else {
 	if (_DEV_) {
 		console.log('no account cache found.');
 	}
+	console.info('9');
 
 	// 連携ログインの場合用にCookieを参照する
 	const i = (document.cookie.match(/igi=(\w+)/) || [null, null])[1];
@@ -166,6 +175,7 @@ fetchInstanceMetaPromise.then(() => {
 	// Init service worker
 	initializeSw();
 });
+console.info('10');
 
 const app = createApp(
 	window.location.search === '?zen' ? defineAsyncComponent(() => import('@/ui/zen.vue')) :
@@ -175,6 +185,8 @@ const app = createApp(
 	defineAsyncComponent(() => import('@/ui/universal.vue')),
 );
 
+console.info('11');
+
 if (_DEV_) {
 	app.config.performance = true;
 }
@@ -191,12 +203,16 @@ widgets(app);
 directives(app);
 components(app);
 
+console.info('12');
+
 const splash = document.getElementById('splash');
 // 念のためnullチェック(HTMLが古い場合があるため(そのうち消す))
 if (splash) splash.addEventListener('transitionend', () => {
 	splash.remove();
 });
 
+console.info('13');
+
 // https://github.com/misskey-dev/misskey/pull/8575#issuecomment-1114239210
 // なぜかinit.tsの内容が2回実行されることがあるため、mountするdivを1つに制限する
 const rootEl = (() => {
@@ -215,19 +231,27 @@ const rootEl = (() => {
 	return rootEl;
 })();
 
+console.info('14');
+
 app.mount(rootEl);
 
+console.info('15');
+
 // boot.jsのやつを解除
 window.onerror = null;
 window.onunhandledrejection = null;
 
 reactionPicker.init();
 
+console.info('16');
+
 if (splash) {
 	splash.style.opacity = '0';
 	splash.style.pointerEvents = 'none';
 }
 
+console.info('17');
+
 // クライアントが更新されたか?
 const lastVersion = localStorage.getItem('lastVersion');
 if (lastVersion !== version) {
@@ -247,6 +271,8 @@ if (lastVersion !== version) {
 	}
 }
 
+console.info('18');
+
 // NOTE: この処理は必ず↑のクライアント更新時処理より後に来ること(テーマ再構築のため)
 watch(defaultStore.reactiveState.darkMode, (darkMode) => {
 	applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
@@ -267,6 +293,8 @@ watch(lightTheme, (theme) => {
 	}
 });
 
+console.info('19');
+
 //#region Sync dark mode
 if (ColdDeviceStorage.get('syncDeviceDarkMode')) {
 	defaultStore.set('darkMode', isDeviceDarkmode());
@@ -279,6 +307,8 @@ window.matchMedia('(prefers-color-scheme: dark)').addListener(mql => {
 });
 //#endregion
 
+console.info('20');
+
 fetchInstanceMetaPromise.then(() => {
 	if (defaultStore.state.themeInitial) {
 		if (instance.defaultLightTheme != null) ColdDeviceStorage.set('lightTheme', JSON5.parse(instance.defaultLightTheme));