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

View file

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

View file

@ -1,4 +1,6 @@
common: common:
misskey: "Note everything and share it others using Misskey."
time: time:
unknown: "unknown" unknown: "unknown"
future: "future" future: "future"
@ -66,6 +68,25 @@ common:
title: "Unable to connect to the server" 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." 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." 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: mk-forkit:
open-github-link: "View source on Github" open-github-link: "View source on Github"

View file

@ -1,4 +1,6 @@
common: common:
misskey: "Misskeyに何でも投稿して皆と共有しましょう。"
time: time:
unknown: "なぞのじかん" unknown: "なぞのじかん"
future: "未来" future: "未来"
@ -66,6 +68,25 @@ common:
title: "サーバーに接続できません" title: "サーバーに接続できません"
description: "インターネット回線に問題があるか、サーバーがダウンまたはメンテナンスしている可能性があります。しばらくしてから{再度お試し}ください。" description: "インターネット回線に問題があるか、サーバーがダウンまたはメンテナンスしている可能性があります。しばらくしてから{再度お試し}ください。"
thanks: "いつもMisskeyをご利用いただきありがとうございます。" 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: mk-forkit:
open-github-link: "View source on Github" open-github-link: "View source on Github"

View file

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

View file

@ -8,6 +8,8 @@
}</a>{ }</a>{
'%i18n:common.tags.mk-error.description%'.substr('%i18n:common.tags.mk-error.description%'.indexOf('}') + 1) '%i18n:common.tags.mk-error.description%'.substr('%i18n:common.tags.mk-error.description%'.indexOf('}') + 1)
}</p> }</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> <p class="thanks">%i18n:common.tags.mk-error.thanks%</p>
<style> <style>
:scope :scope
@ -36,6 +38,25 @@
font-size 1em font-size 1em
color #666 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 > .thanks
display block display block
margin 2em auto 0 auto margin 2em auto 0 auto
@ -55,6 +76,8 @@
</style> </style>
<script> <script>
this.troubleshooting = false;
this.on('mount', () => { this.on('mount', () => {
document.title = 'Oops!'; document.title = 'Oops!';
document.documentElement.style.background = '#f8f8f8'; document.documentElement.style.background = '#f8f8f8';
@ -63,5 +86,132 @@
this.reload = () => { this.reload = () => {
location.reload(); location.reload();
}; };
this.troubleshoot = () => {
this.update({
troubleshooting: true
});
};
</script> </script>
</mk-error> </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> <mk-version-home-widget>
<p>ver { version }</p> <p>ver { version } (葵 aoi)</p>
<style> <style>
:scope :scope
display block display block

View file

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

View file

@ -5,7 +5,7 @@
<div class="content"> <div class="content">
<yield /> <yield />
</div> </div>
<mk-stream-indicator/> <mk-stream-indicator if={ SIGNIN }/>
<style> <style>
:scope :scope
display block display block
@ -416,22 +416,26 @@
this.page = this.opts.page; this.page = this.opts.page;
this.on('mount', () => { this.on('mount', () => {
this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages); if (this.SIGNIN) {
this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage); this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages);
this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage);
// Fetch count of unread messaging messages // Fetch count of unread messaging messages
this.api('messaging/unread').then(res => { this.api('messaging/unread').then(res => {
if (res.count > 0) { if (res.count > 0) {
this.update({ this.update({
hasUnreadMessagingMessages: true hasUnreadMessagingMessages: true
}); });
} }
}); });
}
}); });
this.on('unmount', () => { this.on('unmount', () => {
this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages); if (this.SIGNIN) {
this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage); this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages);
this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage);
}
}); });
this.onReadAllMessagingMessages = () => { this.onReadAllMessagingMessages = () => {

View file

@ -2,7 +2,7 @@
* App initializer * App initializer
*/ */
"use strict"; 'use strict';
import * as riot from 'riot'; import * as riot from 'riot';
import api from './common/scripts/api'; import api from './common/scripts/api';
@ -19,7 +19,15 @@ require('./common/tags');
* APP ENTRY POINT! * 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; document.domain = CONFIG.host;

View file

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

View file

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

View file

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

View file

@ -4,34 +4,46 @@
const StringReplacePlugin = require('string-replace-webpack-plugin'); const StringReplacePlugin = require('string-replace-webpack-plugin');
export default (lang, locale) => ({ export default (lang, locale) => {
enforce: 'pre', function get(key: string) {
test: /\.(tag|js)$/, let text = locale;
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /%i18n:(.+?)%/g, replacement: (_, key) => {
let text = locale;
// Check the key existance // Check the key existance
const error = key.split('.').some(k => { const error = key.split('.').some(k => {
if (text.hasOwnProperty(k)) { if (text.hasOwnProperty(k)) {
text = text[k]; text = text[k];
return false; return false;
} else { } else {
return true; return true;
}
});
if (error) {
console.warn(`key '${key}' not found in '${lang}'`);
return key; // Fallback
} else {
return text.replace(/'/g, '\\\'').replace(/"/g, '\\"');
}
}
} }
] });
})
}); if (error) {
console.warn(`key '${key}' not found in '${lang}'`);
return key; // Fallback
} else {
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);
}
}]
})
};
};