mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
14 lines
433 B
CoffeeScript
14 lines
433 B
CoffeeScript
|
Settings = require 'settings-sharelatex'
|
||
|
|
||
|
module.exports = UrlHelper =
|
||
|
|
||
|
wrapUrlWithProxy: (url) ->
|
||
|
# TODO: Consider what to do for Community and Enterprise edition?
|
||
|
if !Settings.apis?.linkedUrlProxy?.url?
|
||
|
throw new Error('no linked url proxy configured')
|
||
|
return "#{Settings.apis.linkedUrlProxy.url}?url=#{encodeURIComponent(url)}"
|
||
|
|
||
|
prependHttpIfNeeded: (url) ->
|
||
|
if !url.match('://')
|
||
|
url = 'http://' + url
|
||
|
return url
|