diff --git a/images/cloudshell/alpine.png b/images/cloudshell/alpine.png deleted file mode 100644 index 721ccc6..0000000 Binary files a/images/cloudshell/alpine.png and /dev/null differ diff --git a/images/cloudshell/archlinux.png b/images/cloudshell/archlinux.png deleted file mode 100644 index 445cfee..0000000 Binary files a/images/cloudshell/archlinux.png and /dev/null differ diff --git a/images/cloudshell/centos.png b/images/cloudshell/centos.png deleted file mode 100644 index 4094cb6..0000000 Binary files a/images/cloudshell/centos.png and /dev/null differ diff --git a/images/cloudshell/debian.png b/images/cloudshell/debian.png deleted file mode 100644 index 4752c25..0000000 Binary files a/images/cloudshell/debian.png and /dev/null differ diff --git a/images/cloudshell/fedora.png b/images/cloudshell/fedora.png deleted file mode 100644 index 43a393b..0000000 Binary files a/images/cloudshell/fedora.png and /dev/null differ diff --git a/images/cloudshell/kali.png b/images/cloudshell/kali.png deleted file mode 100644 index bf12e2a..0000000 Binary files a/images/cloudshell/kali.png and /dev/null differ diff --git a/images/cloudshell/opensuse.png b/images/cloudshell/opensuse.png deleted file mode 100644 index 21cfe4e..0000000 Binary files a/images/cloudshell/opensuse.png and /dev/null differ diff --git a/images/cloudshell/rockylinux.png b/images/cloudshell/rockylinux.png deleted file mode 100644 index 92cd8f3..0000000 Binary files a/images/cloudshell/rockylinux.png and /dev/null differ diff --git a/images/cloudshell/ubuntu.png b/images/cloudshell/ubuntu.png deleted file mode 100644 index e966783..0000000 Binary files a/images/cloudshell/ubuntu.png and /dev/null differ diff --git a/js/toss.js b/js/toss.js index cd8e5ac..6cb1088 100644 --- a/js/toss.js +++ b/js/toss.js @@ -31,10 +31,10 @@ function removeFile(fileName) { renderPending(fileHandlers) } -async function renderPending(handlers, target = '#fileList') { +async function renderPending(handlers, target = '#pending') { let parent = document.querySelector(target) - if (target == '#fileList') { + if (target == '#pending') { parent.innerHTML = handlers.length == 0 ? '

Pending list

' : '' @@ -54,6 +54,11 @@ async function renderPending(handlers, target = '#fileList') { async function showFile(handler, parent) { let file = await getFile(handler) + let expires = file.uploaded ? ` +

+ Expires: ${new Date(Date.parse(file.uploaded) + 24 * 60 * 60 * 1000).toLocaleString()} +

` : '' + parent.innerHTML +=`
@@ -65,8 +70,11 @@ async function showFile(handler, parent) { Delete  
-
- ${Math.round(file.size / 1000)}kb +
+ ${expires} +

+ Size: ${Math.round(file.size / 1000)}kb +

` @@ -112,11 +120,17 @@ async function deleteFile(key) { } async function upload() { - toast("Conchbrain OSS", "Uploading...") - files.splice(0) await getAllFiles(fileHandlers) + if (files.length == 0) { + toast("Conchbrain OSS", "Empty pending list") + return + } + + updateUploadStatus(true) + toast("Conchbrain OSS", "Uploading...") + for (let file of files) { let reader = file.stream().getReader(); @@ -126,6 +140,7 @@ async function upload() { }) .catch(err => { alert(err) + updateUploadStatus(false) }) while (true) { @@ -145,6 +160,7 @@ async function upload() { renderUploaded() setTimeout(() => { + updateUploadStatus(false) document.querySelector('#progress').style.width = '0' toast("Conchbrain OSS", "Upload Success") }, 2000) @@ -152,6 +168,22 @@ async function upload() { } } +function updateUploadStatus(uploading = false) { + let html = ` +
+ Loading... +
` + + let btn = document.querySelector('#btn-upload') + + if (uploading) + btn.setAttribute('disabled', 'disabled') + else + btn.removeAttribute('disabled') + + btn.innerHTML = uploading ? html : 'Upload' +} + async function getFile(handler) { if (handler.getFile) { return await handler.getFile() diff --git a/serviceworker.js b/serviceworker.js index d0c889b..50c9028 100644 --- a/serviceworker.js +++ b/serviceworker.js @@ -13,49 +13,38 @@ const PRE_CACHED_RESOURCES = [ "images/pic5.png", "images/pic6.png", - "images/cloudshell/alpine.png", - "images/cloudshell/archlinux.png", - "images/cloudshell/centos.png", - "images/cloudshell/debian.png", - "images/cloudshell/fedora.png", - "images/cloudshell/kali.png", - "images/cloudshell/opensuse.png", - "images/cloudshell/rockylinux.png", - "images/cloudshell/ubuntu.png", - "view/cloudshell.html", "view/conch.html", "view/corsproxy.html", - "view/favourites.html", + "view/dockerproxy.html", "view/home.html", "view/intro.html", - "view/kvstorage.html", + "view/kv.html", + "view/mixstore.html", "view/notfound.html", - "view/proxyservice.html", + "view/toss.html", + "view/webproxy.html", - "css/index.css", - "css/notfound.css", + "css/cloudshell.css", + "css/conch.css", "css/home.css", + "css/index.css", "css/intro.css", - "css/conch.css", - "css/favourites.css", - "css/cloudshell.css", - "css/proxyservice.css", + "css/notfound.css", + "css/webproxy.css", + "js/conch.js", "js/index.js", "js/intro.js", - "js/favourites.js", - "js/conch.js", - "js/cloudshell.js", - "js/cloudshell_worker.js", - "js/proxyservice.js", + "js/toss.js", + "js/webproxy.js", - "https://fastly.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css", + "https://fastly.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css", "https://fastly.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css", "https://fastly.jsdelivr.net/gh/CodeByZach/pace/themes/blue/pace-theme-barber-shop.css", - "https://fastly.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js", - "https://fastly.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js", + "https://fastly.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js", + "https://fastly.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js", "https://fastly.jsdelivr.net/gh/CodeByZach/pace/pace.min.js" ]; diff --git a/view/toss.html b/view/toss.html index e65cd10..aafae0c 100644 --- a/view/toss.html +++ b/view/toss.html @@ -23,7 +23,7 @@

ConchBrain TOSS

- +
@@ -36,7 +36,7 @@

ConchBrain TOSS

-
+

Pending list