mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 19:30:45 -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
|