Skip to content

Commit f2df3a6

Browse files
author
Hasan Haghniya
authored
Merge pull request #6 from Streamware/fix-some-issues-with-getting-releases
get apk release url and fix issue with fetching latest release
2 parents 220960b + 68b9d36 commit f2df3a6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/page.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import Image from "next/image";
22
import PublishedAt from "./publishedAt";
33

4+
type Asset = {
5+
browser_download_url: string;
6+
name: string;
7+
};
8+
49
export default async function Home() {
510
const data = await fetch(
6-
"https://api.github.com/repos/Streamware/Mirrors/releases?per_page=1",
7-
{ cache: "force-cache" }
11+
"https://api.github.com/repos/Streamware/Mirrors/releases?per_page=1"
812
).then((res) => res.json());
913

14+
const getReleaseAsset = data[0].assets.find((asset: Asset) =>
15+
asset.name.includes("app-release.apk")
16+
);
17+
1018
return (
1119
<main className="flex min-h-screen flex-col items-center sm:p-24 p-10">
1220
<div className="flex items-center justify-center text-[60px] rounded pointer-events-none select-none bg-[#0049FF] text-white w-24 h-24 mb-3">
@@ -22,7 +30,7 @@ export default async function Home() {
2230
<div className="flex-col items-center content-center justify-center my-5">
2331
<a
2432
className="block bg-[#171717] text-gray-100 px-4 py-2 rounded-lg text-sm mb-2"
25-
href={data[0].assets[0].browser_download_url}
33+
href={getReleaseAsset.browser_download_url}
2634
download
2735
>
2836
Download APK

0 commit comments

Comments
 (0)