Skip to content

Commit

Permalink
feat(plugin): support webdav
Browse files Browse the repository at this point in the history
  • Loading branch information
reruin committed Oct 9, 2021
1 parent 9eba287 commit 9e08099
Show file tree
Hide file tree
Showing 7 changed files with 2,151 additions and 1,228 deletions.
20 changes: 8 additions & 12 deletions packages/sharelist-plugin/lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ const cache = {}
module.exports = (app) => {
const { onListed, config, driver, utils: { yaml, safeCall } } = app

onListed(async (file, query) => {

if (file.error) return file

let hit = file?.files.find(i => i.name == config.acl_file)

onListed(async (data, query) => {
let hit = data?.files.find(i => i.name == config.acl_file)
if (hit) {
let { auth } = query
let auth = query?.auth

if (auth) {
let content
Expand All @@ -34,21 +30,21 @@ module.exports = (app) => {
})
}

console.log(content, auth)
if (content) {
cache[hit.id] = content

if (authMethods?.[content.type]('' + auth, content.data, app)) {
return file
return req
}
}

file.error = { code: 401, message: 'Invalid password' }
return { error: { code: 401, message: 'Invalid password' } }
} else {
file.error = { code: 401 }
return { error: { code: 401, message: 'Invalid password' } }
}

}

return data
})

}
Loading

0 comments on commit 9e08099

Please sign in to comment.