add mirror view and subscribe buttons

ref #467
This commit is contained in:
Collin Barrett 2018-09-09 20:21:17 -05:00
parent 2df84ff68b
commit 8586e45280

View file

@ -76,7 +76,11 @@ function ListInfo(props: any) {
function ListUrls(props: any) {
return <div className="col-3 p-0 btn-group-vertical justify-content-start d-flex align-items-end">
<SubscribeUrl url={props.details.viewUrl} name={props.details.name}/>
<SubscribeUrlMirror url={props.details.viewUrlMirror1} name={props.details.name}/>
<SubscribeUrlMirror url={props.details.viewUrlMirror2} name={props.details.name}/>
<ViewUrl url={props.details.viewUrl} name={props.details.name}/>
<ViewUrlMirror url={props.details.viewUrlMirror1} name={props.details.name}/>
<ViewUrlMirror url={props.details.viewUrlMirror2} name={props.details.name}/>
<HomeUrl url={props.details.homeUrl} name={props.details.name}/>
<PolicyUrl url={props.details.policyUrl} name={props.details.name}/>
<DonateUrl url={props.details.donateUrl} name={props.details.name}/>
@ -199,6 +203,30 @@ function SubscribeUrl(props: any) {
}
};
function SubscribeUrlMirror(props: any) {
return props.url
? props.url.indexOf("https://") === -1
? SubscribeUrlNotSecure()
: SubscribeUrlSecondary()
: null;
function SubscribeUrlSecondary() {
return <a href={`abp:subscribe?location=${encodeURIComponent(props.url)}&amp;title=${encodeURIComponent(props.name)}`}
className="btn btn-secondary btn-block fl-btn-details-action"
title={`Mirror - Subscribe to list with browser extension supporting \"abp:\" protocol (e.g. uBlock Origin, AdBlock Plus).`}>
Subscribe
</a>;
}
function SubscribeUrlNotSecure() {
return <a href={`abp:subscribe?location=${encodeURIComponent(props.url)}&amp;title=${encodeURIComponent(props.name)}`}
className="btn btn-danger btn-block fl-btn-details-action"
title={`Mirrow - Not Secure - Subscribe to list with browser extension supporting \"abp:\" protocol (e.g. uBlock Origin, AdBlock Plus).`}>
Subscribe
</a>;
}
};
function ViewUrl(props: any) {
return props.url.indexOf("https://") === -1
? ViewUrlNotSecure()
@ -231,6 +259,30 @@ function ViewUrl(props: any) {
}
};
function ViewUrlMirror(props: any) {
return props.url
? props.url.indexOf("https://") === -1
? ViewUrlNotSecure()
: viewUrlSecondary()
: null;
function viewUrlSecondary() {
return <a href={props.url}
className="btn btn-secondary fl-btn-details-action"
title={`Mirror - View ${props.name} in its raw format.`}>
View
</a>;
}
function ViewUrlNotSecure() {
return <a href={props.url}
className="btn btn-danger fl-btn-details-action"
title={`Mirror - Not Secure - View ${props.name} in its raw format.`}>
View
</a>;
}
};
function HomeUrl(props: any) {
return props.url
? <a href={props.url} className="btn btn-primary fl-btn-details-action"
@ -390,6 +442,8 @@ interface IFilterListDetailsDto {
tags: IListTagDto[];
updatedDate: string;
viewUrl: string;
viewUrlMirror1: string;
viewUrlMirror2: string;
}
interface IListLicenseDto {