Files
kst4contest/website/src/_data/beta.js
T
Rsclub2_2andClaude Fable 5 a28abe1591 Update repository URLs to HamRadioOnline organisation (#142)
* Move remaining references to the HamRadioOnline organisation

The repository moved from praktimarc/kst4contest to
HamRadioOnline/kst4contest. Document the move in the German and English
changelog, point manuals, README, website, AUR packaging and the
version-feed tooling at the new address, and keep accepting pre-move
release URLs in the update-feed validator because published feeds still
carry the old owner. Personal identities (Ko-Fi account, contact
e-mail) stay unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFGQ7wkSPo21itLMHPi8Yw

* Lowercase the owner in the generated Flatpak Pages URL

GITHUB_REPOSITORY_OWNER is now the mixed-case HamRadioOnline, and the
next build would write that spelling into the published flatpakrepo and
flatpakref files. Hostnames are case-insensitive, but the published
metadata should match the documented lowercase address.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFGQ7wkSPo21itLMHPi8Yw

* Build the Flatpak against org.freedesktop.Platform 25.08

Runtime branch 24.08 is end-of-life and no longer receives security
updates, so every flatpak update now prints an EOL warning. 25.08 is
the current supported branch on Flathub. The app bundles its own Java
runtime, so the platform bump only changes the base libraries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WFGQ7wkSPo21itLMHPi8Yw

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-17 23:06:01 +02:00

170 lines
6.0 KiB
JavaScript

const REPO = "HamRadioOnline/kst4contest";
const API = `https://api.github.com/repos/${REPO}`;
const RELEASES_URL = `https://github.com/${REPO}/releases`;
/**
* Beta builds are published by .github/workflows/tagged-release.yml whenever
* a tag starting with "beta-" is pushed: it creates a GitHub prerelease with
* the same asset naming as a Stable release (based on the tag), except for
* the flatpakref, which is named ...beta.flatpakref instead of .flatpakref.
*
* There is no dedicated "beta" marker in the GitHub API beyond the
* prerelease flag, but that flag is exactly what this workflow sets, and
* nothing else in this repository publishes prereleases, so it is a safe
* signal to use here.
*
* A prerelease flag alone isn't enough though: GitHub never clears
* `prerelease` once the corresponding Stable version has actually shipped,
* so the latest prerelease can be stale (e.g. beta-1.41-rc04 published
* 2026-06-30, followed by Stable v1.41.0 on 2026-07-01). If the newest
* Stable release is more recent than the newest prerelease, there is no
* current beta and the empty state should be shown instead.
*/
async function fetchLatestBetaRelease() {
const headers = { Accept: "application/vnd.github+json" };
if (process.env.GITHUB_TOKEN) {
headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
}
try {
const res = await fetch(`${API}/releases?per_page=10`, { headers });
if (!res.ok) {
throw new Error(`GitHub API /releases failed: ${res.status}`);
}
const releases = await res.json();
const latestBeta = releases.find((release) => release.prerelease && !release.draft) || null;
const latestStable = releases.find((release) => !release.prerelease && !release.draft) || null;
if (!latestBeta) {
return null;
}
if (latestStable && latestStable.published_at > latestBeta.published_at) {
return null;
}
return latestBeta;
} catch (err) {
console.warn(
`[beta] Could not load the latest beta release. ` +
`The Beta tab will show its empty state instead: ${err.message}`
);
return null;
}
}
function unavailable() {
return {
available: false,
releasesUrl: RELEASES_URL,
items: []
};
}
/**
* Builds the Beta download list from the most recent GitHub prerelease.
* If there is currently no Beta release, the Beta tab is expected to show
* nothing but an explanatory empty state rather than guessed-at links.
*/
module.exports = async function () {
const release = await fetchLatestBetaRelease();
if (!release) {
return unavailable();
}
const tag = release.tag_name;
const assetUrl = (filenameTemplate) =>
`https://github.com/${REPO}/releases/download/${tag}/${filenameTemplate.replace(/\{tag\}/g, tag)}`;
// The MSI installer exists for tags from version 1.50 onwards (issue #61);
// an older beta release has no such asset and gets no dead link.
const assetNames = (release.assets || []).map((asset) => asset.name);
const windowsMsi = assetNames.includes(`KST4Contest-${tag}-windows-x64.msi`)
? [
{
os: "Windows",
format: "MSI installer x64",
icon: "🪟",
note: "Installs for the current user without administrator rights, with a Start menu entry and a desktop shortcut. Settings are shared with the ZIP version.",
url: assetUrl("KST4Contest-{tag}-windows-x64.msi")
}
]
: [];
const items = [
{
os: "Windows",
format: "ZIP x64",
icon: "🪟",
note: "Extract the archive, then start praktiKST.exe. No separate Java installation is required.",
url: assetUrl("praktiKST-{tag}-windows-x64.zip")
},
...windowsMsi,
{
os: "Linux",
format: "Flatpak (.flatpakref)",
icon: "🐧",
note: "Installs the beta branch of the Flatpak repo through Flatpak or the desktop software centre.",
url: assetUrl("de.x08.KST4Contest.beta.flatpakref")
},
{
os: "Linux",
format: "AppImage x86_64",
icon: "🐧",
note: "Portable build without package installation. Make the downloaded file executable before the first launch.",
url: assetUrl("KST4Contest-{tag}-linux-x86_64.AppImage")
},
{
os: "Debian / Ubuntu",
format: "DEB amd64",
icon: "📦",
note: "Native package for Debian, Ubuntu and distributions based on them.",
url: assetUrl("KST4Contest-{tag}-debian-amd64.deb")
},
{
os: "Fedora",
format: "RPM x86_64",
icon: "📦",
note: "Native package built for Fedora and compatible RPM-based systems.",
url: assetUrl("KST4Contest-{tag}-fedora-x86_64.rpm")
},
{
os: "Arch Linux",
format: "pkg.tar.zst",
icon: "📦",
note: "Release package for direct installation with pacman.",
url: assetUrl("KST4Contest-{tag}-archlinux-x86_64.pkg.tar.zst")
},
{
os: "macOS Apple Silicon",
format: "DMG arm64",
icon: "🍎",
note: "Best-effort build for Apple Silicon Macs. Signed and notarized by Apple from version 1.42 onwards.",
url: assetUrl("KST4Contest-{tag}-macos-arm64.dmg")
},
{
os: "macOS Intel",
format: "DMG x86_64",
icon: "🍎",
note: "Best-effort build for Intel Macs. Signed and notarized by Apple from version 1.42 onwards.",
url: assetUrl("KST4Contest-{tag}-macos-x86_64.dmg")
}
];
return {
available: true,
releasesUrl: RELEASES_URL,
tag,
name: release.name,
publishedAt: release.published_at,
releaseUrl: release.html_url,
items
};
};