-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmeta.json.ts
56 lines (52 loc) · 1.56 KB
/
meta.json.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Fetch version value fromy yaml file https://raw.githubusercontent.com/LinwoodDev/Setonix/nightly/app/pubspec.yaml
const nightlyUrl =
"https://raw.githubusercontent.com/LinwoodDev/Setonix/nightly/app/pubspec.yaml";
const nightlyVersion = await fetch(nightlyUrl)
.then((res) => res.text())
.then((text) => {
const regex = /^version:\s(.+)\+(.+)$/gm;
const match = regex.exec(text);
return match?.[1];
});
// stable
const stableUrl =
"https://raw.githubusercontent.com/LinwoodDev/Setonix/stable/app/pubspec.yaml";
const stableVersion = await fetch(stableUrl)
.then((res) => res.text())
.then((text) => {
const regex = /^version:\s(.+)\+(.+)$/gm;
const match = regex.exec(text);
return match?.[1];
});
// develop
const developUrl =
"https://raw.githubusercontent.com/LinwoodDev/Setonix/develop/app/pubspec.yaml";
const developVersion = await fetch(developUrl)
.then((res) => res.text())
.then((text) => {
const regex = /^version:\s(.+)\+(.+)$/gm;
const match = regex.exec(text);
return match?.[1];
});
// main
const mainUrl =
"https://raw.githubusercontent.com/LinwoodDev/Setonix/main/app/pubspec.yaml";
const mainVersion = await fetch(mainUrl)
.then((res) => res.text())
.then((text) => {
const regex = /^version:\s(.+)\+(.+)$/gm;
const match = regex.exec(text);
return match?.[1];
});
export function GET() {
return new Response(
JSON.stringify({
version: {
nightly: nightlyVersion,
stable: stableVersion,
develop: developVersion,
main: mainVersion,
},
})
);
}