diff --git a/src/redux/thunks/viewer.ts b/src/redux/thunks/viewer.ts index 29aa9fb..5ebbbd3 100644 --- a/src/redux/thunks/viewer.ts +++ b/src/redux/thunks/viewer.ts @@ -282,8 +282,8 @@ export function openCustomViewer(file: FileResponse, viewer: Viewer, preferredVe url = url.replace(`{$${key}}`, vars[key]); } - // if not start with http or https, it's a custom scheme - if (!url.startsWith("http") && !url.startsWith("https")) { + // if url matches custom scheme pattern like nplayer://xxx, use window.location.assign + if (/^(?!https?:\/\/)[a-zA-Z0-9]+:\/\//.test(url)) { window.location.assign(url); return; }