diff options
author | Ajay <[email protected]> | 2023-11-08 16:07:59 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2023-11-08 16:07:59 -0500 |
commit | e722ded58a928989bb583ae266acf765c129592c (patch) | |
tree | 28d2dea746c1b764737775564e65ce10b01ef3d4 /src/utils/warnings.ts | |
parent | 6d37180d005f8f1c7691e0567ea4802425ca7569 (diff) | |
download | SponsorBlock-e722ded58a928989bb583ae266acf765c129592c.tar.gz SponsorBlock-e722ded58a928989bb583ae266acf765c129592c.zip |
Add dearrow promo based on title and remove old one
Also refactor requests out to seperate file
Diffstat (limited to 'src/utils/warnings.ts')
-rw-r--r-- | src/utils/warnings.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/utils/warnings.ts b/src/utils/warnings.ts index 72062699..e35c703c 100644 --- a/src/utils/warnings.ts +++ b/src/utils/warnings.ts @@ -3,8 +3,7 @@ import { getHash } from "../../maze-utils/src/hash"; import Config from "../config"; import GenericNotice, { NoticeOptions } from "../render/GenericNotice"; import { ContentContainer } from "../types"; -import Utils from "../utils"; -const utils = new Utils(); +import { asyncRequestToServer } from "./requests"; export interface ChatConfig { displayName: string; @@ -13,14 +12,14 @@ export interface ChatConfig { } export async function openWarningDialog(contentContainer: ContentContainer): Promise<void> { - const userInfo = await utils.asyncRequestToServer("GET", "/api/userInfo", { + const userInfo = await asyncRequestToServer("GET", "/api/userInfo", { publicUserID: await getHash(Config.config.userID), values: ["warningReason"] }); if (userInfo.ok) { const warningReason = JSON.parse(userInfo.responseText)?.warningReason; - const userNameData = await utils.asyncRequestToServer("GET", "/api/getUsername?userID=" + Config.config.userID); + const userNameData = await asyncRequestToServer("GET", "/api/getUsername?userID=" + Config.config.userID); const userName = userNameData.ok ? JSON.parse(userNameData.responseText).userName : ""; const publicUserID = await getHash(Config.config.userID); @@ -43,7 +42,7 @@ export async function openWarningDialog(contentContainer: ContentContainer): Pro { name: chrome.i18n.getMessage("warningConfirmButton"), listener: async () => { - const result = await utils.asyncRequestToServer("POST", "/api/warnUser", { + const result = await asyncRequestToServer("POST", "/api/warnUser", { userID: Config.config.userID, enabled: false }); |