This commit is contained in:
syuilo 2018-02-18 12:35:18 +09:00
parent 61b95e0c26
commit 99b3499364
103 changed files with 878 additions and 790 deletions

View file

@ -87,8 +87,8 @@ export default Vue.extend({
}
},
mounted() {
this.connection = this.$root.$data.os.streams.driveStream.getConnection();
this.connectionId = this.$root.$data.os.streams.driveStream.use();
this.connection = (this as any).os.streams.driveStream.getConnection();
this.connectionId = (this as any).os.streams.driveStream.use();
this.connection.on('file_created', this.onStreamDriveFileCreated);
this.connection.on('file_updated', this.onStreamDriveFileUpdated);
@ -112,7 +112,7 @@ export default Vue.extend({
this.connection.off('file_updated', this.onStreamDriveFileUpdated);
this.connection.off('folder_created', this.onStreamDriveFolderCreated);
this.connection.off('folder_updated', this.onStreamDriveFolderUpdated);
this.$root.$data.os.streams.driveStream.dispose(this.connectionId);
(this as any).os.streams.driveStream.dispose(this.connectionId);
},
methods: {
onStreamDriveFileCreated(file) {
@ -158,7 +158,7 @@ export default Vue.extend({
this.fetching = true;
this.$root.$data.os.api('drive/folders/show', {
(this as any).api('drive/folders/show', {
folder_id: target
}).then(folder => {
this.folder = folder;
@ -253,7 +253,7 @@ export default Vue.extend({
const filesMax = 20;
//
this.$root.$data.os.api('drive/folders', {
(this as any).api('drive/folders', {
folder_id: this.folder ? this.folder.id : null,
limit: foldersMax + 1
}).then(folders => {
@ -266,7 +266,7 @@ export default Vue.extend({
});
//
this.$root.$data.os.api('drive/files', {
(this as any).api('drive/files', {
folder_id: this.folder ? this.folder.id : null,
limit: filesMax + 1
}).then(files => {
@ -296,7 +296,7 @@ export default Vue.extend({
if (this.folder == null) {
// Fetch addtional drive info
this.$root.$data.os.api('drive').then(info => {
(this as any).api('drive').then(info => {
this.info = info;
});
}
@ -309,7 +309,7 @@ export default Vue.extend({
const max = 30;
//
this.$root.$data.os.api('drive/files', {
(this as any).api('drive/files', {
folder_id: this.folder ? this.folder.id : null,
limit: max + 1,
until_id: this.files[this.files.length - 1].id
@ -348,7 +348,7 @@ export default Vue.extend({
this.fetching = true;
this.$root.$data.os.api('drive/files/show', {
(this as any).api('drive/files/show', {
file_id: file
}).then(file => {
this.fetching = false;
@ -394,7 +394,7 @@ export default Vue.extend({
createFolder() {
const name = window.prompt('フォルダー名');
if (name == null || name == '') return;
this.$root.$data.os.api('drive/folders/create', {
(this as any).api('drive/folders/create', {
name: name,
parent_id: this.folder ? this.folder.id : undefined
}).then(folder => {
@ -409,7 +409,7 @@ export default Vue.extend({
}
const name = window.prompt('フォルダー名', this.folder.name);
if (name == null || name == '') return;
this.$root.$data.os.api('drive/folders/update', {
(this as any).api('drive/folders/update', {
name: name,
folder_id: this.folder.id
}).then(folder => {
@ -424,7 +424,7 @@ export default Vue.extend({
}
const dialog = riot.mount(document.body.appendChild(document.createElement('mk-drive-folder-selector')))[0];
dialog.one('selected', folder => {
this.$root.$data.os.api('drive/folders/update', {
(this as any).api('drive/folders/update', {
parent_id: folder ? folder.id : null,
folder_id: this.folder.id
}).then(folder => {
@ -436,7 +436,7 @@ export default Vue.extend({
urlUpload() {
const url = window.prompt('アップロードしたいファイルのURL');
if (url == null || url == '') return;
this.$root.$data.os.api('drive/files/upload_from_url', {
(this as any).api('drive/files/upload_from_url', {
url: url,
folder_id: this.folder ? this.folder.id : undefined
});

View file

@ -28,8 +28,8 @@ export default Vue.extend({
};
},
mounted() {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('follow', this.onFollow);
this.connection.on('unfollow', this.onUnfollow);
@ -37,7 +37,7 @@ export default Vue.extend({
beforeDestroy() {
this.connection.off('follow', this.onFollow);
this.connection.off('unfollow', this.onUnfollow);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
},
methods: {
@ -56,7 +56,7 @@ export default Vue.extend({
onClick() {
this.wait = true;
if (this.user.is_following) {
this.$root.$data.os.api('following/delete', {
(this as any).api('following/delete', {
user_id: this.user.id
}).then(() => {
this.user.is_following = false;
@ -66,7 +66,7 @@ export default Vue.extend({
this.wait = false;
});
} else {
this.$root.$data.os.api('following/create', {
(this as any).api('following/create', {
user_id: this.user.id
}).then(() => {
this.user.is_following = true;

View file

@ -32,7 +32,7 @@ export default Vue.extend({
this.fetching = true;
this.users = [];
this.$root.$data.os.api('users/recommendation', {
(this as any).api('users/recommendation', {
limit: this.limit,
offset: this.limit * this.page
}).then(users => {

View file

@ -42,14 +42,14 @@ export default Vue.extend({
}
},
mounted() {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('notification', this.onNotification);
const max = 10;
this.$root.$data.os.api('i/notifications', {
(this as any).api('i/notifications', {
limit: max + 1
}).then(notifications => {
if (notifications.length == max + 1) {
@ -63,7 +63,7 @@ export default Vue.extend({
},
beforeDestroy() {
this.connection.off('notification', this.onNotification);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
},
methods: {
fetchMoreNotifications() {
@ -71,7 +71,7 @@ export default Vue.extend({
const max = 30;
this.$root.$data.os.api('i/notifications', {
(this as any).api('i/notifications', {
limit: max + 1,
until_id: this.notifications[this.notifications.length - 1].id
}).then(notifications => {

View file

@ -33,7 +33,7 @@
</div>
</header>
<div class="body">
<mk-post-html v-if="p.ast" :ast="p.ast" :i="$root.$data.os.i"/>
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i"/>
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
<div class="media" v-if="p.media">
<mk-images images={ p.media }/>
@ -116,7 +116,7 @@ export default Vue.extend({
mounted() {
// Get replies
if (!this.compact) {
this.$root.$data.os.api('posts/replies', {
(this as any).api('posts/replies', {
post_id: this.p.id,
limit: 8
}).then(replies => {
@ -129,7 +129,7 @@ export default Vue.extend({
this.contextFetching = true;
// Fetch context
this.$root.$data.os.api('posts/context', {
(this as any).api('posts/context', {
post_id: this.p.reply_id
}).then(context => {
this.contextFetching = false;

View file

@ -106,24 +106,24 @@ export default Vue.extend({
}
},
created() {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
},
mounted() {
this.capture(true);
if (this.$root.$data.os.isSignedIn) {
if ((this as any).os.isSignedIn) {
this.connection.on('_connected_', this.onStreamConnected);
}
},
beforeDestroy() {
this.decapture(true);
this.connection.off('_connected_', this.onStreamConnected);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
},
methods: {
capture(withHandler = false) {
if (this.$root.$data.os.isSignedIn) {
if ((this as any).os.isSignedIn) {
this.connection.send({
type: 'capture',
id: this.post.id
@ -132,7 +132,7 @@ export default Vue.extend({
}
},
decapture(withHandler = false) {
if (this.$root.$data.os.isSignedIn) {
if ((this as any).os.isSignedIn) {
this.connection.send({
type: 'decapture',
id: this.post.id

View file

@ -2,7 +2,7 @@
<div class="mk-sub-post-content">
<div class="body">
<a class="reply" v-if="post.reply_id">%fa:reply%</a>
<mk-post-html v-if="post.ast" :ast="post.ast" :i="$root.$data.os.i"/>
<mk-post-html v-if="post.ast" :ast="post.ast" :i="os.i"/>
<a class="quote" v-if="post.repost_id">RP: ...</a>
</div>
<details v-if="post.media">

View file

@ -37,12 +37,12 @@ export default Vue.extend({
},
computed: {
alone(): boolean {
return this.$root.$data.os.i.following_count == 0;
return (this as any).os.i.following_count == 0;
}
},
mounted() {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('post', this.onPost);
this.connection.on('follow', this.onChangeFollowing);
@ -54,13 +54,13 @@ export default Vue.extend({
this.connection.off('post', this.onPost);
this.connection.off('follow', this.onChangeFollowing);
this.connection.off('unfollow', this.onChangeFollowing);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
},
methods: {
fetch(cb?) {
this.fetching = true;
this.$root.$data.os.api('posts/timeline', {
(this as any).api('posts/timeline', {
until_date: this.date ? (this.date as any).getTime() : undefined
}).then(posts => {
this.fetching = false;
@ -71,7 +71,7 @@ export default Vue.extend({
more() {
if (this.moreFetching || this.fetching || this.posts.length == 0) return;
this.moreFetching = true;
this.$root.$data.os.api('posts/timeline', {
(this as any).api('posts/timeline', {
until_id: this.posts[this.posts.length - 1].id
}).then(posts => {
this.moreFetching = false;

View file

@ -31,9 +31,9 @@ export default Vue.extend({
};
},
mounted() {
if (this.$root.$data.os.isSignedIn) {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
if ((this as any).os.isSignedIn) {
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('read_all_notifications', this.onReadAllNotifications);
this.connection.on('unread_notification', this.onUnreadNotification);
@ -41,14 +41,14 @@ export default Vue.extend({
this.connection.on('unread_messaging_message', this.onUnreadMessagingMessage);
// Fetch count of unread notifications
this.$root.$data.os.api('notifications/get_unread_count').then(res => {
(this as any).api('notifications/get_unread_count').then(res => {
if (res.count > 0) {
this.hasUnreadNotifications = true;
}
});
// Fetch count of unread messaging messages
this.$root.$data.os.api('messaging/unread').then(res => {
(this as any).api('messaging/unread').then(res => {
if (res.count > 0) {
this.hasUnreadMessagingMessages = true;
}
@ -56,12 +56,12 @@ export default Vue.extend({
}
},
beforeDestroy() {
if (this.$root.$data.os.isSignedIn) {
if ((this as any).os.isSignedIn) {
this.connection.off('read_all_notifications', this.onReadAllNotifications);
this.connection.off('unread_notification', this.onUnreadNotification);
this.connection.off('read_all_messaging_messages', this.onReadAllMessagingMessages);
this.connection.off('unread_messaging_message', this.onUnreadMessagingMessage);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
}
},
methods: {

View file

@ -2,7 +2,7 @@
<div class="mk-ui-nav" :style="{ display: isOpen ? 'block' : 'none' }">
<div class="backdrop" @click="parent.toggleDrawer"></div>
<div class="body">
<a class="me" v-if="$root.$data.os.isSignedIn" href={ '/' + I.username }>
<a class="me" v-if="os.isSignedIn" href={ '/' + I.username }>
<img class="avatar" src={ I.avatar_url + '?thumbnail&size=128' } alt="avatar"/>
<p class="name">{ I.name }</p>
</a>
@ -41,9 +41,9 @@ export default Vue.extend({
};
},
mounted() {
if (this.$root.$data.os.isSignedIn) {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
if ((this as any).os.isSignedIn) {
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('read_all_notifications', this.onReadAllNotifications);
this.connection.on('unread_notification', this.onUnreadNotification);
@ -51,14 +51,14 @@ export default Vue.extend({
this.connection.on('unread_messaging_message', this.onUnreadMessagingMessage);
// Fetch count of unread notifications
this.$root.$data.os.api('notifications/get_unread_count').then(res => {
(this as any).api('notifications/get_unread_count').then(res => {
if (res.count > 0) {
this.hasUnreadNotifications = true;
}
});
// Fetch count of unread messaging messages
this.$root.$data.os.api('messaging/unread').then(res => {
(this as any).api('messaging/unread').then(res => {
if (res.count > 0) {
this.hasUnreadMessagingMessages = true;
}
@ -66,12 +66,12 @@ export default Vue.extend({
}
},
beforeDestroy() {
if (this.$root.$data.os.isSignedIn) {
if ((this as any).os.isSignedIn) {
this.connection.off('read_all_notifications', this.onReadAllNotifications);
this.connection.off('unread_notification', this.onUnreadNotification);
this.connection.off('read_all_messaging_messages', this.onReadAllMessagingMessages);
this.connection.off('unread_messaging_message', this.onUnreadMessagingMessage);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
}
},
methods: {

View file

@ -7,7 +7,7 @@
<div class="content">
<slot></slot>
</div>
<mk-stream-indicator v-if="$root.$data.os.isSignedIn"/>
<mk-stream-indicator v-if="os.isSignedIn"/>
</div>
</template>
@ -23,17 +23,17 @@ export default Vue.extend({
};
},
mounted() {
if (this.$root.$data.os.isSignedIn) {
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
if ((this as any).os.isSignedIn) {
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('notification', this.onNotification);
}
},
beforeDestroy() {
if (this.$root.$data.os.isSignedIn) {
if ((this as any).os.isSignedIn) {
this.connection.off('notification', this.onNotification);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
}
},
methods: {

View file

@ -14,7 +14,7 @@ export default Vue.extend({
props: ['user'],
methods: {
fetch(iknow, limit, cursor, cb) {
this.$root.$data.os.api('users/followers', {
(this as any).api('users/followers', {
user_id: this.user.id,
iknow: iknow,
limit: limit,

View file

@ -14,7 +14,7 @@ export default Vue.extend({
props: ['user'],
methods: {
fetch(iknow, limit, cursor, cb) {
this.$root.$data.os.api('users/following', {
(this as any).api('users/following', {
user_id: this.user.id,
iknow: iknow,
limit: limit,

View file

@ -27,7 +27,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/posts', {
(this as any).api('users/posts', {
user_id: this.user.id,
with_media: this.withMedia
}).then(posts => {

View file

@ -2,7 +2,7 @@
<div class="mk-users-list">
<nav>
<span :data-is-active="mode == 'all'" @click="mode = 'all'">%i18n:mobile.tags.mk-users-list.all%<span>{{ count }}</span></span>
<span v-if="$root.$data.os.isSignedIn && youKnowCount" :data-is-active="mode == 'iknow'" @click="mode = 'iknow'">%i18n:mobile.tags.mk-users-list.known%<span>{{ youKnowCount }}</span></span>
<span v-if="os.isSignedIn && youKnowCount" :data-is-active="mode == 'iknow'" @click="mode = 'iknow'">%i18n:mobile.tags.mk-users-list.known%<span>{{ youKnowCount }}</span></span>
</nav>
<div class="users" v-if="!fetching && users.length != 0">
<mk-user-preview v-for="u in users" :user="u" :key="u.id"/>

View file

@ -23,7 +23,7 @@ export default Vue.extend({
mounted() {
Progress.start();
this.$root.$data.os.api('users/show', {
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.fetching = false;

View file

@ -23,7 +23,7 @@ export default Vue.extend({
mounted() {
Progress.start();
this.$root.$data.os.api('users/show', {
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.fetching = false;

View file

@ -23,8 +23,8 @@ export default Vue.extend({
document.title = 'Misskey';
document.documentElement.style.background = '#313a42';
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('post', this.onStreamPost);
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
@ -33,7 +33,7 @@ export default Vue.extend({
},
beforeDestroy() {
this.connection.off('post', this.onStreamPost);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
document.removeEventListener('visibilitychange', this.onVisibilitychange);
},
methods: {
@ -44,7 +44,7 @@ export default Vue.extend({
Progress.done();
},
onStreamPost(post) {
if (document.hidden && post.user_id !== this.$root.$data.os.i.id) {
if (document.hidden && post.user_id !== (this as any).os.i.id) {
this.unreadCount++;
document.title = `(${this.unreadCount}) ${getPostSummary(post)}`;
}

View file

@ -21,7 +21,7 @@ export default Vue.extend({
const ok = window.confirm('%i18n:mobile.tags.mk-notifications-page.read-all%');
if (!ok) return;
this.$root.$data.os.api('notifications/mark_as_read_all');
(this as any).api('notifications/mark_as_read_all');
},
onFetched() {
Progress.done();

View file

@ -29,7 +29,7 @@ export default Vue.extend({
Progress.start();
this.$root.$data.os.api('posts/show', {
(this as any).api('posts/show', {
post_id: this.postId
}).then(post => {
this.fetching = false;

View file

@ -35,7 +35,7 @@ export default Vue.extend({
Progress.start();
this.$root.$data.os.api('posts/search', Object.assign({}, parse(this.query), {
(this as any).api('posts/search', Object.assign({}, parse(this.query), {
limit: limit
})).then(posts => {
this.posts = posts;
@ -46,7 +46,7 @@ export default Vue.extend({
methods: {
more() {
this.offset += limit;
return this.$root.$data.os.api('posts/search', Object.assign({}, parse(this.query), {
return (this as any).api('posts/search', Object.assign({}, parse(this.query), {
limit: limit,
offset: this.offset
}));

View file

@ -9,7 +9,7 @@
<a class="avatar">
<img :src="`${user.avatar_url}?thumbnail&size=200`" alt="avatar"/>
</a>
<mk-follow-button v-if="$root.$data.os.isSignedIn && $root.$data.os.i.id != user.id" :user="user"/>
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
</div>
<div class="title">
<h1>{{ user.name }}</h1>
@ -85,7 +85,7 @@ export default Vue.extend({
document.documentElement.style.background = '#313a42';
Progress.start();
this.$root.$data.os.api('users/show', {
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.fetching = false;

View file

@ -21,7 +21,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/followers', {
(this as any).api('users/followers', {
user_id: this.user.id,
iknow: true,
limit: 30

View file

@ -28,7 +28,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('aggregation/users/activity', {
(this as any).api('aggregation/users/activity', {
user_id: this.user.id,
limit: 30
}).then(data => {

View file

@ -19,7 +19,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/get_frequently_replied_users', {
(this as any).api('users/get_frequently_replied_users', {
user_id: this.user.id
}).then(res => {
this.fetching = false;

View file

@ -23,7 +23,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/posts', {
(this as any).api('users/posts', {
user_id: this.user.id,
with_media: true,
limit: 6

View file

@ -19,7 +19,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/posts', {
(this as any).api('users/posts', {
user_id: this.user.id
}).then(posts => {
this.fetching = false;

View file

@ -37,7 +37,7 @@
<mk-user-home-frequently-replied-users :user="user"/>
</div>
</section>
<section class="followers-you-know" v-if="$root.$data.os.isSignedIn && $root.$data.os.i.id !== user.id">
<section class="followers-you-know" v-if="os.isSignedIn && os.i.id !== user.id">
<h2>%fa:users%%i18n:mobile.tags.mk-user-overview.followers-you-know%</h2>
<div>
<mk-user-home-followers-you-know :user="user"/>