Some bug fixes

This commit is contained in:
syuilo
2018-04-08 03:58:11 +09:00
parent a1b490afa7
commit a02ee3a08b
81 changed files with 337 additions and 1318 deletions

View File

@ -53,7 +53,7 @@
<div class="main">
<a @click="hint">カスタマイズのヒント</a>
<div>
<mk-post-form v-if="os.i.account.clientSettings.showPostFormOnTopOfTl"/>
<mk-post-form v-if="os.i.clientSettings.showPostFormOnTopOfTl"/>
<mk-timeline ref="tl" @loaded="onTlLoaded"/>
</div>
</div>
@ -63,7 +63,7 @@
<component v-for="widget in widgets[place]" :is="`mkw-${widget.name}`" :key="widget.id" :ref="widget.id" :widget="widget" @chosen="warp"/>
</div>
<div class="main">
<mk-post-form v-if="os.i.account.clientSettings.showPostFormOnTopOfTl"/>
<mk-post-form v-if="os.i.clientSettings.showPostFormOnTopOfTl"/>
<mk-timeline ref="tl" @loaded="onTlLoaded" v-if="mode == 'timeline'"/>
<mk-mentions @loaded="onTlLoaded" v-if="mode == 'mentions'"/>
</div>
@ -82,7 +82,10 @@ export default Vue.extend({
XDraggable
},
props: {
customize: Boolean,
customize: {
type: Boolean,
default: false
},
mode: {
type: String,
default: 'timeline'
@ -104,16 +107,16 @@ export default Vue.extend({
home: {
get(): any[] {
//#region 互換性のため
(this as any).os.i.account.clientSettings.home.forEach(w => {
(this as any).os.i.clientSettings.home.forEach(w => {
if (w.name == 'rss-reader') w.name = 'rss';
if (w.name == 'user-recommendation') w.name = 'users';
if (w.name == 'recommended-polls') w.name = 'polls';
});
//#endregion
return (this as any).os.i.account.clientSettings.home;
return (this as any).os.i.clientSettings.home;
},
set(value) {
(this as any).os.i.account.clientSettings.home = value;
(this as any).os.i.clientSettings.home = value;
}
},
left(): any[] {
@ -126,7 +129,7 @@ export default Vue.extend({
created() {
this.widgets.left = this.left;
this.widgets.right = this.right;
this.$watch('os.i.account.clientSettings', i => {
this.$watch('os.i.clientSettings', i => {
this.widgets.left = this.left;
this.widgets.right = this.right;
}, {
@ -161,17 +164,17 @@ export default Vue.extend({
},
onHomeUpdated(data) {
if (data.home) {
(this as any).os.i.account.clientSettings.home = data.home;
(this as any).os.i.clientSettings.home = data.home;
this.widgets.left = data.home.filter(w => w.place == 'left');
this.widgets.right = data.home.filter(w => w.place == 'right');
} else {
const w = (this as any).os.i.account.clientSettings.home.find(w => w.id == data.id);
const w = (this as any).os.i.clientSettings.home.find(w => w.id == data.id);
if (w != null) {
w.data = data.data;
this.$refs[w.id][0].preventSave = true;
this.$refs[w.id][0].props = w.data;
this.widgets.left = (this as any).os.i.account.clientSettings.home.filter(w => w.place == 'left');
this.widgets.right = (this as any).os.i.account.clientSettings.home.filter(w => w.place == 'right');
this.widgets.left = (this as any).os.i.clientSettings.home.filter(w => w.place == 'left');
this.widgets.right = (this as any).os.i.clientSettings.home.filter(w => w.place == 'right');
}
}
},

View File

@ -115,7 +115,7 @@ export default Vue.extend({
isRenote(): boolean {
return (this.note.renote &&
this.note.text == null &&
this.note.mediaIds == null &&
this.note.mediaIds.length == 0 &&
this.note.poll == null);
},
p(): any {
@ -168,7 +168,7 @@ export default Vue.extend({
// Draw map
if (this.p.geo) {
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.account.clientSettings.showMaps : true;
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.clientSettings.showMaps : true;
if (shouldShowMap) {
(this as any).os.getGoogleMaps().then(maps => {
const uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]);

View File

@ -5,25 +5,25 @@
</div>
<div class="renote" v-if="isRenote">
<p>
<router-link class="avatar-anchor" :to="`/@${acct}`" v-user-preview="note.userId">
<router-link class="avatar-anchor" :to="`/@${getAcct(note.user)}`" v-user-preview="note.userId">
<img class="avatar" :src="`${note.user.avatarUrl}?thumbnail&size=32`" alt="avatar"/>
</router-link>
%fa:retweet%
<span>{{ '%i18n:desktop.tags.mk-timeline-note.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-note.reposted-by%'.indexOf('{')) }}</span>
<a class="name" :href="`/@${acct}`" v-user-preview="note.userId">{{ getUserName(note.user) }}</a>
<a class="name" :href="`/@${getAcct(note.user)}`" v-user-preview="note.userId">{{ getUserName(note.user) }}</a>
<span>{{ '%i18n:desktop.tags.mk-timeline-note.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-note.reposted-by%'.indexOf('}') + 1) }}</span>
</p>
<mk-time :time="note.createdAt"/>
</div>
<article>
<router-link class="avatar-anchor" :to="`/@${acct}`">
<router-link class="avatar-anchor" :to="`/@${getAcct(p.user)}`">
<img class="avatar" :src="`${p.user.avatarUrl}?thumbnail&size=64`" alt="avatar" v-user-preview="p.user.id"/>
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`" v-user-preview="p.user.id">{{ acct }}</router-link>
<span class="is-bot" v-if="p.user.host === null && p.user.account.isBot">bot</span>
<span class="username">@{{ acct }}</span>
<router-link class="name" :to="`/@${getAcct(p.user)}`" v-user-preview="p.user.id">{{ getUserName(p) }}</router-link>
<span class="is-bot" v-if="p.user.host === null && p.user.isBot">bot</span>
<span class="username">@{{ getAcct(p.user) }}</span>
<div class="info">
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
<span class="mobile" v-if="p.viaMobile">%fa:mobile-alt%</span>
@ -117,21 +117,18 @@ export default Vue.extend({
return {
isDetailOpened: false,
connection: null,
connectionId: null
connectionId: null,
getAcct,
getUserName
};
},
computed: {
acct(): string {
return getAcct(this.p.user);
},
name(): string {
return getUserName(this.p.user);
},
isRenote(): boolean {
return (this.note.renote &&
this.note.text == null &&
this.note.mediaIds == null &&
this.note.mediaIds.length == 0 &&
this.note.poll == null);
},
p(): any {
@ -178,7 +175,7 @@ export default Vue.extend({
// Draw map
if (this.p.geo) {
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.account.clientSettings.showMaps : true;
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.clientSettings.showMaps : true;
if (shouldShowMap) {
(this as any).os.getGoogleMaps().then(maps => {
const uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]);

View File

@ -115,7 +115,7 @@ export default Vue.extend({
isRenote(): boolean {
return (this.note.renote &&
this.note.text == null &&
this.note.mediaIds == null &&
this.note.mediaIds.length == 0 &&
this.note.poll == null);
},
p(): any {
@ -168,7 +168,7 @@ export default Vue.extend({
// Draw map
if (this.p.geo) {
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.account.clientSettings.showMaps : true;
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.clientSettings.showMaps : true;
if (shouldShowMap) {
(this as any).os.getGoogleMaps().then(maps => {
const uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]);

View File

@ -22,7 +22,7 @@
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`" v-user-preview="p.user.id">{{ acct }}</router-link>
<span class="is-bot" v-if="p.user.host === null && p.user.account.isBot">bot</span>
<span class="is-bot" v-if="p.user.host === null && p.user.isBot">bot</span>
<span class="username">@{{ acct }}</span>
<div class="info">
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
@ -131,7 +131,7 @@ export default Vue.extend({
isRenote(): boolean {
return (this.note.renote &&
this.note.text == null &&
this.note.mediaIds == null &&
this.note.mediaIds.length == 0 &&
this.note.poll == null);
},
p(): any {
@ -178,7 +178,7 @@ export default Vue.extend({
// Draw map
if (this.p.geo) {
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.account.clientSettings.showMaps : true;
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.clientSettings.showMaps : true;
if (shouldShowMap) {
(this as any).os.getGoogleMaps().then(maps => {
const uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]);

View File

@ -2,8 +2,8 @@
<div class="2fa">
<p>%i18n:desktop.tags.mk-2fa-setting.intro%<a href="%i18n:desktop.tags.mk-2fa-setting.url%" target="_blank">%i18n:desktop.tags.mk-2fa-setting.detail%</a></p>
<div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-2fa-setting.caution%</p></div>
<p v-if="!data && !os.i.account.twoFactorEnabled"><button @click="register" class="ui primary">%i18n:desktop.tags.mk-2fa-setting.register%</button></p>
<template v-if="os.i.account.twoFactorEnabled">
<p v-if="!data && !os.i.twoFactorEnabled"><button @click="register" class="ui primary">%i18n:desktop.tags.mk-2fa-setting.register%</button></p>
<template v-if="os.i.twoFactorEnabled">
<p>%i18n:desktop.tags.mk-2fa-setting.already-registered%</p>
<button @click="unregister" class="ui">%i18n:desktop.tags.mk-2fa-setting.unregister%</button>
</template>
@ -54,7 +54,7 @@ export default Vue.extend({
password: password
}).then(() => {
(this as any).apis.notify('%i18n:desktop.tags.mk-2fa-setting.unregistered%');
(this as any).os.i.account.twoFactorEnabled = false;
(this as any).os.i.twoFactorEnabled = false;
});
});
},
@ -64,7 +64,7 @@ export default Vue.extend({
token: this.token
}).then(() => {
(this as any).apis.notify('%i18n:desktop.tags.mk-2fa-setting.success%');
(this as any).os.i.account.twoFactorEnabled = true;
(this as any).os.i.twoFactorEnabled = true;
}).catch(() => {
(this as any).apis.notify('%i18n:desktop.tags.mk-2fa-setting.failed%');
});

View File

@ -1,6 +1,6 @@
<template>
<div class="root api">
<p>Token: <code>{{ os.i.account.token }}</code></p>
<p>Token: <code>{{ os.i.token }}</code></p>
<p>%i18n:desktop.tags.mk-api-info.intro%</p>
<div class="ui info warn"><p>%fa:exclamation-triangle%%i18n:desktop.tags.mk-api-info.caution%</p></div>
<p>%i18n:desktop.tags.mk-api-info.regeneration-of-token%</p>

View File

@ -24,7 +24,7 @@
<button class="ui primary" @click="save">%i18n:desktop.tags.mk-profile-setting.save%</button>
<section>
<h2>その他</h2>
<mk-switch v-model="os.i.account.isBot" @change="onChangeIsBot" text="このアカウントはbotです"/>
<mk-switch v-model="os.i.isBot" @change="onChangeIsBot" text="このアカウントはbotです"/>
</section>
</div>
</template>
@ -43,9 +43,9 @@ export default Vue.extend({
},
created() {
this.name = (this as any).os.i.name || '';
this.location = (this as any).os.i.account.profile.location;
this.location = (this as any).os.i.profile.location;
this.description = (this as any).os.i.description;
this.birthday = (this as any).os.i.account.profile.birthday;
this.birthday = (this as any).os.i.profile.birthday;
},
methods: {
updateAvatar() {
@ -63,7 +63,7 @@ export default Vue.extend({
},
onChangeIsBot() {
(this as any).api('i/update', {
isBot: (this as any).os.i.account.isBot
isBot: (this as any).os.i.isBot
});
}
}

View File

@ -20,7 +20,7 @@
<section class="web" v-show="page == 'web'">
<h1>動作</h1>
<mk-switch v-model="os.i.account.clientSettings.fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み">
<mk-switch v-model="os.i.clientSettings.fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み">
<span>ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます</span>
</mk-switch>
<mk-switch v-model="autoPopout" text="ウィンドウの自動ポップアウト">
@ -33,11 +33,11 @@
<div class="div">
<button class="ui button" @click="customizeHome">ホームをカスタマイズ</button>
</div>
<mk-switch v-model="os.i.account.clientSettings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
<mk-switch v-model="os.i.account.clientSettings.showMaps" @change="onChangeShowMaps" text="マップの自動展開">
<mk-switch v-model="os.i.clientSettings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
<mk-switch v-model="os.i.clientSettings.showMaps" @change="onChangeShowMaps" text="マップの自動展開">
<span>位置情報が添付された投稿のマップを自動的に展開します</span>
</mk-switch>
<mk-switch v-model="os.i.account.clientSettings.gradientWindowHeader" @change="onChangeGradientWindowHeader" text="ウィンドウのタイトルバーにグラデーションを使用"/>
<mk-switch v-model="os.i.clientSettings.gradientWindowHeader" @change="onChangeGradientWindowHeader" text="ウィンドウのタイトルバーにグラデーションを使用"/>
</section>
<section class="web" v-show="page == 'web'">
@ -57,7 +57,7 @@
<section class="web" v-show="page == 'web'">
<h1>モバイル</h1>
<mk-switch v-model="os.i.account.clientSettings.disableViaMobile" @change="onChangeDisableViaMobile" text="モバイルからの投稿フラグを付けない"/>
<mk-switch v-model="os.i.clientSettings.disableViaMobile" @change="onChangeDisableViaMobile" text="モバイルからの投稿フラグを付けない"/>
</section>
<section class="web" v-show="page == 'web'">
@ -86,7 +86,7 @@
<section class="notification" v-show="page == 'notification'">
<h1>通知</h1>
<mk-switch v-model="os.i.account.settings.autoWatch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ">
<mk-switch v-model="os.i.settings.autoWatch" @change="onChangeAutoWatch" text="投稿の自動ウォッチ">
<span>リアクションしたり返信したりした投稿に関する通知を自動的に受け取るようにします。</span>
</mk-switch>
</section>

View File

@ -107,7 +107,7 @@ export default Vue.extend({
this.fetch();
},
onScroll() {
if ((this as any).os.i.account.clientSettings.fetchOnScroll !== false) {
if ((this as any).os.i.clientSettings.fetchOnScroll !== false) {
const current = window.scrollY + window.innerHeight;
if (current > document.body.offsetHeight - 8) this.more();
}

View File

@ -37,8 +37,8 @@ import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
computed: {
name() {
return getUserName(this.os.i);
name(): string {
return getUserName((this as any).os.i);
}
},
components: {
@ -51,9 +51,9 @@ export default Vue.extend({
},
mounted() {
if ((this as any).os.isSignedIn) {
const ago = (new Date().getTime() - new Date((this as any).os.i.account.lastUsedAt).getTime()) / 1000
const ago = (new Date().getTime() - new Date((this as any).os.i.lastUsedAt).getTime()) / 1000
const isHisasiburi = ago >= 3600;
(this as any).os.i.account.lastUsedAt = new Date();
(this as any).os.i.lastUsedAt = new Date();
if (isHisasiburi) {
(this.$refs.welcomeback as any).style.display = 'block';
(this.$refs.main as any).style.overflow = 'hidden';

View File

@ -24,8 +24,8 @@ export default Vue.extend({
computed: {
withGradient(): boolean {
return (this as any).os.isSignedIn
? (this as any).os.i.account.clientSettings.gradientWindowHeader != null
? (this as any).os.i.account.clientSettings.gradientWindowHeader
? (this as any).os.i.clientSettings.gradientWindowHeader != null
? (this as any).os.i.clientSettings.gradientWindowHeader
: false
: false;
}

View File

@ -92,8 +92,8 @@ export default Vue.extend({
},
withGradient(): boolean {
return (this as any).os.isSignedIn
? (this as any).os.i.account.clientSettings.gradientWindowHeader != null
? (this as any).os.i.account.clientSettings.gradientWindowHeader
? (this as any).os.i.clientSettings.gradientWindowHeader != null
? (this as any).os.i.clientSettings.gradientWindowHeader
: false
: false;
}