initial commit

This commit is contained in:
ale 2020-05-25 21:35:21 +02:00
commit 7f6f850b2a
6 changed files with 68 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
package-lock.json

17
README.md Normal file
View File

@ -0,0 +1,17 @@
# WebDAV personal server
## Install
- git clone https://gitea.hatthieves.es/manalejandro/webdav
- cd webdav
- npm i
## Run
- change settings on `config.json`
- npm start
- open http://localhost:8080/dav with [cadaver](http://www.webdav.org/cadaver/) and enjoy :)
### License
- MIT

5
config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
port: 8080,
username: 'user',
password: 'dav'
}

24
index.js Normal file
View File

@ -0,0 +1,24 @@
const config = require('./config'),
webdav = require('webdav-server').v2,
serveIndex = require('serve-index'),
express = require('express'),
app = express(),
userManager = new webdav.SimpleUserManager(),
user = userManager.addUser(config.username, config.password, false),
privilegeManager = new webdav.SimplePathPrivilegeManager(),
server = new webdav.WebDAVServer({
requireAuthentification: true,
httpAuthentication: new webdav.HTTPBasicAuthentication(userManager, 'DAV Auth'),
privilegeManager: privilegeManager,
storageManager: new webdav.PerUserStorageManager(10000),
rootFileSystem: new webdav.PhysicalFileSystem(__dirname + '/public')
})
privilegeManager.setRights(user, '/', ['all'])
app.disable('x-powered-by')
.use('/', webdav.extensions.express('/dav', server))
.use(express.static(__dirname + '/public'), serveIndex('public/', { 'icons': true, view: 'details' }))
.listen(config.port, () => {
console.log('Listening om: ::' + config.port)
})

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"name": "webdav",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "ale",
"license": "MIT",
"private": true,
"repository": {
"url": "https://gitea.hatthieves.es/manalejandro/webdav"
},
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "*",
"serve-index": "*",
"webdav-server": "*"
}
}

0
public/.gitignore vendored Normal file
View File