use window.RepoApi when avaliable

This commit is contained in:
Cloudburst 2022-09-10 19:36:53 +02:00 committed by GitHub
parent bd6d994c6c
commit 8d257ca73d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -29,8 +29,13 @@ const RepoCard = ({ url, isFirst }) => {
autoFocus={isFirst}
group={true}
className="btn-primary"
href={`cloudstreamrepo://${url.replace(/^https?:\/\//, "")}`}
target="_blank"
onClick={() => {
if (window.RepoApi !== undefined) {
window.RepoApi.installRepo(url)
} else {
window.open(`cloudstreamrepo://${url.replace(/^https?:\/\//, "")}`)
}
}}
>Install</CompatBtn>
<CompatBtn group={true}
onClick={() => {
@ -51,4 +56,4 @@ const RepoCard = ({ url, isFirst }) => {
</article>
}
export default RepoCard
export default RepoCard