Skip to content

Commit

Permalink
feat(webdav): release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Oct 9, 2021
1 parent 45b780d commit a25898f
Show file tree
Hide file tree
Showing 22 changed files with 876 additions and 0 deletions.
289 changes: 289 additions & 0 deletions packages/sharelist-webdav/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions packages/sharelist-webdav/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@sharelist/webdav",
"version": "0.1.1",
"repository": "https://github.com/reruin/sharelist",
"license": "MIT",
"main": "dist/index.js",
"scripts": {
"dev": "tsc -w -p .",
"build": "rm -rf dist && tsc -p .",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .",
"release": "node ../../scripts/release.js"
},
"devDependencies": {
"@types/koa": "^2.13.4",
"@types/xml2js": "^0.4.9",
"ts-node": "^10.2.1",
"typescript": "^4.3.5"
},
"dependencies": {
"xml2js": "^0.4.23"
}
}
25 changes: 25 additions & 0 deletions packages/sharelist-webdav/src/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import http from 'http'
import { Context, WebDAVDepth } from './types'
import { parseXML } from './operations/shared'

export default (req: http.IncomingMessage, base: string): Context => {
return {
req: req,
depth: req.headers?.depth as WebDAVDepth,
method: (req.method as string || '').toLowerCase(),
path: req.url?.replace(base, ''),
base,
config: {},
get(field: string): string | undefined {
const req: http.IncomingMessage = this.req
switch (field = field.toLowerCase()) {
case 'referer':
case 'referrer':
return req.headers.referrer as string || req.headers.referer || ''
default:
return req.headers[field] as string || ''
}
}
}

}
Loading

0 comments on commit a25898f

Please sign in to comment.