Add types for inject (#155)

This commit is contained in:
tgt 2024-07-31 21:40:41 -04:00 committed by GitHub
parent 24c872b74a
commit a117b5cf2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

22
uv.d.ts vendored
View file

@ -21,6 +21,23 @@ export type UVEncode = (input: Coded) => string;
*/
export type UVDecode = (input: Coded) => string;
export type UVInject = {
/**
* The host(s) to inject the HTML on.
* This is a regex that's tested against the proxied URL's host.
*/
host: RegExp;
/**
* Where to inject the HTML
* Possible values: `"head" | "body"`
*/
injectTo: "head" | "body";
/**
* The HTML to inject.
*/
html: string;
}
/**
* The Ultraviolet configuration object.
* This interface defines the configuration options for the Ultraviolet library.
@ -88,4 +105,9 @@ export interface UVConfig {
* @defaultValue `Ultraviolet.codec.xor.decode`
*/
decodeUrl?: UVDecode;
/**
* HTML inject settings.
* This property expects an array of `UVInject`.
*/
inject?: UVInject[];
}