Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types for inject #155

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions uv.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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[];
}