website/src/pages/repos.js

91 lines
4.1 KiB
JavaScript
Raw Permalink Normal View History

2022-08-26 13:46:21 +00:00
import React, {useEffect, useState} from "react"
import Layout from "../components/layout"
import RepoCard from "../components/cards/repo"
2022-09-18 10:07:07 +00:00
import AdbConnect from "../components/adbconnect"
2022-12-01 09:04:26 +00:00
import SEO from "../components/seo"
2022-08-26 13:46:21 +00:00
2022-09-01 07:56:43 +00:00
import { TiWarning } from "react-icons/ti";
import { BiErrorAlt } from "react-icons/bi";
2022-09-19 07:36:53 +00:00
import { GoVerified } from "react-icons/go";
2022-09-22 09:39:46 +00:00
import { IconContext } from "react-icons";
2022-09-01 07:56:43 +00:00
2022-10-03 08:18:32 +00:00
import "./repos.css";
2022-12-01 09:04:26 +00:00
const ReposPage = () => {
const [repos, setRepos] = useState(null);
2022-10-02 19:37:57 +00:00
const [hadError, setHadError] = useState(false);
2022-08-26 13:46:21 +00:00
useEffect(() => {
2022-10-03 08:18:32 +00:00
fetch("https://raw.githubusercontent.com/recloudstream/cs-repos/master/repos-db.json")
2022-10-02 19:37:57 +00:00
.catch(err => { setHadError(true) })
2022-08-26 13:46:21 +00:00
.then(r => r.json())
2022-10-02 19:37:57 +00:00
.then(setRepos)
.catch(err => { setHadError(true) })
2022-08-26 13:46:21 +00:00
}, [setRepos])
return <Layout>
<div className="flex items-center w-full flex-col">
2022-09-01 07:56:43 +00:00
<div className="alert alert-warning shadow-lg w-full mx-10 md:w-2/3 mb-5">
<div>
<TiWarning className="stroke-current flex-shrink-0 h-6 w-6"/>
<div>
<h3 className="font-bold text-xl">Keep in mind that the extensions can execute arbitrary code inside the app.</h3>
2022-09-19 07:36:53 +00:00
<span className="text-xs">
This means you should treat them with the same level of scrutiny you treat any apps. Extensions can also read all of the Cloudstream's data.
</span>
<br />
2022-09-22 09:39:46 +00:00
<IconContext.Provider value={{className: 'inline-block'}}>
<span className="text-xs">
Repos with a <GoVerified class="stroke-current flex-shrink-0 mx-1" /> are constantly audited by the app developers so you can probably trust them.
</span>
</IconContext.Provider>
2022-09-01 07:56:43 +00:00
</div>
</div>
</div>
2022-10-02 19:41:48 +00:00
{(!repos && !hadError) &&
2022-10-03 08:18:32 +00:00
<div className="swap-child">
<div class="alert shadow-lg w-full mx-10 md:w-2/3 mb-5">
<div>
<span>Fetching data...</span>
</div>
</div>
2022-10-03 08:18:32 +00:00
<div class="alert alert-error shadow-lg w-full mx-10 md:w-2/3 mb-5">
<div>
<BiErrorAlt />
<div>
<h3 class="font-bold">Failed to connect to GitHub servers.</h3>
<div class="text-xs">GitHub has been a target of <a href="https://en.wikipedia.org/wiki/Censorship_of_GitHub" className="link" target="_blank">censorship</a> in some countries. <br/> Please try changing your <a href="https://1.1.1.1/dns/" className="link" target="_blank">DNS server</a> or try using a VPN.</div>
</div>
</div>
</div>
</div>
}
2022-08-26 13:46:21 +00:00
{repos &&
<>
<AdbConnect />
{repos.map((it, index) => <RepoCard repoData={it} key={index} isFirst={index===0}/>)}
</>
}
2022-10-02 19:41:48 +00:00
{(!repos && hadError) &&
2022-10-01 18:30:02 +00:00
<div class="alert alert-error shadow-lg w-full mx-10 md:w-2/3 mb-5">
<div>
<BiErrorAlt />
<div>
2022-10-01 18:37:51 +00:00
<h3 class="font-bold">Failed to connect to GitHub servers.</h3>
<div class="text-xs">GitHub has been a target of <a href="https://en.wikipedia.org/wiki/Censorship_of_GitHub" className="link" target="_blank">censorship</a> in some countries. <br/> Please try changing your <a href="https://1.1.1.1/dns/" className="link" target="_blank">DNS server</a> or try using a VPN.</div>
</div>
</div>
</div>
2022-08-26 13:46:21 +00:00
}
</div>
</Layout>
}
export function Head() {
2022-12-01 09:04:26 +00:00
return <SEO title="Cloudstream Repositories" />
2022-08-26 13:46:21 +00:00
}
2022-12-01 09:04:26 +00:00
export default ReposPage