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