Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eget
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
eget
Commits
be694e44
Commit
be694e44
authored
Mar 28, 2024
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: add support for a new IPFS gateways
parent
5f795502
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
12 deletions
+31
-12
eget
eget
+31
-12
No files found.
eget
View file @
be694e44
...
@@ -503,9 +503,8 @@ ipfs_api_local="/ip4/127.0.0.1/tcp/5001"
...
@@ -503,9 +503,8 @@ ipfs_api_local="/ip4/127.0.0.1/tcp/5001"
ipfs_api_brave
=
"/ip4/127.0.0.1/tcp/45005"
ipfs_api_brave
=
"/ip4/127.0.0.1/tcp/45005"
ipfs_gateway
=
"https://cloudflare-ipfs.com/ipfs"
# Public IPFS http gateways
[
-n
"
$EGET_IPFS_GATEWAY
"
]
&&
ipfs_gateway
=
"
$EGET_IPFS_GATEWAY
"
ipfs_gateways
=
"https://cloudflare-ipfs.com/ipfs https://dweb.link/ipfs https://dhash.ru/ipfs"
IPFS_GATEWAY
=
"
$ipfs_gateway
"
# Test data: https://etersoft.ru/templates/etersoft/images/logo.png
# Test data: https://etersoft.ru/templates/etersoft/images/logo.png
ipfs_checkQm
=
"QmYwf2GAMvHxfFiUFL2Mr6KUG6QrDiupqGc8ms785ktaYw"
ipfs_checkQm
=
"QmYwf2GAMvHxfFiUFL2Mr6KUG6QrDiupqGc8ms785ktaYw"
...
@@ -533,6 +532,23 @@ ipfs_check()
...
@@ -533,6 +532,23 @@ ipfs_check()
verdocmd
$IPFS_CMD
--api
$IPFS_API
$ipfs_diag_timeout
cat
"
$1
"
>
/dev/null
verdocmd
$IPFS_CMD
--api
$IPFS_API
$ipfs_diag_timeout
cat
"
$1
"
>
/dev/null
}
}
check_ipfs_gateway
()
{
local
ipfs_gateway
=
"
$1
"
# TODO: check checksum
if
docmd eget
--check-url
"
$ipfs_gateway
/
$ipfs_checkQm
"
;
then
ipfs_mode
=
"gateway"
return
fi
if
docmd eget
--check-site
"
$(
dirname
$ipfs_gateway
)
"
;
then
info
"IPFS gateway
$ipfs_gateway
is accessible, but can't return shared
$ipfs_checkQm
"
else
info
"IPFS gateway
$(
dirname
$ipfs_gateway
)
is not accessible"
fi
return
1
}
select_ipfs_mode
()
select_ipfs_mode
()
...
@@ -564,20 +580,23 @@ select_ipfs_mode()
...
@@ -564,20 +580,23 @@ select_ipfs_mode()
fi
fi
fi
fi
# TODO: check checksum
IPFS_GATEWAY
=
''
if
docmd eget
--check-url
"
$ipfs_gateway
/
$ipfs_checkQm
"
;
then
ipfs_mode
=
"gateway"
# if set some http gateway, use only it
if
[
-n
"
$EGET_IPFS_GATEWAY
"
]
;
then
check_ipfs_gateway
"
$EGET_IPFS_GATEWAY
"
&&
IPFS_GATEWAY
=
"
$EGET_IPFS_GATEWAY
"
||
ipfs_mode
=
"disabled"
return
return
fi
fi
IPFS_GATEWAY
=
''
# check public http gateways
if
docmd eget
--check-site
"
$(
dirname
$ipfs_gateway
)
"
;
then
for
ipfs_gateway
in
$ipfs_gateways
;
do
info
"IPFS gateway
$ipfs_gateway
is accessible, but can't return shared
$ipfs_checkQm
"
check_ipfs_gateway
$ipfs_gateway
||
continue
else
IPFS_GATEWAY
=
"
$ipfs_gateway
"
info
"IPFS gateway
$(
dirname
$ipfs_gateway
)
is not accessible"
return
fi
done
ipfs_mode
=
"disabled"
ipfs_mode
=
"disabled"
}
}
...
...
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