aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils
diff options
context:
space:
mode:
authormini-bomba <[email protected]>2022-10-29 13:18:41 +0200
committermini-bomba <[email protected]>2022-10-29 13:20:51 +0200
commitea73a92fb72973be0a6d4101f229fd75ba6dca34 (patch)
treecc0320357fc796d801efbde813d226246ac50788 /src/utils
parentd68c3659be89e40ed116c868317d05eee819828b (diff)
downloadSponsorBlock-ea73a92fb72973be0a6d4101f229fd75ba6dca34.tar.gz
SponsorBlock-ea73a92fb72973be0a6d4101f229fd75ba6dca34.zip
Use publicID instead of privateID for /userInfo calls
This should reduce the load on the server a bit, as it will no longer have to compute the publicID for each sponsorblock user. This also reduces the list of actions that leak the privateID to the server.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/licenseKey.ts10
-rw-r--r--src/utils/warnings.ts4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/utils/licenseKey.ts b/src/utils/licenseKey.ts
index 7ce41a8a..77eca21d 100644
--- a/src/utils/licenseKey.ts
+++ b/src/utils/licenseKey.ts
@@ -15,7 +15,7 @@ export async function checkLicenseKey(licenseKey: string): Promise<boolean> {
Config.config.showChapterInfoMessage = false;
Config.config.payments.lastCheck = Date.now();
Config.forceSyncUpdate("payments");
-
+
return true;
}
} catch (e) { } //eslint-disable-line no-empty
@@ -43,7 +43,7 @@ export async function fetchingChaptersAllowed(): Promise<boolean> {
return licensePromise;
}
}
-
+
if (Config.config.payments.chaptersAllowed) return true;
if (Config.config.payments.lastCheck === 0 && Date.now() - Config.config.payments.lastFreeCheck > 2 * 24 * 60 * 60 * 1000) {
@@ -53,7 +53,7 @@ export async function fetchingChaptersAllowed(): Promise<boolean> {
// Check for free access if no license key, and it is the first time
const result = await utils.asyncRequestToServer("GET", "/api/userInfo", {
value: "freeChaptersAccess",
- userID: Config.config.userID
+ publicUserID: await utils.getHash(Config.config.userID)
});
try {
@@ -66,7 +66,7 @@ export async function fetchingChaptersAllowed(): Promise<boolean> {
Config.config.payments.chaptersAllowed = true;
Config.config.showChapterInfoMessage = false;
Config.forceSyncUpdate("payments");
-
+
return true;
}
}
@@ -74,4 +74,4 @@ export async function fetchingChaptersAllowed(): Promise<boolean> {
}
return false;
-} \ No newline at end of file
+}
diff --git a/src/utils/warnings.ts b/src/utils/warnings.ts
index f2f2657e..17e919ba 100644
--- a/src/utils/warnings.ts
+++ b/src/utils/warnings.ts
@@ -13,7 +13,7 @@ export interface ChatConfig {
export async function openWarningDialog(contentContainer: ContentContainer): Promise<void> {
const userInfo = await utils.asyncRequestToServer("GET", "/api/userInfo", {
- userID: Config.config.userID,
+ publicUserID: await utils.getHash(Config.config.userID),
values: ["warningReason"]
});
@@ -63,4 +63,4 @@ export async function openWarningDialog(contentContainer: ContentContainer): Pro
export function openChat(config: ChatConfig): void {
window.open("https://chat.sponsor.ajay.app/#" + GenericUtils.objectToURI("", config, false));
-} \ No newline at end of file
+}