diff options
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | assets/admin.css | 9 | ||||
-rw-r--r-- | assets/cargohold.css | 20 | ||||
-rw-r--r-- | assets/cargohold.js | 22 | ||||
-rw-r--r-- | interface/admin_files.tmpl | 4 | ||||
-rw-r--r-- | interface/listing.htm | 3 | ||||
-rw-r--r-- | interface/listing_default.tmpl | 58 |
8 files changed, 117 insertions, 15 deletions
@@ -61,4 +61,13 @@ Other httpds may provide a similar mechanism, which will need to be called out t ## Authentication -TBD +This projects provides multiple methods to identify and authenticate users, including delegating authentication to external software. +Implementing custom authentication methods is possible and patches contributing such are welcome. + +The following authentication methods are currently available: + +* *NoneAuth*: The default. Does not support any logins. Use this if you want to manage cargohold exclusively via the command line or direct database interfaces +* *ExternalAuth*: Delegate authentication to an external entity. Expects the authenticated user (if any) in the REMOTE_USER environment variable +* *LocalBasicAuth*: Internal implementation of HTTP Basic Auth using htpasswd-style user databases +* *RemoteCookieAuth*: Custom authentication scheme validating a domain-wide cookie against an external service +* @@ -2,14 +2,17 @@ Size limiting HTML-only frontend Automatic resizing for gallery mode Alias titles -'Download all' button Password protection per alias 'Scramble' file links (do not make the parent directory available via the individual links) Admin Size limit administration + Add aliases + Add specific aliases? JS Admin Rename Create Alias Delete + +Storage size calculation diff --git a/assets/admin.css b/assets/admin.css index bf93fbc..bfa854c 100644 --- a/assets/admin.css +++ b/assets/admin.css @@ -26,15 +26,6 @@ div.entry { vertical-align: center; } -a.button { - padding: 0.5em; - background-color: #c8e; - text-decoration: none; - margin-left: 0.5em; - /*display: block;*/ - border-radius: 0.5em; -} - .info, .permission { padding: 0.5em; background-color: #c8e; diff --git a/assets/cargohold.css b/assets/cargohold.css index df40b98..eddd1c7 100644 --- a/assets/cargohold.css +++ b/assets/cargohold.css @@ -56,7 +56,7 @@ html { } #dirlisting { - padding: 2em; + padding: 0 2em 2em 2em; } #storage { @@ -113,6 +113,24 @@ html { width: 85%; } +a.button { + padding: 0.5em; + background-color: #c8e; + text-decoration: none; + margin-left: 0.5em; + border-radius: 0.5em; +} + +.buttonrow { + display: block; + text-align: right; + padding: 0.5em; +} + +.buttonrow > a { + display: inline-block; +} + .tab-wrap > input { display: none; } diff --git a/assets/cargohold.js b/assets/cargohold.js index 18dbeae..ea882fa 100644 --- a/assets/cargohold.js +++ b/assets/cargohold.js @@ -7,7 +7,6 @@ var running = false; var queue = []; - function queue_work(){ let i = 0; for(; i < queue.length; i++){ @@ -118,6 +117,7 @@ function interface_update(access){ function listing_add(file, style = "default"){ let link = node("a", "listing-entry", file.name); link.href = "file/" + encodeURIComponent(file.name); + link.setAttribute("data-filename", file.name) if(style == "gallery"){ let image = node("img", "preview"); @@ -139,14 +139,34 @@ function listing_update(){ for(let i = 0; i < data.files.length; i++){ listing_add(data.files[i], data.display); } + + element("download-all").innerText = "Download all (" + data.files.length + " Files, " + (data.total / 1024 /1024) + "MB)"; }; req.open("GET", "listing"); req.send(); } +function download_all(ev){ + let links = document.getElementsByClassName("listing-entry"); + var current = 0; + var interval = setInterval(function(){ + if(current < links.length){ + link = links[current]; + link.download = link.getAttribute("data-filename"); + link.click(); + link.removeAttribute("download"); + current++; + } + else{ + clearInterval(interval); + } + }, 1000); +} + function init(){ element("file-submit").style.display = "none"; element("files").onchange = upload_start; + element("download-all").onclick = download_all; listing_update(); } diff --git a/interface/admin_files.tmpl b/interface/admin_files.tmpl index b0828b6..76e97aa 100644 --- a/interface/admin_files.tmpl +++ b/interface/admin_files.tmpl @@ -27,9 +27,9 @@ <div id="dirlisting"> {% for file in listing %} <div class="entry"> - <a class="entry" href="/admin/{{ directory }}/file/{{ file.name }}">{{ file.name }}</a> + <a class="entry" href="/admin/{{ directory }}/file/{{ file.name | urlencode }}">{{ file.name }}</a> <div class="info">{{ (file.size / 1024 / 1024) | round(2, "ceil") }} MB</div> - <a class="button delete" href="/admin/{{ directory }}/delete/{{ file.name }}">Delete</a> + <a class="button delete" href="/admin/{{ directory }}/delete/{{ file.name | urlencode }}">Delete</a> </div> {% endfor %} </div> diff --git a/interface/listing.htm b/interface/listing.htm index 7cc2b62..d7d08cd 100644 --- a/interface/listing.htm +++ b/interface/listing.htm @@ -30,6 +30,9 @@ current link. </div> </noscript> + <div class="buttonrow"> + <a class="button" href="#" id="download-all">Download all</a> + </div> <div id="dirlisting"> </div> </div> diff --git a/interface/listing_default.tmpl b/interface/listing_default.tmpl new file mode 100644 index 0000000..4a6d8bc --- /dev/null +++ b/interface/listing_default.tmpl @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="robots" content="noindex,nofollow" /> + <title>cargohold</title> + <link rel="stylesheet" href="/assets/cargohold.css" /> + <link rel="icon" href="/assets/cargohold.ico" /> + <script src="/assets/cargohold.js"></script> + </head> + <body> + <div id="header"> + <h1>cargohold</h1> + </div> + <div id="container"> + <div class="tab-wrap"> + <input type="radio" id="tab-view" name="tabs" class="tab" checked> + <label for="tab-view" id="tab-view-label">View</label> + + <input type="radio" id="tab-upload" name="tabs" class="tab"> + <label for="tab-upload" id="tab-upload-label">Upload</label> + + <div class="tab-content"> + <div class="buttonrow"> + <a class="button" href="#" id="download-all">Download all</a> + </div> + <div id="dirlisting"> + {% for file in listing %} + <a class="listing-entry" href="file/{{ file.name | urlencode }}" data-filename="{{ file.name }}">{{ file.name }}</a> + {% endfor %} + </div> + </div> + <div class="tab-content"> + <div id="upload"> + <form action="upload" method="post" enctype="multipart/form-data"> + <label for="files" id="selector-label"> + △ Select files to upload + <input type="file" id="files" name="files" multiple> + </label> + <input type="submit" value="Start upload" name="submit" id="file-submit"> + + </form> + </div> + <div id="queue"> + </div> + <!-- + <div id="storage"> + Storage space left: 2GB / 2GB <br/> + <progress value="70" max="100">70 %</progress> + </div> + --> + </div> + </div> + </div> + <div class="footer"><a href="https://git.services.cbcdn.com/cargohold/">cargohold</a> is a free and open source project</div> + </body> +</html> |