From bc9c7efe8578d6e82bf874b1f3cebe9763cececf Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sat, 25 Aug 2018 11:19:17 +0000 Subject: [PATCH 01/11] fix(package): update systeminformation to version 3.44.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8562e6f6c4..296e8e0ef4 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,7 @@ "stylus": "0.54.5", "stylus-loader": "3.0.2", "summaly": "2.1.4", - "systeminformation": "3.43.0", + "systeminformation": "3.44.0", "syuilo-password-strength": "0.0.1", "textarea-caret": "3.1.0", "tmp": "0.0.33", From c624da70ef72ddb72d27554591f6efab75fdaf78 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sat, 25 Aug 2018 12:45:23 +0000 Subject: [PATCH 02/11] fix(package): update nan to version 2.11.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8562e6f6c4..4b94cee39d 100644 --- a/package.json +++ b/package.json @@ -158,7 +158,7 @@ "mongodb": "3.1.1", "monk": "6.0.6", "ms": "2.1.1", - "nan": "2.10.0", + "nan": "2.11.0", "nested-property": "0.0.7", "node-sass": "4.9.3", "node-sass-json-importer": "3.3.1", From 6806eafaed968fd362e906f23fba15196e9fa887 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sun, 26 Aug 2018 02:26:22 +0000 Subject: [PATCH 03/11] fix(package): update vue-loader to version 15.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8bde6935b8..f41a631f3e 100644 --- a/package.json +++ b/package.json @@ -212,7 +212,7 @@ "vue-cropperjs": "2.2.1", "vue-js-modal": "1.3.19", "vue-json-tree-view": "2.1.4", - "vue-loader": "15.4.0", + "vue-loader": "15.4.1", "vue-router": "3.0.1", "vue-style-loader": "4.1.2", "vue-template-compiler": "2.5.17", From c07f668f14a3510e270b24ecea7193112b67221c Mon Sep 17 00:00:00 2001 From: Hiramiya Date: Mon, 27 Aug 2018 16:06:04 +0100 Subject: [PATCH 04/11] Fix border-radius on photos --- src/client/app/desktop/views/pages/user/user.photos.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/app/desktop/views/pages/user/user.photos.vue b/src/client/app/desktop/views/pages/user/user.photos.vue index 2318f2b8e4..8397e56484 100644 --- a/src/client/app/desktop/views/pages/user/user.photos.vue +++ b/src/client/app/desktop/views/pages/user/user.photos.vue @@ -44,6 +44,7 @@ root(isDark) background isDark ? #282C37 : #fff border solid 1px rgba(#000, 0.075) border-radius 6px + overflow hidden > .title z-index 1 From f283d2423fa3b5b4e0e4ee6fda6a7848b1a53365 Mon Sep 17 00:00:00 2001 From: Hiramiya Date: Mon, 27 Aug 2018 16:06:31 +0100 Subject: [PATCH 05/11] Fix border-radius on friends --- src/client/app/desktop/views/pages/user/user.friends.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/client/app/desktop/views/pages/user/user.friends.vue b/src/client/app/desktop/views/pages/user/user.friends.vue index 49ca7a3f8f..516eea0288 100644 --- a/src/client/app/desktop/views/pages/user/user.friends.vue +++ b/src/client/app/desktop/views/pages/user/user.friends.vue @@ -45,6 +45,7 @@ root(isDark) background isDark ? #282C37 : #fff border solid 1px rgba(#000, 0.075) border-radius 6px + overflow hidden > .title z-index 1 From ba6cd874aa41230e4cc98800d0d407bf3e94a55b Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 27 Aug 2018 15:41:07 +0000 Subject: [PATCH 06/11] fix(package): update vue-js-modal to version 1.3.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c84f01fc51..a3b50c5713 100644 --- a/package.json +++ b/package.json @@ -210,7 +210,7 @@ "vue": "2.5.17", "vue-chartjs": "3.4.0", "vue-cropperjs": "2.2.1", - "vue-js-modal": "1.3.19", + "vue-js-modal": "1.3.20", "vue-json-tree-view": "2.1.4", "vue-loader": "15.4.0", "vue-router": "3.0.1", From ef43721e32c226c2c66dddd83e0c2a0ceb1d36db Mon Sep 17 00:00:00 2001 From: Hiramiya Date: Mon, 27 Aug 2018 17:29:21 +0100 Subject: [PATCH 07/11] Update update-avatar.ts --- src/client/app/desktop/api/update-avatar.ts | 56 ++++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts index 83820f92bd..18b912d148 100644 --- a/src/client/app/desktop/api/update-avatar.ts +++ b/src/client/app/desktop/api/update-avatar.ts @@ -3,9 +3,9 @@ import { apiUrl } from '../../config'; import CropWindow from '../views/components/crop-window.vue'; import ProgressDialog from '../views/components/progress-dialog.vue'; -export default (os: OS) => (cb, file = null) => { - const fileSelected = file => { +export default (os: OS) => { + const cropImage = file => new Promise((resolve, reject) => { const w = os.new(CropWindow, { image: file, title: '%i18n:desktop.avatar-crop-title%', @@ -19,27 +19,29 @@ export default (os: OS) => (cb, file = null) => { os.api('drive/folders/find', { name: '%i18n:desktop.avatar%' - }).then(iconFolder => { - if (iconFolder.length === 0) { + }).then(avatarFolder => { + if (avatarFolder.length === 0) { os.api('drive/folders/create', { name: '%i18n:desktop.avatar%' }).then(iconFolder => { - upload(data, iconFolder); + resolve(upload(data, iconFolder)); }); } else { - upload(data, iconFolder[0]); + resolve(upload(data, avatarFolder[0])); } }); }); w.$once('skipped', () => { - set(file); + resolve(file); }); - document.body.appendChild(w.$el); - }; + w.$once('cancelled', reject); - const upload = (data, folder) => { + document.body.appendChild(w.$el); + }); + + const upload = (data, folder) => new Promise((resolve, reject) => { const dialog = os.new(ProgressDialog, { title: '%i18n:desktop.uploading-avatar%' }); @@ -52,18 +54,19 @@ export default (os: OS) => (cb, file = null) => { xhr.onload = e => { const file = JSON.parse((e.target as any).response); (dialog as any).close(); - set(file); + resolve(file); }; + xhr.onerror = reject; xhr.upload.onprogress = e => { if (e.lengthComputable) (dialog as any).update(e.loaded, e.total); }; xhr.send(data); - }; + }); - const set = file => { - os.api('i/update', { + const setAvatar = file => { + return os.api('i/update', { avatarId: file.id }).then(i => { os.store.commit('updateIKeyValue', { @@ -83,18 +86,21 @@ export default (os: OS) => (cb, file = null) => { }] }); - if (cb) cb(i); + return i; }); }; - if (file) { - fileSelected(file); - } else { - os.apis.chooseDriveFile({ - multiple: false, - title: '%fa:image% %i18n:desktop.choose-avatar%' - }).then(file => { - fileSelected(file); - }); - } + return (file = null) => { + const selectedFile = file + ? Promise.resolve(file) + : os.apis.chooseDriveFile({ + multiple: false, + title: '%fa:image% %i18n:desktop.choose-avatar%' + }); + + return selectedFile + .then(cropImage) + .then(setAvatar) + .catch(err => err && console.warn(err)); + }; }; From c7bda6f908c355bde3d7bf4cf0d4c706a968d606 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 27 Aug 2018 18:05:30 +0000 Subject: [PATCH 08/11] fix(package): update style-loader to version 0.23.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c84f01fc51..83f63ee0a6 100644 --- a/package.json +++ b/package.json @@ -190,7 +190,7 @@ "single-line-log": "1.1.2", "speakeasy": "2.0.0", "stringz": "1.0.0", - "style-loader": "0.22.1", + "style-loader": "0.23.0", "stylus": "0.54.5", "stylus-loader": "3.0.2", "summaly": "2.1.4", From d1a956113554d3be174207d90770eb5d4875cd46 Mon Sep 17 00:00:00 2001 From: Hiramiya Date: Mon, 27 Aug 2018 20:03:28 +0100 Subject: [PATCH 09/11] Restrict avatar filetypes --- src/client/app/desktop/api/update-avatar.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/client/app/desktop/api/update-avatar.ts b/src/client/app/desktop/api/update-avatar.ts index 18b912d148..f07dc623f2 100644 --- a/src/client/app/desktop/api/update-avatar.ts +++ b/src/client/app/desktop/api/update-avatar.ts @@ -6,6 +6,19 @@ import ProgressDialog from '../views/components/progress-dialog.vue'; export default (os: OS) => { const cropImage = file => new Promise((resolve, reject) => { + + var regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$') + if(!regex.test(file.name) ) { + os.apis.dialog({ + title: '%fa:info-circle% %i18n:desktop.invalid-filetype%', + text: null, + actions: [{ + text: '%i18n:common.got-it%' + }] + }); + reject + } + const w = os.new(CropWindow, { image: file, title: '%i18n:desktop.avatar-crop-title%', From e7e6d833b7039957cc58bdf0b673156a65f3cc92 Mon Sep 17 00:00:00 2001 From: Hiramiya Date: Mon, 27 Aug 2018 20:03:48 +0100 Subject: [PATCH 10/11] Restrict banner filetypes --- src/client/app/desktop/api/update-banner.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/client/app/desktop/api/update-banner.ts b/src/client/app/desktop/api/update-banner.ts index 33c4e306a2..5af6ea88d2 100644 --- a/src/client/app/desktop/api/update-banner.ts +++ b/src/client/app/desktop/api/update-banner.ts @@ -6,6 +6,20 @@ import ProgressDialog from '../views/components/progress-dialog.vue'; export default (os: OS) => { const cropImage = file => new Promise((resolve, reject) => { + + var regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$') + + if(!regex.test(file.name) ) { + os.apis.dialog({ + title: '%fa:info-circle% %i18n:desktop.invalid-filetype%', + text: null, + actions: [{ + text: '%i18n:common.got-it%' + }] + }); + reject + } + const w = os.new(CropWindow, { image: file, title: '%i18n:desktop.banner-crop-title%', From 14ad3af30d36dbc28d8e85973144aaa6f36efe77 Mon Sep 17 00:00:00 2001 From: Hiramiya Date: Mon, 27 Aug 2018 20:04:39 +0100 Subject: [PATCH 11/11] Add "invalid-filetype" translation --- locales/en-US.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/locales/en-US.yml b/locales/en-US.yml index bc2dbc86f6..c7c24433e0 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -411,6 +411,7 @@ desktop: uploading-avatar: "Uploading a new avatar" avatar-updated: "Successfully updated the avatar" choose-avatar: "Select an image for the avatar" + invalid-filetype: "This filetype is not acceptable here" desktop/views/components/activity.chart.vue: total: "Black ... Total" notes: "Blue ... Notes"