MCPcopy Create free account
hub / github.com/hackmdio/codimd / extractNoteIdFromReferer

Function extractNoteIdFromReferer

lib/realtime/realtime.js:333–345  ·  view source on GitHub ↗
(referer)

Source from the content-addressed store, hash-verified

331
332function extractNoteIdFromSocket (socket) {
333 function extractNoteIdFromReferer (referer) {
334 if (referer) {
335 const hostUrl = parseUrl(referer)
336 if (!hostUrl) {
337 return false
338 }
339 if (config.urlPath) {
340 return hostUrl.pathname.slice(config.urlPath.length + 1, hostUrl.pathname.length).split('/')[1]
341 }
342 return hostUrl.pathname.split('/')[1]
343 }
344 return false
345 }
346
347 if (!socket || !socket.handshake) {
348 return false

Callers 1

extractNoteIdFromSocketFunction · 0.85

Calls 1

parseUrlFunction · 0.85

Tested by

no test coverage detected