Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
380d6725
Commit
380d6725
authored
Apr 10, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: use timeout only for diag access
parent
f97e31af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
tools_eget
bin/tools_eget
+14
-10
No files found.
bin/tools_eget
View file @
380d6725
...
@@ -423,7 +423,7 @@ done
...
@@ -423,7 +423,7 @@ done
# defaults
# defaults
# https://github.com/ipfs/kubo/issues/5541
# https://github.com/ipfs/kubo/issues/5541
ipfs_timeout
=
'--timeout 10s'
ipfs_
diag_
timeout
=
'--timeout 10s'
ipfs_api_local
=
"/ip4/127.0.0.1/tcp/5001"
ipfs_api_local
=
"/ip4/127.0.0.1/tcp/5001"
[
-n
"
$EGET_IPFS_API
"
]
&&
ipfs_api_local
=
"
$EGET_IPFS_API
"
[
-n
"
$EGET_IPFS_API
"
]
&&
ipfs_api_local
=
"
$EGET_IPFS_API
"
...
@@ -447,13 +447,13 @@ get_ipfs_brave()
...
@@ -447,13 +447,13 @@ get_ipfs_brave()
ipfs_access
()
ipfs_access
()
{
{
[
-n
"
$IPFS_CMD
"
]
||
fatal
"IPFS is disabled"
[
-n
"
$IPFS_CMD
"
]
||
fatal
"IPFS is disabled"
$IPFS_CMD
--api
$IPFS_API
$ipfs_timeout
diag sys
>
/dev/null 2>/dev/null
$IPFS_CMD
--api
$IPFS_API
$ipfs_
diag_
timeout
diag sys
>
/dev/null 2>/dev/null
}
}
ipfs_check
()
ipfs_check
()
{
{
[
-n
"
$IPFS_CMD
"
]
||
fatal
"IPFS is disabled"
[
-n
"
$IPFS_CMD
"
]
||
fatal
"IPFS is disabled"
$IPFS_CMD
--api
$IPFS_API
$ipfs_timeout
cat
"
$1
"
>
/dev/null
$IPFS_CMD
--api
$IPFS_API
$ipfs_
diag_
timeout
cat
"
$1
"
>
/dev/null
}
}
...
@@ -461,7 +461,8 @@ ipfs_check()
...
@@ -461,7 +461,8 @@ ipfs_check()
select_ipfs_mode
()
select_ipfs_mode
()
{
{
IPFS_CMD
=
"
$(
get_ipfs_brave
)
"
IPFS_CMD
=
"
$(
get_ipfs_brave
)
"
if
[
-n
"
$IPFS_CMD
"
]
;
then
# if no EGET_IPFS_API, check brave
if
[
-z
"
$EGET_IPFS_API
"
]
&&
[
-n
"
$IPFS_CMD
"
]
;
then
IPFS_API
=
"
$ipfs_api_brave
"
IPFS_API
=
"
$ipfs_api_brave
"
if
ipfs_access
;
then
if
ipfs_access
;
then
if
ipfs_check
"
$ipfs_checkQm
"
;
then
if
ipfs_check
"
$ipfs_checkQm
"
;
then
...
@@ -585,14 +586,17 @@ elif [ "$ipfs_mode" = "brave" ] ; then
...
@@ -585,14 +586,17 @@ elif [ "$ipfs_mode" = "brave" ] ; then
IPFS_PRETTY_CMD
=
"~Brave-Browser/
$(
basename
$IPFS_CMD
)
"
IPFS_PRETTY_CMD
=
"~Brave-Browser/
$(
basename
$IPFS_CMD
)
"
IPFS_API
=
"
$ipfs_api_brave
"
IPFS_API
=
"
$ipfs_api_brave
"
ipfs_access
||
fatal
"Can't access to Brave IPFS API (Brave browser is not running and IPFS is not activated?)"
ipfs_access
||
fatal
"Can't access to Brave IPFS API (Brave browser is not running and IPFS is not activated?)"
info
"Will use
$IPFS_PRETTY_CMD
--api
$IPFS_API
"
elif
[
"
$ipfs_mode
"
=
"local"
]
;
then
elif
[
"
$ipfs_mode
"
=
"local"
]
;
then
IPFS_CMD
=
"
$(
print_command_path ipfs
)
"
||
fatal
"Can't find ipfs command"
IPFS_CMD
=
"
$(
print_command_path ipfs
)
"
||
fatal
"Can't find ipfs command"
IPFS_PRETTY_CMD
=
"
$IPFS_CMD
"
IPFS_PRETTY_CMD
=
"
$IPFS_CMD
"
IPFS_API
=
"
$ipfs_api_local
"
IPFS_API
=
"
$ipfs_api_local
"
ipfs_access
||
fatal
"Can't access to IPFS API (ipfs daemon is not running?)"
ipfs_access
||
fatal
"Can't access to IPFS API (ipfs daemon is not running?)"
info
"Will use
$IPFS_PRETTY_CMD
--api
$IPFS_API
"
elif
[
"
$ipfs_mode
"
=
"gateway"
]
;
then
elif
[
"
$ipfs_mode
"
=
"gateway"
]
;
then
info
"Will use eget
$IPFS_GATEWAY
/HASH"
ipfs_get
()
ipfs_get
()
{
{
[
-n
"
$IPFS_GATEWAY
"
]
||
fatal
"ipfs http gateway is not set"
[
-n
"
$IPFS_GATEWAY
"
]
||
fatal
"ipfs http gateway is not set"
...
@@ -626,11 +630,11 @@ ipfs_get()
...
@@ -626,11 +630,11 @@ ipfs_get()
{
{
[
-n
"
$IPFS_CMD
"
]
||
fatal
"ipfs api is not usable"
[
-n
"
$IPFS_CMD
"
]
||
fatal
"ipfs api is not usable"
if
[
-n
"
$2
"
]
;
then
if
[
-n
"
$2
"
]
;
then
showcmd
$IPFS_PRETTY_CMD
--api
$IPFS_API
$ipfs_timeout
get
-o
"
$2
"
"
$1
"
showcmd
$IPFS_PRETTY_CMD
--api
$IPFS_API
get
-o
"
$2
"
"
$1
"
$IPFS_CMD
--api
$IPFS_API
$ipfs_timeout
get
-o
"
$2
"
"
$1
"
$IPFS_CMD
--api
$IPFS_API
get
-o
"
$2
"
"
$1
"
else
else
showcmd
$IPFS_PRETTY_CMD
--api
$IPFS_API
$ipfs_timeout
get
"
$1
"
showcmd
$IPFS_PRETTY_CMD
--api
$IPFS_API
get
"
$1
"
$IPFS_CMD
--api
$IPFS_API
$ipfs_timeout
get
"
$1
"
$IPFS_CMD
--api
$IPFS_API
get
"
$1
"
fi
fi
}
}
...
@@ -659,8 +663,8 @@ ipfs_put()
...
@@ -659,8 +663,8 @@ ipfs_put()
ipfs_cat
()
ipfs_cat
()
{
{
[
-n
"
$IPFS_CMD
"
]
||
fatal
"ipfs api is not usable"
[
-n
"
$IPFS_CMD
"
]
||
fatal
"ipfs api is not usable"
showcmd
$IPFS_PRETTY_CMD
--api
$IPFS_API
$ipfs_timeout
cat
"
$1
"
showcmd
$IPFS_PRETTY_CMD
--api
$IPFS_API
cat
"
$1
"
$IPFS_CMD
--api
$IPFS_API
$ipfs_timeout
cat
"
$1
"
$IPFS_CMD
--api
$IPFS_API
cat
"
$1
"
}
}
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment