bump types
This commit is contained in:
parent
2b5ad8287d
commit
2221bfade6
4 changed files with 28 additions and 48 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@equicord/types",
|
||||
"private": false,
|
||||
"version": "1.14.1",
|
||||
"version": "1.14.2",
|
||||
"description": "",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
"type-fest": "^4.35.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "18.3.1",
|
||||
"@types/react-dom": "18.3.1"
|
||||
"@types/react": "^19.0.10",
|
||||
"@types/react-dom": "19.0.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
34
pnpm-lock.yaml
generated
34
pnpm-lock.yaml
generated
|
|
@ -201,14 +201,14 @@ importers:
|
|||
specifier: ^22.13.4
|
||||
version: 22.13.13
|
||||
'@types/react':
|
||||
specifier: 18.3.1
|
||||
version: 18.3.1
|
||||
specifier: ^19.0.10
|
||||
version: 19.0.12
|
||||
'@types/react-dom':
|
||||
specifier: 18.3.1
|
||||
version: 18.3.1
|
||||
specifier: 19.0.4
|
||||
version: 19.0.4(@types/react@19.0.12)
|
||||
'@vencord/discord-types':
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(@types/react@18.3.1)
|
||||
version: 1.0.0(@types/react@19.0.12)
|
||||
highlight.js:
|
||||
specifier: 11.11.1
|
||||
version: 11.11.1
|
||||
|
|
@ -789,20 +789,11 @@ packages:
|
|||
'@types/node@24.10.1':
|
||||
resolution: {integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==}
|
||||
|
||||
'@types/prop-types@15.7.15':
|
||||
resolution: {integrity: sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==}
|
||||
|
||||
'@types/react-dom@18.3.1':
|
||||
resolution: {integrity: sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ==}
|
||||
|
||||
'@types/react-dom@19.0.4':
|
||||
resolution: {integrity: sha512-4fSQ8vWFkg+TGhePfUzVmat3eC14TXYSsiiDSLI0dVLsrm9gZFABjPy/Qu6TKgl1tq1Bu1yDsuQgY3A3DOjCcg==}
|
||||
peerDependencies:
|
||||
'@types/react': ^19.0.0
|
||||
|
||||
'@types/react@18.3.1':
|
||||
resolution: {integrity: sha512-V0kuGBX3+prX+DQ/7r2qsv1NsdfnCLnTgnRJ1pYnxykBhGMz+qj+box5lq7XsO5mtZsBqpjwwTu/7wszPfMBcw==}
|
||||
|
||||
'@types/react@19.0.12':
|
||||
resolution: {integrity: sha512-V6Ar115dBDrjbtXSrS+/Oruobc+qVbbUxDFC1RSbRqLt5SYvxxyIDrSC85RWml54g+jfNeEMZhEj7wW07ONQhA==}
|
||||
|
||||
|
|
@ -3118,21 +3109,10 @@ snapshots:
|
|||
dependencies:
|
||||
undici-types: 7.16.0
|
||||
|
||||
'@types/prop-types@15.7.15': {}
|
||||
|
||||
'@types/react-dom@18.3.1':
|
||||
dependencies:
|
||||
'@types/react': 19.0.12
|
||||
|
||||
'@types/react-dom@19.0.4(@types/react@19.0.12)':
|
||||
dependencies:
|
||||
'@types/react': 19.0.12
|
||||
|
||||
'@types/react@18.3.1':
|
||||
dependencies:
|
||||
'@types/prop-types': 15.7.15
|
||||
csstype: 3.1.3
|
||||
|
||||
'@types/react@19.0.12':
|
||||
dependencies:
|
||||
csstype: 3.1.3
|
||||
|
|
@ -3255,9 +3235,9 @@ snapshots:
|
|||
vscode-oniguruma: 1.7.0
|
||||
vscode-textmate: 5.2.0
|
||||
|
||||
'@vencord/discord-types@1.0.0(@types/react@18.3.1)':
|
||||
'@vencord/discord-types@1.0.0(@types/react@19.0.12)':
|
||||
dependencies:
|
||||
'@types/react': 18.3.1
|
||||
'@types/react': 19.0.12
|
||||
moment: 2.30.1
|
||||
type-fest: 4.41.0
|
||||
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@ import { Constants, Flux, FluxDispatcher, RestAPI } from "@webpack/common";
|
|||
import { RefreshedUrlsResponse } from "./types";
|
||||
import { BatchedRequestQueue, isAllowedHost } from "./utils";
|
||||
|
||||
export interface SignedUrlsStoreType {
|
||||
get(url: string): string | null;
|
||||
addSigned(url: string): void;
|
||||
}
|
||||
|
||||
/** Used for storing and automatically refreshing signed CDN/Media proxy urls ({@link https://docs.discord.food/reference#signed-attachment-urls}). */
|
||||
export const SignedUrlsStore = proxyLazyWebpack(() => {
|
||||
interface Store {
|
||||
get(url: string): string | null;
|
||||
addSigned(url: string): void;
|
||||
}
|
||||
class SignedUrlsStoreClass extends Flux.Store implements SignedUrlsStoreType {
|
||||
public static readonly _expirationThreshold = 60 * 60 * 1000;
|
||||
|
||||
class SignedUrlsStore extends Flux.Store implements Store {
|
||||
private static readonly _expirationThreshold = 60 * 60 * 1000;
|
||||
|
||||
private _urls = new Map<string, string>();
|
||||
private _queue = new BatchedRequestQueue<string>(batch => this._handleBatch(batch), {
|
||||
public _urls = new Map<string, string>();
|
||||
public _queue = new BatchedRequestQueue<string>(batch => this._handleBatch(batch), {
|
||||
maxCount: 50,
|
||||
timeout: 50
|
||||
});
|
||||
|
|
@ -50,27 +50,27 @@ export const SignedUrlsStore = proxyLazyWebpack(() => {
|
|||
else this._update([[`${this._clean(parsed)}`, url]]);
|
||||
}
|
||||
|
||||
private _refresh(url: URL): void {
|
||||
public _refresh(url: URL): void {
|
||||
this._queue.add(`${this._clean(url)}`);
|
||||
}
|
||||
|
||||
private _clean(url: URL): URL {
|
||||
public _clean(url: URL): URL {
|
||||
const clean = new URL(url);
|
||||
clean.search = "";
|
||||
clean.hash = "";
|
||||
return clean;
|
||||
}
|
||||
|
||||
private _isValid(url: URL | null): url is URL {
|
||||
public _isValid(url: URL | null): url is URL {
|
||||
return !!(url && isAllowedHost(url.hostname));
|
||||
}
|
||||
|
||||
private _willExpire(url: URL): boolean {
|
||||
public _willExpire(url: URL): boolean {
|
||||
const expiryTimestamp = parseInt(url.searchParams.get("ex")!, 16) * 1000;
|
||||
return isNaN(expiryTimestamp) || expiryTimestamp - SignedUrlsStore._expirationThreshold < Date.now();
|
||||
return isNaN(expiryTimestamp) || expiryTimestamp - SignedUrlsStoreClass._expirationThreshold < Date.now();
|
||||
}
|
||||
|
||||
private _update(urls: [string, string][]): void {
|
||||
public _update(urls: [string, string][]): void {
|
||||
let hasChanged: boolean = false;
|
||||
|
||||
for (const [url, value] of urls) {
|
||||
|
|
@ -83,7 +83,7 @@ export const SignedUrlsStore = proxyLazyWebpack(() => {
|
|||
if (hasChanged) this.emitChange();
|
||||
}
|
||||
|
||||
private async _handleBatch(batch: string[]): Promise<void> {
|
||||
public async _handleBatch(batch: string[]): Promise<void> {
|
||||
await RestAPI.post({
|
||||
url: Constants.Endpoints.ATTACHMENTS_REFRESH_URLS,
|
||||
body: { attachment_urls: batch },
|
||||
|
|
@ -94,5 +94,5 @@ export const SignedUrlsStore = proxyLazyWebpack(() => {
|
|||
}
|
||||
}
|
||||
|
||||
return new SignedUrlsStore(FluxDispatcher) as Store;
|
||||
return new SignedUrlsStoreClass(FluxDispatcher) as SignedUrlsStoreType;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import { JSX } from "react";
|
|||
|
||||
import Song from ".";
|
||||
|
||||
interface WidgetSongsProps {
|
||||
export interface WidgetSongsProps {
|
||||
user: User;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue