Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 91 additions & 61 deletions bin/fetch-warp-releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import fs from "fs";
import YAML from "yaml";
import { marked } from "marked";

const tracks = [
"windows/ga",
"windows/beta",
"macos/ga",
"macos/beta",
"noble-intel/ga",
"noble-intel/beta",
];
const BASE_URL = "https://downloads.cloudflareclient.com/v1";

const platforms = await fetch(`${BASE_URL}/platforms`)
.then((res) => res.json())
.then((data) => data.result);

fs.writeFileSync(
"./src/util/warp-platforms.json",
JSON.stringify(platforms, null, "\t"),
"utf-8",
);

const linesToRemove = [
"For related Cloudflare for Teams documentation please see: https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp",
Expand All @@ -18,72 +21,99 @@ const linesToRemove = [
"For Consumer documentation please see: <https://developers.cloudflare.com/warp-client/>",
];

for (let track of tracks) {
fetch(`https://downloads.cloudflareclient.com/v1/update/json/${track}`)
.then((res) => res.json())
.then((data) => {
if (!data.items) {
console.warn(
`${track} has no releases: ${JSON.stringify(data, null, 2)}`,
);

return;
}

data.items.forEach((item) => {
if (track.startsWith("noble-intel")) {
track = track.replace("noble-intel", "linux");
}
for (const { platform } of platforms) {
const isLinux = platform !== "windows" && platform !== "macos";

const folder = `./src/content/warp-releases/${track}`;
const path = `${folder}/${item.version}.yaml`;
for (const track of ["ga", "beta"]) {
fetch(`${BASE_URL}/update/json/${platform}/${track}`)
.then((res) => res.json())
.then((data) => {
if (!data.items) {
console.warn(
`${track} has no releases: ${JSON.stringify(data, null, 2)}`,
);

if (!fs.existsSync(folder)) {
fs.mkdirSync(folder, { recursive: true });
}

if (fs.existsSync(path)) {
console.log(`${track} ${item.version} already exists.`);
return;
}

console.log(`Saving ${track} ${item.version}.`);
data.items.forEach((item) => {
let folder = `./src/content/warp-releases/`;

let markdown = item.releaseNotes;
if (isLinux) {
folder += `linux/${track}`;
} else {
folder += `${platform}/${track}`;
}

markdown.replace(/\r\n/g, "\n");
const path = `${folder}/${item.version}.yaml`;

for (const line of linesToRemove) {
markdown = markdown.replace(line, "");
}
if (!fs.existsSync(folder)) {
fs.mkdirSync(folder, { recursive: true });
}

markdown = markdown.trim();
if (fs.existsSync(path)) {
if (isLinux) {
const existingFile = YAML.parse(fs.readFileSync(path, "utf-8"));

const tokens = marked.lexer(markdown);
existingFile.linuxPlatforms ??= {};

marked.walkTokens(tokens, (token) => {
if (token.type === "heading") {
token.type = "strong";
token.raw = `**${token.text}**\n`;
if (!existingFile.linuxPlatforms[platform]) {
console.log(
`Adding ${platform} to Linux ${track} ${item.version}.`,
);

delete token.depth;
existingFile.linuxPlatforms[platform] = item.packageSize;
}

fs.writeFileSync(path, YAML.stringify(existingFile), "utf-8");
} else {
console.log(
`${platform} ${track} ${item.version} already exists.`,
);
}

return;
}
});

const releaseNotes = tokens.reduce((s, t) => s + t.raw, "");
const platformName = data.platformName.startsWith("noble-")
? "Linux"
: data.platformName;

fs.writeFileSync(
`./src/content/warp-releases/${track}/${item.version}.yaml`,
YAML.stringify({
...item,
releaseNotes,
platformName,
}),
"utf-8",
);
console.log(`Saving ${track} ${item.version}.`);

let markdown = item.releaseNotes;

markdown.replace(/\r\n/g, "\n");

for (const line of linesToRemove) {
markdown = markdown.replace(line, "");
}

markdown = markdown.trim();

const tokens = marked.lexer(markdown);

marked.walkTokens(tokens, (token) => {
if (token.type === "heading") {
token.type = "strong";
token.raw = `**${token.text}**\n`;

delete token.depth;
}
});

const releaseNotes = tokens.reduce((s, t) => s + t.raw, "");
const platformName = isLinux ? "Linux" : data.platformName;

fs.writeFileSync(
path,
YAML.stringify({
...item,
releaseNotes,
platformName,
linuxPlatforms: isLinux
? { [platform]: item.packageSize }
: undefined,
}),
"utf-8",
);
});
});
});
}
}
124 changes: 98 additions & 26 deletions src/components/WARPRelease.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { marked } from "marked";
import { z } from "astro:schema";
import prettyBytes from "pretty-bytes";
import { warpReleasesSchema } from "~/schemas";
import platforms from "~/util/warp-platforms.json";

type Props = z.infer<typeof props>;

Expand All @@ -14,37 +15,108 @@ const props = z.object({
});

const { header, open, release } = props.parse(Astro.props);

const getPrettyLinuxName = (platform: string) => {
const platformInfo = platforms.find(p => p.platform === platform);

if (platformInfo) {
return platformInfo.display_name;
}

return platform;
};

const sortedPlatforms = Object.entries(release.linuxPlatforms ?? {}).sort(
(a, b) => {
return getPrettyLinuxName(a[0]).localeCompare(getPrettyLinuxName(b[0]));
},
);
---

<Details header={header} open={open}>
<p>
<div class="flex gap-2">
<warp-download data-version={release.version} data-platforms={JSON.stringify(sortedPlatforms)}>
<p>
<div class="flex gap-2">
<span>
<strong>Version: </strong>
{release.platformName}
{release.version}
</span>
<span>
<strong>Date: </strong>
{release.releaseDate.toISOString().split("T")[0]}
</span>
{
release.packageSize && (
<span>
<strong>Size: </strong>
<span data-size>{prettyBytes(release.packageSize)}</span>
</span>
)
}
</div>
</p>
<p>
<span>
<strong>Version: </strong>
{release.platformName}
{release.version}
{
release.linuxPlatforms ? (
<select>
{sortedPlatforms.map(([platform]) => (
<option value={platform}>
{getPrettyLinuxName(platform)}
</option>
))}
</select>
<a
class="inline-block"
data-linux-download
href={`https://downloads.cloudflareclient.com/v1/download/${release.linuxPlatforms[0]}/version/${release.version}`}
>
Download
</a>
) : (
<a href={release.packageURL}>Download</a>
)
}
</span>
</p>
<p>
<span>
<strong>Date: </strong>
{release.releaseDate.toISOString().split("T")[0]}
<h4>Release notes</h4>
</span>
{
release.packageSize && (
<span>
<strong>Size: </strong>
{prettyBytes(release.packageSize)}
</span>
)
}
</div>
<span>
<a href={release.packageURL}>Download</a>
</span>
</p>
<p>
<span>
<h4>Release notes</h4>
</span>
<Fragment set:html={marked.parse(release.releaseNotes)} />
</p>
<Fragment set:html={marked.parse(release.releaseNotes)} />
</p>
</warp-download>
</Details>

<script>
import prettyBytes from "pretty-bytes";

class WarpDownload extends HTMLElement {
connectedCallback() {
const platforms = JSON.parse(this.dataset.platforms as string);

const dropdown = this.querySelector<HTMLSelectElement>("select");

dropdown?.addEventListener("change", () => {
const platform = dropdown?.value;

const download = this.querySelector<HTMLAnchorElement>("a[data-linux-download]");
const size = this.querySelector<HTMLSpanElement>("span[data-size]");

download?.setAttribute(
"href",
`https://downloads.cloudflareclient.com/v1/download/${platform}/version/${this.dataset.version}`,
);

if (size) {
const platformInfo = platforms.find(([p]: [string, number]) => p === platform);

size.textContent = prettyBytes(Number(platformInfo?.[1] ?? 0));
}
});
}
}

customElements.define("warp-download", WarpDownload);
</script>
14 changes: 12 additions & 2 deletions src/content/warp-releases/linux/beta/2025.2.459.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ releaseNotes: >-

**Changes and improvements**

- Improved command line interface for Access for Infrastructure
with added function for filtering and ordering.
- Improved command line interface for Access for Infrastructure with added
function for filtering and ordering.

- Fixed client connectivity issues when switching between managed network
profiles that use different WARP protocols.
Expand All @@ -27,3 +27,13 @@ releaseDate: 2025-03-13T17:13:33.600Z
packageURL: https://downloads.cloudflareclient.com/v1/download/noble-intel/version/2025.2.459.1
packageSize: 44462470
platformName: Linux
linuxPlatforms:
noble-intel: 44462470
buster-intel: 44952080
focal-intel: 44913046
fedora34-intel: 47124791
fedora35-intel: 46859092
jammy-intel: 44575658
centos8-intel: 46730316
bookworm-intel: 44577042
bullseye-intel: 44883128
28 changes: 15 additions & 13 deletions src/content/warp-releases/linux/beta/2025.2.460.1.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
releaseNotes: >-
This release contains significant improvements to our captive portal / public
Wi-Fi detection logic. If you have experienced captive portal issues in the past, re-test and give this version a try.

releaseNotes: |-
This release contains significant improvements to our captive portal / public Wi-Fi detection logic. If you have experienced captive portal issues in the past, re-test and give this version a try.

**Changes and improvements**

- Improved [captive portal detection](/cloudflare-one/connections/connect-devices/warp/configure-warp/warp-settings/captive-portals/) to make more public networks compatible
and have faster detection.

- WARP tunnel protocol details can now be viewed using the `warp-cli tunnel stats`
command.

- Fixed issue with device revocation and re-registration when switching
configurations.
- Improved [captive portal detection](/cloudflare-one/connections/connect-devices/warp/configure-warp/warp-settings/captive-portals/) to make more public networks compatible and have faster detection.
- WARP tunnel protocol details can now be viewed using the `warp-cli tunnel stats` command.
- Fixed issue with device revocation and re-registration when switching configurations.
version: 2025.2.460.1
releaseDate: 2025-03-13T18:24:32.891Z
packageURL: https://downloads.cloudflareclient.com/v1/download/noble-intel/version/2025.2.460.1
packageSize: 44461586
platformName: Linux
linuxPlatforms:
noble-intel: 44461586
buster-intel: 44949796
focal-intel: 44915238
fedora34-intel: 47124281
fedora35-intel: 46857904
jammy-intel: 44573296
centos8-intel: 46729306
bookworm-intel: 44579760
bullseye-intel: 44885436
Loading
Loading