Refactor & Clean up

This commit is contained in:
syuilo 2018-11-09 08:13:34 +09:00
parent ba845f5218
commit 60ef3e3563
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
154 changed files with 438 additions and 481 deletions

View File

@ -26,14 +26,6 @@ common:
close: "閉じる" close: "閉じる"
do-not-copy-paste: "ここにコードを入力したり張り付けたりしないでください。アカウントが不正利用される可能性があります。" do-not-copy-paste: "ここにコードを入力したり張り付けたりしないでください。アカウントが不正利用される可能性があります。"
load-more: "もっと読み込む" load-more: "もっと読み込む"
BSoD:
fatal-error: ":( 致命的な問題が発生しました。"
update-browser-os: "お使いのブラウザ(またはOS)のバージョンを更新すると解決する可能性があります。"
error-code: "エラーコード"
browser-version: "ブラウザ バージョン"
client-version: "クライアント バージョン"
email-support: "問題が解決しない場合は、上記の情報をお書き添えの上 syuilotan@yahoo.co.jp までご連絡ください。"
thanks: "Thank you for using Misskey."
got-it: "わかった" got-it: "わかった"
customization-tips: customization-tips:

View File

@ -34,7 +34,7 @@ export default Vue.extend({
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.announcements = meta.broadcasts; this.announcements = meta.broadcasts;
}); });
}, },
@ -64,7 +64,7 @@ export default Vue.extend({
}, },
save(silent) { save(silent) {
(this as any).api('admin/update-meta', { this.$root.api('admin/update-meta', {
broadcasts: this.announcements broadcasts: this.announcements
}).then(() => { }).then(() => {
if (!silent) { if (!silent) {

View File

@ -33,7 +33,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('apLog'); this.connection = this.$root.stream.useSharedConnection('apLog');
this.connection.on('log', this.onLog); this.connection.on('log', this.onLog);
this.connection.on('logs', this.onLogs); this.connection.on('logs', this.onLogs);
this.connection.send('requestLog', { this.connection.send('requestLog', {

View File

@ -105,17 +105,17 @@ export default Vue.extend({
this.now = new Date(); this.now = new Date();
const [perHour, perDay] = await Promise.all([Promise.all([ const [perHour, perDay] = await Promise.all([Promise.all([
(this as any).api('charts/federation', { limit: limit, span: 'hour' }), this.$root.api('charts/federation', { limit: limit, span: 'hour' }),
(this as any).api('charts/users', { limit: limit, span: 'hour' }), this.$root.api('charts/users', { limit: limit, span: 'hour' }),
(this as any).api('charts/notes', { limit: limit, span: 'hour' }), this.$root.api('charts/notes', { limit: limit, span: 'hour' }),
(this as any).api('charts/drive', { limit: limit, span: 'hour' }), this.$root.api('charts/drive', { limit: limit, span: 'hour' }),
(this as any).api('charts/network', { limit: limit, span: 'hour' }) this.$root.api('charts/network', { limit: limit, span: 'hour' })
]), Promise.all([ ]), Promise.all([
(this as any).api('charts/federation', { limit: limit, span: 'day' }), this.$root.api('charts/federation', { limit: limit, span: 'day' }),
(this as any).api('charts/users', { limit: limit, span: 'day' }), this.$root.api('charts/users', { limit: limit, span: 'day' }),
(this as any).api('charts/notes', { limit: limit, span: 'day' }), this.$root.api('charts/notes', { limit: limit, span: 'day' }),
(this as any).api('charts/drive', { limit: limit, span: 'day' }), this.$root.api('charts/drive', { limit: limit, span: 'day' }),
(this as any).api('charts/network', { limit: limit, span: 'day' }) this.$root.api('charts/network', { limit: limit, span: 'day' })
])]); ])]);
const chart = { const chart = {

View File

@ -47,7 +47,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });

View File

@ -101,13 +101,13 @@ export default Vue.extend({
}, },
created() { created() {
this.connection = (this as any).os.stream.useSharedConnection('serverStats'); this.connection = this.$root.stream.useSharedConnection('serverStats');
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
(this as any).api('stats').then(stats => { this.$root.api('stats').then(stats => {
this.stats = stats; this.stats = stats;
}); });
}, },

View File

@ -68,7 +68,7 @@ export default Vue.extend({
methods: { methods: {
add() { add() {
(this as any).api('admin/emoji/add', { this.$root.api('admin/emoji/add', {
name: this.name, name: this.name,
url: this.url, url: this.url,
aliases: this.aliases.split(' ').filter(x => x.length > 0) aliases: this.aliases.split(' ').filter(x => x.length > 0)
@ -87,7 +87,7 @@ export default Vue.extend({
}, },
fetchEmojis() { fetchEmojis() {
(this as any).api('admin/emoji/list').then(emojis => { this.$root.api('admin/emoji/list').then(emojis => {
emojis.reverse(); emojis.reverse();
emojis.forEach(e => e.aliases = (e.aliases || []).join(' ')); emojis.forEach(e => e.aliases = (e.aliases || []).join(' '));
this.emojis = emojis; this.emojis = emojis;
@ -95,7 +95,7 @@ export default Vue.extend({
}, },
updateEmoji(emoji) { updateEmoji(emoji) {
(this as any).api('admin/emoji/update', { this.$root.api('admin/emoji/update', {
id: emoji.id, id: emoji.id,
name: emoji.name, name: emoji.name,
url: emoji.url, url: emoji.url,
@ -121,7 +121,7 @@ export default Vue.extend({
}).then(res => { }).then(res => {
if (!res.value) return; if (!res.value) return;
(this as any).api('admin/emoji/remove', { this.$root.api('admin/emoji/remove', {
id: emoji.id id: emoji.id
}).then(() => { }).then(() => {
this.$swal({ this.$swal({

View File

@ -22,18 +22,18 @@ export default Vue.extend({
}; };
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.hidedTags = meta.hidedTags.join('\n'); this.hidedTags = meta.hidedTags.join('\n');
}); });
}, },
methods: { methods: {
save() { save() {
(this as any).api('admin/update-meta', { this.$root.api('admin/update-meta', {
hidedTags: this.hidedTags.split('\n') hidedTags: this.hidedTags.split('\n')
}).then(() => { }).then(() => {
//(this as any).os.apis.dialog({ text: `Saved` }); //this.$root.os.apis.dialog({ text: `Saved` });
}).catch(e => { }).catch(e => {
//(this as any).os.apis.dialog({ text: `Failed ${e}` }); //this.$root.os.apis.dialog({ text: `Failed ${e}` });
}); });
} }
} }

View File

@ -113,7 +113,7 @@ export default Vue.extend({
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.maintainerName = meta.maintainer.name; this.maintainerName = meta.maintainer.name;
this.maintainerEmail = meta.maintainer.email; this.maintainerEmail = meta.maintainer.email;
this.bannerUrl = meta.bannerUrl; this.bannerUrl = meta.bannerUrl;
@ -139,7 +139,7 @@ export default Vue.extend({
methods: { methods: {
invite() { invite() {
(this as any).api('admin/invite').then(x => { this.$root.api('admin/invite').then(x => {
this.inviteCode = x.code; this.inviteCode = x.code;
}).catch(e => { }).catch(e => {
this.$swal({ this.$swal({
@ -150,7 +150,7 @@ export default Vue.extend({
}, },
updateMeta() { updateMeta() {
(this as any).api('admin/update-meta', { this.$root.api('admin/update-meta', {
maintainerName: this.maintainerName, maintainerName: this.maintainerName,
maintainerEmail: this.maintainerEmail, maintainerEmail: this.maintainerEmail,
disableRegistration: this.disableRegistration, disableRegistration: this.disableRegistration,

View File

@ -67,13 +67,13 @@ export default Vue.extend({
this.verifying = true; this.verifying = true;
const process = async () => { const process = async () => {
const user = await (this as any).os.api('users/show', parseAcct(this.verifyUsername)); const user = await this.$root.os.api('users/show', parseAcct(this.verifyUsername));
await (this as any).os.api('admin/verify-user', { userId: user.id }); await this.$root.os.api('admin/verify-user', { userId: user.id });
//(this as any).os.apis.dialog({ text: this.$t('verified') }); //this.$root.os.apis.dialog({ text: this.$t('verified') });
}; };
await process().catch(e => { await process().catch(e => {
//(this as any).os.apis.dialog({ text: `Failed: ${e}` }); //this.$root.os.apis.dialog({ text: `Failed: ${e}` });
}); });
this.verifying = false; this.verifying = false;
@ -83,13 +83,13 @@ export default Vue.extend({
this.unverifying = true; this.unverifying = true;
const process = async () => { const process = async () => {
const user = await (this as any).os.api('users/show', parseAcct(this.unverifyUsername)); const user = await this.$root.os.api('users/show', parseAcct(this.unverifyUsername));
await (this as any).os.api('admin/unverify-user', { userId: user.id }); await this.$root.os.api('admin/unverify-user', { userId: user.id });
//(this as any).os.apis.dialog({ text: this.$t('unverified') }); //this.$root.os.apis.dialog({ text: this.$t('unverified') });
}; };
await process().catch(e => { await process().catch(e => {
//(this as any).os.apis.dialog({ text: `Failed: ${e}` }); //this.$root.os.apis.dialog({ text: `Failed: ${e}` });
}); });
this.unverifying = false; this.unverifying = false;
@ -99,13 +99,13 @@ export default Vue.extend({
this.suspending = true; this.suspending = true;
const process = async () => { const process = async () => {
const user = await (this as any).os.api('users/show', parseAcct(this.suspendUsername)); const user = await this.$root.os.api('users/show', parseAcct(this.suspendUsername));
await (this as any).os.api('admin/suspend-user', { userId: user.id }); await this.$root.os.api('admin/suspend-user', { userId: user.id });
//(this as any).os.apis.dialog({ text: this.$t('suspended') }); //this.$root.os.apis.dialog({ text: this.$t('suspended') });
}; };
await process().catch(e => { await process().catch(e => {
//(this as any).os.apis.dialog({ text: `Failed: ${e}` }); //this.$root.os.apis.dialog({ text: `Failed: ${e}` });
}); });
this.suspending = false; this.suspending = false;
@ -115,13 +115,13 @@ export default Vue.extend({
this.unsuspending = true; this.unsuspending = true;
const process = async () => { const process = async () => {
const user = await (this as any).os.api('users/show', parseAcct(this.unsuspendUsername)); const user = await this.$root.os.api('users/show', parseAcct(this.unsuspendUsername));
await (this as any).os.api('admin/unsuspend-user', { userId: user.id }); await this.$root.os.api('admin/unsuspend-user', { userId: user.id });
//(this as any).os.apis.dialog({ text: this.$t('unsuspended') }); //this.$root.os.apis.dialog({ text: this.$t('unsuspended') });
}; };
await process().catch(e => { await process().catch(e => {
//(this as any).os.apis.dialog({ text: `Failed: ${e}` }); //this.$root.os.apis.dialog({ text: `Failed: ${e}` });
}); });
this.unsuspending = false; this.unsuspending = false;

View File

@ -13,13 +13,6 @@ html
body body
overflow-wrap break-word overflow-wrap break-word
#error
padding 32px
color #fff
hr
border solid 1px #fff
#nprogress #nprogress
pointer-events none pointer-events none

View File

@ -48,7 +48,7 @@ export default Vue.extend({
}, },
methods: { methods: {
cancel() { cancel() {
(this as any).api('auth/deny', { this.$root.api('auth/deny', {
token: this.session.token token: this.session.token
}).then(() => { }).then(() => {
this.$emit('denied'); this.$emit('denied');
@ -56,7 +56,7 @@ export default Vue.extend({
}, },
accept() { accept() {
(this as any).api('auth/accept', { this.$root.api('auth/accept', {
token: this.session.token token: this.session.token
}).then(() => { }).then(() => {
this.$emit('accepted'); this.$emit('accepted');

View File

@ -57,7 +57,7 @@ export default Vue.extend({
if (!this.$store.getters.isSignedIn) return; if (!this.$store.getters.isSignedIn) return;
// Fetch session // Fetch session
(this as any).api('auth/session/show', { this.$root.api('auth/session/show', {
token: this.token token: this.token
}).then(session => { }).then(session => {
this.session = session; this.session = session;
@ -65,7 +65,7 @@ export default Vue.extend({
// //
if (this.session.app.isAuthorized) { if (this.session.app.isAuthorized) {
(this as any).api('auth/accept', { this.$root.api('auth/accept', {
token: this.session.token token: this.session.token
}).then(() => { }).then(() => {
this.accepted(); this.accepted();

View File

@ -115,7 +115,7 @@ export default (opts: Opts = {}) => ({
react(viaKeyboard = false) { react(viaKeyboard = false) {
this.blur(); this.blur();
(this as any).os.new(MkReactionPicker, { this.$root.new(MkReactionPicker, {
source: this.$refs.reactButton, source: this.$refs.reactButton,
note: this.appearNote, note: this.appearNote,
showFocus: viaKeyboard, showFocus: viaKeyboard,
@ -126,28 +126,28 @@ export default (opts: Opts = {}) => ({
}, },
reactDirectly(reaction) { reactDirectly(reaction) {
(this as any).api('notes/reactions/create', { (this.$root.api('notes/reactions/create', {
noteId: this.appearNote.id, noteId: this.appearNote.id,
reaction: reaction reaction: reaction
}); });
}, },
favorite() { favorite() {
(this as any).api('notes/favorites/create', { this.$root.api('notes/favorites/create', {
noteId: this.appearNote.id noteId: this.appearNote.id
}).then(() => { }).then(() => {
(this as any).os.new(Ok); this.$root.new(Ok);
}); });
}, },
del() { del() {
(this as any).api('notes/delete', { this.$root.api('notes/delete', {
noteId: this.appearNote.id noteId: this.appearNote.id
}); });
}, },
menu(viaKeyboard = false) { menu(viaKeyboard = false) {
(this as any).os.new(MkNoteMenu, { this.$root.new(MkNoteMenu, {
source: this.$refs.menuButton, source: this.$refs.menuButton,
note: this.appearNote, note: this.appearNote,
animation: !viaKeyboard, animation: !viaKeyboard,

View File

@ -26,7 +26,7 @@ export default prop => ({
created() { created() {
if (this.$store.getters.isSignedIn) { if (this.$store.getters.isSignedIn) {
this.connection = (this as any).os.stream; this.connection = this.$root.stream;
} }
}, },

View File

@ -54,7 +54,7 @@ export default Vue.extend({
title: this.$t('enter-password'), title: this.$t('enter-password'),
type: 'password' type: 'password'
}).then(password => { }).then(password => {
(this as any).api('i/regenerate_token', { this.$root.api('i/regenerate_token', {
password: password password: password
}); });
}); });
@ -62,7 +62,7 @@ export default Vue.extend({
send() { send() {
this.sending = true; this.sending = true;
(this as any).api(this.endpoint, JSON5.parse(this.body)).then(res => { this.$root.api(this.endpoint, JSON5.parse(this.body)).then(res => {
this.sending = false; this.sending = false;
this.res = JSON5.stringify(res, null, 2); this.res = JSON5.stringify(res, null, 2);
}, err => { }, err => {

View File

@ -114,7 +114,7 @@ export default Vue.extend({
mounted() { mounted() {
//#region Construct Emoji DB //#region Construct Emoji DB
const customEmojis = (this.os.getMetaSync() || { emojis: [] }).emojis || []; const customEmojis = (this.$root.getMetaSync() || { emojis: [] }).emojis || [];
const emojiDefinitions: EmojiDef[] = []; const emojiDefinitions: EmojiDef[] = [];
customEmojis.forEach(x => { customEmojis.forEach(x => {
@ -185,7 +185,7 @@ export default Vue.extend({
this.users = users; this.users = users;
this.fetching = false; this.fetching = false;
} else { } else {
(this as any).api('users/search', { this.$root.api('users/search', {
query: this.q, query: this.q,
limit: 30 limit: 30
}).then(users => { }).then(users => {
@ -208,7 +208,7 @@ export default Vue.extend({
this.hashtags = hashtags; this.hashtags = hashtags;
this.fetching = false; this.fetching = false;
} else { } else {
(this as any).api('hashtags/search', { this.$root.api('hashtags/search', {
query: this.q, query: this.q,
limit: 30 limit: 30
}).then(hashtags => { }).then(hashtags => {

View File

@ -44,7 +44,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
(this as any).api('drive').then(info => { this.$root.api('drive').then(info => {
this.capacity = info.capacity; this.capacity = info.capacity;
this.usage = info.usage; this.usage = info.usage;
this.fetching = false; this.fetching = false;
@ -57,7 +57,7 @@ export default Vue.extend({
methods: { methods: {
renderChart() { renderChart() {
(this as any).api('charts/user/drive', { this.$root.api('charts/user/drive', {
userId: this.$store.state.i.id, userId: this.$store.state.i.id,
span: 'day', span: 'day',
limit: 21 limit: 21

View File

@ -291,7 +291,7 @@ export default Vue.extend({
}, },
surrender() { surrender() {
(this as any).api('games/reversi/games/surrender', { this.$root.api('games/reversi/games/surrender', {
gameId: this.game.id gameId: this.game.id
}); });
}, },

View File

@ -35,7 +35,7 @@ export default Vue.extend({
}, },
created() { created() {
this.g = this.game; this.g = this.game;
this.connection = (this as any).os.stream.connectToChannel('gamesReversiGame', { this.connection = this.$root.stream.connectToChannel('gamesReversiGame', {
gameId: this.game.id gameId: this.game.id
}); });
this.connection.on('started', this.onStarted); this.connection.on('started', this.onStarted);

View File

@ -67,22 +67,22 @@ export default Vue.extend({
mounted() { mounted() {
if (this.$store.getters.isSignedIn) { if (this.$store.getters.isSignedIn) {
this.connection = (this as any).os.stream.useSharedConnection('gamesReversi'); this.connection = this.$root.stream.useSharedConnection('gamesReversi');
this.connection.on('invited', this.onInvited); this.connection.on('invited', this.onInvited);
(this as any).api('games/reversi/games', { this.$root.api('games/reversi/games', {
my: true my: true
}).then(games => { }).then(games => {
this.myGames = games; this.myGames = games;
}); });
(this as any).api('games/reversi/invitations').then(invitations => { this.$root.api('games/reversi/invitations').then(invitations => {
this.invitations = this.invitations.concat(invitations); this.invitations = this.invitations.concat(invitations);
}); });
} }
(this as any).api('games/reversi/games').then(games => { this.$root.api('games/reversi/games').then(games => {
this.games = games; this.games = games;
this.gamesFetching = false; this.gamesFetching = false;
}); });
@ -103,10 +103,10 @@ export default Vue.extend({
(this as any).apis.input({ (this as any).apis.input({
title: this.$t('enter-username') title: this.$t('enter-username')
}).then(username => { }).then(username => {
(this as any).api('users/show', { this.$root.api('users/show', {
username username
}).then(user => { }).then(user => {
(this as any).api('games/reversi/match', { this.$root.api('games/reversi/match', {
userId: user.id userId: user.id
}).then(res => { }).then(res => {
if (res == null) { if (res == null) {
@ -120,7 +120,7 @@ export default Vue.extend({
}, },
accept(invitation) { accept(invitation) {
(this as any).api('games/reversi/match', { this.$root.api('games/reversi/match', {
userId: invitation.parent.id userId: invitation.parent.id
}).then(game => { }).then(game => {
if (game) { if (game) {

View File

@ -67,7 +67,7 @@ export default Vue.extend({
this.fetch(); this.fetch();
if (this.$store.getters.isSignedIn) { if (this.$store.getters.isSignedIn) {
this.connection = (this as any).os.stream.useSharedConnection('gamesReversi'); this.connection = this.$root.stream.useSharedConnection('gamesReversi');
this.connection.on('matched', this.onMatched); this.connection.on('matched', this.onMatched);
@ -94,7 +94,7 @@ export default Vue.extend({
this.game = null; this.game = null;
} else { } else {
Progress.start(); Progress.start();
(this as any).api('games/reversi/games/show', { this.$root.api('games/reversi/games/show', {
gameId: this.gameId gameId: this.gameId
}).then(game => { }).then(game => {
this.game = game; this.game = game;
@ -107,7 +107,7 @@ export default Vue.extend({
if (this.selfNav) { if (this.selfNav) {
// //
if (game != null && (game.settings == null || game.settings.map == null)) { if (game != null && (game.settings == null || game.settings.map == null)) {
game = await (this as any).api('games/reversi/games/show', { game = await this.$root.api('games/reversi/games/show', {
gameId: game.id gameId: game.id
}); });
} }
@ -124,11 +124,11 @@ export default Vue.extend({
cancel() { cancel() {
this.matching = null; this.matching = null;
(this as any).api('games/reversi/match/cancel'); this.$root.api('games/reversi/match/cancel');
}, },
accept(invitation) { accept(invitation) {
(this as any).api('games/reversi/match', { this.$root.api('games/reversi/match', {
userId: invitation.parent.id userId: invitation.parent.id
}).then(game => { }).then(game => {
if (game) { if (game) {

View File

@ -20,7 +20,7 @@ export default Vue.extend({
} }
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
} }

View File

@ -152,7 +152,7 @@ export default Vue.extend({
send() { send() {
this.sending = true; this.sending = true;
(this as any).api('messaging/messages/create', { this.$root.api('messaging/messages/create', {
userId: this.user.id, userId: this.user.id,
text: this.text ? this.text : undefined, text: this.text ? this.text : undefined,
fileId: this.file ? this.file.id : undefined fileId: this.file ? this.file.id : undefined

View File

@ -73,7 +73,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.connectToChannel('messaging', { otherparty: this.user.id }); this.connection = this.$root.stream.connectToChannel('messaging', { otherparty: this.user.id });
this.connection.on('message', this.onMessage); this.connection.on('message', this.onMessage);
this.connection.on('read', this.onRead); this.connection.on('read', this.onRead);
@ -139,7 +139,7 @@ export default Vue.extend({
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const max = this.existMoreMessages ? 20 : 10; const max = this.existMoreMessages ? 20 : 10;
(this as any).api('messaging/messages', { this.$root.api('messaging/messages', {
userId: this.user.id, userId: this.user.id,
limit: max + 1, limit: max + 1,
untilId: this.existMoreMessages ? this.messages[0].id : undefined untilId: this.existMoreMessages ? this.messages[0].id : undefined

View File

@ -77,12 +77,12 @@ export default Vue.extend({
}; };
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('messagingIndex'); this.connection = this.$root.stream.useSharedConnection('messagingIndex');
this.connection.on('message', this.onMessage); this.connection.on('message', this.onMessage);
this.connection.on('read', this.onRead); this.connection.on('read', this.onRead);
(this as any).api('messaging/history').then(messages => { this.$root.api('messaging/history').then(messages => {
this.messages = messages; this.messages = messages;
this.fetching = false; this.fetching = false;
}); });
@ -113,7 +113,7 @@ export default Vue.extend({
this.result = []; this.result = [];
return; return;
} }
(this as any).api('users/search', { this.$root.api('users/search', {
query: this.q, query: this.q,
max: 5 max: 5
}).then(users => { }).then(users => {

View File

@ -187,7 +187,7 @@ export default Vue.component('misskey-flavored-markdown', {
} }
case 'emoji': { case 'emoji': {
const customEmojis = (this.os.getMetaSync() || { emojis: [] }).emojis || []; const customEmojis = (this.$root.getMetaSync() || { emojis: [] }).emojis || [];
return [createElement('mk-emoji', { return [createElement('mk-emoji', {
attrs: { attrs: {
emoji: token.emoji, emoji: token.emoji,

View File

@ -40,12 +40,12 @@ export default Vue.extend({
}, },
mounted() { mounted() {
(this as any).api('mute/list').then(mute => { this.$root.api('mute/list').then(mute => {
this.mute = mute.map(x => x.mutee); this.mute = mute.map(x => x.mutee);
this.muteFetching = false; this.muteFetching = false;
}); });
(this as any).api('blocking/list').then(blocking => { this.$root.api('blocking/list').then(blocking => {
this.block = blocking.map(x => x.blockee); this.block = blocking.map(x => x.blockee);
this.blockFetching = false; this.blockFetching = false;
}); });

View File

@ -25,7 +25,7 @@ export default Vue.extend({
} }
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
if (meta.maintainer.repository_url) this.repositoryUrl = meta.maintainer.repository_url; if (meta.maintainer.repository_url) this.repositoryUrl = meta.maintainer.repository_url;
if (meta.maintainer.feedback_url) this.feedbackUrl = meta.maintainer.feedback_url; if (meta.maintainer.feedback_url) this.feedbackUrl = meta.maintainer.feedback_url;
}); });

View File

@ -91,16 +91,16 @@ export default Vue.extend({
}, },
pin() { pin() {
(this as any).api('i/pin', { this.$root.api('i/pin', {
noteId: this.note.id noteId: this.note.id
}).then(() => { }).then(() => {
(this as any).os.new(Ok); this.$root.new(Ok);
this.destroyDom(); this.destroyDom();
}); });
}, },
unpin() { unpin() {
(this as any).api('i/unpin', { this.$root.api('i/unpin', {
noteId: this.note.id noteId: this.note.id
}).then(() => { }).then(() => {
this.destroyDom(); this.destroyDom();
@ -109,7 +109,7 @@ export default Vue.extend({
del() { del() {
if (!window.confirm(this.$t('delete-confirm'))) return; if (!window.confirm(this.$t('delete-confirm'))) return;
(this as any).api('notes/delete', { this.$root.api('notes/delete', {
noteId: this.note.id noteId: this.note.id
}).then(() => { }).then(() => {
this.destroyDom(); this.destroyDom();
@ -117,19 +117,19 @@ export default Vue.extend({
}, },
favorite() { favorite() {
(this as any).api('notes/favorites/create', { this.$root.api('notes/favorites/create', {
noteId: this.note.id noteId: this.note.id
}).then(() => { }).then(() => {
(this as any).os.new(Ok); this.$root.new(Ok);
this.destroyDom(); this.destroyDom();
}); });
}, },
unfavorite() { unfavorite() {
(this as any).api('notes/favorites/delete', { this.$root.api('notes/favorites/delete', {
noteId: this.note.id noteId: this.note.id
}).then(() => { }).then(() => {
(this as any).os.new(Ok); this.$root.new(Ok);
this.destroyDom(); this.destroyDom();
}); });
}, },

View File

@ -34,7 +34,7 @@ export default Vue.extend({
}); });
return; return;
} }
(this as any).api('i/change_password', { this.$root.api('i/change_password', {
currentPasword: currentPassword, currentPasword: currentPassword,
newPassword: newPassword newPassword: newPassword
}).then(() => { }).then(() => {

View File

@ -51,7 +51,7 @@ export default Vue.extend({
}, },
vote(id) { vote(id) {
if (this.poll.choices.some(c => c.isVoted)) return; if (this.poll.choices.some(c => c.isVoted)) return;
(this as any).api('notes/polls/vote', { this.$root.api('notes/polls/vote', {
noteId: this.note.id, noteId: this.note.id,
choice: id choice: id
}).then(() => { }).then(() => {

View File

@ -95,7 +95,7 @@ export default Vue.extend({
computed: { computed: {
alwaysMarkNsfw: { alwaysMarkNsfw: {
get() { return this.$store.state.i.settings.alwaysMarkNsfw; }, get() { return this.$store.state.i.settings.alwaysMarkNsfw; },
set(value) { (this as any).api('i/update', { alwaysMarkNsfw: value }); } set(value) { this.$root.api('i/update', { alwaysMarkNsfw: value }); }
}, },
}, },
@ -161,7 +161,7 @@ export default Vue.extend({
save(notify) { save(notify) {
this.saving = true; this.saving = true;
(this as any).api('i/update', { this.$root.api('i/update', {
name: this.name || null, name: this.name || null,
location: this.location || null, location: this.location || null,
description: this.description || null, description: this.description || null,

View File

@ -145,7 +145,7 @@ export default Vue.extend({
methods: { methods: {
react(reaction) { react(reaction) {
(this as any).api('notes/reactions/create', { this.$root.api('notes/reactions/create', {
noteId: this.note.id, noteId: this.note.id,
reaction: reaction reaction: reaction
}).then(() => { }).then(() => {

View File

@ -27,7 +27,7 @@ export default Vue.extend({
}, },
methods: { methods: {
react(reaction: string) { react(reaction: string) {
(this as any).api('notes/reactions/create', { this.$root.api('notes/reactions/create', {
noteId: this.note.id, noteId: this.note.id,
reaction: reaction reaction: reaction
}); });

View File

@ -44,7 +44,7 @@ export default Vue.extend({
}, },
methods: { methods: {
onUsernameChange() { onUsernameChange() {
(this as any).api('users/show', { this.$root.api('users/show', {
username: this.username username: this.username
}).then(user => { }).then(user => {
this.user = user; this.user = user;
@ -55,7 +55,7 @@ export default Vue.extend({
onSubmit() { onSubmit() {
this.signing = true; this.signing = true;
(this as any).api('signin', { this.$root.api('signin', {
username: this.username, username: this.username,
password: this.password, password: this.password,
token: this.user && this.user.twoFactorEnabled ? this.token : undefined token: this.user && this.user.twoFactorEnabled ? this.token : undefined

View File

@ -72,7 +72,7 @@ export default Vue.extend({
} }
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
}, },
@ -102,7 +102,7 @@ export default Vue.extend({
this.usernameState = 'wait'; this.usernameState = 'wait';
(this as any).api('username/available', { this.$root.api('username/available', {
username: this.username username: this.username
}).then(result => { }).then(result => {
this.usernameState = result.available ? 'ok' : 'unavailable'; this.usernameState = result.available ? 'ok' : 'unavailable';
@ -128,13 +128,13 @@ export default Vue.extend({
this.passwordRetypeState = this.password == this.retypedPassword ? 'match' : 'not-match'; this.passwordRetypeState = this.password == this.retypedPassword ? 'match' : 'not-match';
}, },
onSubmit() { onSubmit() {
(this as any).api('signup', { this.$root.api('signup', {
username: this.username, username: this.username,
password: this.password, password: this.password,
invitationCode: this.invitationCode, invitationCode: this.invitationCode,
'g-recaptcha-response': this.meta.enableRecaptcha ? (window as any).grecaptcha.getResponse() : null 'g-recaptcha-response': this.meta.enableRecaptcha ? (window as any).grecaptcha.getResponse() : null
}, true).then(() => { }, true).then(() => {
(this as any).api('signin', { this.$root.api('signin', {
username: this.username, username: this.username,
password: this.password password: this.password
}, true).then(() => { }, true).then(() => {

View File

@ -24,12 +24,12 @@ export default Vue.extend({
i18n: i18n('common/views/components/stream-indicator.vue'), i18n: i18n('common/views/components/stream-indicator.vue'),
computed: { computed: {
stream() { stream() {
return (this as any).os.stream; return this.$root.stream;
} }
}, },
created() { created() {
(this as any).os.stream.on('_connected_', this.onConnected); this.$root.stream.on('_connected_', this.onConnected);
(this as any).os.stream.on('_disconnected_', this.onDisconnected); this.$root.stream.on('_disconnected_', this.onDisconnected);
this.$nextTick(() => { this.$nextTick(() => {
if (this.stream.state == 'connected') { if (this.stream.state == 'connected') {
@ -38,8 +38,8 @@ export default Vue.extend({
}); });
}, },
beforeDestroy() { beforeDestroy() {
(this as any).os.stream.off('_connected_', this.onConnected); this.$root.stream.off('_connected_', this.onConnected);
(this as any).os.stream.off('_disconnected_', this.onDisconnected); this.$root.stream.off('_disconnected_', this.onDisconnected);
}, },
methods: { methods: {
onConnected() { onConnected() {

View File

@ -43,7 +43,7 @@ export default Vue.extend({
}, },
methods: { methods: {
fetch() { fetch() {
(this as any).api('aggregation/hashtags').then(tags => { this.$root.api('aggregation/hashtags').then(tags => {
this.tags = tags; this.tags = tags;
this.fetching = false; this.fetching = false;
}); });

View File

@ -41,7 +41,7 @@ export default Vue.extend({
}, },
methods: { methods: {
fetch() { fetch() {
(this as any).api('hashtags/trend').then(stats => { this.$root.api('hashtags/trend').then(stats => {
this.stats = stats; this.stats = stats;
this.fetching = false; this.fetching = false;
}); });

View File

@ -36,7 +36,7 @@ export default Vue.extend({
const data = new FormData(); const data = new FormData();
data.append('md5', getMD5(fileData)); data.append('md5', getMD5(fileData));
(this as any).api('drive/files/check_existence', { this.$root.api('drive/files/check_existence', {
md5: getMD5(fileData) md5: getMD5(fileData)
}).then(resp => { }).then(resp => {
resolve(resp.file); resolve(resp.file);

View File

@ -45,7 +45,7 @@ export default Vue.extend({
mounted() { mounted() {
this.fetch(); this.fetch();
this.connection = (this as any).os.stream.useSharedConnection('localTimeline'); this.connection = this.$root.stream.useSharedConnection('localTimeline');
this.connection.on('note', this.onNote); this.connection.on('note', this.onNote);
}, },
@ -57,7 +57,7 @@ export default Vue.extend({
methods: { methods: {
fetch(cb?) { fetch(cb?) {
this.fetching = true; this.fetching = true;
(this as any).api('notes', { this.$root.api('notes', {
limit: this.max, limit: this.max,
local: true, local: true,
reply: false, reply: false,

View File

@ -69,7 +69,7 @@ export default Vue.extend({
const acct = new URL(location.href).searchParams.get('acct'); const acct = new URL(location.href).searchParams.get('acct');
this.fetching = true; this.fetching = true;
Progress.start(); Progress.start();
(this as any).api('users/show', parseAcct(acct)).then(user => { this.$root.api('users/show', parseAcct(acct)).then(user => {
this.user = user; this.user = user;
this.fetching = false; this.fetching = false;
Progress.done(); Progress.done();
@ -81,20 +81,20 @@ export default Vue.extend({
try { try {
if (this.user.isFollowing) { if (this.user.isFollowing) {
this.user = await (this as any).api('following/delete', { this.user = await this.$root.api('following/delete', {
userId: this.user.id userId: this.user.id
}); });
} else { } else {
if (this.user.hasPendingFollowRequestFromYou) { if (this.user.hasPendingFollowRequestFromYou) {
this.user = await (this as any).api('following/requests/cancel', { this.user = await this.$root.api('following/requests/cancel', {
userId: this.user.id userId: this.user.id
}); });
} else if (this.user.isLocked) { } else if (this.user.isLocked) {
this.user = await (this as any).api('following/create', { this.user = await this.$root.api('following/create', {
userId: this.user.id userId: this.user.id
}); });
} else { } else {
this.user = await (this as any).api('following/create', { this.user = await this.$root.api('following/create', {
userId: this.user.id userId: this.user.id
}); });
} }

View File

@ -46,7 +46,7 @@ export default define({
}; };
}, },
mounted() { mounted() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.announcements = meta.broadcasts; this.announcements = meta.broadcasts;
this.fetching = false; this.fetching = false;
}); });

View File

@ -27,7 +27,7 @@ export default define({
}; };
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
} }

View File

@ -32,11 +32,11 @@ export default define({
}; };
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('driveFileCreated', this.onDriveFileCreated); this.connection.on('driveFileCreated', this.onDriveFileCreated);
(this as any).api('drive/stream', { this.$root.api('drive/stream', {
type: 'image/*', type: 'image/*',
limit: 9 limit: 9
}).then(images => { }).then(images => {

View File

@ -112,7 +112,7 @@ export default define({
} }
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('notesStats'); this.connection = this.$root.stream.useSharedConnection('notesStats');
this.connection.on('stats', this.onStats); this.connection.on('stats', this.onStats);
this.connection.on('statsLog', this.onStatsLog); this.connection.on('statsLog', this.onStatsLog);

View File

@ -52,12 +52,12 @@ export default define({
}; };
}, },
mounted() { mounted() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
this.fetching = false; this.fetching = false;
}); });
this.connection = (this as any).os.stream.useSharedConnection('serverStats'); this.connection = this.$root.stream.useSharedConnection('serverStats');
}, },
beforeDestroy() { beforeDestroy() {
this.connection.dispose(); this.connection.dispose();

View File

@ -101,7 +101,7 @@ export default define({
fetch() { fetch() {
this.fetching = true; this.fetching = true;
(this as any).api('drive/files', { this.$root.api('drive/files', {
folderId: this.props.folder, folderId: this.props.folder,
type: 'image/*', type: 'image/*',
limit: 100 limit: 100

View File

@ -45,7 +45,7 @@ export default Vue.extend({
}; };
}, },
mounted() { mounted() {
(this as any).api('charts/user/notes', { this.$root.api('charts/user/notes', {
userId: this.user.id, userId: this.user.id,
span: 'day', span: 'day',
limit: 7 * 20 limit: 7 * 20

View File

@ -22,7 +22,7 @@ export default Vue.extend({
}; };
}, },
mounted() { mounted() {
(this as any).api('drive').then(info => { this.$root.api('drive').then(info => {
this.usage = info.usage / info.capacity * 100; this.usage = info.usage / info.capacity * 100;
}); });
}, },

View File

@ -155,7 +155,7 @@ export default Vue.extend({
default: this.file.name, default: this.file.name,
allowEmpty: false allowEmpty: false
}).then(name => { }).then(name => {
(this as any).api('drive/files/update', { this.$root.api('drive/files/update', {
fileId: this.file.id, fileId: this.file.id,
name: name name: name
}); });
@ -163,7 +163,7 @@ export default Vue.extend({
}, },
toggleSensitive() { toggleSensitive() {
(this as any).api('drive/files/update', { this.$root.api('drive/files/update', {
fileId: this.file.id, fileId: this.file.id,
isSensitive: !this.file.isSensitive isSensitive: !this.file.isSensitive
}); });
@ -193,7 +193,7 @@ export default Vue.extend({
}, },
deleteFile() { deleteFile() {
(this as any).api('drive/files/delete', { this.$root.api('drive/files/delete', {
fileId: this.file.id fileId: this.file.id
}); });
} }

View File

@ -132,7 +132,7 @@ export default Vue.extend({
if (driveFile != null && driveFile != '') { if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile); const file = JSON.parse(driveFile);
this.browser.removeFile(file.id); this.browser.removeFile(file.id);
(this as any).api('drive/files/update', { this.$root.api('drive/files/update', {
fileId: file.id, fileId: file.id,
folderId: this.folder.id folderId: this.folder.id
}); });
@ -148,7 +148,7 @@ export default Vue.extend({
if (folder.id == this.folder.id) return; if (folder.id == this.folder.id) return;
this.browser.removeFolder(folder.id); this.browser.removeFolder(folder.id);
(this as any).api('drive/folders/update', { this.$root.api('drive/folders/update', {
folderId: folder.id, folderId: folder.id,
parentId: this.folder.id parentId: this.folder.id
}).then(() => { }).then(() => {
@ -201,7 +201,7 @@ export default Vue.extend({
placeholder: this.$t('contextmenu.input-new-folder-name'), placeholder: this.$t('contextmenu.input-new-folder-name'),
default: this.folder.name default: this.folder.name
}).then(name => { }).then(name => {
(this as any).api('drive/folders/update', { this.$root.api('drive/folders/update', {
folderId: this.folder.id, folderId: this.folder.id,
name: name name: name
}); });
@ -209,7 +209,7 @@ export default Vue.extend({
}, },
deleteFolder() { deleteFolder() {
(this as any).api('drive/folders/delete', { this.$root.api('drive/folders/delete', {
folderId: this.folder.id folderId: this.folder.id
}); });
} }

View File

@ -79,7 +79,7 @@ export default Vue.extend({
if (driveFile != null && driveFile != '') { if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile); const file = JSON.parse(driveFile);
this.browser.removeFile(file.id); this.browser.removeFile(file.id);
(this as any).api('drive/files/update', { this.$root.api('drive/files/update', {
fileId: file.id, fileId: file.id,
folderId: this.folder ? this.folder.id : null folderId: this.folder ? this.folder.id : null
}); });
@ -93,7 +93,7 @@ export default Vue.extend({
// reject // reject
if (this.folder && folder.id == this.folder.id) return; if (this.folder && folder.id == this.folder.id) return;
this.browser.removeFolder(folder.id); this.browser.removeFolder(folder.id);
(this as any).api('drive/folders/update', { this.$root.api('drive/folders/update', {
folderId: folder.id, folderId: folder.id,
parentId: this.folder ? this.folder.id : null parentId: this.folder ? this.folder.id : null
}); });

View File

@ -117,7 +117,7 @@ export default Vue.extend({
}; };
}, },
mounted() { 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('fileCreated', this.onStreamDriveFileCreated);
this.connection.on('fileUpdated', this.onStreamDriveFileUpdated); this.connection.on('fileUpdated', this.onStreamDriveFileUpdated);
@ -290,7 +290,7 @@ export default Vue.extend({
const file = JSON.parse(driveFile); const file = JSON.parse(driveFile);
if (this.files.some(f => f.id == file.id)) return; if (this.files.some(f => f.id == file.id)) return;
this.removeFile(file.id); this.removeFile(file.id);
(this as any).api('drive/files/update', { this.$root.api('drive/files/update', {
fileId: file.id, fileId: file.id,
folderId: this.folder ? this.folder.id : null 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.folder && folder.id == this.folder.id) return false;
if (this.folders.some(f => f.id == folder.id)) return false; if (this.folders.some(f => f.id == folder.id)) return false;
this.removeFolder(folder.id); this.removeFolder(folder.id);
(this as any).api('drive/folders/update', { this.$root.api('drive/folders/update', {
folderId: folder.id, folderId: folder.id,
parentId: this.folder ? this.folder.id : null parentId: this.folder ? this.folder.id : null
}).then(() => { }).then(() => {
@ -339,7 +339,7 @@ export default Vue.extend({
title: this.$t('url-upload'), title: this.$t('url-upload'),
placeholder: this.$t('url-of-file') placeholder: this.$t('url-of-file')
}).then(url => { }).then(url => {
(this as any).api('drive/files/upload_from_url', { this.$root.api('drive/files/upload_from_url', {
url: url, url: url,
folderId: this.folder ? this.folder.id : undefined folderId: this.folder ? this.folder.id : undefined
}); });
@ -359,7 +359,7 @@ export default Vue.extend({
title: this.$t('create-folder'), title: this.$t('create-folder'),
placeholder: this.$t('folder-name') placeholder: this.$t('folder-name')
}).then(name => { }).then(name => {
(this as any).api('drive/folders/create', { this.$root.api('drive/folders/create', {
name: name, name: name,
parentId: this.folder ? this.folder.id : undefined parentId: this.folder ? this.folder.id : undefined
}).then(folder => { }).then(folder => {
@ -400,7 +400,7 @@ export default Vue.extend({
newWindow(folder) { newWindow(folder) {
if (document.body.clientWidth > 800) { if (document.body.clientWidth > 800) {
(this as any).os.new(MkDriveWindow, { this.$root.new(MkDriveWindow, {
folder: folder folder: folder
}); });
} else { } else {
@ -420,7 +420,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this as any).api('drive/folders/show', { this.$root.api('drive/folders/show', {
folderId: target folderId: target
}).then(folder => { }).then(folder => {
this.folder = folder; this.folder = folder;
@ -522,7 +522,7 @@ export default Vue.extend({
const filesMax = 30; const filesMax = 30;
// //
(this as any).api('drive/folders', { this.$root.api('drive/folders', {
folderId: this.folder ? this.folder.id : null, folderId: this.folder ? this.folder.id : null,
limit: foldersMax + 1 limit: foldersMax + 1
}).then(folders => { }).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, folderId: this.folder ? this.folder.id : null,
limit: filesMax + 1 limit: filesMax + 1
}).then(files => { }).then(files => {
@ -565,7 +565,7 @@ export default Vue.extend({
const max = 30; const max = 30;
// //
(this as any).api('drive/files', { this.$root.api('drive/files', {
folderId: this.folder ? this.folder.id : null, folderId: this.folder ? this.folder.id : null,
untilId: this.files[this.files.length - 1].id, untilId: this.files[this.files.length - 1].id,
limit: max + 1 limit: max + 1

View File

@ -41,7 +41,7 @@ export default Vue.extend({
}, },
mounted() { 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('follow', this.onFollowChange);
this.connection.on('unfollow', this.onFollowChange); this.connection.on('unfollow', this.onFollowChange);
}, },
@ -64,20 +64,20 @@ export default Vue.extend({
try { try {
if (this.u.isFollowing) { 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 userId: this.u.id
}); });
} else { } else {
if (this.u.hasPendingFollowRequestFromYou) { 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 userId: this.u.id
}); });
} else if (this.u.isLocked) { } 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 userId: this.u.id
}); });
} else { } else {
this.u = await (this as any).api('following/create', { this.u = await this.$root.api('following/create', {
userId: this.user.id userId: this.user.id
}); });
} }

View File

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

View File

@ -168,7 +168,7 @@ export default Vue.extend({
created() { created() {
if (this.$store.state.settings.home == null) { if (this.$store.state.settings.home == null) {
this.api('i/update_home', { this.$root.api('i/update_home', {
home: _defaultDesktopHomeWidgets home: _defaultDesktopHomeWidgets
}).then(() => { }).then(() => {
this.$store.commit('settings/setHome', _defaultDesktopHomeWidgets); this.$store.commit('settings/setHome', _defaultDesktopHomeWidgets);
@ -177,7 +177,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
}, },
beforeDestroy() { beforeDestroy() {
@ -227,7 +227,7 @@ export default Vue.extend({
this.$store.commit('settings/setHome', left.concat(right)); this.$store.commit('settings/setHome', left.concat(right));
left.forEach(w => w.place = 'left'); left.forEach(w => w.place = 'left');
right.forEach(w => w.place = 'right'); right.forEach(w => w.place = 'right');
(this as any).api('i/update_home', { this.$root.api('i/update_home', {
home: this.home home: this.home
}); });
}, },

View File

@ -60,7 +60,7 @@ export default Vue.extend({
}, },
onClick() { onClick() {
(this as any).os.new(ImageViewer, { this.$root.new(ImageViewer, {
image: this.image image: this.image
}); });
} }

View File

@ -53,7 +53,7 @@ export default Vue.extend({
start = videoTag.currentTime start = videoTag.currentTime
videoTag.pause() videoTag.pause()
} }
(this as any).os.new(MkMediaVideoDialog, { this.$root.new(MkMediaVideoDialog, {
video: this.video, video: this.video,
start, start,
}) })

View File

@ -14,7 +14,7 @@ export default Vue.extend({
i18n: i18n('desktop/views/components/messaging-window.vue'), i18n: i18n('desktop/views/components/messaging-window.vue'),
methods: { methods: {
navigate(user) { navigate(user) {
(this as any).os.new(MkMessagingRoomWindow, { this.$root.new(MkMessagingRoomWindow, {
user: user user: user
}); });
} }

View File

@ -161,7 +161,7 @@ export default Vue.extend({
mounted() { mounted() {
// Get replies // Get replies
if (!this.compact) { if (!this.compact) {
(this as any).api('notes/replies', { this.$root.api('notes/replies', {
noteId: this.p.id, noteId: this.p.id,
limit: 8 limit: 8
}).then(replies => { }).then(replies => {
@ -173,7 +173,7 @@ export default Vue.extend({
if (this.p.geo) { if (this.p.geo) {
const shouldShowMap = this.$store.getters.isSignedIn ? this.$store.state.settings.showMaps : true; const shouldShowMap = this.$store.getters.isSignedIn ? this.$store.state.settings.showMaps : true;
if (shouldShowMap) { 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 uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]);
const map = new maps.Map(this.$refs.map, { const map = new maps.Map(this.$refs.map, {
center: uluru, center: uluru,
@ -193,7 +193,7 @@ export default Vue.extend({
this.conversationFetching = true; this.conversationFetching = true;
// Fetch conversation // Fetch conversation
(this as any).api('notes/conversation', { this.$root.api('notes/conversation', {
noteId: this.p.replyId noteId: this.p.replyId
}).then(conversation => { }).then(conversation => {
this.conversationFetching = false; this.conversationFetching = false;
@ -202,26 +202,26 @@ export default Vue.extend({
}, },
reply() { reply() {
(this as any).os.new(MkPostFormWindow, { this.$root.new(MkPostFormWindow, {
reply: this.p reply: this.p
}); });
}, },
renote() { renote() {
(this as any).os.new(MkRenoteFormWindow, { this.$root.new(MkRenoteFormWindow, {
note: this.p note: this.p
}); });
}, },
react() { react() {
(this as any).os.new(MkReactionPicker, { this.$root.new(MkReactionPicker, {
source: this.$refs.reactButton, source: this.$refs.reactButton,
note: this.p note: this.p
}); });
}, },
menu() { menu() {
(this as any).os.new(MkNoteMenu, { this.$root.new(MkNoteMenu, {
source: this.$refs.menuButton, source: this.$refs.menuButton,
note: this.p note: this.p
}); });

View File

@ -117,14 +117,14 @@ export default Vue.extend({
created() { created() {
if (this.detail) { if (this.detail) {
(this as any).api('notes/replies', { this.$root.api('notes/replies', {
noteId: this.appearNote.id, noteId: this.appearNote.id,
limit: 8 limit: 8
}).then(replies => { }).then(replies => {
this.replies = replies; this.replies = replies;
}); });
(this as any).api('notes/conversation', { this.$root.api('notes/conversation', {
noteId: this.appearNote.replyId noteId: this.appearNote.replyId
}).then(conversation => { }).then(conversation => {
this.conversation = conversation.reverse(); this.conversation = conversation.reverse();

View File

@ -142,13 +142,13 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('notification', this.onNotification); this.connection.on('notification', this.onNotification);
const max = 10; const max = 10;
(this as any).api('i/notifications', { this.$root.api('i/notifications', {
limit: max + 1 limit: max + 1
}).then(notifications => { }).then(notifications => {
if (notifications.length == max + 1) { if (notifications.length == max + 1) {
@ -171,7 +171,7 @@ export default Vue.extend({
const max = 30; const max = 30;
(this as any).api('i/notifications', { this.$root.api('i/notifications', {
limit: max + 1, limit: max + 1,
untilId: this.notifications[this.notifications.length - 1].id untilId: this.notifications[this.notifications.length - 1].id
}).then(notifications => { }).then(notifications => {
@ -188,7 +188,7 @@ export default Vue.extend({
onNotification(notification) { onNotification(notification) {
// TODO: () // TODO: ()
(this as any).os.stream.send('readNotification', { this.$root.stream.send('readNotification', {
id: notification.id id: notification.id
}); });

View File

@ -115,7 +115,7 @@ export default Vue.extend({
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.maxNoteTextLength = meta.maxNoteTextLength; this.maxNoteTextLength = meta.maxNoteTextLength;
}); });
}, },
@ -195,7 +195,7 @@ export default Vue.extend({
// //
if (this.reply && this.reply.visibility === 'specified') { 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); this.visibleUsers.push(user);
}); });
} }
@ -354,7 +354,7 @@ export default Vue.extend({
}, },
setVisibility() { setVisibility() {
const w = (this as any).os.new(MkVisibilityChooser, { const w = this.$root.new(MkVisibilityChooser, {
source: this.$refs.visibilityButton source: this.$refs.visibilityButton
}); });
w.$once('chosen', v => { w.$once('chosen', v => {
@ -367,7 +367,7 @@ export default Vue.extend({
title: this.$t('enter-username') title: this.$t('enter-username')
}).then(acct => { }).then(acct => {
if (acct.startsWith('@')) acct = acct.substr(1); 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); this.visibleUsers.push(user);
}); });
}); });
@ -380,7 +380,7 @@ export default Vue.extend({
post() { post() {
this.posting = true; this.posting = true;
(this as any).api('notes/create', { this.$root.api('notes/create', {
text: this.text == '' ? undefined : this.text, text: this.text == '' ? undefined : this.text,
fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined, fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
replyId: this.reply ? this.reply.id : undefined, replyId: this.reply ? this.reply.id : undefined,

View File

@ -26,19 +26,19 @@ export default Vue.extend({
}; };
}, },
mounted() { mounted() {
(this as any).api('following/requests/list').then(requests => { this.$root.api('following/requests/list').then(requests => {
this.fetching = false; this.fetching = false;
this.requests = requests; this.requests = requests;
}); });
}, },
methods: { methods: {
accept(user) { 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); this.requests = this.requests.filter(r => r.follower.id != user.id);
}); });
}, },
reject(user) { 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); this.requests = this.requests.filter(r => r.follower.id != user.id);
}); });
}, },

View File

@ -30,7 +30,7 @@ export default Vue.extend({
methods: { methods: {
ok() { ok() {
this.wait = true; this.wait = true;
(this as any).api('notes/create', { this.$root.api('notes/create', {
renoteId: this.note.id renoteId: this.note.id
}).then(data => { }).then(data => {
this.$emit('posted'); this.$emit('posted');

View File

@ -39,7 +39,7 @@ export default Vue.extend({
title: this.$t('enter-password'), title: this.$t('enter-password'),
type: 'password' type: 'password'
}).then(password => { }).then(password => {
(this as any).api('i/2fa/register', { this.$root.api('i/2fa/register', {
password: password password: password
}).then(data => { }).then(data => {
this.data = data; this.data = data;
@ -52,7 +52,7 @@ export default Vue.extend({
title: this.$t('enter-password'), title: this.$t('enter-password'),
type: 'password' type: 'password'
}).then(password => { }).then(password => {
(this as any).api('i/2fa/unregister', { this.$root.api('i/2fa/unregister', {
password: password password: password
}).then(() => { }).then(() => {
(this as any).apis.notify(this.$t('unregistered')); (this as any).apis.notify(this.$t('unregistered'));
@ -62,7 +62,7 @@ export default Vue.extend({
}, },
submit() { submit() {
(this as any).api('i/2fa/done', { this.$root.api('i/2fa/done', {
token: this.token token: this.token
}).then(() => { }).then(() => {
(this as any).apis.notify(this.$t('success')); (this as any).apis.notify(this.$t('success'));

View File

@ -22,7 +22,7 @@ export default Vue.extend({
}; };
}, },
mounted() { mounted() {
(this as any).api('i/authorized_apps').then(apps => { this.$root.api('i/authorized_apps').then(apps => {
this.apps = apps; this.apps = apps;
this.fetching = false; this.fetching = false;
}); });

View File

@ -28,12 +28,12 @@ export default Vue.extend({
}, },
mounted() { mounted() {
(this as any).api('i/signin_history').then(signins => { this.$root.api('i/signin_history').then(signins => {
this.signins = signins; this.signins = signins;
this.fetching = false; 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); this.connection.on('signin', this.onSignin);
}, },

View File

@ -500,13 +500,13 @@ export default Vue.extend({
} }
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.meta = meta; this.meta = meta;
}); });
}, },
methods: { methods: {
readAllUnreadNotes() { readAllUnreadNotes() {
(this as any).api('i/read_all_unread_notes'); this.$root.api('i/read_all_unread_notes');
}, },
customizeHome() { customizeHome() {
this.$router.push('/i/customize-home'); this.$router.push('/i/customize-home');
@ -516,18 +516,18 @@ export default Vue.extend({
(this as any).apis.chooseDriveFile({ (this as any).apis.chooseDriveFile({
multiple: false multiple: false
}).then(file => { }).then(file => {
(this as any).api('i/update', { this.$root.api('i/update', {
wallpaperId: file.id wallpaperId: file.id
}); });
}); });
}, },
deleteWallpaper() { deleteWallpaper() {
(this as any).api('i/update', { this.$root.api('i/update', {
wallpaperId: null wallpaperId: null
}); });
}, },
onChangeAutoWatch(v) { onChangeAutoWatch(v) {
(this as any).api('i/update', { this.$root.api('i/update', {
autoWatch: v autoWatch: v
}); });
}, },

View File

@ -65,32 +65,32 @@ export default Vue.extend({
this.query = { this.query = {
query: this.tagTl.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); this.connection.on('note', prepend);
} else if (this.src == 'home') { } else if (this.src == 'home') {
this.endpoint = 'notes/timeline'; this.endpoint = 'notes/timeline';
const onChangeFollowing = () => { const onChangeFollowing = () => {
this.fetch(); 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('note', prepend);
this.connection.on('follow', onChangeFollowing); this.connection.on('follow', onChangeFollowing);
this.connection.on('unfollow', onChangeFollowing); this.connection.on('unfollow', onChangeFollowing);
} else if (this.src == 'local') { } else if (this.src == 'local') {
this.endpoint = 'notes/local-timeline'; 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); this.connection.on('note', prepend);
} else if (this.src == 'hybrid') { } else if (this.src == 'hybrid') {
this.endpoint = 'notes/hybrid-timeline'; 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); this.connection.on('note', prepend);
} else if (this.src == 'global') { } else if (this.src == 'global') {
this.endpoint = 'notes/global-timeline'; 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); this.connection.on('note', prepend);
} else if (this.src == 'mentions') { } else if (this.src == 'mentions') {
this.endpoint = 'notes/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); this.connection.on('mention', prepend);
} else if (this.src == 'messages') { } else if (this.src == 'messages') {
this.endpoint = 'notes/mentions'; this.endpoint = 'notes/mentions';
@ -102,7 +102,7 @@ export default Vue.extend({
prepend(note); prepend(note);
} }
}; };
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('mention', onNote); this.connection.on('mention', onNote);
} }
@ -118,7 +118,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (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, limit: fetchLimit + 1,
untilDate: this.date ? this.date.getTime() : undefined untilDate: this.date ? this.date.getTime() : undefined
}, this.baseQuery, this.query)).then(notes => { }, this.baseQuery, this.query)).then(notes => {
@ -138,7 +138,7 @@ export default Vue.extend({
this.moreFetching = true; 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, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id untilId: (this.$refs.timeline as any).tail().id
}, this.baseQuery, this.query)); }, this.baseQuery, this.query));

View File

@ -64,7 +64,7 @@ export default Vue.extend({
}, },
created() { created() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.enableLocalTimeline = !meta.disableLocalTimeline; this.enableLocalTimeline = !meta.disableLocalTimeline;
}); });
@ -103,7 +103,7 @@ export default Vue.extend({
}, },
async chooseList() { async chooseList() {
const lists = await (this as any).api('users/lists/list'); const lists = await this.$root.api('users/lists/list');
let menu = [{ let menu = [{
icon: 'plus', icon: 'plus',
@ -112,7 +112,7 @@ export default Vue.extend({
(this as any).apis.input({ (this as any).apis.input({
title: this.$t('list-name'), title: this.$t('list-name'),
}).then(async title => { }).then(async title => {
const list = await (this as any).api('users/lists/create', { const list = await this.$root.api('users/lists/create', {
title title
}); });
@ -135,7 +135,7 @@ export default Vue.extend({
} }
}))); })));
this.os.new(Menu, { this.$root.new(Menu, {
source: this.$refs.listButton, source: this.$refs.listButton,
compact: false, compact: false,
items: menu items: menu
@ -147,7 +147,7 @@ export default Vue.extend({
icon: 'plus', icon: 'plus',
text: this.$t('add-tag-timeline'), text: this.$t('add-tag-timeline'),
action: () => { action: () => {
(this as any).os.new(MkSettingsWindow, { this.$root.new(MkSettingsWindow, {
initialPage: 'hashtags' initialPage: 'hashtags'
}); });
} }
@ -166,7 +166,7 @@ export default Vue.extend({
} }
}))); })));
this.os.new(Menu, { this.$root.new(Menu, {
source: this.$refs.tagButton, source: this.$refs.tagButton,
compact: false, compact: false,
items: menu items: menu

View File

@ -137,25 +137,25 @@ export default Vue.extend({
}, },
drive() { drive() {
this.close(); this.close();
(this as any).os.new(MkDriveWindow); this.$root.new(MkDriveWindow);
}, },
list() { list() {
this.close(); this.close();
const w = (this as any).os.new(MkUserListsWindow); const w = this.$root.new(MkUserListsWindow);
w.$once('choosen', list => { w.$once('choosen', list => {
this.$router.push(`i/lists/${ list.id }`); this.$router.push(`i/lists/${ list.id }`);
}); });
}, },
followRequests() { followRequests() {
this.close(); this.close();
(this as any).os.new(MkFollowRequestsWindow); this.$root.new(MkFollowRequestsWindow);
}, },
settings() { settings() {
this.close(); this.close();
(this as any).os.new(MkSettingsWindow); this.$root.new(MkSettingsWindow);
}, },
signout() { signout() {
(this as any).os.signout(); this.$root.os.signout();
}, },
dark() { dark() {
this.$store.commit('device/set', { this.$store.commit('device/set', {

View File

@ -58,7 +58,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
if (this.$store.getters.isSignedIn) { 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('reversiInvited', this.onReversiInvited);
this.connection.on('reversi_no_invites', this.onReversiNoInvites); this.connection.on('reversi_no_invites', this.onReversiNoInvites);
@ -79,11 +79,11 @@ export default Vue.extend({
}, },
messaging() { messaging() {
(this as any).os.new(MkMessagingWindow); this.$root.new(MkMessagingWindow);
}, },
game() { game() {
(this as any).os.new(MkGameWindow); this.$root.new(MkGameWindow);
}, },
goToTop() { goToTop() {

View File

@ -108,7 +108,7 @@ export default Vue.extend({
mounted() { mounted() {
if (this.$store.getters.isSignedIn) { 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('reversiInvited', this.onReversiInvited);
this.connection.on('reversi_no_invites', this.onReversiNoInvites); this.connection.on('reversi_no_invites', this.onReversiNoInvites);
@ -131,11 +131,11 @@ export default Vue.extend({
}, },
messaging() { messaging() {
(this as any).os.new(MkMessagingWindow); this.$root.new(MkMessagingWindow);
}, },
game() { game() {
(this as any).os.new(MkGameWindow); this.$root.new(MkGameWindow);
}, },
post() { post() {
@ -143,26 +143,26 @@ export default Vue.extend({
}, },
drive() { drive() {
(this as any).os.new(MkDriveWindow); this.$root.new(MkDriveWindow);
}, },
list() { list() {
const w = (this as any).os.new(MkUserListsWindow); const w = this.$root.new(MkUserListsWindow);
w.$once('choosen', list => { w.$once('choosen', list => {
this.$router.push(`i/lists/${ list.id }`); this.$router.push(`i/lists/${ list.id }`);
}); });
}, },
followRequests() { followRequests() {
(this as any).os.new(MkFollowRequestsWindow); this.$root.new(MkFollowRequestsWindow);
}, },
settings() { settings() {
(this as any).os.new(MkSettingsWindow); this.$root.new(MkSettingsWindow);
}, },
signout() { signout() {
(this as any).os.signout(); this.$root.os.signout();
}, },
notifications() { notifications() {

View File

@ -31,7 +31,7 @@ export default Vue.extend({
methods: { methods: {
init() { init() {
if (this.connection) this.connection.dispose(); 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 listId: this.list.id
}); });
this.connection.on('note', this.onNote); this.connection.on('note', this.onNote);
@ -44,7 +44,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (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, listId: this.list.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
@ -64,7 +64,7 @@ export default Vue.extend({
more() { more() {
this.moreFetching = true; 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, listId: this.list.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,

View File

@ -22,7 +22,7 @@ export default Vue.extend({
}; };
}, },
mounted() { mounted() {
(this as any).api('users/lists/list').then(lists => { this.$root.api('users/lists/list').then(lists => {
this.fetching = false; this.fetching = false;
this.lists = lists; this.lists = lists;
}); });
@ -32,7 +32,7 @@ export default Vue.extend({
(this as any).apis.input({ (this as any).apis.input({
title: this.$t('list-name'), title: this.$t('list-name'),
}).then(async title => { }).then(async title => {
const list = await (this as any).api('users/lists/create', { const list = await this.$root.api('users/lists/create', {
title title
}); });

View File

@ -54,7 +54,7 @@ export default Vue.extend({
parseAcct(this.user.substr(1)) : parseAcct(this.user.substr(1)) :
{ userId: this.user }; { userId: this.user };
(this as any).api('users/show', query).then(user => { this.$root.api('users/show', query).then(user => {
this.u = user; this.u = user;
this.open(); this.open();
}); });

View File

@ -110,7 +110,7 @@ export default Vue.extend({
this.preventMount = true; this.preventMount = true;
} else { } else {
// //
(this as any).os.windows.add(this); this.$root.os.windows.add(this);
} }
}, },
@ -133,7 +133,7 @@ export default Vue.extend({
destroyed() { destroyed() {
// //
(this as any).os.windows.remove(this); this.$root.os.windows.remove(this);
window.removeEventListener('resize', this.onBrowserResize); window.removeEventListener('resize', this.onBrowserResize);
}, },
@ -234,7 +234,7 @@ export default Vue.extend({
top() { top() {
let z = 0; let z = 0;
(this as any).os.windows.getAll().forEach(w => { this.$root.os.windows.getAll().forEach(w => {
if (w == this) return; if (w == this) return;
const m = w.$refs.main; const m = w.$refs.main;
const mz = Number(document.defaultView.getComputedStyle(m, null).zIndex); const mz = Number(document.defaultView.getComputedStyle(m, null).zIndex);

View File

@ -234,7 +234,7 @@ export default Vue.extend({
}, },
showMenu() { showMenu() {
this.os.new(Menu, { this.$root.new(Menu, {
source: this.$refs.menu, source: this.$refs.menu,
compact: false, compact: false,
items: this.getMenu() items: this.getMenu()

View File

@ -26,7 +26,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('mention', this.onNote); this.connection.on('mention', this.onNote);
this.fetch(); this.fetch();
@ -41,7 +41,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
(this as any).api('notes/mentions', { this.$root.api('notes/mentions', {
limit: fetchLimit + 1, limit: fetchLimit + 1,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes, includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
@ -62,7 +62,7 @@ export default Vue.extend({
more() { more() {
this.moreFetching = true; this.moreFetching = true;
const promise = (this as any).api('notes/mentions', { const promise = this.$root.api('notes/mentions', {
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,

View File

@ -39,7 +39,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
(this as any).api('charts/hashtag', { this.$root.api('charts/hashtag', {
tag: this.tag, tag: this.tag,
span: 'hour', span: 'hour',
limit: 24 limit: 24

View File

@ -47,7 +47,7 @@ export default Vue.extend({
mounted() { mounted() {
if (this.connection) this.connection.close(); if (this.connection) this.connection.close();
this.connection = (this as any).os.stream.connectToChannel('hashtag', { this.connection = this.$root.stream.connectToChannel('hashtag', {
q: this.tagTl.query q: this.tagTl.query
}); });
this.connection.on('note', this.onNote); this.connection.on('note', this.onNote);
@ -64,7 +64,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
(this as any).api('notes/search_by_tag', { this.$root.api('notes/search_by_tag', {
limit: fetchLimit + 1, limit: fetchLimit + 1,
withFiles: this.mediaOnly, withFiles: this.mediaOnly,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
@ -86,7 +86,7 @@ export default Vue.extend({
more() { more() {
this.moreFetching = true; this.moreFetching = true;
const promise = (this as any).api('notes/search_by_tag', { const promise = this.$root.api('notes/search_by_tag', {
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
withFiles: this.mediaOnly, withFiles: this.mediaOnly,

View File

@ -47,7 +47,7 @@ export default Vue.extend({
mounted() { mounted() {
if (this.connection) this.connection.dispose(); 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 listId: this.list.id
}); });
this.connection.on('note', this.onNote); this.connection.on('note', this.onNote);
@ -66,7 +66,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (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, listId: this.list.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
withFiles: this.mediaOnly, withFiles: this.mediaOnly,
@ -88,7 +88,7 @@ export default Vue.extend({
more() { more() {
this.moreFetching = true; 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, listId: this.list.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,

View File

@ -26,7 +26,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('mention', this.onNote); this.connection.on('mention', this.onNote);
this.fetch(); this.fetch();
@ -41,7 +41,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
(this as any).api('notes/mentions', { this.$root.api('notes/mentions', {
limit: fetchLimit + 1, limit: fetchLimit + 1,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes, includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
@ -61,7 +61,7 @@ export default Vue.extend({
more() { more() {
this.moreFetching = true; this.moreFetching = true;
const promise = (this as any).api('notes/mentions', { const promise = this.$root.api('notes/mentions', {
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,

View File

@ -52,7 +52,7 @@ export default Vue.extend({
}, },
created() { created() {
(this as any).api('notes/show', { noteId: this.noteId }).then(note => { this.$root.api('notes/show', { noteId: this.noteId }).then(note => {
this.note = note; this.note = note;
this.fetching = false; this.fetching = false;
}); });

View File

@ -68,7 +68,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
this.connection = (this as any).os.stream.useSharedConnection('main'); this.connection = this.$root.stream.useSharedConnection('main');
this.connection.on('notification', this.onNotification); this.connection.on('notification', this.onNotification);
@ -77,7 +77,7 @@ export default Vue.extend({
const max = 10; const max = 10;
(this as any).api('i/notifications', { this.$root.api('i/notifications', {
limit: max + 1 limit: max + 1
}).then(notifications => { }).then(notifications => {
if (notifications.length == max + 1) { if (notifications.length == max + 1) {
@ -103,7 +103,7 @@ export default Vue.extend({
const max = 20; const max = 20;
(this as any).api('i/notifications', { this.$root.api('i/notifications', {
limit: max + 1, limit: max + 1,
untilId: this.notifications[this.notifications.length - 1].id untilId: this.notifications[this.notifications.length - 1].id
}).then(notifications => { }).then(notifications => {
@ -120,7 +120,7 @@ export default Vue.extend({
onNotification(notification) { onNotification(notification) {
// TODO: () // TODO: ()
(this as any).os.stream.send('readNotification', { this.$root.stream.send('readNotification', {
id: notification.id id: notification.id
}); });

View File

@ -43,10 +43,10 @@ export default Vue.extend({
computed: { computed: {
stream(): any { stream(): any {
switch (this.src) { switch (this.src) {
case 'home': return (this as any).os.stream.useSharedConnection('homeTimeline'); case 'home': return this.$root.stream.useSharedConnection('homeTimeline');
case 'local': return (this as any).os.stream.useSharedConnection('localTimeline'); case 'local': return this.$root.stream.useSharedConnection('localTimeline');
case 'hybrid': return (this as any).os.stream.useSharedConnection('hybridTimeline'); case 'hybrid': return this.$root.stream.useSharedConnection('hybridTimeline');
case 'global': return (this as any).os.stream.useSharedConnection('globalTimeline'); case 'global': return this.$root.stream.useSharedConnection('globalTimeline');
} }
}, },
@ -87,7 +87,7 @@ export default Vue.extend({
this.fetching = true; this.fetching = true;
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
(this as any).api(this.endpoint, { this.$root.api(this.endpoint, {
limit: fetchLimit + 1, limit: fetchLimit + 1,
withFiles: this.mediaOnly, withFiles: this.mediaOnly,
includeMyRenotes: this.$store.state.settings.showMyRenotes, includeMyRenotes: this.$store.state.settings.showMyRenotes,
@ -108,7 +108,7 @@ export default Vue.extend({
more() { more() {
this.moreFetching = true; this.moreFetching = true;
const promise = (this as any).api(this.endpoint, { const promise = this.$root.api(this.endpoint, {
limit: fetchLimit + 1, limit: fetchLimit + 1,
withFiles: this.mediaOnly, withFiles: this.mediaOnly,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,

View File

@ -138,7 +138,7 @@ export default Vue.extend({
}, },
created() { created() {
(this as any).api('users/show', parseAcct(this.acct)).then(user => { this.$root.api('users/show', parseAcct(this.acct)).then(user => {
this.user = user; this.user = user;
this.fetching = false; this.fetching = false;
@ -152,7 +152,7 @@ export default Vue.extend({
'image/gif' 'image/gif'
]; ];
(this as any).api('users/notes', { this.$root.api('users/notes', {
userId: this.user.id, userId: this.user.id,
fileType: image, fileType: image,
limit: 9 limit: 9
@ -166,7 +166,7 @@ export default Vue.extend({
this.images = files.filter(f => image.includes(f.type)).slice(0, 9); this.images = files.filter(f => image.includes(f.type)).slice(0, 9);
}); });
(this as any).api('charts/user/notes', { this.$root.api('charts/user/notes', {
userId: this.user.id, userId: this.user.id,
span: 'day', span: 'day',
limit: 21 limit: 21
@ -251,7 +251,7 @@ export default Vue.extend({
methods: { methods: {
initTl() { initTl() {
return new Promise((res, rej) => { return new Promise((res, rej) => {
(this as any).api('users/notes', { this.$root.api('users/notes', {
userId: this.user.id, userId: this.user.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
withFiles: this.withFiles, withFiles: this.withFiles,
@ -271,7 +271,7 @@ export default Vue.extend({
fetchMoreNotes() { fetchMoreNotes() {
this.moreFetching = true; this.moreFetching = true;
const promise = (this as any).api('users/notes', { const promise = this.$root.api('users/notes', {
userId: this.user.id, userId: this.user.id,
limit: fetchLimit + 1, limit: fetchLimit + 1,
untilId: (this.$refs.timeline as any).tail().id, untilId: (this.$refs.timeline as any).tail().id,
@ -299,19 +299,19 @@ export default Vue.extend({
icon: 'list', icon: 'list',
text: this.$t('push-to-a-list'), text: this.$t('push-to-a-list'),
action: () => { action: () => {
const w = (this as any).os.new(MkUserListsWindow); const w = this.$root.new(MkUserListsWindow);
w.$once('choosen', async list => { w.$once('choosen', async list => {
w.close(); w.close();
await (this as any).api('users/lists/push', { await this.$root.api('users/lists/push', {
listId: list.id, listId: list.id,
userId: this.user.id userId: this.user.id
}); });
(this as any).os.new(Ok); this.$root.new(Ok);
}); });
} }
}]; }];
this.os.new(Menu, { this.$root.new(Menu, {
source: this.$refs.menu, source: this.$refs.menu,
compact: false, compact: false,
items: menu items: menu

View File

@ -131,7 +131,7 @@ export default Vue.extend({
}, },
mounted() { mounted() {
document.title = (this as any).os.instanceName; document.title = this.$root.os.instanceName;
document.documentElement.style.overflow = 'hidden'; document.documentElement.style.overflow = 'hidden';
}, },
@ -180,7 +180,7 @@ export default Vue.extend({
}, },
add() { add() {
this.os.new(Menu, { this.$root.new(Menu, {
source: this.$refs.add, source: this.$refs.add,
compact: true, compact: true,
items: [{ items: [{
@ -241,7 +241,7 @@ export default Vue.extend({
icon: 'list', icon: 'list',
text: this.$t('@deck.list'), text: this.$t('@deck.list'),
action: () => { action: () => {
const w = (this as any).os.new(MkUserListsWindow); const w = this.$root.new(MkUserListsWindow);
w.$once('choosen', list => { w.$once('choosen', list => {
this.$store.dispatch('settings/addDeckColumn', { this.$store.dispatch('settings/addDeckColumn', {
id: uuid(), id: uuid(),

View File

@ -32,7 +32,7 @@ export default Vue.extend({
Progress.start(); Progress.start();
this.fetching = true; this.fetching = true;
(this as any).api('i/favorites', { this.$root.api('i/favorites', {
limit: 11 limit: 11
}).then(favorites => { }).then(favorites => {
if (favorites.length == 11) { if (favorites.length == 11) {
@ -48,7 +48,7 @@ export default Vue.extend({
}, },
more() { more() {
this.moreFetching = true; this.moreFetching = true;
(this as any).api('i/favorites', { this.$root.api('i/favorites', {
limit: 11, limit: 11,
untilId: this.favorites[this.favorites.length - 1].id untilId: this.favorites[this.favorites.length - 1].id
}).then(favorites => { }).then(favorites => {

View File

@ -23,7 +23,7 @@ export default Vue.extend({
} }
}, },
mounted() { mounted() {
document.title = (this as any).os.instanceName; document.title = this.$root.os.instanceName;
Progress.start(); Progress.start();
}, },

View File

@ -44,7 +44,7 @@ export default Vue.extend({
Progress.start(); Progress.start();
this.fetching = true; this.fetching = true;
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => { this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => {
this.user = user; this.user = user;
this.fetching = false; this.fetching = false;

View File

@ -34,7 +34,7 @@ export default Vue.extend({
Progress.start(); Progress.start();
this.fetching = true; this.fetching = true;
(this as any).api('notes/show', { this.$root.api('notes/show', {
noteId: this.$route.params.note noteId: this.$route.params.note
}).then(note => { }).then(note => {
this.note = note; this.note = note;

View File

@ -59,7 +59,7 @@ export default Vue.extend({
Progress.start(); Progress.start();
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
(this as any).api('notes/search', { this.$root.api('notes/search', {
limit: limit + 1, limit: limit + 1,
offset: this.offset, offset: this.offset,
query: this.q query: this.q
@ -82,7 +82,7 @@ export default Vue.extend({
more() { more() {
this.offset += limit; this.offset += limit;
const promise = (this as any).api('notes/search', { const promise = this.$root.api('notes/search', {
limit: limit + 1, limit: limit + 1,
offset: this.offset, offset: this.offset,
query: this.q query: this.q

View File

@ -29,7 +29,7 @@ export default Vue.extend({
} }
}, },
mounted() { mounted() {
(this as any).os.getMeta().then(meta => { this.$root.getMeta().then(meta => {
this.name = meta.name; this.name = meta.name;
}); });
} }

View File

@ -52,7 +52,7 @@ export default Vue.extend({
Progress.start(); Progress.start();
(this.$refs.timeline as any).init(() => new Promise((res, rej) => { (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
(this as any).api('notes/search_by_tag', { this.$root.api('notes/search_by_tag', {
limit: limit + 1, limit: limit + 1,
offset: this.offset, offset: this.offset,
tag: this.$route.params.tag tag: this.$route.params.tag
@ -71,7 +71,7 @@ export default Vue.extend({
more() { more() {
this.offset += limit; this.offset += limit;
const promise = (this as any).api('notes/search_by_tag', { const promise = this.$root.api('notes/search_by_tag', {
limit: limit + 1, limit: limit + 1,
offset: this.offset, offset: this.offset,
tag: this.$route.params.tag tag: this.$route.params.tag

View File

@ -54,9 +54,9 @@ export default Vue.extend({
fetch() { fetch() {
this.fetching = true; this.fetching = true;
Progress.start(); Progress.start();
(this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => { this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => {
this.user = user; this.user = user;
(this as any).api(this.endpoint, { this.$root.api(this.endpoint, {
userId: this.user.id, userId: this.user.id,
iknow: false, iknow: false,
limit: limit limit: limit
@ -70,7 +70,7 @@ export default Vue.extend({
}, },
fetchMore() { fetchMore() {
(this as any).api(this.endpoint, { this.$root.api(this.endpoint, {
userId: this.user.id, userId: this.user.id,
iknow: false, iknow: false,
limit: limit, limit: limit,

View File

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

Some files were not shown because too many files have changed in this diff Show More