-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download as zip #907
Comments
Yes the zip download is missing (issue is #48) - the reason is that it is not trivial to add given that sharry wants to support large files. I want it then to create the zip file in the background and possibly cache for some time since it may be an expensive operation. I would really like to add it, but unfortunately time is a bit tight this year. |
Someone wrote a script to extract the files from the chunks: https://www.codeslikeaduck.com/posts/sharryfilerebuilder/ Downside is that the filenames are gone. I was hoping the 'filesystem' store would just store uploaded files as files. Edit: just found the discussion over at #1006 |
I was hoping for a "download all" feature but i assume it is kind of the same than this one ? |
Correct :) it's currently missing. But you can download all files to a share using some script, which is not much effort. I can dig out such a script if you want. It would involve a curl to the share to get the list of files and then downloading each. |
Thanks for you answer, I plan to use this product with "regular users", the kind of person that are afraid of a black window lauching text commands ^^. This is why I'm looking for a graphical button that does everything ^^ ! |
I also would love to see this feature. |
My users also would love to see "download as .zip" |
Since I was also really missing a "Download all" function to this otherwise perfect application for my needs, I decided to try and implement a solution myself. However, I quickly found out that elm is too confusing for me and would take me too much time to learn, so I went for a 'dirty/hacky' workaround instead, which I'm sharing here in case it's of use to anyone else: <style>
/* Title right padding to make space for download all button */
h1 {
padding-right: 60px;
}
@media (min-width: 640px) {
h1 {
padding-right: 160px;
}
}
</style>
<script>
function placeDownloadButton() {
// Remove existing button
preexisting_button_div_el = document.getElementById('download-all-div')
if (preexisting_button_div_el) {
preexisting_button_div_el.remove()
}
// Check if we are on a download page
if (!window.location.href.includes('/app/open/') && !window.location.href.includes('/app/upload/')) {
return
}
// Create download all button
const button_div_el = document.createElement('div')
button_div_el.id = 'download-all-div'
button_div_el.className = "container px-2 py-3"
button_div_el.setAttribute("style", "position: absolute; top: 60px; left: 50%; transform: translateX(-50%); text-align: end;")
const button_el = document.createElement('a')
button_el.id = 'download-all-button'
button_el.className = 'rounded border px-4 py-2 my-auto whitespace-nowrap border-gray-500 dark:border-stone-500 text-gray-500 ' +
'dark:text-stone-400 text-center shadow-none focus:outline-none focus:ring focus:ring-opacity-75 ' +
'hover:bg-gray-600 hover:text-white dark:hover:text-white dark:hover:bg-stone-500 dark:hover:text-stone-100'
button_el.innerHTML = '<i class="fa fa-download"></i><span class="ml-2 hidden sm:inline">Download all</span>'
button_el.setAttribute("style", "cursor: pointer;")
button_div_el.appendChild(button_el)
document.body.appendChild(button_div_el)
document.getElementById("download-all-button").addEventListener("click", downloadAll)
}
function downloadAll() {
// Click all download urls on page
a_elems = document.querySelectorAll("td > a, .inline > a")
for (const a_elem of a_elems) {
if (!a_elem.getAttribute("href").includes('/api/')) {
continue
}
a_elem.click()
}
}
// Run button place once, then watch for window href changes
const observeUrlChange = () => {
let oldHref = document.location.href
const body = document.querySelector('body')
const observer = new MutationObserver(mutations => {
if (oldHref !== document.location.href) {
oldHref = document.location.href
placeDownloadButton()
}
});
observer.observe(body, { childList: true, subtree: true })
};
window.onload = () => {
placeDownloadButton()
observeUrlChange()
}
</script> Adding this html in a file and setting that file as I hope this workaround is useful for others! Finally, I think it goes without saying, but use at your own risk, things might break with future updates of Sharry or I might have made mistakes. This script has been working fine for me, but YMMV.
|
hello @Jeroen-45 that is really nice! Thank you! 🚀 |
Hello guys,
Your product is incredible, and it works differently to others what is very useful : when uploading various files, you can get a single link for all those files.
Is there any plan to get the feature "download as .zip" back ?
That would be the last thing missing for me, to make it perfect.
Thanks a lot !
The text was updated successfully, but these errors were encountered: