From d7e3421473abfb4be74c22e30368f319b2f3d9da Mon Sep 17 00:00:00 2001 From: Wildan M Date: Thu, 15 Feb 2024 10:11:06 +0700 Subject: [PATCH] Use Temurium java and fix zig under firewall --- package-lock.json | 4 ++-- package.json | 2 +- src/util.js | 23 +++++++++-------------- src/whitelist/sites.conf | 4 ++++ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6792357..df1a04e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "domcloud-bridge", - "version": "0.41.3", + "version": "0.42.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "domcloud-bridge", - "version": "0.41.3", + "version": "0.42.0", "license": "MIT", "dependencies": { "axios": "^1.6.5", diff --git a/package.json b/package.json index 7d1370e..3701719 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "domcloud-bridge", - "version": "0.41.3", + "version": "0.42.0", "description": "Deployment runner for DOM Cloud", "main": "app.js", "engines": { diff --git a/src/util.js b/src/util.js index 4cdcc32..42708c9 100644 --- a/src/util.js +++ b/src/util.js @@ -25,7 +25,7 @@ let javaVersionsMap = {}; let sslWildcardsMap = {}; const pythonConstants = { // https://raw.githubusercontent.com/indygreg/python-build-standalone/latest-release/latest-release.json - tag: "20231002", + tag: "20240107", // NOTE: x86_64_v3 requires AVX2 CPU support match: /cpython-(\d+\.\d+\.\d+)\+\d+-x86_64_v3-unknown-linux-gnu-pgo\+lto-full\.tar\.zst/g, index() { @@ -103,17 +103,15 @@ export const initUtils = async () => { }).catch(err => { console.error('error fetching Python releases', err); }); - await axios.get('https://raw.githubusercontent.com/actions/setup-java/main/src/distributions/microsoft/microsoft-openjdk-versions.json').then(res => { - for (const verItem of res.data) { - if (verItem.version && verItem.files) { - var iPlatform = verItem.files.findIndex(x => x.filename.endsWith('-linux-x64.tar.gz')) - if (iPlatform >= 0) { - javaVersionsList.push(verItem.version); - javaVersionsMap[verItem.version] = verItem.files[iPlatform].download_url; + await axios.get('https://api.adoptium.net/v3/info/available_releases').then(async res => { + for (const ver of res.data.available_releases) { + await axios.get(`https://api.adoptium.net/v3/assets/latest/${ver}/hotspot?architecture=x64&image_type=jdk&os=linux&vendor=eclipse`).then(x => { + for (const binary of x.data) { + javaVersionsMap[binary.version.semver] = binary.binary.package.link; } - } + }) } - javaVersionsList = sortSemver(javaVersionsList).reverse(); + javaVersionsList = sortSemver(Object.keys(javaVersionsMap)).reverse(); }) } @@ -177,7 +175,7 @@ export const getRubyVersion = (/** @type {string} */ status) => { if (/^ruby-/.test(status)) { status = status.substring(5); } - if (/^\d+(\.\d+)?$/.test(status)) { + if (/^\d+(\.\d+){0,2}$/.test(status)) { var m = rubyVersionsList.find(x => { return x.startsWith(status); }); @@ -185,9 +183,6 @@ export const getRubyVersion = (/** @type {string} */ status) => { return m; } } - if (/^\d+\.\d+\.\d+$/.test(status)) { - return status; - } switch (status) { case 'lts': case 'security': diff --git a/src/whitelist/sites.conf b/src/whitelist/sites.conf index 2232c3e..1450684 100644 --- a/src/whitelist/sites.conf +++ b/src/whitelist/sites.conf @@ -49,6 +49,10 @@ static.rust-lang.org # Go golang.org pkg.go.dev +# Zig +ziglang.org +# Podman +docker.io # WordPress api.wordpress.org dashboard.jetpack.com