Refactor client (#3178)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../i18n';
|
||||
import * as anime from 'animejs';
|
||||
import contextmenu from '../../api/contextmenu';
|
||||
import copyToClipboard from '../../../common/scripts/copy-to-clipboard';
|
||||
|
||||
export default Vue.extend({
|
||||
@@ -70,7 +69,7 @@ export default Vue.extend({
|
||||
|
||||
onContextmenu(e) {
|
||||
this.isContextmenuShowing = true;
|
||||
contextmenu((this as any).os)(e, [{
|
||||
this.$contextmenu(e, [{
|
||||
type: 'item',
|
||||
text: this.$t('contextmenu.rename'),
|
||||
icon: 'i-cursor',
|
||||
@@ -116,10 +115,10 @@ export default Vue.extend({
|
||||
action: this.addApp
|
||||
}]
|
||||
}*/], {
|
||||
closed: () => {
|
||||
this.isContextmenuShowing = false;
|
||||
}
|
||||
});
|
||||
closed: () => {
|
||||
this.isContextmenuShowing = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onDragstart(e) {
|
||||
@@ -149,7 +148,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
rename() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('contextmenu.rename-file'),
|
||||
placeholder: this.$t('contextmenu.input-new-file-name'),
|
||||
default: this.file.name,
|
||||
@@ -171,7 +170,7 @@ export default Vue.extend({
|
||||
|
||||
copyUrl() {
|
||||
copyToClipboard(this.file.url);
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('contextmenu.copied'),
|
||||
text: this.$t('contextmenu.copied-url-to-clipboard'),
|
||||
actions: [{
|
||||
@@ -181,11 +180,11 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
setAsAvatar() {
|
||||
this.$root.apis.updateAvatar(this.file);
|
||||
this.$updateAvatar(this.file);
|
||||
},
|
||||
|
||||
setAsBanner() {
|
||||
this.$root.apis.updateBanner(this.file);
|
||||
this.$updateBanner(this.file);
|
||||
},
|
||||
|
||||
addApp() {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../i18n';
|
||||
import contextmenu from '../../api/contextmenu';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('desktop/views/components/drive.folder.vue'),
|
||||
@@ -54,7 +53,7 @@ export default Vue.extend({
|
||||
|
||||
onContextmenu(e) {
|
||||
this.isContextmenuShowing = true;
|
||||
contextmenu((this as any).os)(e, [{
|
||||
this.$contextmenu(e, [{
|
||||
type: 'item',
|
||||
text: this.$t('contextmenu.move-to-this-folder'),
|
||||
icon: 'arrow-right',
|
||||
@@ -75,10 +74,10 @@ export default Vue.extend({
|
||||
icon: ['far', 'trash-alt'],
|
||||
action: this.deleteFolder
|
||||
}], {
|
||||
closed: () => {
|
||||
this.isContextmenuShowing = false;
|
||||
}
|
||||
});
|
||||
closed: () => {
|
||||
this.isContextmenuShowing = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onMouseover() {
|
||||
@@ -156,7 +155,7 @@ export default Vue.extend({
|
||||
}).catch(err => {
|
||||
switch (err) {
|
||||
case 'detected-circular-definition':
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('unable-to-process'),
|
||||
text: this.$t('circular-reference-detected'),
|
||||
actions: [{
|
||||
@@ -196,7 +195,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
rename() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('contextmenu.rename-folder'),
|
||||
placeholder: this.$t('contextmenu.input-new-folder-name'),
|
||||
default: this.folder.name
|
||||
|
||||
@@ -65,7 +65,6 @@ import XNavFolder from './drive.nav-folder.vue';
|
||||
import XFolder from './drive.folder.vue';
|
||||
import XFile from './drive.file.vue';
|
||||
import contains from '../../../common/scripts/contains';
|
||||
import contextmenu from '../../api/contextmenu';
|
||||
import { url } from '../../../config';
|
||||
|
||||
export default Vue.extend({
|
||||
@@ -137,7 +136,7 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
onContextmenu(e) {
|
||||
contextmenu((this as any).os)(e, [{
|
||||
this.$contextmenu(e, [{
|
||||
type: 'item',
|
||||
text: this.$t('contextmenu.create-folder'),
|
||||
icon: ['far', 'folder'],
|
||||
@@ -314,7 +313,7 @@ export default Vue.extend({
|
||||
}).catch(err => {
|
||||
switch (err) {
|
||||
case 'detected-circular-definition':
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('unable-to-process'),
|
||||
text: this.$t('circular-reference-detected'),
|
||||
actions: [{
|
||||
@@ -335,7 +334,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
urlUpload() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('url-upload'),
|
||||
placeholder: this.$t('url-of-file')
|
||||
}).then(url => {
|
||||
@@ -344,7 +343,7 @@ export default Vue.extend({
|
||||
folderId: this.folder ? this.folder.id : undefined
|
||||
});
|
||||
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('url-upload-requested'),
|
||||
text: this.$t('may-take-time'),
|
||||
actions: [{
|
||||
@@ -355,7 +354,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
createFolder() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('create-folder'),
|
||||
placeholder: this.$t('folder-name')
|
||||
}).then(name => {
|
||||
|
||||
@@ -186,7 +186,7 @@ export default Vue.extend({
|
||||
|
||||
methods: {
|
||||
hint() {
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('@.customization-tips.title'),
|
||||
text: this.$t('@.customization-tips.paragraph'),
|
||||
actions: [{
|
||||
|
||||
@@ -245,7 +245,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
chooseFileFromDrive() {
|
||||
this.$root.apis.chooseDriveFile({
|
||||
this.$chooseDriveFile({
|
||||
multiple: true
|
||||
}).then(files => {
|
||||
files.forEach(this.attachMedia);
|
||||
@@ -363,7 +363,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
addVisibleUser() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-username')
|
||||
}).then(acct => {
|
||||
if (acct.startsWith('@')) acct = acct.substr(1);
|
||||
@@ -401,13 +401,13 @@ export default Vue.extend({
|
||||
this.clear();
|
||||
this.deleteDraft();
|
||||
this.$emit('posted');
|
||||
this.$root.apis.notify(this.renote
|
||||
this.$notify(this.renote
|
||||
? this.$t('reposted')
|
||||
: this.reply
|
||||
? this.$t('replied')
|
||||
: this.$t('posted'));
|
||||
}).catch(err => {
|
||||
this.$root.apis.notify(this.renote
|
||||
this.$notify(this.renote
|
||||
? this.$t('renote-failed')
|
||||
: this.reply
|
||||
? this.$t('reply-failed')
|
||||
|
||||
@@ -34,9 +34,9 @@ export default Vue.extend({
|
||||
renoteId: this.note.id
|
||||
}).then(data => {
|
||||
this.$emit('posted');
|
||||
this.$root.apis.notify(this.$t('success'));
|
||||
this.$notify(this.$t('success'));
|
||||
}).catch(err => {
|
||||
this.$root.apis.notify(this.$t('failure'));
|
||||
this.$notify(this.$t('failure'));
|
||||
}).then(() => {
|
||||
this.wait = false;
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
register() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-password'),
|
||||
type: 'password'
|
||||
}).then(password => {
|
||||
@@ -48,14 +48,14 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
unregister() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-password'),
|
||||
type: 'password'
|
||||
}).then(password => {
|
||||
this.$root.api('i/2fa/unregister', {
|
||||
password: password
|
||||
}).then(() => {
|
||||
this.$root.apis.notify(this.$t('unregistered'));
|
||||
this.$notify(this.$t('unregistered'));
|
||||
this.$store.state.i.twoFactorEnabled = false;
|
||||
});
|
||||
});
|
||||
@@ -65,10 +65,10 @@ export default Vue.extend({
|
||||
this.$root.api('i/2fa/done', {
|
||||
token: this.token
|
||||
}).then(() => {
|
||||
this.$root.apis.notify(this.$t('success'));
|
||||
this.$notify(this.$t('success'));
|
||||
this.$store.state.i.twoFactorEnabled = true;
|
||||
}).catch(() => {
|
||||
this.$root.apis.notify(this.$t('failed'));
|
||||
this.$notify(this.$t('failed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ export default Vue.extend({
|
||||
this.$emit('done');
|
||||
},
|
||||
updateWallpaper() {
|
||||
this.$root.apis.chooseDriveFile({
|
||||
this.$chooseDriveFile({
|
||||
multiple: false
|
||||
}).then(file => {
|
||||
this.$root.api('i/update', {
|
||||
@@ -533,16 +533,16 @@ export default Vue.extend({
|
||||
},
|
||||
checkForUpdate() {
|
||||
this.checkingForUpdate = true;
|
||||
checkForUpdate((this as any).os, true, true).then(newer => {
|
||||
checkForUpdate(this.$root, true, true).then(newer => {
|
||||
this.checkingForUpdate = false;
|
||||
this.latestVersion = newer;
|
||||
if (newer == null) {
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('no-updates'),
|
||||
text: this.$t('no-updates-desc')
|
||||
});
|
||||
} else {
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('update-available'),
|
||||
text: this.$t('update-available-desc')
|
||||
});
|
||||
@@ -551,7 +551,7 @@ export default Vue.extend({
|
||||
},
|
||||
clean() {
|
||||
localStorage.clear();
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: this.$t('cache-cleared'),
|
||||
text: this.$t('cache-cleared-desc')
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ export default Vue.extend({
|
||||
icon: 'plus',
|
||||
text: this.$t('add-list'),
|
||||
action: () => {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('list-name'),
|
||||
}).then(async title => {
|
||||
const list = await this.$root.api('users/lists/create', {
|
||||
|
||||
@@ -12,7 +12,7 @@ export default Vue.extend({
|
||||
i18n: i18n('desktop/views/components/ui.header.post.vue'),
|
||||
methods: {
|
||||
post() {
|
||||
this.$root.apis.post();
|
||||
this.$post();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
post() {
|
||||
this.$root.apis.post();
|
||||
this.$post();
|
||||
},
|
||||
|
||||
drive() {
|
||||
|
||||
@@ -67,7 +67,7 @@ export default Vue.extend({
|
||||
|
||||
methods: {
|
||||
post() {
|
||||
this.$root.apis.post();
|
||||
this.$post();
|
||||
},
|
||||
|
||||
toggleZenMode() {
|
||||
|
||||
@@ -29,7 +29,7 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('list-name'),
|
||||
}).then(async title => {
|
||||
const list = await this.$root.api('users/lists/create', {
|
||||
|
||||
Reference in New Issue
Block a user