From 8769761163262d255f2b3efa9a6e329db405c0d8 Mon Sep 17 00:00:00 2001
From: nbitzz <77242831+nbitzz@users.noreply.github.com>
Date: Mon, 30 Jan 2023 21:32:01 -0800
Subject: [PATCH] i don't even know what i did here
---
README.md | 7 ++--
assets/script/clone_file.js | 30 ---------------
assets/script/upload_file.js | 37 -------------------
pages/collection.html | 24 ++++++++++++
pages/download.html | 28 +++++++-------
pages/index.html | 2 +-
rollup.config.mjs | 36 ++++++++++++------
src/client/collection.js | 5 +++
src/client/{main.js => index.js} | 0
src/style/_base.scss | 27 ++++++++++++++
src/style/app/pulldown.scss | 14 +++++--
src/style/app/uploader/add_new_files.scss | 18 ++++++---
src/style/downloads.scss | 13 ++++++-
src/svelte/App.svelte | 28 +++++---------
src/svelte/Collections.svelte | 12 ++++++
src/svelte/elem/PulldownManager.svelte | 36 ++++++++++++++++++
src/svelte/elem/Topbar.svelte | 17 ++++++++-
src/svelte/elem/transition/_void.js | 4 +-
.../elem/uploader/AttachmentZone.svelte | 5 ++-
19 files changed, 214 insertions(+), 129 deletions(-)
delete mode 100644 assets/script/clone_file.js
delete mode 100644 assets/script/upload_file.js
create mode 100644 pages/collection.html
create mode 100644 src/client/collection.js
rename src/client/{main.js => index.js} (100%)
create mode 100644 src/svelte/Collections.svelte
create mode 100644 src/svelte/elem/PulldownManager.svelte
diff --git a/README.md b/README.md
index 777e6f2..47857f2 100644
--- a/README.md
+++ b/README.md
@@ -21,10 +21,9 @@ TOKEN=KILL-YOURSELF.NOW
- [X] 1.2.1 add file counter to main page
- [X] 1.2.2 clean up this shitty code
- [X] 1.2.3 bugfixes
-- [ ] 1.3.0 new ui; accounts; utility endpoints; multi file uploads
-- [ ] 1.3.1 organize svelte code
-- [ ] 1.3.2 self-destructing files
-- [ ] 1.3.3 disable cloning of local ips
+- [ ] 1.3.0 new ui; collections; accounts; utility endpoints; multi file uploads
+- [ ] 1.3.1 self-destructing files
+- [ ] 1.3.2 disable cloning of local ips
- [ ] 1.4.0 admin panel
- [ ] 2.0.0 rewrite using theUnfunny's code as a base/rewrite using monofile-core
diff --git a/assets/script/clone_file.js b/assets/script/clone_file.js
deleted file mode 100644
index 5b31f64..0000000
--- a/assets/script/clone_file.js
+++ /dev/null
@@ -1,30 +0,0 @@
-document.getElementById("uploadButton").addEventListener("click",() => {
- let ask = prompt("Input a URL to clone.")
-
- if (ask) {
- let opt = getOptionsForUploading()
- updateBtnTxt("Requesting clone. Please wait.")
-
- let xmlhttp = new XMLHttpRequest()
-
- xmlhttp.addEventListener("error",function(e) {
- updateBtnTxt(`Upload failed.
${e.toString()}`)
- console.error(e)
- })
-
- xmlhttp.addEventListener("load",function() {
- if (xmlhttp.status == 200) {
- document.getElementById("CopyTB").value = `https://${location.hostname}/download/${xmlhttp.responseText}`
- updateBtnTxt(`Upload complete.
Copy URL View URL`)
- } else {
- updateBtnTxt(`Upload failed.
${xmlhttp.responseText}`)
- }
- })
-
- xmlhttp.open("POST","/clone")
- xmlhttp.send(JSON.stringify({
- url: ask,
- ...opt
- }))
- }
-})
\ No newline at end of file
diff --git a/assets/script/upload_file.js b/assets/script/upload_file.js
deleted file mode 100644
index 9bf54c3..0000000
--- a/assets/script/upload_file.js
+++ /dev/null
@@ -1,37 +0,0 @@
-let FileUpload = document.createElement("input")
-FileUpload.setAttribute("type","file")
-
-document.getElementById("uploadButton").addEventListener("click",() => FileUpload.click())
-
-FileUpload.addEventListener("input",() => {
- if (FileUpload.files[0]) {
- let opt = getOptionsForUploading()
- let file = FileUpload.files[0]
-
- updateBtnTxt("Uploading file. This may take a while, so stay put.")
-
- let xmlhttp = new XMLHttpRequest()
-
- xmlhttp.addEventListener("error",function(e) {
- updateBtnTxt(`Upload failed.
${e.toString()}`)
- console.error(e)
- })
-
- xmlhttp.addEventListener("load",function() {
- if (xmlhttp.status == 200) {
- document.getElementById("CopyTB").value = `https://${location.hostname}/download/${xmlhttp.responseText}`
- updateBtnTxt(`Upload complete.
Copy URL View URL`)
- } else {
- updateBtnTxt(`Upload failed.
${xmlhttp.responseText}`)
- }
- })
-
- let fd = new FormData()
- fd.append('file',file)
-
- xmlhttp.open("POST","/upload")
- xmlhttp.setRequestHeader("monofile-upload-id",opt.uploadId)
- xmlhttp.send(fd)
-
- }
-})
\ No newline at end of file
diff --git a/pages/collection.html b/pages/collection.html
new file mode 100644
index 0000000..a163bef
--- /dev/null
+++ b/pages/collection.html
@@ -0,0 +1,24 @@
+
+
+
- file id $FileId -
++ file id $FileId +
- - - + + + +monofile
\ No newline at end of file +{collection.id}  â€” by @{collection.owner}
+