Skip to content

Commit ab2ab6e

Browse files
committed
Small store improvements
1 parent 9fc47c1 commit ab2ab6e

File tree

7 files changed

+439
-333
lines changed

7 files changed

+439
-333
lines changed

download.html

Lines changed: 185 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,191 @@
250250
</div>
251251

252252
<div id="nightly-div" style="margin: 15px"></div>
253-
<script type="text/javascript" src="download.js"></script>
253+
<script type="text/javascript">
254+
function main() {
255+
let unstable_downloads = [
256+
[
257+
"macOS Universal",
258+
"https://storage.googleapis.com/plugdata-nightly/plugdata-macOS-Universal.pkg",
259+
"Download",
260+
true,
261+
],
262+
[
263+
"macOS Legacy",
264+
"https://storage.googleapis.com/plugdata-nightly/plugdata-macOS-Legacy.pkg",
265+
"Download",
266+
true,
267+
],
268+
[
269+
"Windows (x64)",
270+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Win64.msi",
271+
"Download",
272+
true,
273+
],
274+
[
275+
"Windows (x86)",
276+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Win32.msi",
277+
"Download",
278+
true,
279+
],
280+
[
281+
"Arch (x64)",
282+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Arch-x64.tar.gz",
283+
"Download",
284+
true,
285+
],
286+
[
287+
"Debian (x64)",
288+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Debian-x64.tar.gz",
289+
"Download",
290+
true,
291+
],
292+
[
293+
"Fedora 39 (x64)",
294+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Fedora-39-x64.tar.gz",
295+
"Download",
296+
true,
297+
],
298+
[
299+
"Fedora 40 (x64)",
300+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Fedora-40-x64.tar.gz",
301+
"Download",
302+
true,
303+
],
304+
[
305+
"Ubuntu 22.04 (x64)",
306+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Ubuntu-22.04-x64.tar.gz",
307+
"Download",
308+
true,
309+
],
310+
[
311+
"Ubuntu 24.04 (x64)",
312+
"https://storage.googleapis.com/plugdata-nightly/plugdata-Ubuntu-24.04-x64.tar.gz",
313+
"Download",
314+
true,
315+
],
316+
[
317+
"OpenSUSE Tumbleweed (x64)",
318+
"https://storage.googleapis.com/plugdata-nightly/plugdata-OpenSUSE-Tumbleweed-x64.tar.gz",
319+
"Download",
320+
true,
321+
],
322+
[
323+
"Arch Linux AUR Repository",
324+
"https://aur.archlinux.org/packages/plugdata-git",
325+
"View",
326+
false,
327+
],
328+
];
329+
330+
let unstable_container = document.getElementById("nightly-div");
331+
unstable_container.style.margin = "15px";
332+
333+
let onHashUpdate = [];
334+
335+
let latest_hash = "";
336+
const getLatestHash = async () => {
337+
fetch(
338+
`https://api.github.com/repos/plugdata-team/plugdata/commits/develop`,
339+
)
340+
.then((response) => response.json())
341+
.then((data) => {
342+
latest_hash = data.sha;
343+
console.log("Last Commit Hash:", latest_hash);
344+
for (let i = 0; i < onHashUpdate.length; i++) {
345+
onHashUpdate[i]();
346+
}
347+
})
348+
.catch((error) => console.error("Error:", error));
349+
};
350+
351+
const table = document.getElementById("nightly-table");
352+
353+
for (let i = 0; i < unstable_downloads.length; i++) {
354+
const downloadRow = document.createElement("tr");
355+
356+
let name = document.createElement("td");
357+
name.textContent = unstable_downloads[i][0];
358+
359+
let link = document.createElement("td");
360+
let clickableLink = document.createElement("a");
361+
362+
clickableLink.href = unstable_downloads[i][1];
363+
clickableLink.textContent = unstable_downloads[i][2];
364+
link.appendChild(clickableLink);
365+
366+
let has_info = unstable_downloads[i][3];
367+
368+
const dummy1 = document.createElement("td");
369+
const dummy2 = document.createElement("td");
370+
371+
downloadRow.appendChild(name);
372+
downloadRow.appendChild(dummy1);
373+
downloadRow.appendChild(dummy2);
374+
downloadRow.appendChild(link);
375+
376+
const getDownloadInfo = async () => {
377+
let url = unstable_downloads[i][1] + ".txt";
378+
console.log(url);
379+
let response = await fetch(url);
380+
const result = await response.text().then((str) => {
381+
return str.split("\n"); // return the string after splitting it.
382+
});
383+
384+
// Create new cells and set their content
385+
const date = document.createElement("td");
386+
date.textContent = result[0];
387+
date.style.minWidth = "200px";
388+
389+
const hash = result[1];
390+
let color = hash == latest_hash ? "#006400" : "#FFA500";
391+
392+
const commit_hash = document.createElement("td");
393+
const commit_link = document.createElement("a");
394+
395+
commit_link.textContent = hash.substring(0, 7);
396+
commit_link.style.cssText = `color: ${color}`;
397+
commit_link.href =
398+
"https://github.com/plugdata-team/plugdata/commits/" +
399+
hash;
400+
commit_hash.appendChild(commit_link);
401+
402+
onHashUpdate.push(() => {
403+
let color =
404+
hash == latest_hash ? "#006400" : "#FFA500";
405+
commit_hash.style.cssText = `color: ${color}`;
406+
console.log(
407+
hash == latest_hash
408+
? "hash was equal"
409+
: "hash was not equal",
410+
);
411+
});
412+
413+
downloadRow.removeChild(name);
414+
downloadRow.removeChild(dummy1);
415+
downloadRow.removeChild(dummy2);
416+
downloadRow.removeChild(link);
417+
418+
// Append the cells to the row
419+
downloadRow.appendChild(name);
420+
downloadRow.appendChild(date);
421+
downloadRow.appendChild(commit_hash);
422+
downloadRow.appendChild(link);
423+
};
424+
425+
if (has_info) {
426+
getDownloadInfo();
427+
}
428+
429+
// Append the row to the table
430+
table.appendChild(downloadRow);
431+
}
432+
433+
getLatestHash();
434+
}
435+
436+
main();
437+
</script>
254438

255439
<footer>
256440
<div>

download.js

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)