summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/common/tags/error.tag150
-rw-r--r--src/web/app/desktop/tags/home-widgets/version.tag2
-rw-r--r--src/web/app/desktop/tags/timeline.tag30
-rw-r--r--src/web/app/desktop/tags/ui.tag30
-rw-r--r--src/web/app/init.js12
-rw-r--r--src/web/app/mobile/tags/page/settings.tag2
-rw-r--r--src/web/app/mobile/tags/timeline.tag30
-rw-r--r--src/web/app/mobile/tags/ui.tag2
8 files changed, 218 insertions, 40 deletions
diff --git a/src/web/app/common/tags/error.tag b/src/web/app/common/tags/error.tag
index 7a2976541d..62f4563e5c 100644
--- a/src/web/app/common/tags/error.tag
+++ b/src/web/app/common/tags/error.tag
@@ -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>
diff --git a/src/web/app/desktop/tags/home-widgets/version.tag b/src/web/app/desktop/tags/home-widgets/version.tag
index fa92afc49f..ea5307061c 100644
--- a/src/web/app/desktop/tags/home-widgets/version.tag
+++ b/src/web/app/desktop/tags/home-widgets/version.tag
@@ -1,5 +1,5 @@
<mk-version-home-widget>
- <p>ver { version }</p>
+ <p>ver { version } (葵 aoi)</p>
<style>
:scope
display block
diff --git a/src/web/app/desktop/tags/timeline.tag b/src/web/app/desktop/tags/timeline.tag
index cd7ac7d207..2d6b439e38 100644
--- a/src/web/app/desktop/tags/timeline.tag
+++ b/src/web/app/desktop/tags/timeline.tag
@@ -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 => {
- this.stream.send({
- type: 'capture',
- id: this.post.id
- });
- if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
+ if (this.SIGNIN) {
+ this.stream.send({
+ type: 'capture',
+ id: this.post.id
+ });
+ if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
+ }
};
this.decapture = withHandler => {
- this.stream.send({
- type: 'decapture',
- id: this.post.id
- });
- if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
+ 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);
- this.stream.on('_connected_', this.onStreamConnected);
+
+ if (this.SIGNIN) {
+ this.stream.on('_connected_', this.onStreamConnected);
+ }
if (this.p.text) {
const tokens = this.p.ast;
diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag
index fce0743ff7..e0d7393b08 100644
--- a/src/web/app/desktop/tags/ui.tag
+++ b/src/web/app/desktop/tags/ui.tag
@@ -5,7 +5,7 @@
<div class="content">
<yield />
</div>
- <mk-stream-indicator/>
+ <mk-stream-indicator if={ SIGNIN }/>
<style>
:scope
display block
@@ -416,22 +416,26 @@
this.page = this.opts.page;
this.on('mount', () => {
- this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages);
- this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage);
+ if (this.SIGNIN) {
+ this.stream.on('read_all_messaging_messages', this.onReadAllMessagingMessages);
+ this.stream.on('unread_messaging_message', this.onUnreadMessagingMessage);
- // Fetch count of unread messaging messages
- this.api('messaging/unread').then(res => {
- if (res.count > 0) {
- this.update({
- hasUnreadMessagingMessages: true
- });
- }
- });
+ // Fetch count of unread messaging messages
+ this.api('messaging/unread').then(res => {
+ if (res.count > 0) {
+ this.update({
+ hasUnreadMessagingMessages: true
+ });
+ }
+ });
+ }
});
this.on('unmount', () => {
- this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages);
- this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage);
+ if (this.SIGNIN) {
+ this.stream.off('read_all_messaging_messages', this.onReadAllMessagingMessages);
+ this.stream.off('unread_messaging_message', this.onUnreadMessagingMessage);
+ }
});
this.onReadAllMessagingMessages = () => {
diff --git a/src/web/app/init.js b/src/web/app/init.js
index 44391b8fcb..cb661c2595 100644
--- a/src/web/app/init.js
+++ b/src/web/app/init.js
@@ -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;
diff --git a/src/web/app/mobile/tags/page/settings.tag b/src/web/app/mobile/tags/page/settings.tag
index b366d3a16a..b6501142ee 100644
--- a/src/web/app/mobile/tags/page/settings.tag
+++ b/src/web/app/mobile/tags/page/settings.tag
@@ -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
diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag
index 5ecc2df9d1..c7f5bfd681 100644
--- a/src/web/app/mobile/tags/timeline.tag
+++ b/src/web/app/mobile/tags/timeline.tag
@@ -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 => {
- this.stream.send({
- type: 'capture',
- id: this.post.id
- });
- if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
+ if (this.SIGNIN) {
+ this.stream.send({
+ type: 'capture',
+ id: this.post.id
+ });
+ if (withHandler) this.stream.on('post-updated', this.onStreamPostUpdated);
+ }
};
this.decapture = withHandler => {
- this.stream.send({
- type: 'decapture',
- id: this.post.id
- });
- if (withHandler) this.stream.off('post-updated', this.onStreamPostUpdated);
+ 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);
- this.stream.on('_connected_', this.onStreamConnected);
+
+ if (this.SIGNIN) {
+ this.stream.on('_connected_', this.onStreamConnected);
+ }
if (this.p.text) {
const tokens = this.p.ast;
diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag
index b2f738dc2e..9d9cd4d74a 100644
--- a/src/web/app/mobile/tags/ui.tag
+++ b/src/web/app/mobile/tags/ui.tag
@@ -4,7 +4,7 @@
<div class="content">
<yield />
</div>
- <mk-stream-indicator/>
+ <mk-stream-indicator if={ SIGNIN }/>
<style>
:scope
display block