aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-12-19 14:40:20 -0500
committerB Stack <bgstack15@gmail.com>2020-12-19 14:40:20 -0500
commitf6ec759890a86981942fd144400df3e8ac856644 (patch)
treec26541f8ad3a6d4c1f80dd09398bbd00aa6c6277
parentadd drag-and-drop /upload/ route (diff)
downloadhex-zero-stack.tar.gz
hex-zero-stack.tar.bz2
hex-zero-stack.zip
add hex-zeroctl which calls flask managerstack
and the function descriptions so hex-zeroctl can describe available functions
-rwxr-xr-xdebian/hex-zeroctl2
-rw-r--r--debian/install1
-rwxr-xr-xhex_zero.py15
3 files changed, 18 insertions, 0 deletions
diff --git a/debian/hex-zeroctl b/debian/hex-zeroctl
new file mode 100755
index 0000000..7036817
--- /dev/null
+++ b/debian/hex-zeroctl
@@ -0,0 +1,2 @@
+#!/bin/sh
+su hex-zero -s /bin/bash -c "python3 /var/www/hex-zero/hex_zero.py ${*}"
diff --git a/debian/install b/debian/install
index 8bd6e93..1630ed6 100644
--- a/debian/install
+++ b/debian/install
@@ -1 +1,2 @@
debian/install-short_url-for-hex-zero.sh /usr/libexec/hex-zero
+debian/hex-zeroctl /usr/bin
diff --git a/hex_zero.py b/hex_zero.py
index bcd8bb3..c91a326 100755
--- a/hex_zero.py
+++ b/hex_zero.py
@@ -464,6 +464,9 @@ def debug():
@manager.command
def permadelete(name):
+ """
+ Remove file from disk and mark it as removed in db
+ """
id = su.debase(name)
f = File.query.get(id)
@@ -475,6 +478,9 @@ def permadelete(name):
@manager.command
def query(name):
+ """
+ Find file with this name sans extension, e.g., E
+ """
id = su.debase(name)
f = File.query.get(id)
@@ -483,6 +489,9 @@ def query(name):
@manager.command
def queryhash(h):
+ """
+ Find file by this sha256 hash
+ """
f = File.query.filter_by(sha256=h).first()
if f:
@@ -490,6 +499,9 @@ def queryhash(h):
@manager.command
def queryaddr(a, nsfw=False, removed=False):
+ """
+ Find all files uploaded from this IP address
+ """
res = File.query.filter_by(addr=a)
if not removed:
@@ -503,6 +515,9 @@ def queryaddr(a, nsfw=False, removed=False):
@manager.command
def deladdr(a):
+ """
+ Delete all files uploaded from this IP address
+ """
res = File.query.filter_by(addr=a).filter(File.removed != True)
for f in res:
bgstack15