LCOV - code coverage report
Current view: top level - src/platform/workflowErrors/missingModel - modelUrlAllowlist.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 4 4
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1         2355 : const ALLOWED_SOURCES = [
       2              :   'https://civitai.com/',
       3              :   'https://civitai.red/',
       4              :   'https://huggingface.co/'
       5              : ] as const
       6              : 
       7              : /** Exact model URLs the editor downloads from outside the allowed sources. */
       8         2355 : export const WHITE_LISTED_URLS: ReadonlySet<string> = new Set([
       9              :   'https://huggingface.co/stabilityai/stable-zero123/resolve/main/stable_zero123.ckpt',
      10              :   'https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth?download=true',
      11              :   'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth',
      12              :   'http://localhost:8188/api/devtools/fake_model.safetensors'
      13              : ])
      14              : 
      15              : /** Whether the editor may download a model from this URL. */
      16         2902 : export function isModelUrlAllowlisted(url: string): boolean {
      17         2902 :   return (
      18              :     WHITE_LISTED_URLS.has(url) ||
      19              :     ALLOWED_SOURCES.some((source) => url.startsWith(source))
      20              :   )
      21              : }
        

Generated by: LCOV version 2.0-1