Commit d6e85b40 authored by Michael Murtaugh's avatar Michael Murtaugh

readme!

parent 19d46b38
Pipeline #494 failed with stages
Goal: to build a simple (as possible) in-page directory listing media player. This will be deployable as a "mixin" to an existing apache directory listing via the appropriate directives.
```
___ __
___/ (_)______ ____/ /____ ______ __
/ _ / / __/ -_) __/ __/ _ \/ __/ // /
\_,_/_/_/ \__/\__/\__/\___/_/ \_, /
/___/
```
Goal: to build a simple (as possible) means of convering standard Apache directory listings into a local file-sharing repository. The results are accessible via a feed API.
## Deployment on Apache
......@@ -14,36 +23,6 @@ ReadmeName README.html
```
## Plan
Re-enable on this directory:
<https://video.constantvzw.org/diversions/2016-10-05/>
* Store derived files in a hidden subdirectory
.aa/FILENAME/derived files
* Enable New "Formats" & "Thumbnails" to be uploaded and placed in these directories.
* Map "open" clicks to player
Player features
* Links to versions (drop down)
* Editable description (markdown?!)
* "Share" link with embed code
* Download links
* Collect icon (to perform evt. editorial work on groups of items ?!)
* Audio
* Video
* PDF
Make viewer respond to "formats" available including "original".
## Resources
* <https://github.com/marcj/css-element-queries> Great shim to support responsive elements
......@@ -54,7 +33,3 @@ Make viewer respond to "formats" available including "original".
* https://lokeshdhakar.com/projects/lightbox2/
* https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
* the ever useful: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
## CGI
Produced by Bobby Orlando (original single) and Steven Hague (later album version)
\ No newline at end of file
......@@ -50,7 +50,13 @@ if method=="POST":
ffp2 = os.path.join(ffp, x)
os.remove(ffp2)
os.rmdir(ffp)
os.remove(fullpath)
if os.path.isdir(fullpath):
aapath = os.path.join(fullpath, ".aa")
if os.path.isdir(aapath):
os.rmdir(aapath)
os.rmdir(fullpath)
else:
os.remove(fullpath)
print ("Content-type: text-html;charset=utf-8")
print ()
print ("Deleted {0}".format(normalized_url))
......
......@@ -93,15 +93,11 @@ elif f == "annotate":
# HANDLE REDIRECTS
submit = fs.getvalue('submit')
if submit == "rename":
redirect_url = urljoin(current_url, "/cgi-bin/rename.cgi")+"?u="+urlquote(normalized_url)
print ("Location: {0}".format(redirect_url))
print ()
sys.exit(0)
redirect_to(urljoin(current_url, "/cgi-bin/rename.cgi")+"?u="+urlquote(normalized_url))
elif submit == "delete":
redirect_url = urljoin(current_url, "/cgi-bin/delete.cgi")+"?u="+urlquote(normalized_url)
print ("Location: {0}".format(redirect_url))
print ()
sys.exit(0)
redirect_to(urljoin(current_url, "/cgi-bin/delete.cgi")+"?u="+urlquote(normalized_url))
elif submit == "mkdir":
redirect_to(urljoin(current_url, "/cgi-bin/mkdir.cgi")+"?u="+urlquote(normalized_url))
description = fs.getvalue("description")
......@@ -141,7 +137,7 @@ elif f == "annotate":
messages.append("Uploaded {0} files".format(len(files)))
except KeyError:
pass
# HANDLE DELETIONS (selectedformats)
sff = fs.getvalue("selectedformatsfn")
if sff == "delete":
......
......@@ -12,6 +12,11 @@ def get_current_url (environ):
else:
return "{0}://{1}{2}".format(request_scheme, server_name, request_uri)
def redirect_to(url):
print ("Location: {0}".format(url))
print ()
sys.exit(0)
# https://github.com/achillean/shodan-python/issues/39
def humanize_bytes(bytes, precision=1):
"""Return a humanized string representation of a number of bytes.
......@@ -178,8 +183,10 @@ def send_form(item, fs_item, messages):
# name = os.path.splitext(filename)[0].replace("_", " ")
# title = fs.getvalue("title", "")
upload = ""
mkdir = ""
if fs_item.get("type") == "folder":
upload = """<div class="upload"><label for="upload">Add files to this folder:</label><input id="upload" type="file" name="upload" multiple="multiple"></div>"""
mkdir = """<input type="submit" name="submit" value="mkdir" />"""
# label = "Upload files"
label = "Add"
edit_url = fs_item.get("url")
......@@ -218,6 +225,7 @@ def send_form(item, fs_item, messages):
<div>
<input type="submit" name="submit" value="save" />
<input type="submit" name="submit" value="rename">
{0[mkdir]}
<input type="submit" name="submit" value="delete">
</div>
{0[messages]}
......@@ -243,4 +251,5 @@ def send_form(item, fs_item, messages):
'files': files,
'filename': edit_filename,
'messages': messages,
'upload': upload}))
'upload': upload,
'mkdir': mkdir}))
......@@ -13,6 +13,8 @@ from aa_password import PASSWORD
from login import authenticate
#DEBUG
# print ("Content-type: text/html; charset=utf8")
# print ()
env = os.environ
......
......@@ -11,6 +11,8 @@
"dependencies": {
"css-element-queries": "^1.2.2",
"d3": "^5.14.2",
"markdown": "^0.5.0",
"markdown-it": "^10.0.0",
"video.js": "^7.6.6",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
......
......@@ -3,6 +3,7 @@ var d3 = require("d3-selection"),
droptoupload = require("./droptoupload.js"),
make_controller = require("./controller.js"),
cookie = require("./cookie.js");
var markdown = require( "markdown" ).markdown;
// polyfills
require("./trim.js");
......@@ -72,7 +73,7 @@ async function read_metadata(json_url) {
// Integrate data
update.each(function (d, i) {
if (d.description) {
d3.select(this).select("td:nth-child(5)").html(d.description);
d3.select(this).select("td:nth-child(5)").html( markdown.toHTML( d.description ));
}
});
update.filter(get_thumb_url).select("img").attr("src", d=>get_thumb_url(d)).classed("thumbnail", true);
......@@ -113,7 +114,7 @@ async function init () {
}
var description = d3.select(document.body).insert("p", "table").attr("class", "description");
if (data.description) {
description.html(data.description);
description.html(markdown.toHTML(data.description));
}
activate_table();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment