mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 21:47:06 +03:00
Also check license status for submitting chapter
This commit is contained in:
@@ -7,6 +7,7 @@ import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
|
|||||||
import { RectangleTooltip } from "../render/RectangleTooltip";
|
import { RectangleTooltip } from "../render/RectangleTooltip";
|
||||||
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
|
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
|
||||||
import { GenericUtils } from "../utils/genericUtils";
|
import { GenericUtils } from "../utils/genericUtils";
|
||||||
|
import { noRefreshFetchingChaptersAllowed } from "../utils/licenseKey";
|
||||||
|
|
||||||
|
|
||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
@@ -402,7 +403,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
for (const category of (this.props.categoryList ?? CompileConfig.categoryList)) {
|
for (const category of (this.props.categoryList ?? CompileConfig.categoryList)) {
|
||||||
// If permission not loaded, treat it like we have permission except chapter
|
// If permission not loaded, treat it like we have permission except chapter
|
||||||
const defaultBlockCategories = ["chapter"];
|
const defaultBlockCategories = ["chapter"];
|
||||||
const permission = Config.config.permissions[category as Category];
|
const permission = Config.config.permissions[category as Category] && (category !== "chapter" || noRefreshFetchingChaptersAllowed());
|
||||||
if ((defaultBlockCategories.includes(category) || permission !== undefined) && !permission) continue;
|
if ((defaultBlockCategories.includes(category) || permission !== undefined) && !permission) continue;
|
||||||
|
|
||||||
elements.push(
|
elements.push(
|
||||||
|
|||||||
@@ -22,6 +22,13 @@ export async function checkLicenseKey(licenseKey: string): Promise<boolean> {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The other one also tried refreshing, so returns a promise
|
||||||
|
*/
|
||||||
|
export function noRefreshFetchingChaptersAllowed(): boolean {
|
||||||
|
return Config.config.payments.chaptersAllowed || CompileConfig["freeChapterAccess"];
|
||||||
|
}
|
||||||
|
|
||||||
export async function fetchingChaptersAllowed(): Promise<boolean> {
|
export async function fetchingChaptersAllowed(): Promise<boolean> {
|
||||||
if (Config.config.payments.freeAccess || CompileConfig["freeChapterAccess"]) {
|
if (Config.config.payments.freeAccess || CompileConfig["freeChapterAccess"]) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user