Skip to content

Commit c9d496e

Browse files
committed
[Docs Site] Fetch all Linux platforms for WARP releases
1 parent 8cf96fc commit c9d496e

16 files changed

+397
-131
lines changed

bin/fetch-warp-releases.js

Lines changed: 100 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@ import fs from "fs";
22
import YAML from "yaml";
33
import { marked } from "marked";
44

5-
const tracks = [
6-
"windows/ga",
7-
"windows/beta",
8-
"macos/ga",
9-
"macos/beta",
10-
"noble-intel/ga",
11-
"noble-intel/beta",
5+
const BASE_URL = "https://downloads.cloudflareclient.com/v1/update/json";
6+
7+
const platforms = [
8+
"windows",
9+
"macos",
10+
"noble-intel",
11+
"noble-arm",
12+
"jammy-intel",
13+
"jammy-arm",
14+
"focal-intel",
15+
"focal-arm",
16+
"buster-intel",
17+
"buster-arm",
18+
"bullseye-intel",
19+
"bullseye-arm",
20+
"bookworm-intel",
21+
"bookworm-arm",
22+
"centos8-intel",
23+
"centos8-arm",
24+
"fedora34-intel",
25+
"fedora34-arm",
26+
"fedora35-intel",
27+
"fedora35-arm",
1228
];
1329

1430
const linesToRemove = [
@@ -18,72 +34,96 @@ const linesToRemove = [
1834
"For Consumer documentation please see: <https://developers.cloudflare.com/warp-client/>",
1935
];
2036

21-
for (let track of tracks) {
22-
fetch(`https://downloads.cloudflareclient.com/v1/update/json/${track}`)
23-
.then((res) => res.json())
24-
.then((data) => {
25-
if (!data.items) {
26-
console.warn(
27-
`${track} has no releases: ${JSON.stringify(data, null, 2)}`,
28-
);
29-
30-
return;
31-
}
32-
33-
data.items.forEach((item) => {
34-
if (track.startsWith("noble-intel")) {
35-
track = track.replace("noble-intel", "linux");
36-
}
37-
38-
const folder = `./src/content/warp-releases/${track}`;
39-
const path = `${folder}/${item.version}.yaml`;
37+
for (const platform of platforms) {
38+
const isLinux = platform !== "windows" && platform !== "macos";
4039

41-
if (!fs.existsSync(folder)) {
42-
fs.mkdirSync(folder, { recursive: true });
43-
}
40+
for (const track of ["ga", "beta"]) {
41+
fetch(`${BASE_URL}/${platform}/${track}`)
42+
.then((res) => res.json())
43+
.then((data) => {
44+
if (!data.items) {
45+
console.warn(
46+
`${track} has no releases: ${JSON.stringify(data, null, 2)}`,
47+
);
4448

45-
if (fs.existsSync(path)) {
46-
console.log(`${track} ${item.version} already exists.`);
4749
return;
4850
}
4951

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

52-
let markdown = item.releaseNotes;
55+
if (isLinux) {
56+
folder += `linux/${track}`;
57+
} else {
58+
folder += `${platform}/${track}`;
59+
}
5360

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

56-
for (const line of linesToRemove) {
57-
markdown = markdown.replace(line, "");
58-
}
63+
if (!fs.existsSync(folder)) {
64+
fs.mkdirSync(folder, { recursive: true });
65+
}
66+
67+
if (fs.existsSync(path)) {
68+
if (isLinux) {
69+
const existingFile = YAML.parse(fs.readFileSync(path, "utf-8"));
70+
71+
existingFile.linuxPlatforms ??= [];
5972

60-
markdown = markdown.trim();
73+
if (!existingFile.linuxPlatforms.includes(platform)) {
74+
console.log(
75+
`Adding ${platform} to Linux ${track} ${item.version}.`,
76+
);
6177

62-
const tokens = marked.lexer(markdown);
78+
existingFile.linuxPlatforms.push(platform);
79+
}
6380

64-
marked.walkTokens(tokens, (token) => {
65-
if (token.type === "heading") {
66-
token.type = "strong";
67-
token.raw = `**${token.text}**\n`;
81+
fs.writeFileSync(path, YAML.stringify(existingFile), "utf-8");
82+
} else {
83+
console.log(
84+
`${platform} ${track} ${item.version} already exists.`,
85+
);
86+
}
6887

69-
delete token.depth;
88+
return;
7089
}
71-
});
7290

73-
const releaseNotes = tokens.reduce((s, t) => s + t.raw, "");
74-
const platformName = data.platformName.startsWith("noble-")
75-
? "Linux"
76-
: data.platformName;
77-
78-
fs.writeFileSync(
79-
`./src/content/warp-releases/${track}/${item.version}.yaml`,
80-
YAML.stringify({
81-
...item,
82-
releaseNotes,
83-
platformName,
84-
}),
85-
"utf-8",
86-
);
91+
console.log(`Saving ${track} ${item.version}.`);
92+
93+
let markdown = item.releaseNotes;
94+
95+
markdown.replace(/\r\n/g, "\n");
96+
97+
for (const line of linesToRemove) {
98+
markdown = markdown.replace(line, "");
99+
}
100+
101+
markdown = markdown.trim();
102+
103+
const tokens = marked.lexer(markdown);
104+
105+
marked.walkTokens(tokens, (token) => {
106+
if (token.type === "heading") {
107+
token.type = "strong";
108+
token.raw = `**${token.text}**\n`;
109+
110+
delete token.depth;
111+
}
112+
});
113+
114+
const releaseNotes = tokens.reduce((s, t) => s + t.raw, "");
115+
const platformName = isLinux ? "Linux" : data.platformName;
116+
117+
fs.writeFileSync(
118+
path,
119+
YAML.stringify({
120+
...item,
121+
releaseNotes,
122+
platformName,
123+
}),
124+
"utf-8",
125+
);
126+
});
87127
});
88-
});
128+
}
89129
}

src/components/WARPRelease.astro

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,53 @@ const props = z.object({
1414
});
1515
1616
const { header, open, release } = props.parse(Astro.props);
17+
18+
const getPrettyLinuxName = (platform: string) => {
19+
switch (platform) {
20+
case "noble-intel":
21+
return "Ubuntu Noble (Intel)";
22+
case "noble-arm":
23+
return "Ubuntu Noble (Arm)";
24+
case "jammy-intel":
25+
return "Ubuntu Jammy (Intel)";
26+
case "jammy-arm":
27+
return "Ubuntu Jammy (Arm)";
28+
case "focal-intel":
29+
return "Ubuntu Focal (Intel)";
30+
case "focal-arm":
31+
return "Ubuntu Focal (Arm)";
32+
case "buster-intel":
33+
return "Debian Buster (Intel)";
34+
case "buster-arm":
35+
return "Ubuntu Buster (Arm)";
36+
case "bullseye-intel":
37+
return "Debian Bullseye (Intel)";
38+
case "bullseye-arm":
39+
return "Debian Bullseye (Arm)";
40+
case "bookworm-intel":
41+
return "Debian Bookworm (Intel)";
42+
case "bookworm-arm":
43+
return "Debian Bookworm (Arm)";
44+
case "centos8-intel":
45+
return "Centos 8 (Intel)";
46+
case "centos8-arm":
47+
return "Centos 8 (Arm)";
48+
case "fedora34-intel":
49+
return "Fedora 34 (Intel)";
50+
case "fedora34-arm":
51+
return "Fedora 34 (Arm)";
52+
case "fedora35-intel":
53+
return "Fedora 35 (Intel)";
54+
case "fedora35-arm":
55+
return "Fedora 35 (Arm)";
56+
default:
57+
return platform;
58+
}
59+
};
60+
61+
release.linuxPlatforms?.sort((a, b) => {
62+
return getPrettyLinuxName(a).localeCompare(getPrettyLinuxName(b));
63+
});
1764
---
1865

1966
<Details header={header} open={open}>
@@ -37,8 +84,28 @@ const { header, open, release } = props.parse(Astro.props);
3784
)
3885
}
3986
</div>
87+
</p>
88+
<p>
4089
<span>
41-
<a href={release.packageURL}>Download</a>
90+
{
91+
release.linuxPlatforms ? (
92+
<warp-linux-downloads data-version={release.version}>
93+
<select>
94+
{release.linuxPlatforms.map((platform) => (
95+
<option value={platform}>{getPrettyLinuxName(platform)}</option>
96+
))}
97+
</select>
98+
<a
99+
class="inline-block"
100+
href={`https://downloads.cloudflareclient.com/v1/download/${release.linuxPlatforms[0]}/version/${release.version}`}
101+
>
102+
Download
103+
</a>
104+
</warp-linux-downloads>
105+
) : (
106+
<a href={release.packageURL}>Download</a>
107+
)
108+
}
42109
</span>
43110
</p>
44111
<p>
@@ -48,3 +115,25 @@ const { header, open, release } = props.parse(Astro.props);
48115
<Fragment set:html={marked.parse(release.releaseNotes)} />
49116
</p>
50117
</Details>
118+
119+
<script>
120+
class WarpLinuxDownloads extends HTMLElement {
121+
connectedCallback() {
122+
const dropdown = this.querySelector<HTMLSelectElement>("select");
123+
124+
dropdown?.addEventListener("change", () => {
125+
console.log("change");
126+
const platform = dropdown?.value;
127+
const download = this.querySelector<HTMLAnchorElement>("a");
128+
129+
console.log(download);
130+
download?.setAttribute(
131+
"href",
132+
`https://downloads.cloudflareclient.com/v1/download/${platform}/version/${this.dataset.version}`,
133+
);
134+
});
135+
}
136+
}
137+
138+
customElements.define("warp-linux-downloads", WarpLinuxDownloads);
139+
</script>

src/content/warp-releases/linux/beta/2025.2.459.1.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ releaseNotes: >-
44
55
**Changes and improvements**
66
7-
- Improved command line interface for Access for Infrastructure
8-
with added function for filtering and ordering.
7+
- Improved command line interface for Access for Infrastructure with added
8+
function for filtering and ordering.
99
1010
- Fixed client connectivity issues when switching between managed network
1111
profiles that use different WARP protocols.
@@ -27,3 +27,13 @@ releaseDate: 2025-03-13T17:13:33.600Z
2727
packageURL: https://downloads.cloudflareclient.com/v1/download/noble-intel/version/2025.2.459.1
2828
packageSize: 44462470
2929
platformName: Linux
30+
linuxPlatforms:
31+
- buster-intel
32+
- fedora34-intel
33+
- jammy-intel
34+
- fedora35-intel
35+
- bookworm-intel
36+
- focal-intel
37+
- bullseye-intel
38+
- centos8-intel
39+
- noble-intel
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
releaseNotes: >-
2-
This release contains significant improvements to our captive portal / public
3-
Wi-Fi detection logic. If you have experienced captive portal issues in the past, re-test and give this version a try.
4-
1+
releaseNotes: |-
2+
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.
53
64
**Changes and improvements**
7-
8-
- Improved [captive portal detection](/cloudflare-one/connections/connect-devices/warp/configure-warp/warp-settings/captive-portals/) to make more public networks compatible
9-
and have faster detection.
10-
11-
- WARP tunnel protocol details can now be viewed using the `warp-cli tunnel stats`
12-
command.
13-
14-
- Fixed issue with device revocation and re-registration when switching
15-
configurations.
5+
- 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.
6+
- WARP tunnel protocol details can now be viewed using the `warp-cli tunnel stats` command.
7+
- Fixed issue with device revocation and re-registration when switching configurations.
168
version: 2025.2.460.1
179
releaseDate: 2025-03-13T18:24:32.891Z
1810
packageURL: https://downloads.cloudflareclient.com/v1/download/noble-intel/version/2025.2.460.1
1911
packageSize: 44461586
2012
platformName: Linux
13+
linuxPlatforms:
14+
- buster-intel
15+
- fedora34-intel
16+
- jammy-intel
17+
- fedora35-intel
18+
- bookworm-intel
19+
- focal-intel
20+
- bullseye-intel
21+
- centos8-intel
22+
- noble-intel

src/content/warp-releases/linux/beta/2025.4.589.1.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,22 @@ releaseDate: 2025-04-22T19:12:01.383Z
1212
packageURL: https://downloads.cloudflareclient.com/v1/download/noble-intel/version/2025.4.589.1
1313
packageSize: 45489326
1414
platformName: Linux
15+
linuxPlatforms:
16+
- fedora35-arm
17+
- bullseye-arm
18+
- buster-intel
19+
- focal-arm
20+
- fedora34-intel
21+
- jammy-intel
22+
- bookworm-arm
23+
- buster-arm
24+
- fedora35-intel
25+
- bookworm-intel
26+
- focal-intel
27+
- bullseye-intel
28+
- centos8-intel
29+
- noble-intel
30+
- centos8-arm
31+
- fedora34-arm
32+
- jammy-arm
33+
- noble-arm

0 commit comments

Comments
 (0)