mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 15:08:40 +01:00
cgi-io: add download operation
Add a new `cgi-download` applet which allows to retrieve the contents
of regular files or block devices.
In order to initiate a transfer, a POST request in x-www-form-urlencoded
format must be sent to the applet, with one field "sessionid" holding
the login session and another field "path" containing the file path to
download.
Further optional fields are "filename" which - if present - will cause
the download applet to set a Content-Dispostition header and "mimetype"
which allows to let the applet respond with a specific type instead of
the default "application/octet-stream".
Below is an example for the required acl rules to grant download access
to files or block devices:
ubus call session grant '{
"ubus_rpc_session": "...",
"scope": "cgi-io",
"objects": [
[ "download", "read" ]
]
}'
ubus call session grant '{
"ubus_rpc_session": "...",
"scope": "file",
"objects": [
[ "/etc/config/*", "read" ],
[ "/dev/mtdblock*", "read" ]
]
}'
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
committed by
John Crispin
parent
c8a86c8c8e
commit
ab2a2b080d
+2
-1
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=cgi-io
|
||||
PKG_RELEASE:=9
|
||||
PKG_RELEASE:=10
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
@@ -38,6 +38,7 @@ define Package/cgi-io/install
|
||||
$(INSTALL_DIR) $(1)/usr/libexec $(1)/www/cgi-bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/cgi-io $(1)/usr/libexec
|
||||
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-upload
|
||||
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-download
|
||||
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-backup
|
||||
endef
|
||||
|
||||
|
||||
Reference in New Issue
Block a user