2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-12-31 19:01:12 +09:00
|
|
|
<FormBase>
|
|
|
|
<FormGroup>
|
|
|
|
<template #label>{{ $ts._exportOrImport.allNotes }}</template>
|
2021-04-20 23:22:59 +09:00
|
|
|
<FormButton @click="doExport('notes')"><i class="fas fa-download"></i> {{ $ts.export }}</FormButton>
|
2020-12-31 19:01:12 +09:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<template #label>{{ $ts._exportOrImport.followingList }}</template>
|
2021-04-20 23:22:59 +09:00
|
|
|
<FormButton @click="doExport('following')"><i class="fas fa-download"></i> {{ $ts.export }}</FormButton>
|
|
|
|
<FormButton @click="doImport('following', $event)"><i class="fas fa-upload"></i> {{ $ts.import }}</FormButton>
|
2020-12-31 19:01:12 +09:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<template #label>{{ $ts._exportOrImport.userLists }}</template>
|
2021-04-20 23:22:59 +09:00
|
|
|
<FormButton @click="doExport('user-lists')"><i class="fas fa-download"></i> {{ $ts.export }}</FormButton>
|
|
|
|
<FormButton @click="doImport('user-lists', $event)"><i class="fas fa-upload"></i> {{ $ts.import }}</FormButton>
|
2020-12-31 19:01:12 +09:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<template #label>{{ $ts._exportOrImport.muteList }}</template>
|
2021-04-20 23:22:59 +09:00
|
|
|
<FormButton @click="doExport('mute')"><i class="fas fa-download"></i> {{ $ts.export }}</FormButton>
|
2020-12-31 19:01:12 +09:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<template #label>{{ $ts._exportOrImport.blockingList }}</template>
|
2021-04-20 23:22:59 +09:00
|
|
|
<FormButton @click="doExport('blocking')"><i class="fas fa-download"></i> {{ $ts.export }}</FormButton>
|
2020-12-31 19:01:12 +09:00
|
|
|
</FormGroup>
|
|
|
|
</FormBase>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 20:12:00 +09:00
|
|
|
import { defineComponent } from 'vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import FormSelect from '@client/components/form/select.vue';
|
2021-09-30 00:50:45 +09:00
|
|
|
import FormButton from '@client/components/debobigego/button.vue';
|
|
|
|
import FormBase from '@client/components/debobigego/base.vue';
|
|
|
|
import FormGroup from '@client/components/debobigego/group.vue';
|
2021-03-23 17:30:14 +09:00
|
|
|
import * as os from '@client/os';
|
|
|
|
import { selectFile } from '@client/scripts/select-file';
|
2021-04-10 12:54:12 +09:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
2020-12-31 19:01:12 +09:00
|
|
|
FormBase,
|
|
|
|
FormGroup,
|
|
|
|
FormButton,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
2020-12-31 19:01:12 +09:00
|
|
|
emits: ['info'],
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 12:54:12 +09:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-31 19:01:12 +09:00
|
|
|
title: this.$ts.importAndExport,
|
2021-09-30 00:50:45 +09:00
|
|
|
icon: 'fas fa-boxes',
|
|
|
|
bg: 'var(--bg)',
|
2020-12-31 19:01:12 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-12-31 19:01:12 +09:00
|
|
|
mounted() {
|
2021-04-10 12:54:12 +09:00
|
|
|
this.$emit('info', this[symbols.PAGE_INFO]);
|
2020-12-31 19:01:12 +09:00
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
methods: {
|
2020-12-31 19:01:12 +09:00
|
|
|
doExport(target) {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api(
|
2020-12-31 19:01:12 +09:00
|
|
|
target == 'notes' ? 'i/export-notes' :
|
|
|
|
target == 'following' ? 'i/export-following' :
|
|
|
|
target == 'blocking' ? 'i/export-blocking' :
|
|
|
|
target == 'user-lists' ? 'i/export-user-lists' :
|
|
|
|
target == 'mute' ? 'i/export-mute' :
|
2020-01-30 04:37:25 +09:00
|
|
|
null, {})
|
|
|
|
.then(() => {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.dialog({
|
2020-01-30 04:37:25 +09:00
|
|
|
type: 'info',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.exportRequested
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
}).catch((e: any) => {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.dialog({
|
2020-01-30 04:37:25 +09:00
|
|
|
type: 'error',
|
|
|
|
text: e.message
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-12-31 19:01:12 +09:00
|
|
|
async doImport(target, e) {
|
2020-10-25 10:48:33 +09:00
|
|
|
const file = await selectFile(e.currentTarget || e.target);
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
os.api(
|
2020-12-31 19:01:12 +09:00
|
|
|
target == 'following' ? 'i/import-following' :
|
|
|
|
target == 'user-lists' ? 'i/import-user-lists' :
|
2020-01-30 04:37:25 +09:00
|
|
|
null, {
|
|
|
|
fileId: file.id
|
|
|
|
}).then(() => {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.dialog({
|
2020-01-30 04:37:25 +09:00
|
|
|
type: 'info',
|
2020-12-26 10:47:36 +09:00
|
|
|
text: this.$ts.importRequested
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
}).catch((e: any) => {
|
2020-10-17 20:12:00 +09:00
|
|
|
os.dialog({
|
2020-01-30 04:37:25 +09:00
|
|
|
type: 'error',
|
|
|
|
text: e.message
|
|
|
|
});
|
|
|
|
});
|
2020-10-25 10:48:33 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|