Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) {
if ( request.type == msg.MESSAGE_ACTION.WebDAV ) {
const { url, user, password, method } = request.value;
const dav = new WebDAV.Fs( url, user, password );
if ( method.type == "folder" ) {
dav.dir( method.root ).mkdir( result => {
sendResponse({ done: result, status: result.status });
})
} else if ( method.type == "file" ) {
dav.file( method.root + "/" + method.name ).write( method.content, result => {
sendResponse({ done: result, status: result.status });
});
}
}
//return true;
});