This commit is contained in:
ha-dai 2017-10-26 15:05:20 +09:00
commit 80adba7522
13 changed files with 312 additions and 72 deletions

View file

@ -2,9 +2,17 @@ ChangeLog (Release Notes)
=========================
主に notable な changes を書いていきます
2747 (2017/10/25)
-----------------
* Fix: 非ログイン状態ですべてのページが致命的な問題を発生させる (#89)
2742 (2017/10/25)
-----------------
* New: トラブルシューティングを実装するなど
2735 (2017/10/22)
-----------------
* モバイル版からでもクライアントバージョンを確認できるように
* New: モバイル版からでもクライアントバージョンを確認できるように
2732 (2017/10/22)
-----------------

View file

@ -1,4 +1,6 @@
common:
misskey: "Note everything and share it others using Misskey."
time:
unknown: "unknown"
future: "future"
@ -66,6 +68,25 @@ common:
title: "Unable to connect to the server"
description: "There is a problem with Internet connection, or the server may be down or maintaining. Please {try again} later."
thanks: "Thank you for using Misskey."
troubleshoot: "Troubleshoot"
troubleshooter:
title: "TroubleShooting"
network: "Network connection"
checking-network: "Checking network connection"
internet: "Internet connection"
checking-internet: "Checking internet connection"
server: "Server connection"
checking-server: "Checking server connection"
finding: "Finding a problem"
no-network: "There is no Network connection"
no-network-desc: "Please make sure you are connected to the Network."
no-internet: "There is no Internet connection"
no-internet-desc: "Please make sure you are connected to the Internet."
no-server: "Unable to connect to the server"
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 down or maintaining, please try to access it again after a while."
success: "Successfully connect to the Misskey's server"
success-desc: "It seems to be able to connect normally. Please reload the page."
mk-forkit:
open-github-link: "View source on Github"

View file

@ -1,4 +1,6 @@
common:
misskey: "Misskeyに何でも投稿して皆と共有しましょう。"
time:
unknown: "なぞのじかん"
future: "未来"
@ -66,6 +68,25 @@ common:
title: "サーバーに接続できません"
description: "インターネット回線に問題があるか、サーバーがダウンまたはメンテナンスしている可能性があります。しばらくしてから{再度お試し}ください。"
thanks: "いつもMisskeyをご利用いただきありがとうございます。"
troubleshoot: "トラブルシュート"
troubleshooter:
title: "トラブルシューティング"
network: "ネットワーク接続"
checking-network: "ネットワーク接続を確認中"
internet: "インターネット接続"
checking-internet: "インターネット接続を確認中"
server: "サーバー接続"
checking-server: "サーバー接続を確認中"
finding: "問題を調べています"
no-network: "ネットワークに接続されていません"
no-network-desc: "お使いのPCのネットワーク接続が正常か確認してください。"
no-internet: "インターネットに接続されていません"
no-internet-desc: "ネットワークには接続されていますが、インターネットには接続されていないようです。お使いのPCのインターネット接続が正常か確認してください。"
no-server: "Misskeyのサーバーに接続できません"
no-server-desc: "お使いのPCのネットワーク接続は正常ですが、Misskeyのサーバーには接続できませんでした。サーバーがダウンまたはメンテナンスしている可能性があるので、しばらくしてから再度御アクセスください。"
success: "Misskeyのサーバーに接続できました"
success-desc: "正常に接続できるようです。ページを再度読み込みしてください。"
mk-forkit:
open-github-link: "View source on Github"

View file

@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "0.0.2735",
"version": "0.0.2747",
"license": "MIT",
"description": "A miniblog-based SNS",
"bugs": "https://github.com/syuilo/misskey/issues",

View file

@ -8,6 +8,8 @@
}</a>{
'%i18n:common.tags.mk-error.description%'.substr('%i18n:common.tags.mk-error.description%'.indexOf('}') + 1)
}</p>
<button if={ !troubleshooting } onclick={ troubleshoot }>%i18n:common.tags.mk-error.troubleshoot%</button>
<mk-troubleshooter if={ troubleshooting }/>
<p class="thanks">%i18n:common.tags.mk-error.thanks%</p>
<style>
:scope
@ -36,6 +38,25 @@
font-size 1em
color #666
> button
display block
margin 1em auto 0 auto
padding 8px 10px
color $theme-color-foreground
background $theme-color
&:focus
outline solid 3px rgba($theme-color, 0.3)
&:hover
background lighten($theme-color, 10%)
&:active
background darken($theme-color, 10%)
> mk-troubleshooter
margin 1em auto 0 auto
> .thanks
display block
margin 2em auto 0 auto
@ -55,6 +76,8 @@
</style>
<script>
this.troubleshooting = false;
this.on('mount', () => {
document.title = 'Oops!';
document.documentElement.style.background = '#f8f8f8';
@ -63,5 +86,132 @@
this.reload = () => {
location.reload();
};
this.troubleshoot = () => {
this.update({
troubleshooting: true
});
};
</script>
</mk-error>
<mk-troubleshooter>
<h1><i class="fa fa-wrench"></i>%i18n:common.tags.mk-error.troubleshooter.title%</h1>
<div>
<p data-wip={ network == null }><i if={ network != null } class="fa fa-{ network ? 'check' : 'times' }"></i>{ network == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-network%' : '%i18n:common.tags.mk-error.troubleshooter.network%' }<mk-ellipsis if={ network == null }/></p>
<p if={ network == true } data-wip={ internet == null }><i if={ internet != null } class="fa fa-{ internet ? 'check' : 'times' }"></i>{ internet == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-internet%' : '%i18n:common.tags.mk-error.troubleshooter.internet%' }<mk-ellipsis if={ internet == null }/></p>
<p if={ internet == true } data-wip={ server == null }><i if={ server != null } class="fa fa-{ server ? 'check' : 'times' }"></i>{ server == null ? '%i18n:common.tags.mk-error.troubleshooter.checking-server%' : '%i18n:common.tags.mk-error.troubleshooter.server%' }<mk-ellipsis if={ server == null }/></p>
</div>
<p if={ !end }>%i18n:common.tags.mk-error.troubleshooter.finding%<mk-ellipsis/></p>
<p if={ network === false }><b><i class="fa fa-exclamation-triangle"></i>%i18n:common.tags.mk-error.troubleshooter.no-network%</b><br>%i18n:common.tags.mk-error.troubleshooter.no-network-desc%</p>
<p if={ internet === false }><b><i class="fa fa-exclamation-triangle"></i>%i18n:common.tags.mk-error.troubleshooter.no-internet%</b><br>%i18n:common.tags.mk-error.troubleshooter.no-internet-desc%</p>
<p if={ server === false }><b><i class="fa fa-exclamation-triangle"></i>%i18n:common.tags.mk-error.troubleshooter.no-server%</b><br>%i18n:common.tags.mk-error.troubleshooter.no-server-desc%</p>
<p if={ server === true } class="success"><b><i class="fa fa-info-circle"></i>%i18n:common.tags.mk-error.troubleshooter.success%</b><br>%i18n:common.tags.mk-error.troubleshooter.success-desc%</p>
<style>
:scope
display block
width 100%
max-width 500px
text-align left
background #fff
border-radius 8px
border solid 1px #ddd
> h1
margin 0
padding 0.6em 1.2em
font-size 1em
color #444
border-bottom solid 1px #eee
> i
margin-right 0.25em
> div
overflow hidden
padding 0.6em 1.2em
> p
margin 0.5em 0
font-size 0.9em
color #444
&[data-wip]
color #888
> i
margin-right 0.25em
&.fa-times
color #e03524
&.fa-check
color #84c32f
> p
margin 0
padding 0.6em 1.2em
font-size 1em
color #444
border-top solid 1px #eee
> b
> i
margin-right 0.25em
&.success
> b
color #39adad
&:not(.success)
> b
color #ad4339
</style>
<script>
import CONFIG from '../../common/scripts/config';
this.on('mount', () => {
this.update({
network: navigator.onLine
});
if (!this.network) {
this.update({
end: true
});
return;
}
// Check internet connection
fetch('https://google.com?rand=' + Math.random(), {
mode: 'no-cors'
}).then(() => {
this.update({
internet: true
});
// Check misskey server is available
fetch(`${CONFIG.apiUrl}/meta`).then(() => {
this.update({
end: true,
server: true
});
})
.catch(() => {
this.update({
end: true,
server: false
});
});
})
.catch(() => {
this.update({
end: true,
internet: false
});
});
});
</script>
</mk-troubleshooter>

View file

@ -1,5 +1,5 @@
<mk-version-home-widget>
<p>ver { version }</p>
<p>ver { version } (葵 aoi)</p>
<style>
:scope
display block

View file

@ -424,6 +424,7 @@
import compile from '../../common/scripts/text-compiler';
import dateStringify from '../../common/scripts/date-stringify';
this.mixin('i');
this.mixin('api');
this.mixin('stream');
this.mixin('user-preview');
@ -462,24 +463,31 @@
};
this.capture = withHandler => {
if (this.SIGNIN) {
this.stream.send({
type: 'capture',
id: this.post.id
});
if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
}
};
this.decapture = withHandler => {
if (this.SIGNIN) {
this.stream.send({
type: 'decapture',
id: this.post.id
});
if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
}
};
this.on('mount', () => {
this.capture(true);
if (this.SIGNIN) {
this.stream.on('_connected_', this.onStreamConnected);
}
if (this.p.text) {
const tokens = this.p.ast;

View file

@ -5,7 +5,7 @@
<div class="content">
<yield />
</div>
<mk-stream-indicator/>
<mk-stream-indicator if={ SIGNIN }/>
<style>
:scope
display block
@ -416,6 +416,7 @@
this.page = this.opts.page;
this.on('mount', () => {
if (this.SIGNIN) {
this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages);
this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage);
@ -427,11 +428,14 @@
});
}
});
}
});
this.on('unmount', () => {
if (this.SIGNIN) {
this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages);
this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage);
}
});
this.onReadAllMessagingMessages = () => {

View file

@ -2,7 +2,7 @@
* App initializer
*/
"use strict";
'use strict';
import * as riot from 'riot';
import api from './common/scripts/api';
@ -19,7 +19,15 @@ require('./common/tags');
* APP ENTRY POINT!
*/
console.info(`Misskey v${VERSION}`);
console.info(`Misskey v${VERSION} (葵 aoi)`);
{ // Set description meta tag
const head = document.getElementsByTagName('head')[0];
const meta = document.createElement('meta');
meta.setAttribute('name', 'description');
meta.setAttribute('content', '%i18n:common.misskey%');
head.appendChild(meta);
}
document.domain = CONFIG.host;

View file

@ -29,7 +29,7 @@
<ul>
<li><a onclick={ signout }><i class="fa fa-power-off"></i>%i18n:mobile.tags.mk-settings-page.signout%</a></li>
</ul>
<p><small>ver { version }</small></p>
<p><small>ver { version } (葵 aoi)</small></p>
<style>
:scope
display block

View file

@ -467,6 +467,7 @@
import getPostSummary from '../../../../common/get-post-summary.ts';
import openPostForm from '../scripts/open-post-form';
this.mixin('i');
this.mixin('api');
this.mixin('stream');
@ -502,24 +503,31 @@
};
this.capture = withHandler => {
if (this.SIGNIN) {
this.stream.send({
type: 'capture',
id: this.post.id
});
if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
}
};
this.decapture = withHandler => {
if (this.SIGNIN) {
this.stream.send({
type: 'decapture',
id: this.post.id
});
if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
}
};
this.on('mount', () => {
this.capture(true);
if (this.SIGNIN) {
this.stream.on('_connected_', this.onStreamConnected);
}
if (this.p.text) {
const tokens = this.p.ast;

View file

@ -4,7 +4,7 @@
<div class="content">
<yield />
</div>
<mk-stream-indicator/>
<mk-stream-indicator if={ SIGNIN }/>
<style>
:scope
display block

View file

@ -4,14 +4,8 @@
const StringReplacePlugin = require('string-replace-webpack-plugin');
export default (lang, locale) => ({
enforce: 'pre',
test: /\.(tag|js)$/,
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /%i18n:(.+?)%/g, replacement: (_, key) => {
export default (lang, locale) => {
function get(key: string) {
let text = locale;
// Check the key existance
@ -28,10 +22,28 @@ export default (lang, locale) => ({
console.warn(`key '${key}' not found in '${lang}'`);
return key; // Fallback
} else {
return text.replace(/'/g, '\\\'').replace(/"/g, '\\"');
return text;
}
}
return {
enforce: 'pre',
test: /\.(tag|js)$/,
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [{
pattern: /"%i18n:(.+?)%"/g, replacement: (_, key) => {
return '"' + get(key).replace(/"/g, '\\"') + '"';
}
]
}, {
pattern: /'%i18n:(.+?)%'/g, replacement: (_, key) => {
return '\'' + get(key).replace(/'/g, '\\\'') + '\'';
}
}, {
pattern: /%i18n:(.+?)%/g, replacement: (_, key) => {
return get(key);
}
}]
})
});
};
};