Refactor & Clean up
This commit is contained in:
parent
ba845f5218
commit
60ef3e3563
154 changed files with 438 additions and 481 deletions
|
|
@ -45,7 +45,7 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
(this as any).api('charts/user/notes', {
|
||||
this.$root.api('charts/user/notes', {
|
||||
userId: this.user.id,
|
||||
span: 'day',
|
||||
limit: 7 * 20
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
(this as any).api('drive').then(info => {
|
||||
this.$root.api('drive').then(info => {
|
||||
this.usage = info.usage / info.capacity * 100;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ export default Vue.extend({
|
|||
default: this.file.name,
|
||||
allowEmpty: false
|
||||
}).then(name => {
|
||||
(this as any).api('drive/files/update', {
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: this.file.id,
|
||||
name: name
|
||||
});
|
||||
|
|
@ -163,7 +163,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
toggleSensitive() {
|
||||
(this as any).api('drive/files/update', {
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: this.file.id,
|
||||
isSensitive: !this.file.isSensitive
|
||||
});
|
||||
|
|
@ -193,7 +193,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
deleteFile() {
|
||||
(this as any).api('drive/files/delete', {
|
||||
this.$root.api('drive/files/delete', {
|
||||
fileId: this.file.id
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export default Vue.extend({
|
|||
if (driveFile != null && driveFile != '') {
|
||||
const file = JSON.parse(driveFile);
|
||||
this.browser.removeFile(file.id);
|
||||
(this as any).api('drive/files/update', {
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
folderId: this.folder.id
|
||||
});
|
||||
|
|
@ -148,7 +148,7 @@ export default Vue.extend({
|
|||
if (folder.id == this.folder.id) return;
|
||||
|
||||
this.browser.removeFolder(folder.id);
|
||||
(this as any).api('drive/folders/update', {
|
||||
this.$root.api('drive/folders/update', {
|
||||
folderId: folder.id,
|
||||
parentId: this.folder.id
|
||||
}).then(() => {
|
||||
|
|
@ -201,7 +201,7 @@ export default Vue.extend({
|
|||
placeholder: this.$t('contextmenu.input-new-folder-name'),
|
||||
default: this.folder.name
|
||||
}).then(name => {
|
||||
(this as any).api('drive/folders/update', {
|
||||
this.$root.api('drive/folders/update', {
|
||||
folderId: this.folder.id,
|
||||
name: name
|
||||
});
|
||||
|
|
@ -209,7 +209,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
deleteFolder() {
|
||||
(this as any).api('drive/folders/delete', {
|
||||
this.$root.api('drive/folders/delete', {
|
||||
folderId: this.folder.id
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export default Vue.extend({
|
|||
if (driveFile != null && driveFile != '') {
|
||||
const file = JSON.parse(driveFile);
|
||||
this.browser.removeFile(file.id);
|
||||
(this as any).api('drive/files/update', {
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
folderId: this.folder ? this.folder.id : null
|
||||
});
|
||||
|
|
@ -93,7 +93,7 @@ export default Vue.extend({
|
|||
// 移動先が自分自身ならreject
|
||||
if (this.folder && folder.id == this.folder.id) return;
|
||||
this.browser.removeFolder(folder.id);
|
||||
(this as any).api('drive/folders/update', {
|
||||
this.$root.api('drive/folders/update', {
|
||||
folderId: folder.id,
|
||||
parentId: this.folder ? this.folder.id : null
|
||||
});
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('drive');
|
||||
this.connection = this.$root.stream.useSharedConnection('drive');
|
||||
|
||||
this.connection.on('fileCreated', this.onStreamDriveFileCreated);
|
||||
this.connection.on('fileUpdated', this.onStreamDriveFileUpdated);
|
||||
|
|
@ -290,7 +290,7 @@ export default Vue.extend({
|
|||
const file = JSON.parse(driveFile);
|
||||
if (this.files.some(f => f.id == file.id)) return;
|
||||
this.removeFile(file.id);
|
||||
(this as any).api('drive/files/update', {
|
||||
this.$root.api('drive/files/update', {
|
||||
fileId: file.id,
|
||||
folderId: this.folder ? this.folder.id : null
|
||||
});
|
||||
|
|
@ -306,7 +306,7 @@ export default Vue.extend({
|
|||
if (this.folder && folder.id == this.folder.id) return false;
|
||||
if (this.folders.some(f => f.id == folder.id)) return false;
|
||||
this.removeFolder(folder.id);
|
||||
(this as any).api('drive/folders/update', {
|
||||
this.$root.api('drive/folders/update', {
|
||||
folderId: folder.id,
|
||||
parentId: this.folder ? this.folder.id : null
|
||||
}).then(() => {
|
||||
|
|
@ -339,7 +339,7 @@ export default Vue.extend({
|
|||
title: this.$t('url-upload'),
|
||||
placeholder: this.$t('url-of-file')
|
||||
}).then(url => {
|
||||
(this as any).api('drive/files/upload_from_url', {
|
||||
this.$root.api('drive/files/upload_from_url', {
|
||||
url: url,
|
||||
folderId: this.folder ? this.folder.id : undefined
|
||||
});
|
||||
|
|
@ -359,7 +359,7 @@ export default Vue.extend({
|
|||
title: this.$t('create-folder'),
|
||||
placeholder: this.$t('folder-name')
|
||||
}).then(name => {
|
||||
(this as any).api('drive/folders/create', {
|
||||
this.$root.api('drive/folders/create', {
|
||||
name: name,
|
||||
parentId: this.folder ? this.folder.id : undefined
|
||||
}).then(folder => {
|
||||
|
|
@ -400,7 +400,7 @@ export default Vue.extend({
|
|||
|
||||
newWindow(folder) {
|
||||
if (document.body.clientWidth > 800) {
|
||||
(this as any).os.new(MkDriveWindow, {
|
||||
this.$root.new(MkDriveWindow, {
|
||||
folder: folder
|
||||
});
|
||||
} else {
|
||||
|
|
@ -420,7 +420,7 @@ export default Vue.extend({
|
|||
|
||||
this.fetching = true;
|
||||
|
||||
(this as any).api('drive/folders/show', {
|
||||
this.$root.api('drive/folders/show', {
|
||||
folderId: target
|
||||
}).then(folder => {
|
||||
this.folder = folder;
|
||||
|
|
@ -522,7 +522,7 @@ export default Vue.extend({
|
|||
const filesMax = 30;
|
||||
|
||||
// フォルダ一覧取得
|
||||
(this as any).api('drive/folders', {
|
||||
this.$root.api('drive/folders', {
|
||||
folderId: this.folder ? this.folder.id : null,
|
||||
limit: foldersMax + 1
|
||||
}).then(folders => {
|
||||
|
|
@ -535,7 +535,7 @@ export default Vue.extend({
|
|||
});
|
||||
|
||||
// ファイル一覧取得
|
||||
(this as any).api('drive/files', {
|
||||
this.$root.api('drive/files', {
|
||||
folderId: this.folder ? this.folder.id : null,
|
||||
limit: filesMax + 1
|
||||
}).then(files => {
|
||||
|
|
@ -565,7 +565,7 @@ export default Vue.extend({
|
|||
const max = 30;
|
||||
|
||||
// ファイル一覧取得
|
||||
(this as any).api('drive/files', {
|
||||
this.$root.api('drive/files', {
|
||||
folderId: this.folder ? this.folder.id : null,
|
||||
untilId: this.files[this.files.length - 1].id,
|
||||
limit: max + 1
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
this.connection.on('follow', this.onFollowChange);
|
||||
this.connection.on('unfollow', this.onFollowChange);
|
||||
},
|
||||
|
|
@ -64,20 +64,20 @@ export default Vue.extend({
|
|||
|
||||
try {
|
||||
if (this.u.isFollowing) {
|
||||
this.u = await (this as any).api('following/delete', {
|
||||
this.u = await this.$root.api('following/delete', {
|
||||
userId: this.u.id
|
||||
});
|
||||
} else {
|
||||
if (this.u.hasPendingFollowRequestFromYou) {
|
||||
this.u = await (this as any).api('following/requests/cancel', {
|
||||
this.u = await this.$root.api('following/requests/cancel', {
|
||||
userId: this.u.id
|
||||
});
|
||||
} else if (this.u.isLocked) {
|
||||
this.u = await (this as any).api('following/create', {
|
||||
this.u = await this.$root.api('following/create', {
|
||||
userId: this.u.id
|
||||
});
|
||||
} else {
|
||||
this.u = await (this as any).api('following/create', {
|
||||
this.u = await this.$root.api('following/create', {
|
||||
userId: this.user.id
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default Vue.extend({
|
|||
this.fetching = true;
|
||||
this.users = [];
|
||||
|
||||
(this as any).api('users/recommendation', {
|
||||
this.$root.api('users/recommendation', {
|
||||
limit: this.limit,
|
||||
offset: this.limit * this.page
|
||||
}).then(users => {
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ export default Vue.extend({
|
|||
|
||||
created() {
|
||||
if (this.$store.state.settings.home == null) {
|
||||
this.api('i/update_home', {
|
||||
this.$root.api('i/update_home', {
|
||||
home: _defaultDesktopHomeWidgets
|
||||
}).then(() => {
|
||||
this.$store.commit('settings/setHome', _defaultDesktopHomeWidgets);
|
||||
|
|
@ -177,7 +177,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
|
|
@ -227,7 +227,7 @@ export default Vue.extend({
|
|||
this.$store.commit('settings/setHome', left.concat(right));
|
||||
left.forEach(w => w.place = 'left');
|
||||
right.forEach(w => w.place = 'right');
|
||||
(this as any).api('i/update_home', {
|
||||
this.$root.api('i/update_home', {
|
||||
home: this.home
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
onClick() {
|
||||
(this as any).os.new(ImageViewer, {
|
||||
this.$root.new(ImageViewer, {
|
||||
image: this.image
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default Vue.extend({
|
|||
start = videoTag.currentTime
|
||||
videoTag.pause()
|
||||
}
|
||||
(this as any).os.new(MkMediaVideoDialog, {
|
||||
this.$root.new(MkMediaVideoDialog, {
|
||||
video: this.video,
|
||||
start,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default Vue.extend({
|
|||
i18n: i18n('desktop/views/components/messaging-window.vue'),
|
||||
methods: {
|
||||
navigate(user) {
|
||||
(this as any).os.new(MkMessagingRoomWindow, {
|
||||
this.$root.new(MkMessagingRoomWindow, {
|
||||
user: user
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ export default Vue.extend({
|
|||
mounted() {
|
||||
// Get replies
|
||||
if (!this.compact) {
|
||||
(this as any).api('notes/replies', {
|
||||
this.$root.api('notes/replies', {
|
||||
noteId: this.p.id,
|
||||
limit: 8
|
||||
}).then(replies => {
|
||||
|
|
@ -173,7 +173,7 @@ export default Vue.extend({
|
|||
if (this.p.geo) {
|
||||
const shouldShowMap = this.$store.getters.isSignedIn ? this.$store.state.settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
this.$root.os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]);
|
||||
const map = new maps.Map(this.$refs.map, {
|
||||
center: uluru,
|
||||
|
|
@ -193,7 +193,7 @@ export default Vue.extend({
|
|||
this.conversationFetching = true;
|
||||
|
||||
// Fetch conversation
|
||||
(this as any).api('notes/conversation', {
|
||||
this.$root.api('notes/conversation', {
|
||||
noteId: this.p.replyId
|
||||
}).then(conversation => {
|
||||
this.conversationFetching = false;
|
||||
|
|
@ -202,26 +202,26 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
reply() {
|
||||
(this as any).os.new(MkPostFormWindow, {
|
||||
this.$root.new(MkPostFormWindow, {
|
||||
reply: this.p
|
||||
});
|
||||
},
|
||||
|
||||
renote() {
|
||||
(this as any).os.new(MkRenoteFormWindow, {
|
||||
this.$root.new(MkRenoteFormWindow, {
|
||||
note: this.p
|
||||
});
|
||||
},
|
||||
|
||||
react() {
|
||||
(this as any).os.new(MkReactionPicker, {
|
||||
this.$root.new(MkReactionPicker, {
|
||||
source: this.$refs.reactButton,
|
||||
note: this.p
|
||||
});
|
||||
},
|
||||
|
||||
menu() {
|
||||
(this as any).os.new(MkNoteMenu, {
|
||||
this.$root.new(MkNoteMenu, {
|
||||
source: this.$refs.menuButton,
|
||||
note: this.p
|
||||
});
|
||||
|
|
|
|||
|
|
@ -117,14 +117,14 @@ export default Vue.extend({
|
|||
|
||||
created() {
|
||||
if (this.detail) {
|
||||
(this as any).api('notes/replies', {
|
||||
this.$root.api('notes/replies', {
|
||||
noteId: this.appearNote.id,
|
||||
limit: 8
|
||||
}).then(replies => {
|
||||
this.replies = replies;
|
||||
});
|
||||
|
||||
(this as any).api('notes/conversation', {
|
||||
this.$root.api('notes/conversation', {
|
||||
noteId: this.appearNote.replyId
|
||||
}).then(conversation => {
|
||||
this.conversation = conversation.reverse();
|
||||
|
|
|
|||
|
|
@ -142,13 +142,13 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
mounted() {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
|
||||
this.connection.on('notification', this.onNotification);
|
||||
|
||||
const max = 10;
|
||||
|
||||
(this as any).api('i/notifications', {
|
||||
this.$root.api('i/notifications', {
|
||||
limit: max + 1
|
||||
}).then(notifications => {
|
||||
if (notifications.length == max + 1) {
|
||||
|
|
@ -171,7 +171,7 @@ export default Vue.extend({
|
|||
|
||||
const max = 30;
|
||||
|
||||
(this as any).api('i/notifications', {
|
||||
this.$root.api('i/notifications', {
|
||||
limit: max + 1,
|
||||
untilId: this.notifications[this.notifications.length - 1].id
|
||||
}).then(notifications => {
|
||||
|
|
@ -188,7 +188,7 @@ export default Vue.extend({
|
|||
|
||||
onNotification(notification) {
|
||||
// TODO: ユーザーが画面を見てないと思われるとき(ブラウザやタブがアクティブじゃないなど)は送信しない
|
||||
(this as any).os.stream.send('readNotification', {
|
||||
this.$root.stream.send('readNotification', {
|
||||
id: notification.id
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.maxNoteTextLength = meta.maxNoteTextLength;
|
||||
});
|
||||
},
|
||||
|
|
@ -195,7 +195,7 @@ export default Vue.extend({
|
|||
|
||||
// ダイレクトへのリプライはリプライ先ユーザーを初期設定
|
||||
if (this.reply && this.reply.visibility === 'specified') {
|
||||
(this as any).api('users/show', { userId: this.reply.userId }).then(user => {
|
||||
this.$root.api('users/show', { userId: this.reply.userId }).then(user => {
|
||||
this.visibleUsers.push(user);
|
||||
});
|
||||
}
|
||||
|
|
@ -354,7 +354,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
setVisibility() {
|
||||
const w = (this as any).os.new(MkVisibilityChooser, {
|
||||
const w = this.$root.new(MkVisibilityChooser, {
|
||||
source: this.$refs.visibilityButton
|
||||
});
|
||||
w.$once('chosen', v => {
|
||||
|
|
@ -367,7 +367,7 @@ export default Vue.extend({
|
|||
title: this.$t('enter-username')
|
||||
}).then(acct => {
|
||||
if (acct.startsWith('@')) acct = acct.substr(1);
|
||||
(this as any).api('users/show', parseAcct(acct)).then(user => {
|
||||
this.$root.api('users/show', parseAcct(acct)).then(user => {
|
||||
this.visibleUsers.push(user);
|
||||
});
|
||||
});
|
||||
|
|
@ -380,7 +380,7 @@ export default Vue.extend({
|
|||
post() {
|
||||
this.posting = true;
|
||||
|
||||
(this as any).api('notes/create', {
|
||||
this.$root.api('notes/create', {
|
||||
text: this.text == '' ? undefined : this.text,
|
||||
fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
||||
replyId: this.reply ? this.reply.id : undefined,
|
||||
|
|
|
|||
|
|
@ -26,19 +26,19 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
(this as any).api('following/requests/list').then(requests => {
|
||||
this.$root.api('following/requests/list').then(requests => {
|
||||
this.fetching = false;
|
||||
this.requests = requests;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
accept(user) {
|
||||
(this as any).api('following/requests/accept', { userId: user.id }).then(() => {
|
||||
this.$root.api('following/requests/accept', { userId: user.id }).then(() => {
|
||||
this.requests = this.requests.filter(r => r.follower.id != user.id);
|
||||
});
|
||||
},
|
||||
reject(user) {
|
||||
(this as any).api('following/requests/reject', { userId: user.id }).then(() => {
|
||||
this.$root.api('following/requests/reject', { userId: user.id }).then(() => {
|
||||
this.requests = this.requests.filter(r => r.follower.id != user.id);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default Vue.extend({
|
|||
methods: {
|
||||
ok() {
|
||||
this.wait = true;
|
||||
(this as any).api('notes/create', {
|
||||
this.$root.api('notes/create', {
|
||||
renoteId: this.note.id
|
||||
}).then(data => {
|
||||
this.$emit('posted');
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default Vue.extend({
|
|||
title: this.$t('enter-password'),
|
||||
type: 'password'
|
||||
}).then(password => {
|
||||
(this as any).api('i/2fa/register', {
|
||||
this.$root.api('i/2fa/register', {
|
||||
password: password
|
||||
}).then(data => {
|
||||
this.data = data;
|
||||
|
|
@ -52,7 +52,7 @@ export default Vue.extend({
|
|||
title: this.$t('enter-password'),
|
||||
type: 'password'
|
||||
}).then(password => {
|
||||
(this as any).api('i/2fa/unregister', {
|
||||
this.$root.api('i/2fa/unregister', {
|
||||
password: password
|
||||
}).then(() => {
|
||||
(this as any).apis.notify(this.$t('unregistered'));
|
||||
|
|
@ -62,7 +62,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
submit() {
|
||||
(this as any).api('i/2fa/done', {
|
||||
this.$root.api('i/2fa/done', {
|
||||
token: this.token
|
||||
}).then(() => {
|
||||
(this as any).apis.notify(this.$t('success'));
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
(this as any).api('i/authorized_apps').then(apps => {
|
||||
this.$root.api('i/authorized_apps').then(apps => {
|
||||
this.apps = apps;
|
||||
this.fetching = false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
mounted() {
|
||||
(this as any).api('i/signin_history').then(signins => {
|
||||
this.$root.api('i/signin_history').then(signins => {
|
||||
this.signins = signins;
|
||||
this.fetching = false;
|
||||
});
|
||||
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
|
||||
this.connection.on('signin', this.onSignin);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -500,13 +500,13 @@ export default Vue.extend({
|
|||
}
|
||||
},
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.meta = meta;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
readAllUnreadNotes() {
|
||||
(this as any).api('i/read_all_unread_notes');
|
||||
this.$root.api('i/read_all_unread_notes');
|
||||
},
|
||||
customizeHome() {
|
||||
this.$router.push('/i/customize-home');
|
||||
|
|
@ -516,18 +516,18 @@ export default Vue.extend({
|
|||
(this as any).apis.chooseDriveFile({
|
||||
multiple: false
|
||||
}).then(file => {
|
||||
(this as any).api('i/update', {
|
||||
this.$root.api('i/update', {
|
||||
wallpaperId: file.id
|
||||
});
|
||||
});
|
||||
},
|
||||
deleteWallpaper() {
|
||||
(this as any).api('i/update', {
|
||||
this.$root.api('i/update', {
|
||||
wallpaperId: null
|
||||
});
|
||||
},
|
||||
onChangeAutoWatch(v) {
|
||||
(this as any).api('i/update', {
|
||||
this.$root.api('i/update', {
|
||||
autoWatch: v
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -65,32 +65,32 @@ export default Vue.extend({
|
|||
this.query = {
|
||||
query: this.tagTl.query
|
||||
};
|
||||
this.connection = (this as any).os.stream.connectToChannel('hashtag', { q: this.tagTl.query });
|
||||
this.connection = this.$root.stream.connectToChannel('hashtag', { q: this.tagTl.query });
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'home') {
|
||||
this.endpoint = 'notes/timeline';
|
||||
const onChangeFollowing = () => {
|
||||
this.fetch();
|
||||
};
|
||||
this.connection = (this as any).os.stream.useSharedConnection('homeTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('homeTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
this.connection.on('follow', onChangeFollowing);
|
||||
this.connection.on('unfollow', onChangeFollowing);
|
||||
} else if (this.src == 'local') {
|
||||
this.endpoint = 'notes/local-timeline';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('localTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('localTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'hybrid') {
|
||||
this.endpoint = 'notes/hybrid-timeline';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('hybridTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('hybridTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'global') {
|
||||
this.endpoint = 'notes/global-timeline';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('globalTimeline');
|
||||
this.connection = this.$root.stream.useSharedConnection('globalTimeline');
|
||||
this.connection.on('note', prepend);
|
||||
} else if (this.src == 'mentions') {
|
||||
this.endpoint = 'notes/mentions';
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
this.connection.on('mention', prepend);
|
||||
} else if (this.src == 'messages') {
|
||||
this.endpoint = 'notes/mentions';
|
||||
|
|
@ -102,7 +102,7 @@ export default Vue.extend({
|
|||
prepend(note);
|
||||
}
|
||||
};
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
this.connection.on('mention', onNote);
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ export default Vue.extend({
|
|||
this.fetching = true;
|
||||
|
||||
(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
|
||||
(this as any).api(this.endpoint, Object.assign({
|
||||
this.$root.api(this.endpoint, Object.assign({
|
||||
limit: fetchLimit + 1,
|
||||
untilDate: this.date ? this.date.getTime() : undefined
|
||||
}, this.baseQuery, this.query)).then(notes => {
|
||||
|
|
@ -138,7 +138,7 @@ export default Vue.extend({
|
|||
|
||||
this.moreFetching = true;
|
||||
|
||||
const promise = (this as any).api(this.endpoint, Object.assign({
|
||||
const promise = this.$root.api(this.endpoint, Object.assign({
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id
|
||||
}, this.baseQuery, this.query));
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.enableLocalTimeline = !meta.disableLocalTimeline;
|
||||
});
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
async chooseList() {
|
||||
const lists = await (this as any).api('users/lists/list');
|
||||
const lists = await this.$root.api('users/lists/list');
|
||||
|
||||
let menu = [{
|
||||
icon: 'plus',
|
||||
|
|
@ -112,7 +112,7 @@ export default Vue.extend({
|
|||
(this as any).apis.input({
|
||||
title: this.$t('list-name'),
|
||||
}).then(async title => {
|
||||
const list = await (this as any).api('users/lists/create', {
|
||||
const list = await this.$root.api('users/lists/create', {
|
||||
title
|
||||
});
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ export default Vue.extend({
|
|||
}
|
||||
})));
|
||||
|
||||
this.os.new(Menu, {
|
||||
this.$root.new(Menu, {
|
||||
source: this.$refs.listButton,
|
||||
compact: false,
|
||||
items: menu
|
||||
|
|
@ -147,7 +147,7 @@ export default Vue.extend({
|
|||
icon: 'plus',
|
||||
text: this.$t('add-tag-timeline'),
|
||||
action: () => {
|
||||
(this as any).os.new(MkSettingsWindow, {
|
||||
this.$root.new(MkSettingsWindow, {
|
||||
initialPage: 'hashtags'
|
||||
});
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ export default Vue.extend({
|
|||
}
|
||||
})));
|
||||
|
||||
this.os.new(Menu, {
|
||||
this.$root.new(Menu, {
|
||||
source: this.$refs.tagButton,
|
||||
compact: false,
|
||||
items: menu
|
||||
|
|
|
|||
|
|
@ -137,25 +137,25 @@ export default Vue.extend({
|
|||
},
|
||||
drive() {
|
||||
this.close();
|
||||
(this as any).os.new(MkDriveWindow);
|
||||
this.$root.new(MkDriveWindow);
|
||||
},
|
||||
list() {
|
||||
this.close();
|
||||
const w = (this as any).os.new(MkUserListsWindow);
|
||||
const w = this.$root.new(MkUserListsWindow);
|
||||
w.$once('choosen', list => {
|
||||
this.$router.push(`i/lists/${ list.id }`);
|
||||
});
|
||||
},
|
||||
followRequests() {
|
||||
this.close();
|
||||
(this as any).os.new(MkFollowRequestsWindow);
|
||||
this.$root.new(MkFollowRequestsWindow);
|
||||
},
|
||||
settings() {
|
||||
this.close();
|
||||
(this as any).os.new(MkSettingsWindow);
|
||||
this.$root.new(MkSettingsWindow);
|
||||
},
|
||||
signout() {
|
||||
(this as any).os.signout();
|
||||
this.$root.os.signout();
|
||||
},
|
||||
dark() {
|
||||
this.$store.commit('device/set', {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export default Vue.extend({
|
|||
},
|
||||
mounted() {
|
||||
if (this.$store.getters.isSignedIn) {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
|
||||
this.connection.on('reversiInvited', this.onReversiInvited);
|
||||
this.connection.on('reversi_no_invites', this.onReversiNoInvites);
|
||||
|
|
@ -79,11 +79,11 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
messaging() {
|
||||
(this as any).os.new(MkMessagingWindow);
|
||||
this.$root.new(MkMessagingWindow);
|
||||
},
|
||||
|
||||
game() {
|
||||
(this as any).os.new(MkGameWindow);
|
||||
this.$root.new(MkGameWindow);
|
||||
},
|
||||
|
||||
goToTop() {
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export default Vue.extend({
|
|||
|
||||
mounted() {
|
||||
if (this.$store.getters.isSignedIn) {
|
||||
this.connection = (this as any).os.stream.useSharedConnection('main');
|
||||
this.connection = this.$root.stream.useSharedConnection('main');
|
||||
|
||||
this.connection.on('reversiInvited', this.onReversiInvited);
|
||||
this.connection.on('reversi_no_invites', this.onReversiNoInvites);
|
||||
|
|
@ -131,11 +131,11 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
messaging() {
|
||||
(this as any).os.new(MkMessagingWindow);
|
||||
this.$root.new(MkMessagingWindow);
|
||||
},
|
||||
|
||||
game() {
|
||||
(this as any).os.new(MkGameWindow);
|
||||
this.$root.new(MkGameWindow);
|
||||
},
|
||||
|
||||
post() {
|
||||
|
|
@ -143,26 +143,26 @@ export default Vue.extend({
|
|||
},
|
||||
|
||||
drive() {
|
||||
(this as any).os.new(MkDriveWindow);
|
||||
this.$root.new(MkDriveWindow);
|
||||
},
|
||||
|
||||
list() {
|
||||
const w = (this as any).os.new(MkUserListsWindow);
|
||||
const w = this.$root.new(MkUserListsWindow);
|
||||
w.$once('choosen', list => {
|
||||
this.$router.push(`i/lists/${ list.id }`);
|
||||
});
|
||||
},
|
||||
|
||||
followRequests() {
|
||||
(this as any).os.new(MkFollowRequestsWindow);
|
||||
this.$root.new(MkFollowRequestsWindow);
|
||||
},
|
||||
|
||||
settings() {
|
||||
(this as any).os.new(MkSettingsWindow);
|
||||
this.$root.new(MkSettingsWindow);
|
||||
},
|
||||
|
||||
signout() {
|
||||
(this as any).os.signout();
|
||||
this.$root.os.signout();
|
||||
},
|
||||
|
||||
notifications() {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export default Vue.extend({
|
|||
methods: {
|
||||
init() {
|
||||
if (this.connection) this.connection.dispose();
|
||||
this.connection = (this as any).os.stream.connectToChannel('userList', {
|
||||
this.connection = this.$root.stream.connectToChannel('userList', {
|
||||
listId: this.list.id
|
||||
});
|
||||
this.connection.on('note', this.onNote);
|
||||
|
|
@ -44,7 +44,7 @@ export default Vue.extend({
|
|||
this.fetching = true;
|
||||
|
||||
(this.$refs.timeline as any).init(() => new Promise((res, rej) => {
|
||||
(this as any).api('notes/user-list-timeline', {
|
||||
this.$root.api('notes/user-list-timeline', {
|
||||
listId: this.list.id,
|
||||
limit: fetchLimit + 1,
|
||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||
|
|
@ -64,7 +64,7 @@ export default Vue.extend({
|
|||
more() {
|
||||
this.moreFetching = true;
|
||||
|
||||
const promise = (this as any).api('notes/user-list-timeline', {
|
||||
const promise = this.$root.api('notes/user-list-timeline', {
|
||||
listId: this.list.id,
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
(this as any).api('users/lists/list').then(lists => {
|
||||
this.$root.api('users/lists/list').then(lists => {
|
||||
this.fetching = false;
|
||||
this.lists = lists;
|
||||
});
|
||||
|
|
@ -32,7 +32,7 @@ export default Vue.extend({
|
|||
(this as any).apis.input({
|
||||
title: this.$t('list-name'),
|
||||
}).then(async title => {
|
||||
const list = await (this as any).api('users/lists/create', {
|
||||
const list = await this.$root.api('users/lists/create', {
|
||||
title
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default Vue.extend({
|
|||
parseAcct(this.user.substr(1)) :
|
||||
{ userId: this.user };
|
||||
|
||||
(this as any).api('users/show', query).then(user => {
|
||||
this.$root.api('users/show', query).then(user => {
|
||||
this.u = user;
|
||||
this.open();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export default Vue.extend({
|
|||
this.preventMount = true;
|
||||
} else {
|
||||
// ウィンドウをウィンドウシステムに登録
|
||||
(this as any).os.windows.add(this);
|
||||
this.$root.os.windows.add(this);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ export default Vue.extend({
|
|||
|
||||
destroyed() {
|
||||
// ウィンドウをウィンドウシステムから削除
|
||||
(this as any).os.windows.remove(this);
|
||||
this.$root.os.windows.remove(this);
|
||||
|
||||
window.removeEventListener('resize', this.onBrowserResize);
|
||||
},
|
||||
|
|
@ -234,7 +234,7 @@ export default Vue.extend({
|
|||
top() {
|
||||
let z = 0;
|
||||
|
||||
(this as any).os.windows.getAll().forEach(w => {
|
||||
this.$root.os.windows.getAll().forEach(w => {
|
||||
if (w == this) return;
|
||||
const m = w.$refs.main;
|
||||
const mz = Number(document.defaultView.getComputedStyle(m, null).zIndex);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue