mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-12 22:47:12 +03:00
Require permission for filler submissions
This commit is contained in:
@@ -1,11 +1,33 @@
|
||||
import { config } from "../config";
|
||||
import { Category } from "../types/segments.model";
|
||||
import { Feature, HashedUserID } from "../types/user.model";
|
||||
import { hasFeature } from "./features";
|
||||
import { isUserVIP } from "./isUserVIP";
|
||||
import { getReputation } from "./reputation";
|
||||
|
||||
export async function canSubmitChapter(userID: HashedUserID): Promise<boolean> {
|
||||
return (await isUserVIP(userID))
|
||||
|| (await getReputation(userID)) > config.minReputationToSubmitChapter
|
||||
|| (await hasFeature(userID, Feature.ChapterSubmitter));
|
||||
interface CanSubmitResult {
|
||||
canSubmit: boolean;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export async function canSubmit(userID: HashedUserID, category: Category): Promise<CanSubmitResult> {
|
||||
switch (category) {
|
||||
case "chapter":
|
||||
return {
|
||||
canSubmit: (await isUserVIP(userID))
|
||||
|| (await getReputation(userID)) > config.minReputationToSubmitChapter
|
||||
|| (await hasFeature(userID, Feature.ChapterSubmitter))
|
||||
};
|
||||
case "filler":
|
||||
return {
|
||||
canSubmit: (await isUserVIP(userID))
|
||||
|| (await getReputation(userID)) > config.minReputationToSubmitFiller
|
||||
|| (await hasFeature(userID, Feature.FillerSubmitter)),
|
||||
reason: "Someone is submitting over 180,000 spam filler submissions and refuses to stop even after talking with them, so we have to restrict it for now. You can request submission access on chat.sponsor.ajay.app, discord.gg/SponsorBlock or matrix.to/#/#sponsor:ajay.app"
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
canSubmit: true
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user