1
0
forked from mirror/misskey
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
Aya Morisawa 2018-12-26 19:39:51 +09:00
parent 09c57e6d03
commit c8b45f4f42
No known key found for this signature in database
GPG Key ID: 3E64865D70D579F2
2 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
import { apiUrl } from '../../config';
import { apiUrl, locale } from '../../config';
import CropWindow from '../views/components/crop-window.vue';
import ProgressDialog from '../views/components/progress-dialog.vue';
@ -9,7 +9,7 @@ export default ($root: any) => {
const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$');
if (!regex.test(file.name) ) {
$root.dialog({
title: '%fa:info-circle% %i18n:desktop.invalid-filetype%',
title: locale['desktop']['invalid-filetype'],
text: null
});
return reject('invalid-filetype');
@ -17,7 +17,7 @@ export default ($root: any) => {
const w = $root.new(CropWindow, {
image: file,
title: '%i18n:desktop.avatar-crop-title%',
title: locale['desktop']['avatar-crop-title'],
aspectRatio: 1 / 1
});
@ -27,11 +27,11 @@ export default ($root: any) => {
data.append('file', blob, file.name + '.cropped.png');
$root.api('drive/folders/find', {
name: '%i18n:desktop.avatar%'
name: locale['desktop']['avatar']
}).then(avatarFolder => {
if (avatarFolder.length === 0) {
$root.api('drive/folders/create', {
name: '%i18n:desktop.avatar%'
name: locale['desktop']['avatar']
}).then(iconFolder => {
resolve(upload(data, iconFolder));
});
@ -52,7 +52,7 @@ export default ($root: any) => {
const upload = (data, folder) => new Promise((resolve, reject) => {
const dialog = $root.new(ProgressDialog, {
title: '%i18n:desktop.uploading-avatar%'
title: locale['desktop']['uploading-avatar']
});
document.body.appendChild(dialog.$el);
@ -88,7 +88,7 @@ export default ($root: any) => {
});
$root.dialog({
title: '%fa:info-circle% %i18n:desktop.avatar-updated%',
title: locale['desktop']['avatar-updated'],
text: null
});
@ -101,7 +101,7 @@ export default ($root: any) => {
? Promise.resolve(file)
: $root.$chooseDriveFile({
multiple: false,
title: '%fa:image% %i18n:desktop.choose-avatar%'
title: locale['desktop']['choose-avatar']
});
return selectedFile

View File

@ -1,4 +1,4 @@
import { apiUrl } from '../../config';
import { apiUrl, locale } from '../../config';
import CropWindow from '../views/components/crop-window.vue';
import ProgressDialog from '../views/components/progress-dialog.vue';
@ -9,7 +9,7 @@ export default ($root: any) => {
const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$');
if (!regex.test(file.name) ) {
$root.dialog({
title: '%fa:info-circle% %i18n:desktop.invalid-filetype%',
title: locale['desktop']['invalid-filetype'],
text: null
});
return reject('invalid-filetype');
@ -17,7 +17,7 @@ export default ($root: any) => {
const w = $root.new(CropWindow, {
image: file,
title: '%i18n:desktop.banner-crop-title%',
title: locale['desktop']['banner-crop-title'],
aspectRatio: 16 / 9
});
@ -27,11 +27,11 @@ export default ($root: any) => {
data.append('file', blob, file.name + '.cropped.png');
$root.api('drive/folders/find', {
name: '%i18n:desktop.banner%'
name: locale['desktop']['banner']
}).then(bannerFolder => {
if (bannerFolder.length === 0) {
$root.api('drive/folders/create', {
name: '%i18n:desktop.banner%'
name: locale['desktop']['banner']
}).then(iconFolder => {
resolve(upload(data, iconFolder));
});
@ -52,7 +52,7 @@ export default ($root: any) => {
const upload = (data, folder) => new Promise((resolve, reject) => {
const dialog = $root.new(ProgressDialog, {
title: '%i18n:desktop.uploading-banner%'
title: locale['desktop']['uploading-banner']
});
document.body.appendChild(dialog.$el);
@ -88,7 +88,7 @@ export default ($root: any) => {
});
$root.dialog({
title: '%fa:info-circle% %i18n:desktop.banner-updated%',
title: locale['desktop']['banner-updated'],
text: null
});
@ -101,7 +101,7 @@ export default ($root: any) => {
? Promise.resolve(file)
: $root.$chooseDriveFile({
multiple: false,
title: '%fa:image% %i18n:desktop.choose-banner%'
title: locale['desktop']['choose-banner']
});
return selectedFile