@warren-bank/hls-proxy 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,10 +121,12 @@ const parse_manifest = function(m3u8_content, m3u8_url, referer_url, hooks, cach
121
121
  if (embedded_urls && Array.isArray(embedded_urls) && embedded_urls.length) {
122
122
  embedded_urls.forEach(embedded_url => {
123
123
  redirect_embedded_url(embedded_url, hooks, m3u8_url, debug)
124
- finalize_embedded_url(embedded_url, vod_start_at_ms, debug)
125
- encode_embedded_url(embedded_url, redirected_base_url, debug)
126
- get_prefetch_url(embedded_url, should_prefetch_url, prefetch_urls)
127
- modify_m3u8_line(embedded_url, m3u8_lines)
124
+ if (validate_embedded_url(embedded_url)) {
125
+ finalize_embedded_url(embedded_url, vod_start_at_ms, debug)
126
+ encode_embedded_url(embedded_url, redirected_base_url, debug)
127
+ get_prefetch_url(embedded_url, should_prefetch_url, prefetch_urls)
128
+ modify_m3u8_line(embedded_url, m3u8_lines)
129
+ }
128
130
  })
129
131
  }
130
132
 
@@ -291,6 +293,21 @@ const redirect_embedded_url = function(embedded_url, hooks, m3u8_url, debug) {
291
293
  }
292
294
  }
293
295
 
296
+ const validate_embedded_url = function(embedded_url) {
297
+ if (embedded_url.redirected_url === '') {
298
+ return true
299
+ }
300
+ else {
301
+ const url = new URL(
302
+ embedded_url.redirected_url || embedded_url.resolved_match_url
303
+ )
304
+
305
+ const supported_protocols = ['http:','https:']
306
+
307
+ return (url.protocol && (supported_protocols.indexOf(url.protocol.toLowerCase()) >= 0))
308
+ }
309
+ }
310
+
294
311
  const finalize_embedded_url = function(embedded_url, vod_start_at_ms, debug) {
295
312
  if (embedded_url.redirected_url === '') {
296
313
  embedded_url.unencoded_url = ''
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@warren-bank/hls-proxy",
3
3
  "description": "Node.js server to proxy HLS video streams",
4
- "version": "3.3.0",
4
+ "version": "3.3.1",
5
5
  "scripts": {
6
6
  "start": "node hls-proxy/bin/hlsd.js",
7
7
  "sudo": "sudo node hls-proxy/bin/hlsd.js"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@warren-bank/node-process-argv": "^1.2.1",
14
14
  "@warren-bank/node-request": "^2.0.12",
15
- "@warren-bank/url": "^3.1.0",
15
+ "@warren-bank/url": "^3.1.2",
16
16
  "hpagent": "^1.2.0",
17
17
  "tough-cookie": "^3.0.1"
18
18
  },