GithubHelp home page GithubHelp logo

webdav's Introduction

WebDav Server

Webdav server with partial Nextcloud DAV emulation layer (image previews/thumbnails generation mainly)

To be used with image gallerys with NextCloud storage support, like:

  • QuickPic (Android)
  • Piktures (Android)

To emulate Nextcloud DAV the following entries must be configured:

  - username: owncloud
    password: owncloud123
    scopes:
      - root: /srv/dav/Photos
        alias: remote.php/webdav
        allow_w: true
      - root: /srv/dav/Photos
        alias: remote.php/dav/files/owncloud
        allow_w: true
      - root: /srv/dav/Photos
        alias: /index.php/core/preview.png
        owncloud_preview: true

See config.yml for configuration example

Building

  1. Clone webdav repo:
git clone https://github.com/faust93/webdav.git
  1. Install dependencies:
$ yay -S go libvips openslide
  1. Build the app:
cd ./webdav
go build

Original README.md

  • Adapted from hacdias/webdav
  • 按个人习惯修改了配置选项,参考FileZilla

Changes

  • 认证和默认用户配置选项删除,必须在users中配置用户
  • 支持单个用户下配置多个路径
    • 伪造虚拟根目录,返回每个路径的别名
    • 利用prefix实现,所以配置文件中不再开放prefix选项
  • 权限参数改为allow_r和allow_w
    • 用户可配置写权限,默认不可写
    • 每个路径可配置读写权限,覆盖用户权限
  • 获取文件列表时跳过无权访问项
    • 原本golang webdav库的walkFS函数遇到无权访问的目录会停止扫描、报错,即使还有部分可访问项尚未扫描
    • Windows下返回syscall.ERROR_ACCESS_DENIED,这里修改为跳过,继续扫描
  • 直接把golang的webdav库拉到项目中做了改动
    • 伪造根目录需要使用webdav库的部分私有方法,仅将其改为公有
    • 跳过无权访问项需要判断错误类型以实现跳过
  • 修改了部分文件名,避免重复

Problems

  • 没有配置参数校验
  • walkFS函数扫描到无权访问项时返回的错误类型与OS有关,实测Mac下会报错

配置文件示例

# Server related settings
address: 0.0.0.0
port: 1111
tls: false
cert: cert.pem
key: key.pem

# CORS configuration
cors:
  enabled: true
  credentials: true
  allowed_headers:
    - Depth
  allowed_hosts:
    - http://localhost:1111
  allowed_methods:
    - GET
  exposed_headers:
    - Content-Length
    - Content-Range

# 密码可以到https://bcrypt-generator.com/生成
# 然后添加"{bcrypt}"前缀
users:
  - username: webdav
    password: 123456
    scopes:
      - root: E:/
        alias: pce
        rules:
          - path: /Downloads
            allow_w: true
      - root: F:/
        alias: pcf
        rules:
          - path: /Downloads
            allow_r: false

webdav's People

Contributors

hacdias avatar mohammed90 avatar travalone avatar faust93 avatar scusi avatar mfrister avatar mikitsu avatar pataquets avatar acez avatar c35sys avatar fzoske avatar lustyn avatar sxueck avatar shunf4 avatar icidasset avatar sartoshi-foot-dao avatar marcio199226 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.