overleaf/services/web/app/coffee/Features/Helpers/UrlHelper.coffee
Paulo Jorge Reis af2d959504 Merge pull request #1072 from sharelatex/spd-open-with-overleaf
Implement v1 open-with-overleaf API in v2 (part 1)

GitOrigin-RevId: 488f4eeefc29086a72295ccbc7c63d2f927add12
2018-11-15 10:04:33 +00:00

14 lines
No EOL
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