Commit 1b1fdc99 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: get latest CID entry from IPFS_DB

parent c1f41497
...@@ -691,7 +691,7 @@ get_cid_by_url() ...@@ -691,7 +691,7 @@ get_cid_by_url()
local URL="$1" local URL="$1"
[ -r "$EGET_IPFS_DB" ] || return [ -r "$EGET_IPFS_DB" ] || return
is_fileurl "$URL" && return 1 is_fileurl "$URL" && return 1
grep -F "$URL Qm" "$EGET_IPFS_DB" | cut -f2 -d" " | grep -E "Qm[[:alnum:]]{44}" | head -n1 tac "$EGET_IPFS_DB" | grep -F "$URL Qm" | cut -f2 -d" " | grep -E "Qm[[:alnum:]]{44}" | head -n1
} }
put_cid_and_url() put_cid_and_url()
...@@ -716,14 +716,14 @@ get_filename_by_cid() ...@@ -716,14 +716,14 @@ get_filename_by_cid()
{ {
local CID="$1" local CID="$1"
[ -z "$EGET_IPFS_DB" ] && basename "$CID" && return [ -z "$EGET_IPFS_DB" ] && basename "$CID" && return
grep -F " $CID " "$EGET_IPFS_DB" | head -n1 | cut -f3 -d" " tac "$EGET_IPFS_DB" | grep -F " $CID " | head -n1 | cut -f3 -d" "
} }
get_url_by_cid() get_url_by_cid()
{ {
local CID="$1" local CID="$1"
[ -z "$EGET_IPFS_DB" ] && echo "$CID" && return [ -z "$EGET_IPFS_DB" ] && echo "$CID" && return
grep -F " $CID " "$EGET_IPFS_DB" | head -n1 | cut -f1 -d" " tac "$EGET_IPFS_DB" | grep -F " $CID " | head -n1 | cut -f1 -d" "
} }
################### ###################
......
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