Browse Source

initial commit

master
ale 3 years ago
commit
7f6f850b2a
6 changed files with 68 additions and 0 deletions
  1. +2
    -0
      .gitignore
  2. +17
    -0
      README.md
  3. +5
    -0
      config.js
  4. +24
    -0
      index.js
  5. +20
    -0
      package.json
  6. +0
    -0
      public/.gitignore

+ 2
- 0
.gitignore View File

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

+ 17
- 0
README.md 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
- 0
config.js View File

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

+ 24
- 0
index.js 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
- 0
package.json 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
- 0
public/.gitignore View File


Loading…
Cancel
Save