UNPKG

cozy-proxy

Version:

Cozy Proxy redirects requests properly to the right application of the Cozy platform depending on given path. It also handles authentication to the Cozy for users and devices.

95 lines (85 loc) 1.88 kB
// Generated by CoffeeScript 1.10.0 var apps, auth, devices, disk, experiment, index, passport, utils; index = require('./index'); auth = require('./authentication'); devices = require('./devices'); disk = require('./disk'); apps = require('./applications'); experiment = require('./experimental'); utils = require('../middlewares/authentication'); passport = require('passport'); module.exports = { 'routes': { get: index.showRoutes }, 'routes/reset*': { get: index.resetRoutes }, 'register': { get: [utils.isNotAuthenticated, auth.registerIndex], post: [auth.register, utils.authenticate] }, 'login': { get: [utils.isNotAuthenticated, auth.loginIndex], post: utils.authenticate }, 'login/forgot': { post: auth.forgotPassword }, 'logout': { get: [utils.isAuthenticated, auth.logout] }, 'password/reset/:key': { get: auth.resetPasswordIndex, post: auth.resetPassword }, 'authenticated': { get: auth.authenticated }, 'status': { get: index.status }, 'public/:name/*': { all: apps.publicApp }, 'public/:name*': { all: apps.appWithSlash }, 'disk-space': { get: disk.getSpace }, 'device': { post: devices.create }, 'device/:login': { put: devices.update, "delete": devices.remove }, 'apps/:name/*': { all: [utils.isAuthenticated, apps.app] }, 'apps/:name*': { all: [utils.isAuthenticated, apps.appWithSlash] }, 'replication/*': { all: devices.replication }, 'ds-api/*': { all: devices.dsApi }, 'versions': { get: devices.getVersions }, 'cozy/*': { all: devices.oldReplication }, '.well-known/host-meta.?:ext': { get: experiment.webfingerHostMeta }, '.well-known/:module': { all: experiment.webfingerAccount }, '*': { all: [utils.isAuthenticated, index.defaultRedirect] } };