mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-14 08:25:16 +00:00
website: use new nightly release channel instead of showing nightly.link links
This commit is contained in:
parent
a435d41eb2
commit
576e2c6a1f
@ -11,20 +11,36 @@ import {
|
||||
Tr,
|
||||
HStack,
|
||||
} from "@chakra-ui/react";
|
||||
import { octokit } from "configurations/ocotokit";
|
||||
import { GetServerSideProps, NextPage } from "next";
|
||||
// import { GridMultiplexAd } from "components/special";
|
||||
import NavLink from "next/link";
|
||||
import { ReleaseResponse } from "./stable-downloads";
|
||||
|
||||
const baseURL =
|
||||
"https://nightly.link/KRTirtho/spotube/workflows/spotube-nightly/build/";
|
||||
type NightlyProps = ReleaseResponse;
|
||||
|
||||
const DownloadLinks = Object.freeze({
|
||||
Linux: baseURL + "Spotube-Linux-Bundle.zip",
|
||||
Android: baseURL + "Spotube-Android-Bundle.zip",
|
||||
Windows: baseURL + "Spotube-Windows-Bundle.zip",
|
||||
MacOS: baseURL + "Spotube-Macos-Bundle.zip",
|
||||
});
|
||||
export const getServerSideProps: GetServerSideProps<NightlyProps> =async () =>{
|
||||
const { data } = await octokit.repos.getReleaseByTag({
|
||||
owner: "KRTirtho",
|
||||
repo: "spotube",
|
||||
tag: "nightly",
|
||||
});
|
||||
return {
|
||||
props: {
|
||||
tag_name: data.tag_name,
|
||||
id: data.id,
|
||||
body: data.body,
|
||||
assets: data.assets.map((asset) => ({
|
||||
id: asset.id,
|
||||
name: asset.name,
|
||||
browser_download_url: asset.browser_download_url,
|
||||
})),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function NightlyDownloads() {
|
||||
|
||||
const NightlyDownloads: NextPage<NightlyProps> = (props)=> {
|
||||
return (
|
||||
<>
|
||||
<VStack>
|
||||
@ -57,19 +73,24 @@ function NightlyDownloads() {
|
||||
py="2"
|
||||
w="100%"
|
||||
>
|
||||
{Object.entries(DownloadLinks).map(([platform, url]) => {
|
||||
const segments = url.split("/");
|
||||
{Object.entries(props.assets).map(([_, { name, id, browser_download_url}], i) => {
|
||||
const segments = name.split("-");
|
||||
const platform = segments[1];
|
||||
const executable = segments[segments.length - 1].split(".")[1];
|
||||
return (
|
||||
<HStack key={url}>
|
||||
<Text w="100px">{platform}</Text>
|
||||
<HStack key={id} py="2">
|
||||
<Text w="200px" textTransform="capitalize">
|
||||
{platform}{" "}
|
||||
<chakra.span color="gray.500">({executable})</chakra.span>
|
||||
</Text>
|
||||
<Anchor
|
||||
overflowWrap="break-word"
|
||||
wordBreak="break-word"
|
||||
w="full"
|
||||
href={url}
|
||||
href={browser_download_url}
|
||||
color="blue.500"
|
||||
>
|
||||
{segments.at(segments.length - 1)?.replace("build", "")}
|
||||
{name}
|
||||
</Anchor>
|
||||
</HStack>
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ enum AssetTypes {
|
||||
android = "android",
|
||||
}
|
||||
|
||||
type ReleaseResponse = {
|
||||
export type ReleaseResponse = {
|
||||
id: number;
|
||||
body: string | null | undefined;
|
||||
tag_name: string;
|
||||
@ -38,10 +38,10 @@ type ReleaseResponse = {
|
||||
name: string;
|
||||
browser_download_url: string;
|
||||
}[];
|
||||
}[];
|
||||
};
|
||||
|
||||
type Props = {
|
||||
data: ReleaseResponse;
|
||||
data: ReleaseResponse[];
|
||||
};
|
||||
|
||||
export const getServerSideProps: GetServerSideProps<Props> = async ({
|
||||
@ -55,7 +55,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async ({
|
||||
owner: "KRTirtho",
|
||||
repo: "spotube",
|
||||
});
|
||||
const releaseResponse: ReleaseResponse = data.map((data) => {
|
||||
const releaseResponse: ReleaseResponse[] = data.map((data) => {
|
||||
return {
|
||||
tag_name: data.tag_name,
|
||||
id: data.id,
|
||||
|
Loading…
Reference in New Issue
Block a user