mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-27 12:13:53 +00:00
And rewrite all the require calls. ```bash git mv src/utils/* packages/@uppy/utils/src sed -i 's/[./]*\/utils\//@uppy\/utils\/lib\//' src/**/*.js # transform (../)*utils → @uppy/utils ```
8 lines
286 B
JavaScript
8 lines
286 B
JavaScript
module.exports = function getSocketHost (url) {
|
|
// get the host domain
|
|
var regex = /^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/
|
|
var host = regex.exec(url)[1]
|
|
var socketProtocol = location.protocol === 'https:' ? 'wss' : 'ws'
|
|
|
|
return `${socketProtocol}://${host}`
|
|
}
|