Skip to content

Commit d567bf6

Browse files
committed
Link mirrors for release/stable-build downloads in build websites
1 parent 022492a commit d567bf6

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

sites/eclipse/build/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ <h3 id="swt">SWT Binary and Source
245245
}
246246

247247
// Inject resource files
248+
const mirrorPrefix = getArtifactMirrorPrefix()
248249
const dataTables = Array.from(mainElement.getElementsByClassName('files-table'))
249250
for (const table of dataTables) {
250251
const dataPath = table.getAttribute('data-path')
@@ -262,12 +263,11 @@ <h3 id="swt">SWT Binary and Source
262263
tBody.insertRow().innerHTML = `
263264
<td>${file.platform ? file.platform : getPlatformLabel(file.name)}</td>
264265
<td>
265-
<a href="${file.name}">${file.name}</a>
266+
<a href="${mirrorPrefix}${file.name}">${file.name}</a>
266267
</td>
267268
<td>${file.size}</td>
268269
<td>${appendCopyContentButton(`<code class="single-line-truncate file-hash-value" title="SHA512 hash of file: ${file.sha512}">${file.sha512}</code>`, 'SHA512 checksum')}</td>
269270
`
270-
//TODO: Implement mirror-selection (but https://www.eclipse.org/downloads/download.php?file=eclipse/downloads/drops4/${build.identifier}/${file.name} doesn't work, not even for releases)
271271
}
272272
}
273273
}

sites/eclipse/page.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,17 @@ function injectUnstableBuildCause(buildStateContainerId) {
210210
})
211211
}
212212

213+
function getArtifactMirrorPrefix() {
214+
const id = getIdentifierFromSiteLocation()
215+
// No mirroring for I/Y-build artifacts or when not on the eclipse storage server
216+
if (id && !(id.startsWith('I') || id.startsWith('Y'))) {
217+
const pathname = window.location.pathname
218+
const pagePath = pathname.endsWith('/') ? pathname : pathname + '/'
219+
return `https://www.eclipse.org/downloads/download.php?file=${pagePath}`
220+
}
221+
return ''
222+
}
223+
213224
function fetchAllJSON(urls) {
214225
const promises = urls.map(url => fetch(url).then(res => {
215226
if (res.status == 404) {

sites/equinox/build/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ <h3 id="other">Other Information</h3>
7979
document.getElementById('build-timestamp').innerHTML = `<b>${formatBuildDate(build.timestamp)} (UTC)</b>`
8080

8181
// Inject resource files
82+
const mirrorPrefix = getArtifactMirrorPrefix()
8283
const dataTables = Array.from(mainElement.getElementsByClassName('files-table'))
8384
for (const table of dataTables) {
8485
const dataPath = table.getAttribute('data-path')
@@ -87,12 +88,11 @@ <h3 id="other">Other Information</h3>
8788
for (const file of filesData) {
8889
tBody.insertRow().innerHTML = `
8990
<td width="75%">
90-
<a href="${file.name}">${file.name}</a>
91+
<a href="${mirrorPrefix}${file.name}">${file.name}</a>
9192
</td>
9293
<td width="10%">${file.size}</td>
9394
<td width="15%">${appendCopyContentButton(`<code class="single-line-truncate file-hash-value" title="SHA512 hash of file: ${file.sha512}">${file.sha512}</code>`, 'SHA512 checksum')}</td>
9495
`
95-
//TODO: Implement mirror-selection (but https://www.eclipse.org/downloads/download.php?file=equinox/drops/${build.identifier}/${file.name} doesn't work, not even for releases)
9696
}
9797
}
9898
}

0 commit comments

Comments
 (0)