web-shield.js
Version:
Content security library to prevent downloading videos, copying text, and saving images
106 lines (101 loc) • 2.98 kB
TypeScript
interface VideoOptions$1 {
preventRightClick?: boolean;
hideControls?: boolean;
disableDevTools?: boolean;
targetSelector?: string;
observeDynamicContent?: boolean;
}
declare class VideoShield {
private options;
private eventListeners;
private styleElement;
private mutationObserver;
constructor(options?: VideoOptions$1);
private initialize;
private protectVideoElements;
private interceptMediaElements;
private setupMutationObserver;
disable(): void;
}
interface TextOptions$1 {
preventSelection?: boolean;
preventCopy?: boolean;
preventPrintScreen?: boolean;
targetSelector?: string;
observeDynamicContent?: boolean;
}
declare class TextShield {
private options;
private eventListeners;
private styleElement;
private mutationObserver;
constructor(options?: TextOptions$1);
private initialize;
private applySelectionProtection;
private protectTextElements;
private applyCopyProtection;
private applyPrintScreenProtection;
private setupMutationObserver;
disable(): void;
}
interface ImageOptions$1 {
preventRightClick?: boolean;
preventDrag?: boolean;
addWatermark?: boolean | string;
targetSelector?: string;
observeDynamicContent?: boolean;
convertToCanvas?: boolean;
}
declare class ImageShield {
private options;
private eventListeners;
private watermarkElements;
private mutationObserver;
constructor(options?: ImageOptions$1);
private initialize;
private protectImageElements;
private applyWatermark;
private convertImageToCanvas;
private replaceWithCanvas;
private setupMutationObserver;
disable(): void;
}
interface WebShieldOptions {
video?: boolean | VideoOptions;
text?: boolean | TextOptions;
image?: boolean | ImageOptions;
observeDynamicContent?: boolean;
}
interface VideoOptions {
preventRightClick?: boolean;
hideControls?: boolean;
disableDevTools?: boolean;
targetSelector?: string;
observeDynamicContent?: boolean;
}
interface TextOptions {
preventSelection?: boolean;
preventCopy?: boolean;
preventPrintScreen?: boolean;
targetSelector?: string;
observeDynamicContent?: boolean;
}
interface ImageOptions {
preventRightClick?: boolean;
preventDrag?: boolean;
addWatermark?: boolean | string;
targetSelector?: string;
observeDynamicContent?: boolean;
}
declare class WebShield {
private static readonly VERSION;
private options;
private videoShield;
private textShield;
private imageShield;
constructor(options?: WebShieldOptions);
private initialize;
private verifyIntegrity;
disable(): void;
}
export { type ImageOptions, ImageShield, type TextOptions, TextShield, type VideoOptions, VideoShield, type WebShieldOptions, WebShield as default };