mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-22 13:45:13 +00:00
Better recovery system
This commit is contained in:
parent
d59ad70802
commit
172cca6ad6
7 changed files with 124 additions and 116 deletions
|
@ -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."
|
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: "Successfully connected to Misskey's server"
|
||||||
success-desc: "It seems to be able to connect. Please reload the page."
|
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:
|
common/views/components/messaging.vue:
|
||||||
search-user: "Find an user"
|
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."
|
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: "Connexion au serveur de Misskey reussie!"
|
||||||
success-desc: "La connexion au serveur a été reussie. Veuillez recharger la page."
|
success-desc: "La connexion au serveur a été reussie. Veuillez recharger la page."
|
||||||
|
flush: "キャッシュの削除"
|
||||||
|
set-version: "バージョン指定"
|
||||||
|
|
||||||
common/views/components/messaging.vue:
|
common/views/components/messaging.vue:
|
||||||
search-user: "Trouver un utilisateur"
|
search-user: "Trouver un utilisateur"
|
||||||
|
|
|
@ -62,6 +62,8 @@ common/views/components/connect-failed.troubleshooter.vue:
|
||||||
no-server-desc: "お使いのPCのインターネット接続は正常ですが、Misskeyのサーバーには接続できませんでした。サーバーがダウンまたはメンテナンスしている可能性があるので、しばらくしてから再度御アクセスください。"
|
no-server-desc: "お使いのPCのインターネット接続は正常ですが、Misskeyのサーバーには接続できませんでした。サーバーがダウンまたはメンテナンスしている可能性があるので、しばらくしてから再度御アクセスください。"
|
||||||
success: "Misskeyのサーバーに接続できました"
|
success: "Misskeyのサーバーに接続できました"
|
||||||
success-desc: "正常に接続できるようです。ページを再度読み込みしてください。"
|
success-desc: "正常に接続できるようです。ページを再度読み込みしてください。"
|
||||||
|
flush: "キャッシュの削除"
|
||||||
|
set-version: "バージョン指定"
|
||||||
|
|
||||||
common/views/components/messaging.vue:
|
common/views/components/messaging.vue:
|
||||||
search-user: "ユーザーを探す"
|
search-user: "ユーザーを探す"
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
// ブロック内に入れてスコープを非グローバル化するとそれが防げます
|
// ブロック内に入れてスコープを非グローバル化するとそれが防げます
|
||||||
// (Chrome以外のブラウザでは検証していません)
|
// (Chrome以外のブラウザでは検証していません)
|
||||||
{
|
{
|
||||||
|
if (localStorage.getItem('shouldFlush') == 'true') refresh();
|
||||||
|
|
||||||
// Get the current url information
|
// Get the current url information
|
||||||
const url = new URL(location.href);
|
const url = new URL(location.href);
|
||||||
|
|
||||||
|
@ -103,19 +105,25 @@
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
'New version of Misskey available. The page will be reloaded.');
|
'New version of Misskey available. The page will be reloaded.');
|
||||||
|
|
||||||
// Clear cache (serive worker)
|
refresh();
|
||||||
try {
|
|
||||||
navigator.serviceWorker.controller.postMessage('clear');
|
|
||||||
|
|
||||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
|
||||||
registrations.forEach(registration => registration.unregister());
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Force reload
|
|
||||||
location.reload(true);
|
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
localStorage.setItem('shouldFlush', 'false');
|
||||||
|
|
||||||
|
// Clear cache (serive worker)
|
||||||
|
try {
|
||||||
|
navigator.serviceWorker.controller.postMessage('clear');
|
||||||
|
|
||||||
|
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||||
|
registrations.forEach(registration => registration.unregister());
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force reload
|
||||||
|
location.reload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,39 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="troubleshooter">
|
<div class="troubleshooter">
|
||||||
<h1>%fa:wrench%%i18n:@title%</h1>
|
<div class="body">
|
||||||
<div>
|
<h1>%fa:wrench%%i18n:@title%</h1>
|
||||||
<p :data-wip="network == null">
|
<div>
|
||||||
<template v-if="network != null">
|
<p :data-wip="network == null">
|
||||||
<template v-if="network">%fa:check%</template>
|
<template v-if="network != null">
|
||||||
<template v-if="!network">%fa:times%</template>
|
<template v-if="network">%fa:check%</template>
|
||||||
</template>
|
<template v-if="!network">%fa:times%</template>
|
||||||
{{ network == null ? '%i18n:!@checking-network%' : '%i18n:!@network%' }}<mk-ellipsis v-if="network == null"/>
|
</template>
|
||||||
</p>
|
{{ network == null ? '%i18n:!@checking-network%' : '%i18n:!@network%' }}<mk-ellipsis v-if="network == null"/>
|
||||||
<p v-if="network == true" :data-wip="internet == null">
|
</p>
|
||||||
<template v-if="internet != null">
|
<p v-if="network == true" :data-wip="internet == null">
|
||||||
<template v-if="internet">%fa:check%</template>
|
<template v-if="internet != null">
|
||||||
<template v-if="!internet">%fa:times%</template>
|
<template v-if="internet">%fa:check%</template>
|
||||||
</template>
|
<template v-if="!internet">%fa:times%</template>
|
||||||
{{ internet == null ? '%i18n:!@checking-internet%' : '%i18n:!@internet%' }}<mk-ellipsis v-if="internet == null"/>
|
</template>
|
||||||
</p>
|
{{ internet == null ? '%i18n:!@checking-internet%' : '%i18n:!@internet%' }}<mk-ellipsis v-if="internet == null"/>
|
||||||
<p v-if="internet == true" :data-wip="server == null">
|
</p>
|
||||||
<template v-if="server != null">
|
<p v-if="internet == true" :data-wip="server == null">
|
||||||
<template v-if="server">%fa:check%</template>
|
<template v-if="server != null">
|
||||||
<template v-if="!server">%fa:times%</template>
|
<template v-if="server">%fa:check%</template>
|
||||||
</template>
|
<template v-if="!server">%fa:times%</template>
|
||||||
{{ server == null ? '%i18n:!@checking-server%' : '%i18n:!@server%' }}<mk-ellipsis v-if="server == null"/>
|
</template>
|
||||||
</p>
|
{{ server == null ? '%i18n:!@checking-server%' : '%i18n:!@server%' }}<mk-ellipsis v-if="server == null"/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<p v-if="!end">%i18n:@finding%<mk-ellipsis/></p>
|
||||||
|
<p v-if="network === false"><b>%fa:exclamation-triangle%%i18n:@no-network%</b><br>%i18n:@no-network-desc%</p>
|
||||||
|
<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>
|
</div>
|
||||||
<p v-if="!end">%i18n:@finding%<mk-ellipsis/></p>
|
<footer>
|
||||||
<p v-if="network === false"><b>%fa:exclamation-triangle%%i18n:@no-network%</b><br>%i18n:@no-network-desc%</p>
|
<a href="/assets/flush.html">%i18n:@flush%</a> | <a href="/assets/version.html">%i18n:@set-version%</a>
|
||||||
<p v-if="internet === false"><b>%fa:exclamation-triangle%%i18n:@no-internet%</b><br>%i18n:@no-internet-desc%</p>
|
</footer>
|
||||||
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -77,61 +82,62 @@ export default Vue.extend({
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.troubleshooter
|
.troubleshooter
|
||||||
width 100%
|
> .body
|
||||||
max-width 500px
|
width 100%
|
||||||
text-align left
|
max-width 500px
|
||||||
background #fff
|
text-align left
|
||||||
border-radius 8px
|
background #fff
|
||||||
border solid 1px #ddd
|
border-radius 8px
|
||||||
|
border solid 1px #ddd
|
||||||
|
|
||||||
> h1
|
> h1
|
||||||
margin 0
|
margin 0
|
||||||
padding 0.6em 1.2em
|
padding 0.6em 1.2em
|
||||||
font-size 1em
|
font-size 1em
|
||||||
color #444
|
color #444
|
||||||
border-bottom solid 1px #eee
|
border-bottom solid 1px #eee
|
||||||
|
|
||||||
> [data-fa]
|
> [data-fa]
|
||||||
margin-right 0.25em
|
margin-right 0.25em
|
||||||
|
|
||||||
> div
|
> div
|
||||||
overflow hidden
|
overflow hidden
|
||||||
padding 0.6em 1.2em
|
padding 0.6em 1.2em
|
||||||
|
|
||||||
|
> p
|
||||||
|
margin 0.5em 0
|
||||||
|
font-size 0.9em
|
||||||
|
color #444
|
||||||
|
|
||||||
|
&[data-wip]
|
||||||
|
color #888
|
||||||
|
|
||||||
|
> [data-fa]
|
||||||
|
margin-right 0.25em
|
||||||
|
|
||||||
|
&.times
|
||||||
|
color #e03524
|
||||||
|
|
||||||
|
&.check
|
||||||
|
color #84c32f
|
||||||
|
|
||||||
> p
|
> p
|
||||||
margin 0.5em 0
|
margin 0
|
||||||
font-size 0.9em
|
padding 0.7em 1.2em
|
||||||
|
font-size 1em
|
||||||
color #444
|
color #444
|
||||||
|
border-top solid 1px #eee
|
||||||
|
|
||||||
&[data-wip]
|
|
||||||
color #888
|
|
||||||
|
|
||||||
> [data-fa]
|
|
||||||
margin-right 0.25em
|
|
||||||
|
|
||||||
&.times
|
|
||||||
color #e03524
|
|
||||||
|
|
||||||
&.check
|
|
||||||
color #84c32f
|
|
||||||
|
|
||||||
> p
|
|
||||||
margin 0
|
|
||||||
padding 0.7em 1.2em
|
|
||||||
font-size 1em
|
|
||||||
color #444
|
|
||||||
border-top solid 1px #eee
|
|
||||||
|
|
||||||
> b
|
|
||||||
> [data-fa]
|
|
||||||
margin-right 0.25em
|
|
||||||
|
|
||||||
&.success
|
|
||||||
> b
|
> b
|
||||||
color #39adad
|
> [data-fa]
|
||||||
|
margin-right 0.25em
|
||||||
|
|
||||||
&:not(.success)
|
&.success
|
||||||
> b
|
> b
|
||||||
color #ad4339
|
color #39adad
|
||||||
|
|
||||||
|
&:not(.success)
|
||||||
|
> b
|
||||||
|
color #ad4339
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
16
src/client/assets/flush.html
Normal file
16
src/client/assets/flush.html
Normal file
|
@ -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 a new issue