 
 
 
-# add server to shared plugins data and run init
-plugins.runSync 'init'
+
 
 # little help
 server.send = send = (res, next) -> (e, r) ->


auth = plugins.data.auth


cors_middleware = (req, res, next) ->
	res.setHeader 'Access-Control-Allow-Origin', '*'
	res.setHeader 'Access-Control-Allow-Methods', 'GET'
	next()

# build server options
server_options =
	name: 'OAuth Daemon'

	return chain

fixUrl = (ref) -> ref.replace /^([a-zA-Z\-_]+:\/)([^\/])/, '$1/$2'

# add server to shared plugins data and run init
plugins.runSync 'init'

if not plugins.data.hooks["api_cors_middleware"]
	plugins.data.addhook 'api_cors_middleware', (req, res, next) =>
		next()

cors_middleware = (req, res, next) ->
	res.setHeader 'Access-Control-Allow-Origin', '*'
	res.setHeader 'Access-Control-Allow-Methods', 'GET'
	next()

# generated js sdk
server.get config.base + '/download/latest/oauth.js', bootPathCache(), (req, res, next) ->
