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.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.ts')
-rw-r--r-- | src/utils.ts | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/utils.ts b/src/utils.ts index 7b3a3841..c96a7772 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -2,10 +2,8 @@ import Config, { VideoDownvotes } from "./config"; import { CategorySelection, SponsorTime, BackgroundScriptContainer, Registration, VideoID, SponsorHideType, CategorySkipOption } from "./types"; import { getHash, HashedValue } from "../maze-utils/src/hash"; -import * as CompileConfig from "../config.json"; import { isFirefoxOrSafari, waitFor } from "../maze-utils/src"; import { findValidElementFromSelector } from "../maze-utils/src/dom"; -import { FetchResponse, sendRequestToCustomServer } from "../maze-utils/src/background-request-proxy" import { isSafari } from "../maze-utils/src/config"; export default class Utils { @@ -240,50 +238,6 @@ export default class Utils { return permissionRegex; } - /** - * Sends a request to a custom server - * - * @param type The request type. "GET", "POST", etc. - * @param address The address to add to the SponsorBlock server address - * @param callback - */ - asyncRequestToCustomServer(type: string, url: string, data = {}): Promise<FetchResponse> { - return sendRequestToCustomServer(type, url, data); - } - - /** - * Sends a request to the SponsorBlock server with address added as a query - * - * @param type The request type. "GET", "POST", etc. - * @param address The address to add to the SponsorBlock server address - * @param callback - */ - async asyncRequestToServer(type: string, address: string, data = {}): Promise<FetchResponse> { - const serverAddress = Config.config.testingServer ? CompileConfig.testingServerAddress : Config.config.serverAddress; - - return await (this.asyncRequestToCustomServer(type, serverAddress + address, data)); - } - - /** - * Sends a request to the SponsorBlock server with address added as a query - * - * @param type The request type. "GET", "POST", etc. - * @param address The address to add to the SponsorBlock server address - * @param callback - */ - sendRequestToServer(type: string, address: string, callback?: (response: FetchResponse) => void): void { - const serverAddress = Config.config.testingServer ? CompileConfig.testingServerAddress : Config.config.serverAddress; - - // Ask the background script to do the work - chrome.runtime.sendMessage({ - message: "sendRequest", - type, - url: serverAddress + address - }, (response) => { - callback(response); - }); - } - findReferenceNode(): HTMLElement { const selectors = [ "#player-container-id", // Mobile YouTube |