Connect WebDAV in the Tampermonkey/Violentmonkey script.
in userscript:
// @require https://cdn.jsdelivr.net/npm/userscript-with-webdav@latest/index.iife.js
// @grant GM_xmlhttpRequest
// @connect *
or embed:
npm install userscript-with-webdav
When embed:
import Webdav from 'userscript-with-webdav';
class Webdav {
/**
* Constructor
* @param domainURL WebDAV domain
* @param user User name
* @param password User password
*/
constructor(domainURL?: string, user?: string, password?: string);
/**
* Update Config
* @param domainURL WebDAV domain
* @param user User name
* @param password User password
*/
updateConfig(domainURL: string, user: string, password: string): void;
/**
* Download file content
* @param fileURL Relative file URL
* @returns Response
*/
download(fileURL: string): Promise<{
status: number;
data: string;
}>;
/**
* Upload file content
* @param fileURL Relative file URL
* @param data Data
* @returns Response
*/
upload(
fileURL: string,
data: string
): Promise<{
status: number;
data: any;
}>;
}