-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0664554
commit 9114666
Showing
13 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { WebDAVServer } from '../server/v2/export'; | ||
export declare function express(root: string, server: WebDAVServer, options: any): (req: any, res: any, next: any) => any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Path_1 = require("../manager/v2/Path"); | ||
function express(root, server, options) { | ||
var path = new Path_1.Path(root).toString(false); | ||
var pathRegex = new RegExp('^(' + path + ')((\/[^\/]+)*)\/?$'); | ||
return function (req, res, next) { | ||
var matches = pathRegex.exec(req.url); | ||
if (!matches) | ||
return next(); | ||
var root = matches[1]; | ||
var subUrl = matches[2]; | ||
req.url = new Path_1.Path(subUrl).toString(false); | ||
server.executeRequest(req, res, root); | ||
}; | ||
} | ||
exports.express = express; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { WebDAVServer } from '../server/v2/export'; | ||
/** | ||
* Mount a WebDAVServer instance on a ExpressJS server. | ||
* | ||
* @param root Root path of the mount | ||
* @param server Server to mount | ||
*/ | ||
export declare function express(root: string, server: WebDAVServer): (req: any, res: any, next: any) => any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Path_1 = require("../manager/v2/Path"); | ||
/** | ||
* Mount a WebDAVServer instance on a ExpressJS server. | ||
* | ||
* @param root Root path of the mount | ||
* @param server Server to mount | ||
*/ | ||
function express(root, server) { | ||
var path = new Path_1.Path(root).toString(false); | ||
var pathRegex = new RegExp('^' + path + '((\/[^\/]+)*)\/?$'); | ||
return function (req, res, next) { | ||
var matches = pathRegex.exec(req.url); | ||
if (!matches) | ||
return next(); | ||
var subUrl = matches[1]; | ||
req.url = new Path_1.Path(subUrl).toString(false); | ||
server.executeRequest(req, res, path); | ||
}; | ||
} | ||
exports.express = express; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Express'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Express")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Express'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Express")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { WebDAVServer } from '../server/v2/export' | ||
import { Path } from '../manager/v2/Path' | ||
|
||
/** | ||
* Mount a WebDAVServer instance on a ExpressJS server. | ||
* | ||
* @param root Root path of the mount | ||
* @param server Server to mount | ||
*/ | ||
export function express(root : string, server : WebDAVServer) | ||
{ | ||
const path = new Path(root).toString(false); | ||
|
||
const pathRegex = new RegExp('^' + path + '((\/[^\/]+)*)\/?$'); | ||
|
||
return function(req, res, next) | ||
{ | ||
const matches = pathRegex.exec(req.url); | ||
if(!matches) | ||
return next(); | ||
|
||
const subUrl = matches[1]; | ||
|
||
req.url = new Path(subUrl).toString(false); | ||
|
||
server.executeRequest(req, res, path); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
export * from './Express' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters