Refactor client (#3178)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import MiOS from '../../mios';
|
||||
import { clientVersion as current } from '../../config';
|
||||
|
||||
export default async function(mios: MiOS, force = false, silent = false) {
|
||||
const meta = await mios.getMeta(force);
|
||||
export default async function($root: any, force = false, silent = false) {
|
||||
const meta = await $root.getMeta(force);
|
||||
const newer = meta.clientVersion;
|
||||
|
||||
if (newer != current) {
|
||||
@@ -23,7 +22,7 @@ export default async function(mios: MiOS, force = false, silent = false) {
|
||||
}
|
||||
|
||||
if (!silent) {
|
||||
mios.apis.dialog({
|
||||
$root.$dialog({
|
||||
title: '%i18n:common.update-available-title%',
|
||||
text: '%i18n:common.update-available%'.replace('{newer}', newer).replace('{current}', current)
|
||||
});
|
||||
|
@@ -1,10 +1,10 @@
|
||||
declare const fuckAdBlock: any;
|
||||
|
||||
export default (os) => {
|
||||
export default ($root: any) => {
|
||||
require('fuckadblock');
|
||||
|
||||
function adBlockDetected() {
|
||||
os.apis.dialog({
|
||||
$root.$dialog({
|
||||
title: '%fa:exclamation-triangle%%i18n:common.adblock.detected%',
|
||||
text: '%i18n:common.adblock.warning%',
|
||||
actins: [{
|
||||
|
@@ -88,7 +88,7 @@ export default (opts: Opts = {}) => ({
|
||||
|
||||
methods: {
|
||||
reply(viaKeyboard = false) {
|
||||
this.$root.apis.post({
|
||||
this.$root.$post({
|
||||
reply: this.appearNote,
|
||||
animation: !viaKeyboard,
|
||||
cb: () => {
|
||||
@@ -98,7 +98,7 @@ export default (opts: Opts = {}) => ({
|
||||
},
|
||||
|
||||
renote(viaKeyboard = false) {
|
||||
this.$root.apis.post({
|
||||
this.$root.$post({
|
||||
renote: this.appearNote,
|
||||
animation: !viaKeyboard,
|
||||
cb: () => {
|
||||
|
@@ -50,7 +50,7 @@ export default Vue.extend({
|
||||
|
||||
methods: {
|
||||
regenerateToken() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-password'),
|
||||
type: 'password'
|
||||
}).then(password => {
|
||||
|
@@ -100,7 +100,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
match() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-username')
|
||||
}).then(username => {
|
||||
this.$root.api('users/show', {
|
||||
|
@@ -131,7 +131,7 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
chooseFileFromDrive() {
|
||||
this.$root.apis.chooseDriveFile({
|
||||
this.$chooseDriveFile({
|
||||
multiple: false
|
||||
}).then(file => {
|
||||
this.file = file;
|
||||
|
@@ -12,20 +12,20 @@ export default Vue.extend({
|
||||
i18n: i18n('common/views/components/password-settings.vue'),
|
||||
methods: {
|
||||
reset() {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-current-password'),
|
||||
type: 'password'
|
||||
}).then(currentPassword => {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-new-password'),
|
||||
type: 'password'
|
||||
}).then(newPassword => {
|
||||
this.$root.apis.input({
|
||||
this.$input({
|
||||
title: this.$t('enter-new-password-again'),
|
||||
type: 'password'
|
||||
}).then(newPassword2 => {
|
||||
if (newPassword !== newPassword2) {
|
||||
this.$root.apis.dialog({
|
||||
this.$dialog({
|
||||
title: null,
|
||||
text: this.$t('not-match'),
|
||||
actions: [{
|
||||
@@ -38,7 +38,7 @@ export default Vue.extend({
|
||||
currentPasword: currentPassword,
|
||||
newPassword: newPassword
|
||||
}).then(() => {
|
||||
this.$root.apis.notify(this.$t('changed'));
|
||||
this.$notify(this.$t('changed'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -114,7 +114,7 @@ export default define({
|
||||
});
|
||||
},
|
||||
choose() {
|
||||
this.$root.apis.chooseDriveFolder().then(folder => {
|
||||
this.$chooseDriveFolder().then(folder => {
|
||||
this.props.folder = folder ? folder.id : null;
|
||||
this.save();
|
||||
this.fetch();
|
||||
|
Reference in New Issue
Block a user