✌️
This commit is contained in:
		
							parent
							
								
									5f4f046cd6
								
							
						
					
					
						commit
						6078363311
					
				
					 3 changed files with 33 additions and 1 deletions
				
			
		| 
						 | 
					@ -69,4 +69,31 @@
 | 
				
			||||||
	script.setAttribute('async', 'true');
 | 
						script.setAttribute('async', 'true');
 | 
				
			||||||
	script.setAttribute('defer', 'true');
 | 
						script.setAttribute('defer', 'true');
 | 
				
			||||||
	head.appendChild(script);
 | 
						head.appendChild(script);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 1秒経ってもスクリプトがロードされない場合はバージョンが古くて
 | 
				
			||||||
 | 
						// 404になっているせいかもしれないので、バージョンを確認して古ければ更新する
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// 読み込まれたスクリプトからこのタイマーを解除できるように、
 | 
				
			||||||
 | 
						// グローバルにタイマーIDを代入しておく
 | 
				
			||||||
 | 
						window.mkBootTimer = window.setTimeout(async () => {
 | 
				
			||||||
 | 
							// Fetch meta
 | 
				
			||||||
 | 
							const res = await fetch(API + '/meta', {
 | 
				
			||||||
 | 
								method: 'POST',
 | 
				
			||||||
 | 
								cache: 'no-cache'
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Parse
 | 
				
			||||||
 | 
							const meta = await res.json();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Compare versions
 | 
				
			||||||
 | 
							if (meta.version != VERSION) {
 | 
				
			||||||
 | 
								alert(
 | 
				
			||||||
 | 
									'Misskeyの新しいバージョンがあります。ページを再度読み込みします。' +
 | 
				
			||||||
 | 
									'\n\n' +
 | 
				
			||||||
 | 
									'New version of Misskey available. The page will be reloaded.');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Force reload
 | 
				
			||||||
 | 
								location.reload(true);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}, 1000);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,8 @@ export default (i, endpoint, data = {}): Promise<{ [x: string]: any }> => {
 | 
				
			||||||
		fetch(endpoint.indexOf('://') > -1 ? endpoint : `${_API_URL_}/${endpoint}`, {
 | 
							fetch(endpoint.indexOf('://') > -1 ? endpoint : `${_API_URL_}/${endpoint}`, {
 | 
				
			||||||
			method: 'POST',
 | 
								method: 'POST',
 | 
				
			||||||
			body: JSON.stringify(data),
 | 
								body: JSON.stringify(data),
 | 
				
			||||||
			credentials: endpoint === 'signin' ? 'include' : 'omit'
 | 
								credentials: endpoint === 'signin' ? 'include' : 'omit',
 | 
				
			||||||
 | 
								cache: 'no-cache'
 | 
				
			||||||
		}).then(res => {
 | 
							}).then(res => {
 | 
				
			||||||
			if (--pending === 0) spinner.parentNode.removeChild(spinner);
 | 
								if (--pending === 0) spinner.parentNode.removeChild(spinner);
 | 
				
			||||||
			if (res.status === 200) {
 | 
								if (res.status === 200) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,10 @@ require('./common/tags');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
console.info(`Misskey v${_VERSION_} (葵 aoi)`);
 | 
					console.info(`Misskey v${_VERSION_} (葵 aoi)`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// BootTimer解除
 | 
				
			||||||
 | 
					window.clearTimeout((window as any).mkBootTimer);
 | 
				
			||||||
 | 
					delete (window as any).mkBootTimer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (_HOST_ != 'localhost') {
 | 
					if (_HOST_ != 'localhost') {
 | 
				
			||||||
	document.domain = _HOST_;
 | 
						document.domain = _HOST_;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue