Commit a24cd6a5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add --get-ipfs-cid to help, fix for case when IPFS is disabled (no accessible gateway)

parent 7a2f045b
...@@ -357,6 +357,7 @@ Options: ...@@ -357,6 +357,7 @@ Options:
--get-response URL - get response with all headers (ever if HEAD is not acceptable) --get-response URL - get response with all headers (ever if HEAD is not acceptable)
--get-filename URL - print filename for the URL (via Content-Disposition if applicable) --get-filename URL - print filename for the URL (via Content-Disposition if applicable)
--get-real-url URL - print URL after all redirects --get-real-url URL - print URL after all redirects
--get-ipfs-cid URL - print CID for URL (after all redirects)
Supported URLs: Supported URLs:
ftp:// http:// https:// file:/ ipfs:// ftp:// http:// https:// file:/ ipfs://
...@@ -606,12 +607,12 @@ ipfs_mode="$EGET_IPFS" ...@@ -606,12 +607,12 @@ ipfs_mode="$EGET_IPFS"
[ -z "$ipfs_mode" ] && [ -n "$EGET_IPFS_DB" ] && ipfs_mode="auto" [ -z "$ipfs_mode" ] && [ -n "$EGET_IPFS_DB" ] && ipfs_mode="auto"
if [ -n "$LISTONLY$CHECKURL" ] ; then if [ -n "$LISTONLY$CHECKURL" ] ; then
ipfs_mode="disabled" ipfs_mode=""
EGET_IPFS_DB='' EGET_IPFS_DB=''
fi fi
if [ "$ipfs_mode" != "disabled" ] && [ -n "$EGET_IPFS_DB" ] ; then if [ -n "$ipfs_mode" ] && [ -n "$EGET_IPFS_DB" ] ; then
ddb="$(dirname "$EGET_IPFS_DB")" ddb="$(dirname "$EGET_IPFS_DB")"
if [ -d "$ddb" ] ; then if [ -d "$ddb" ] ; then
info "Using eget IPFS db $EGET_IPFS_DB" info "Using eget IPFS db $EGET_IPFS_DB"
...@@ -628,7 +629,7 @@ if is_ipfsurl "$1" && [ -z "$ipfs_mode" ] || [ "$ipfs_mode" = "auto" ] ; then ...@@ -628,7 +629,7 @@ if is_ipfsurl "$1" && [ -z "$ipfs_mode" ] || [ "$ipfs_mode" = "auto" ] ; then
select_ipfs_mode select_ipfs_mode
info "Auto selected IPFS mode: $ipfs_mode" info "Auto selected IPFS mode: $ipfs_mode"
else else
[ -n "$ipfs_mode" ] && [ "$ipfs_mode" != "disabled" ] && info "IPFS mode: $ipfs_mode" [ -n "$ipfs_mode" ] && info "IPFS mode: $ipfs_mode"
fi fi
IPFS_CMD='' IPFS_CMD=''
...@@ -1052,7 +1053,7 @@ url_get_filename() ...@@ -1052,7 +1053,7 @@ url_get_filename()
fi fi
if [ "$ipfs_mode" != "disabled" ] && [ -n "$EGET_IPFS_DB" ] && ! is_ipfsurl "$1" ; then if [ -n "$ipfs_mode" ] && [ -n "$EGET_IPFS_DB" ] && ! is_ipfsurl "$1" ; then
download_to_ipfs() download_to_ipfs()
{ {
......
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