mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-18 16:58:27 -04:00
Support mods with multi-digest layers
This commit is contained in:
+54
-8
@@ -134,23 +134,69 @@ curl_check() {
|
|||||||
# Use different filtering depending on URL
|
# Use different filtering depending on URL
|
||||||
get_blob_sha() {
|
get_blob_sha() {
|
||||||
if [[ $1 == "ghcr" ]]; then
|
if [[ $1 == "ghcr" ]]; then
|
||||||
curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
MULTIDIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
--silent \
|
--silent \
|
||||||
--location \
|
--location \
|
||||||
--request GET \
|
--request GET \
|
||||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
--header "Accept: application/vnd.oci.image.index.v1+json" \
|
--header "Accept: application/vnd.oci.image.index.v1+json" \
|
||||||
--header "Authorization: Bearer $2" \
|
--header "Authorization: Bearer ${2}" \
|
||||||
"$3" | jq -r '.layers[0].digest'
|
"${3}/${TAG}" | jq -r 'first(.manifests[].digest)?')
|
||||||
|
if [[ -z "${MULTIDIGEST}" ]]; then
|
||||||
|
if DIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
|
--silent \
|
||||||
|
--location \
|
||||||
|
--request GET \
|
||||||
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
|
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
|
||||||
|
--header "Authorization: Bearer ${2}" \
|
||||||
|
"${3}/${TAG}" | grep -v 404); then
|
||||||
|
echo "${DIGEST}" | jq -r '.layers[0].digest';
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if DIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
|
--silent \
|
||||||
|
--location \
|
||||||
|
--request GET \
|
||||||
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
|
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
|
||||||
|
--header "Authorization: Bearer ${2}" \
|
||||||
|
"${3}/${MULTIDIGEST}" | grep -v 404); then
|
||||||
|
echo "${DIGEST}" | jq -r '.layers[0].digest';
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
MULTIDIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
--silent \
|
--silent \
|
||||||
--location \
|
--location \
|
||||||
--request GET \
|
--request GET \
|
||||||
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
--header "Accept: application/vnd.oci.image.index.v1+json" \
|
--header "Accept: application/vnd.oci.image.index.v1+json" \
|
||||||
--header "Authorization: Bearer $2" \
|
--header "Authorization: Bearer ${2}" \
|
||||||
"$3" | jq -r '.fsLayers[0].blobSum'
|
"${3}/${TAG}" | jq -r 'first(.manifests[].digest)?')
|
||||||
|
if [[ -z "${MULTIDIGEST}" ]]; then
|
||||||
|
if DIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
|
--silent \
|
||||||
|
--location \
|
||||||
|
--request GET \
|
||||||
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
|
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
|
||||||
|
--header "Authorization: Bearer ${2}" \
|
||||||
|
"${3}/${TAG}" | grep -v 404); then
|
||||||
|
echo "${DIGEST}" | jq -r '.layers[0].digest';
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if DIGEST=$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
|
||||||
|
--silent \
|
||||||
|
--location \
|
||||||
|
--request GET \
|
||||||
|
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
|
||||||
|
--header "Accept: application/vnd.oci.image.manifest.v1+json" \
|
||||||
|
--header "Authorization: Bearer ${2}" \
|
||||||
|
"${3}/${MULTIDIGEST}" | grep -v 404); then
|
||||||
|
echo "${DIGEST}" | jq -r '.layers[0].digest';
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +216,7 @@ run_mods() {
|
|||||||
fi
|
fi
|
||||||
FILENAME="${USERNAME}.${REPO}.${TAG}"
|
FILENAME="${USERNAME}.${REPO}.${TAG}"
|
||||||
AUTH_URL="https://ghcr.io/token?scope=repository%3A${USERNAME}%2F${REPO}%3Apull"
|
AUTH_URL="https://ghcr.io/token?scope=repository%3A${USERNAME}%2F${REPO}%3Apull"
|
||||||
MANIFEST_URL="https://ghcr.io/v2/${ENDPOINT}/manifests/${TAG}"
|
MANIFEST_URL="https://ghcr.io/v2/${ENDPOINT}/manifests"
|
||||||
BLOB_URL="https://ghcr.io/v2/${ENDPOINT}/blobs/"
|
BLOB_URL="https://ghcr.io/v2/${ENDPOINT}/blobs/"
|
||||||
MODE="ghcr"
|
MODE="ghcr"
|
||||||
else
|
else
|
||||||
@@ -183,7 +229,7 @@ run_mods() {
|
|||||||
fi
|
fi
|
||||||
FILENAME="${USERNAME}.${REPO}.${TAG}"
|
FILENAME="${USERNAME}.${REPO}.${TAG}"
|
||||||
AUTH_URL="https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ENDPOINT}:pull"
|
AUTH_URL="https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ENDPOINT}:pull"
|
||||||
MANIFEST_URL="https://registry-1.docker.io/v2/${ENDPOINT}/manifests/${TAG}"
|
MANIFEST_URL="https://registry-1.docker.io/v2/${ENDPOINT}/manifests"
|
||||||
BLOB_URL="https://registry-1.docker.io/v2/${ENDPOINT}/blobs/"
|
BLOB_URL="https://registry-1.docker.io/v2/${ENDPOINT}/blobs/"
|
||||||
MODE="dockerhub"
|
MODE="dockerhub"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user