Refactor & Clean up
This commit is contained in:
@ -34,7 +34,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.announcements = meta.broadcasts;
|
||||
});
|
||||
},
|
||||
@ -64,7 +64,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
save(silent) {
|
||||
(this as any).api('admin/update-meta', {
|
||||
this.$root.api('admin/update-meta', {
|
||||
broadcasts: this.announcements
|
||||
}).then(() => {
|
||||
if (!silent) {
|
||||
|
@ -33,7 +33,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
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('logs', this.onLogs);
|
||||
this.connection.send('requestLog', {
|
||||
|
@ -105,17 +105,17 @@ export default Vue.extend({
|
||||
this.now = new Date();
|
||||
|
||||
const [perHour, perDay] = await Promise.all([Promise.all([
|
||||
(this as any).api('charts/federation', { limit: limit, span: 'hour' }),
|
||||
(this as any).api('charts/users', { limit: limit, span: 'hour' }),
|
||||
(this as any).api('charts/notes', { limit: limit, span: 'hour' }),
|
||||
(this as any).api('charts/drive', { limit: limit, span: 'hour' }),
|
||||
(this as any).api('charts/network', { limit: limit, span: 'hour' })
|
||||
this.$root.api('charts/federation', { limit: limit, span: 'hour' }),
|
||||
this.$root.api('charts/users', { limit: limit, span: 'hour' }),
|
||||
this.$root.api('charts/notes', { limit: limit, span: 'hour' }),
|
||||
this.$root.api('charts/drive', { limit: limit, span: 'hour' }),
|
||||
this.$root.api('charts/network', { limit: limit, span: 'hour' })
|
||||
]), Promise.all([
|
||||
(this as any).api('charts/federation', { limit: limit, span: 'day' }),
|
||||
(this as any).api('charts/users', { limit: limit, span: 'day' }),
|
||||
(this as any).api('charts/notes', { limit: limit, span: 'day' }),
|
||||
(this as any).api('charts/drive', { limit: limit, span: 'day' }),
|
||||
(this as any).api('charts/network', { limit: limit, span: 'day' })
|
||||
this.$root.api('charts/federation', { limit: limit, span: 'day' }),
|
||||
this.$root.api('charts/users', { limit: limit, span: 'day' }),
|
||||
this.$root.api('charts/notes', { limit: limit, span: 'day' }),
|
||||
this.$root.api('charts/drive', { limit: limit, span: 'day' }),
|
||||
this.$root.api('charts/network', { limit: limit, span: 'day' })
|
||||
])]);
|
||||
|
||||
const chart = {
|
||||
|
@ -47,7 +47,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.meta = meta;
|
||||
});
|
||||
|
||||
|
@ -101,13 +101,13 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
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 as any).api('stats').then(stats => {
|
||||
this.$root.api('stats').then(stats => {
|
||||
this.stats = stats;
|
||||
});
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ export default Vue.extend({
|
||||
|
||||
methods: {
|
||||
add() {
|
||||
(this as any).api('admin/emoji/add', {
|
||||
this.$root.api('admin/emoji/add', {
|
||||
name: this.name,
|
||||
url: this.url,
|
||||
aliases: this.aliases.split(' ').filter(x => x.length > 0)
|
||||
@ -87,7 +87,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
fetchEmojis() {
|
||||
(this as any).api('admin/emoji/list').then(emojis => {
|
||||
this.$root.api('admin/emoji/list').then(emojis => {
|
||||
emojis.reverse();
|
||||
emojis.forEach(e => e.aliases = (e.aliases || []).join(' '));
|
||||
this.emojis = emojis;
|
||||
@ -95,7 +95,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
updateEmoji(emoji) {
|
||||
(this as any).api('admin/emoji/update', {
|
||||
this.$root.api('admin/emoji/update', {
|
||||
id: emoji.id,
|
||||
name: emoji.name,
|
||||
url: emoji.url,
|
||||
@ -121,7 +121,7 @@ export default Vue.extend({
|
||||
}).then(res => {
|
||||
if (!res.value) return;
|
||||
|
||||
(this as any).api('admin/emoji/remove', {
|
||||
this.$root.api('admin/emoji/remove', {
|
||||
id: emoji.id
|
||||
}).then(() => {
|
||||
this.$swal({
|
||||
|
@ -22,18 +22,18 @@ export default Vue.extend({
|
||||
};
|
||||
},
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.hidedTags = meta.hidedTags.join('\n');
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
(this as any).api('admin/update-meta', {
|
||||
this.$root.api('admin/update-meta', {
|
||||
hidedTags: this.hidedTags.split('\n')
|
||||
}).then(() => {
|
||||
//(this as any).os.apis.dialog({ text: `Saved` });
|
||||
//this.$root.os.apis.dialog({ text: `Saved` });
|
||||
}).catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed ${e}` });
|
||||
//this.$root.os.apis.dialog({ text: `Failed ${e}` });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
created() {
|
||||
(this as any).os.getMeta().then(meta => {
|
||||
this.$root.getMeta().then(meta => {
|
||||
this.maintainerName = meta.maintainer.name;
|
||||
this.maintainerEmail = meta.maintainer.email;
|
||||
this.bannerUrl = meta.bannerUrl;
|
||||
@ -139,7 +139,7 @@ export default Vue.extend({
|
||||
|
||||
methods: {
|
||||
invite() {
|
||||
(this as any).api('admin/invite').then(x => {
|
||||
this.$root.api('admin/invite').then(x => {
|
||||
this.inviteCode = x.code;
|
||||
}).catch(e => {
|
||||
this.$swal({
|
||||
@ -150,7 +150,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
updateMeta() {
|
||||
(this as any).api('admin/update-meta', {
|
||||
this.$root.api('admin/update-meta', {
|
||||
maintainerName: this.maintainerName,
|
||||
maintainerEmail: this.maintainerEmail,
|
||||
disableRegistration: this.disableRegistration,
|
||||
|
@ -67,13 +67,13 @@ export default Vue.extend({
|
||||
this.verifying = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await (this as any).os.api('users/show', parseAcct(this.verifyUsername));
|
||||
await (this as any).os.api('admin/verify-user', { userId: user.id });
|
||||
//(this as any).os.apis.dialog({ text: this.$t('verified') });
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.verifyUsername));
|
||||
await this.$root.os.api('admin/verify-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('verified') });
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
});
|
||||
|
||||
this.verifying = false;
|
||||
@ -83,13 +83,13 @@ export default Vue.extend({
|
||||
this.unverifying = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await (this as any).os.api('users/show', parseAcct(this.unverifyUsername));
|
||||
await (this as any).os.api('admin/unverify-user', { userId: user.id });
|
||||
//(this as any).os.apis.dialog({ text: this.$t('unverified') });
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.unverifyUsername));
|
||||
await this.$root.os.api('admin/unverify-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('unverified') });
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
});
|
||||
|
||||
this.unverifying = false;
|
||||
@ -99,13 +99,13 @@ export default Vue.extend({
|
||||
this.suspending = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await (this as any).os.api('users/show', parseAcct(this.suspendUsername));
|
||||
await (this as any).os.api('admin/suspend-user', { userId: user.id });
|
||||
//(this as any).os.apis.dialog({ text: this.$t('suspended') });
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.suspendUsername));
|
||||
await this.$root.os.api('admin/suspend-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('suspended') });
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
});
|
||||
|
||||
this.suspending = false;
|
||||
@ -115,13 +115,13 @@ export default Vue.extend({
|
||||
this.unsuspending = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await (this as any).os.api('users/show', parseAcct(this.unsuspendUsername));
|
||||
await (this as any).os.api('admin/unsuspend-user', { userId: user.id });
|
||||
//(this as any).os.apis.dialog({ text: this.$t('unsuspended') });
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.unsuspendUsername));
|
||||
await this.$root.os.api('admin/unsuspend-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('unsuspended') });
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//(this as any).os.apis.dialog({ text: `Failed: ${e}` });
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
});
|
||||
|
||||
this.unsuspending = false;
|
||||
|
Reference in New Issue
Block a user