From 7e5beeff464e75ab185c430cd96e7cc67209ccc1 Mon Sep 17 00:00:00 2001
From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>
Date: Mon, 13 Jul 2020 14:20:56 +0000
Subject: [PATCH 01/10] fix: directory conflict checking
---
frontend/src/utils/upload.js | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/frontend/src/utils/upload.js b/frontend/src/utils/upload.js
index 61e6a8e7..54b5669e 100644
--- a/frontend/src/utils/upload.js
+++ b/frontend/src/utils/upload.js
@@ -6,10 +6,7 @@ export function checkConflict(files, items) {
items = []
}
- let folder_upload = false
- if (files[0].fullPath !== undefined) {
- folder_upload = true
- }
+ let folder_upload = files[0].fullPath !== undefined
let conflict = false
for (let i = 0; i < files.length; i++) {
@@ -69,7 +66,7 @@ export function scanFiles(dt) {
const dir = {
isDir: true,
size: 0,
- path: `${directory}${entry.name}`
+ fullPath: `${directory}${entry.name}`
}
contents.push(dir)
@@ -112,7 +109,7 @@ export function handleFiles(files, path, overwrite = false) {
if (file.isDir) {
itemPath = path
- let folders = file.path.split("/")
+ let folders = file.fullPath.split("/")
for (let i = 0; i < folders.length; i++) {
let folder = folders[i]
From b3b644527d5673e16e61d404ff58a3c7bd6b6637 Mon Sep 17 00:00:00 2001
From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>
Date: Mon, 13 Jul 2020 17:37:43 +0000
Subject: [PATCH 02/10] fix: dark theme colors
---
frontend/public/themes/dark.css | 66 +++++++++++++++++++++++++++++----
1 file changed, 59 insertions(+), 7 deletions(-)
diff --git a/frontend/public/themes/dark.css b/frontend/public/themes/dark.css
index 978b4f0f..e916457a 100644
--- a/frontend/public/themes/dark.css
+++ b/frontend/public/themes/dark.css
@@ -1,7 +1,7 @@
:root {
- --background: #121212;
- --surfacePrimary: #171819;
- --surfaceSecondary: #212528;
+ --background: #141D24;
+ --surfacePrimary: #20292F;
+ --surfaceSecondary: #3A4147;
--divider: rgba(255, 255, 255, 0.12);
--icon: #ffffff;
--textPrimary: rgba(255, 255, 255, 0.87);
@@ -30,25 +30,34 @@ header {
#search #input {
background: var(--surfaceSecondary);
+ border-color: var(--surfacePrimary);
}
-#search.active #input,
-#search.active .boxes {
+#search #input input::placeholder {
+ color: var(--textSecondary);
+}
+#search.active #input {
background: var(--surfacePrimary);
}
#search.active input {
color: var(--textPrimary);
}
-#search.active #result {
+#search #result {
background: var(--background);
color: var(--textPrimary);
}
-#search.active .boxes h3 {
+#search .boxes {
+ background: var(--surfaceSecondary);
+}
+#search .boxes h3 {
color: var(--textPrimary);
}
.action {
color: var(--textPrimary) !important;
}
+.action:hover {
+ background-color: rgba(255, 255, 255, .1);
+}
.action i {
color: var(--icon) !important;
}
@@ -93,6 +102,10 @@ nav > div {
background: var(--background);
}
+.message {
+ color: var(--textPrimary);
+}
+
.card {
background: var(--surfacePrimary);
color: var(--textPrimary);
@@ -106,9 +119,23 @@ nav > div {
.dashboard p label {
color: var(--textPrimary);
}
+.card#share ul li input,
+.card#share ul li select,
.input {
background: var(--surfaceSecondary);
color: var(--textPrimary);
+ border: 1px solid rgba(255, 255, 255, 0.05);
+}
+.input:hover,
+.input:focus {
+ border-color: rgba(255, 255, 255, 0.15);
+}
+.input--red {
+ background: #73302D;
+}
+
+.input--green {
+ background: #147A41;
}
.dashboard #nav li,
@@ -119,10 +146,27 @@ nav > div {
color: var(--textPrimary);
}
+table th {
+ color: var(--textSecondary);
+}
+
+.file-list li:hover {
+ background: var(--surfaceSecondary);
+}
+.file-list li:before {
+ color: var(--textSecondary);
+}
+.file-list li[aria-selected=true]:before {
+ color: var(--icon);
+}
+
.shell {
background: var(--surfacePrimary);
color: var(--textPrimary);
}
+.shell__result {
+ border-top: 1px solid var(--divider);
+}
#editor-container {
background: var(--background);
@@ -146,3 +190,11 @@ nav > div {
background: var(--surfaceSecondary) !important;
}
}
+
+.share__box, .share__box__download {
+ background: var(--surfaceSecondary) !important;
+ color: var(--textPrimary);
+}
+.share__box__download {
+ border-bottom-color: var(--divider);
+}
\ No newline at end of file
From 194030fcfcf54a2cf5e2f8ececcbb4754474d8f8 Mon Sep 17 00:00:00 2001
From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>
Date: Mon, 13 Jul 2020 18:09:01 +0000
Subject: [PATCH 03/10] fix: prompt before closing window
---
frontend/src/api/files.js | 6 +-----
frontend/src/store/modules/upload.js | 7 +++++++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/frontend/src/api/files.js b/frontend/src/api/files.js
index 602090c1..135e9799 100644
--- a/frontend/src/api/files.js
+++ b/frontend/src/api/files.js
@@ -94,9 +94,6 @@ export async function post (url, content = '', overwrite = false, onupload) {
request.upload.onprogress = onupload
}
- // Send a message to user before closing the tab during file upload
- window.onbeforeunload = () => "Files are being uploaded."
-
request.onload = () => {
if (request.status === 200) {
resolve(request.responseText)
@@ -112,8 +109,7 @@ export async function post (url, content = '', overwrite = false, onupload) {
}
request.send(content)
- // Upload is done no more message before closing the tab
- }).finally(() => { window.onbeforeunload = null })
+ })
}
function moveCopy (items, copy = false) {
diff --git a/frontend/src/store/modules/upload.js b/frontend/src/store/modules/upload.js
index 738edaf9..6552dd01 100644
--- a/frontend/src/store/modules/upload.js
+++ b/frontend/src/store/modules/upload.js
@@ -37,6 +37,11 @@ const mutations = {
}
}
+const beforeUnload = (event) => {
+ event.preventDefault()
+ event.returnValue = ''
+}
+
const actions = {
upload: (context, item) => {
let uploadsCount = Object.keys(context.state.uploads).length;
@@ -45,6 +50,7 @@ const actions = {
let isUploadsEmpty = uploadsCount == 0
if (isQueueEmpty && isUploadsEmpty) {
+ window.addEventListener('beforeunload', beforeUnload)
buttons.loading('upload')
}
@@ -67,6 +73,7 @@ const actions = {
let canProcess = isBellowLimit && !isQueueEmpty
if (isFinished) {
+ window.removeEventListener('beforeunload', beforeUnload)
buttons.success('upload')
context.commit('reset')
context.commit('setReload', true, { root: true })
From 0727496601a9918c8131c56f62419bfac7ac589a Mon Sep 17 00:00:00 2001
From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>
Date: Mon, 13 Jul 2020 18:59:48 +0000
Subject: [PATCH 04/10] fix: remove incomplete uploaded files
---
http/resource.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/http/resource.go b/http/resource.go
index 95224083..2fd6cf04 100644
--- a/http/resource.go
+++ b/http/resource.go
@@ -127,6 +127,10 @@ var resourcePostPutHandler = withUser(func(w http.ResponseWriter, r *http.Reques
return nil
}, action, r.URL.Path, "", d.user)
+ if err != nil {
+ _ = d.user.Fs.RemoveAll(r.URL.Path)
+ }
+
return errToStatus(err), err
})
From 716396a726329f0ba42fc34167dd07497c5bf47c Mon Sep 17 00:00:00 2001
From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com>
Date: Tue, 14 Jul 2020 01:19:48 +0000
Subject: [PATCH 05/10] feat: add previewer title and loading indicator
---
frontend/public/themes/dark.css | 2 +-
frontend/src/components/files/Preview.vue | 37 ++++++++++++++++-------
frontend/src/css/styles.css | 12 +++++++-
3 files changed, 38 insertions(+), 13 deletions(-)
diff --git a/frontend/public/themes/dark.css b/frontend/public/themes/dark.css
index e916457a..1ee5f1ac 100644
--- a/frontend/public/themes/dark.css
+++ b/frontend/public/themes/dark.css
@@ -16,7 +16,7 @@ body {
#loading {
background: var(--background);
}
-#loading .spinner div {
+#loading .spinner div, #previewer .loading .spinner div {
background: var(--icon);
}
diff --git a/frontend/src/components/files/Preview.vue b/frontend/src/components/files/Preview.vue
index 1294fa5f..f0a7ef02 100644
--- a/frontend/src/components/files/Preview.vue
+++ b/frontend/src/components/files/Preview.vue
@@ -5,18 +5,33 @@
close
-