Better recovery system
This commit is contained in:
parent
d59ad70802
commit
172cca6ad6
|
@ -62,6 +62,8 @@ common/views/components/connect-failed.troubleshooter.vue:
|
|||
no-server-desc: "The network connection of your PC is normal, but you could not connect to Misskey's server. There is a possibility that the server is either down or under maintenance, please try again later."
|
||||
success: "Successfully connected to Misskey's server"
|
||||
success-desc: "It seems to be able to connect. Please reload the page."
|
||||
flush: "Clean cache"
|
||||
set-version: "Specify version"
|
||||
|
||||
common/views/components/messaging.vue:
|
||||
search-user: "Find an user"
|
||||
|
|
|
@ -62,6 +62,8 @@ common/views/components/connect-failed.troubleshooter.vue:
|
|||
no-server-desc: "Votre connexion est OK, mais il a été impossible de vous connecter au serveur de Misskey. Il y a des chances que le serveur soit hors-ligne ou en maintenance, veuillez ressayer plus tard."
|
||||
success: "Connexion au serveur de Misskey reussie!"
|
||||
success-desc: "La connexion au serveur a été reussie. Veuillez recharger la page."
|
||||
flush: "キャッシュの削除"
|
||||
set-version: "バージョン指定"
|
||||
|
||||
common/views/components/messaging.vue:
|
||||
search-user: "Trouver un utilisateur"
|
||||
|
|
|
@ -62,6 +62,8 @@ common/views/components/connect-failed.troubleshooter.vue:
|
|||
no-server-desc: "お使いのPCのインターネット接続は正常ですが、Misskeyのサーバーには接続できませんでした。サーバーがダウンまたはメンテナンスしている可能性があるので、しばらくしてから再度御アクセスください。"
|
||||
success: "Misskeyのサーバーに接続できました"
|
||||
success-desc: "正常に接続できるようです。ページを再度読み込みしてください。"
|
||||
flush: "キャッシュの削除"
|
||||
set-version: "バージョン指定"
|
||||
|
||||
common/views/components/messaging.vue:
|
||||
search-user: "ユーザーを探す"
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
// ブロック内に入れてスコープを非グローバル化するとそれが防げます
|
||||
// (Chrome以外のブラウザでは検証していません)
|
||||
{
|
||||
if (localStorage.getItem('shouldFlush') == 'true') refresh();
|
||||
|
||||
// Get the current url information
|
||||
const url = new URL(location.href);
|
||||
|
||||
|
@ -103,6 +105,13 @@
|
|||
'\n\n' +
|
||||
'New version of Misskey available. The page will be reloaded.');
|
||||
|
||||
refresh();
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
function refresh() {
|
||||
localStorage.setItem('shouldFlush', 'false');
|
||||
|
||||
// Clear cache (serive worker)
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
|
@ -117,5 +126,4 @@
|
|||
// Force reload
|
||||
location.reload(true);
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div class="troubleshooter">
|
||||
<div class="body">
|
||||
<h1>%fa:wrench%%i18n:@title%</h1>
|
||||
<div>
|
||||
<p :data-wip="network == null">
|
||||
|
@ -29,6 +30,10 @@
|
|||
<p v-if="internet === false"><b>%fa:exclamation-triangle%%i18n:@no-internet%</b><br>%i18n:@no-internet-desc%</p>
|
||||
<p v-if="server === false"><b>%fa:exclamation-triangle%%i18n:@no-server%</b><br>%i18n:@no-server-desc%</p>
|
||||
<p v-if="server === true" class="success"><b>%fa:info-circle%%i18n:@success%</b><br>%i18n:@success-desc%</p>
|
||||
</div>
|
||||
<footer>
|
||||
<a href="/assets/flush.html">%i18n:@flush%</a> | <a href="/assets/version.html">%i18n:@set-version%</a>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -77,6 +82,7 @@ export default Vue.extend({
|
|||
|
||||
<style lang="stylus" scoped>
|
||||
.troubleshooter
|
||||
> .body
|
||||
width 100%
|
||||
max-width 500px
|
||||
text-align left
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Misskeyのリカバリ</title>
|
||||
<script>
|
||||
const yn = window.confirm('キャッシュをクリアしますか?\n\nDo you want to clear caches?');
|
||||
if (yn) {
|
||||
localStorage.setItem('shouldFlush', 'true');
|
||||
}
|
||||
|
||||
location.href = '/';
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -1,28 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Misskeyのリカバリ</title>
|
||||
<script>
|
||||
const yn = window.confirm('キャッシュをクリアしますか?(他のタブでMisskeyを開いている状態だと正常にクリアできないので、他のMisskeyのタブをすべて閉じてから行ってください)\n\nDo you want to clear caches? (Please close all other Misskey tabs before clear cache)');
|
||||
if (yn) {
|
||||
try {
|
||||
navigator.serviceWorker.controller.postMessage('clear');
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
registrations.forEach(registration => registration.unregister());
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
alert('キャッシュをクリアしました。\n\ncache cleared.');
|
||||
alert('まもなくページを再度読み込みします。再度読み込みが終わると、再度キャッシュをクリアするか尋ねられるので、「キャンセル」を選択して抜けてください。\n\nWe will reload the page shortly. After that, you are asked whether you want to clear the cache again, so please select "Cancel" and exit.');
|
||||
setTimeout(() => {
|
||||
location.reload(true);
|
||||
}, 100);
|
||||
} else {
|
||||
location.href = '/';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
Loading…
Reference in New Issue