Ver Fonte

add "upload to a WebDAV server" option (fix #103)

Gildas há 3 anos atrás
pai
commit
39f8a2d6ff

+ 27 - 11
_locales/de/messages.json

@@ -536,11 +536,11 @@
 		"description": "Options page label: 'set content security policy'"
 	},
 	"optionSaveToClipboard": {
-		"message": "In die Zwischenablage speichern",
+		"message": "Kopieren in die Zwischenablage",
 		"description": "Options page label: 'copy to clipboard'"
 	},
 	"optionSaveToFilesystem": {
-		"message": "save to filesystem",
+		"message": "Speichern im Dateisystem",
 		"description": "Options page label: 'save to filesystem'"
 	},
 	"optionAddProof": {
@@ -552,43 +552,59 @@
 		"description": "Popup text displayed wen enabling the option 'add proof of existence'"
 	},
 	"optionWoleetKey": {
-		"message": "access token",
+		"message": "Zugangstoken",
 		"description": "Options page label: 'access token'"
 	},
 	"optionSaveToGDrive": {
-		"message": "In Google Drive speichern",
+		"message": "Hochladen auf Google Drive",
 		"description": "Options page label: 'upload to Google Drive'"
 	},
 	"optionSaveToGitHub": {
-		"message": "upload to GitHub",
+		"message": "Hochladen auf GitHub",
 		"description": "Options page label: 'upload to GitHub'"
 	},
 	"optionGitHubToken": {
-		"message": "access token",
+		"message": "Zugangstoken",
 		"description": "Options page label: 'access token'"
 	},
 	"optionGitHubUser": {
-		"message": "user name",
+		"message": "Nutzername",
 		"description": "Options page label: 'user name'"
 	},
 	"optionGitHubRepository": {
-		"message": "repository name",
+		"message": "Repository-Name",
 		"description": "Options page label: 'repository name'"
 	},
 	"optionGitHubBranch": {
-		"message": "branch name",
+		"message": "Zweigname ",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "Hochladen auf einen WebDAV-Server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "Benutzerkennwort",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "Passwort",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "Speichern mit SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"
 	},
 	"optionSaveCreatedBookmarks": {
-		"message": "Die Seite eines neu angelegten Bookmark speichern",
+		"message": "Speichern der Seite eines neu angelegten Lesezeichens",
 		"description": "Options page label: 'save the page of a newly created bookmark'"
 	},
 	"optionReplaceBookmarkURL": {
-		"message": "Das neue Bookmark mit der gespeicherten Seite verlinken",
+		"message": "Verlinken Das neue Bookmark mit der gespeicherten Seite",
 		"description": "Options page label: 'link the new bookmark to the saved page'"
 	},
 	"optionAllowedBookmarkFolders": {

+ 16 - 0
_locales/en/messages.json

@@ -579,6 +579,22 @@
 		"message": "branch name",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "save with SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/es/messages.json

@@ -579,6 +579,22 @@
 		"message": "branch name",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "subir a un servidor WebDAV",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "identificador de usuario",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "contraseña",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "guardar la página con SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/fr/messages.json

@@ -579,6 +579,22 @@
 		"message": "nom de la branche",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "téléverser sur un serveur WebDAV",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "identifiant utilisateur",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "mot de passe",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "sauvegarder avec SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/it/messages.json

@@ -579,6 +579,22 @@
 		"message": "nome branch",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "carica su un server WebDAV",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "identificatore utente",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "salva con SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/ja/messages.json

@@ -579,6 +579,22 @@
 		"message": "branch name",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "save with SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/pl/messages.json

@@ -579,6 +579,22 @@
 		"message": "nazwa gałęzi",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "zapisuj z SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/pt_br/messages.json

@@ -579,6 +579,22 @@
 		"message": "nome de branch",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "salvar via SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/ru/messages.json

@@ -579,6 +579,22 @@
 		"message": "название ветки",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "сохранять с помощью SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/uk/messages.json

@@ -579,6 +579,22 @@
 		"message": "branch name",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "save with SingleFile Companion",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/zh_CN/messages.json

@@ -579,6 +579,22 @@
 		"message": "分支名称",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "使用 SingleFile Companion 保存",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 16 - 0
_locales/zh_TW/messages.json

@@ -579,6 +579,22 @@
 		"message": "分支名稱",
 		"description": "Options page label: 'branch name'"
 	},
+	"optionSaveWithWebDAV": {
+		"message": "upload to a WebDAV server",
+		"description": "Options page label: 'upload to a WebDAV server'"
+	},
+	"optionWebDAVURL": {
+		"message": "URL",
+		"description": "Options page label: 'URL'"
+	},
+	"optionWebDAVUser": {
+		"message": "user identifier",
+		"description": "Options page label: 'user identifier'"
+	},
+	"optionWebDAVPassword": {
+		"message": "password",
+		"description": "Options page label: 'password'"
+	},
 	"optionSaveWithCompanion": {
 		"message": "使用 SingleFile Companion 保存",
 		"description": "Options page label: 'save with SingleFile Companion'"

+ 2 - 0
src/core/bg/autosave.js

@@ -160,6 +160,8 @@ async function saveContent(message, tab) {
 				if (options.saveToGDrive) {
 					const blob = new Blob([pageData.content], { type: "text/html" });
 					await (await downloads.saveToGDrive(message.taskId, pageData.filename, blob, options, {})).uploadPromise;
+				} else if (options.saveWithWebDAV) {
+					await downloads.saveWithWebDAV(message.taskId, pageData.filename, pageData.content, options.webDAVURL, options.webDAVUser, options.webDAVPassword);
 				} else if (options.saveToGitHub) {
 					await (await downloads.saveToGitHub(message.taskId, pageData.filename, pageData.content, options.githubToken, options.githubUser, options.githubRepository, options.githubBranch)).pushPromise;
 				} else if (options.saveWithCompanion) {

+ 4 - 0
src/core/bg/config.js

@@ -86,6 +86,10 @@ const DEFAULT_CONFIG = {
 	saveToClipboard: false,
 	addProof: false,
 	saveToGDrive: false,
+	saveWithWebDAV: false,
+	webDAVURL: "",
+	webDAVUser: "",
+	webDAVPassword: "",
 	saveToGitHub: false,
 	githubToken: "",
 	githubUser: "",

+ 56 - 3
src/core/bg/downloads.js

@@ -21,7 +21,7 @@
  *   Source.
  */
 
-/* global browser, Blob, URL, document */
+/* global browser, Blob, URL, document, fetch, btoa, AbortController */
 
 import * as config from "./config.js";
 import * as bookmarks from "./bookmarks.js";
@@ -51,7 +51,8 @@ export {
 	onMessage,
 	downloadPage,
 	saveToGDrive,
-	saveToGitHub
+	saveToGitHub,
+	saveWithWebDAV
 };
 
 async function onMessage(message, sender) {
@@ -126,7 +127,9 @@ async function downloadTabPage(message, tab) {
 
 async function downloadContent(contents, tab, incognito, message) {
 	try {
-		if (message.saveToGDrive) {
+		if (message.saveWithWebDAV) {
+			await saveWithWebDAV(message.taskId, message.filename, contents.join(""), message.webDAVURL, message.webDAVUser, message.webDAVPassword);
+		} else if (message.saveToGDrive) {
 			await (await saveToGDrive(message.taskId, message.filename, new Blob(contents, { type: MIMETYPE_HTML }), {
 				forceWebAuthFlow: message.forceWebAuthFlow
 			}, {
@@ -209,6 +212,56 @@ async function saveToGitHub(taskId, filename, content, githubToken, githubUser,
 	}
 }
 
+async function saveWithWebDAV(taskId, filename, content, url, username, password) {
+	const taskInfo = business.getTaskInfo(taskId);
+	const controller = new AbortController();
+	const { signal } = controller;
+	const authorization = "Basic " + btoa(username + ":" + password);
+	if (!url.endsWith("/")) {
+		url += "/";
+	}
+	if (!taskInfo || !taskInfo.cancelled) {
+		business.setCancelCallback(taskId, () => controller.abort());
+		try {
+			const response = await sendRequest(url + filename, "PUT", content);
+			if (response.status == 404 && filename.includes("/")) {
+				const filenameParts = filename.split(/\/+/);
+				filenameParts.pop();
+				let path = "";
+				for (const filenamePart of filenameParts) {
+					if (filenamePart) {
+						path += filenamePart;
+						const response = await sendRequest(url + path, "MKCOL");
+						if (response.status >= 400) {
+							throw new Error("Error " + response.status + " (WebDAV)");
+						}
+						path += "/";
+					}
+				}
+				return saveWithWebDAV(taskId, filename, content, url, username, password);
+			} else if (response.status >= 400) {
+				throw new Error("Error " + response.status + " (WebDAV)");
+			} else {
+				return response;
+			}
+		} catch (error) {
+			if (error.name != "AbortError") {
+				throw new Error(error.message + " (WebDAV)");
+			}
+		}
+	}
+
+	function sendRequest(url, method, body) {
+		const headers = {
+			"Authorization": authorization
+		};
+		if (body) {
+			headers["Content-Type"] = "text/html";
+		}
+		return fetch(url, { method, headers, signal, body, credentials: "omit" });
+	}
+}
+
 async function saveToGDrive(taskId, filename, blob, authOptions, uploadOptions) {
 	try {
 		await getAuthInfo(authOptions);

+ 5 - 1
src/core/common/download.js

@@ -36,7 +36,7 @@ async function downloadPage(pageData, options) {
 	if (options.includeInfobar) {
 		pageData.content += await infobar.getScript();
 	}
-	if (options.backgroundSave || options.openEditor || options.saveToGDrive || options.saveToGitHub || options.saveWithCompanion) {
+	if (options.backgroundSave || options.openEditor || options.saveToGDrive || options.saveToGitHub || options.saveWithCompanion || options.saveWithWebDAV) {
 		for (let blockIndex = 0; blockIndex * MAX_CONTENT_SIZE < pageData.content.length; blockIndex++) {
 			const message = {
 				method: "downloads.download",
@@ -46,6 +46,10 @@ async function downloadPage(pageData, options) {
 				filename: pageData.filename,
 				saveToClipboard: options.saveToClipboard,
 				saveToGDrive: options.saveToGDrive,
+				saveWithWebDAV: options.saveWithWebDAV,
+				webDAVURL: options.webDAVURL,
+				webDAVUser: options.webDAVUser,
+				webDAVPassword: options.webDAVPassword,
 				saveToGitHub: options.saveToGitHub,
 				githubToken: options.githubToken,
 				githubUser: options.githubUser,

+ 1 - 1
src/core/content/content.js

@@ -91,7 +91,7 @@ async function savePage(message) {
 			try {
 				const pageData = await processPage(options);
 				if (pageData) {
-					if (((!options.backgroundSave && !options.saveToClipboard) || options.saveToGDrive || options.saveToGitHub || options.saveWithCompanion) && options.confirmFilename) {
+					if (((!options.backgroundSave && !options.saveToClipboard) || options.saveToGDrive || options.saveToGitHub || options.saveWithCompanion || options.saveWithWebDAV) && options.confirmFilename) {
 						pageData.filename = ui.prompt("Save as", pageData.filename) || pageData.filename;
 					}
 					await download.downloadPage(pageData, options);

+ 1 - 1
src/lib/woleet/woleet.js

@@ -22,7 +22,7 @@
  */
 /* global fetch */
 const urlService = "https://api.woleet.io/v1/anchor";
-const apiKey = "";
+const apiKey = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhYzZmZTMzMi0wODNjLTRjZmMtYmYxNC0xNWU5MTJmMWY4OWIiLCJpYXQiOjE1NzYxNzQzNDV9.n31j9ctJj7R1Vjwyc5yd1d6Cmg0NDnpwSaLWsqtZJQA";
 export {
 	anchor
 };

+ 26 - 1
src/ui/bg/ui-options.js

@@ -51,6 +51,10 @@ const saveToFilesystemLabel = document.getElementById("saveToFilesystemLabel");
 const addProofLabel = document.getElementById("addProofLabel");
 const woleetKeyLabel = document.getElementById("woleetKeyLabel");
 const saveToGDriveLabel = document.getElementById("saveToGDriveLabel");
+const saveWithWebDAVLabel = document.getElementById("saveWithWebDAVLabel");
+const webDAVURLLabel = document.getElementById("webDAVURLLabel");
+const webDAVUserLabel = document.getElementById("webDAVUserLabel");
+const webDAVPasswordLabel = document.getElementById("webDAVPasswordLabel");
 const saveToGitHubLabel = document.getElementById("saveToGitHubLabel");
 const githubTokenLabel = document.getElementById("githubTokenLabel");
 const githubUserLabel = document.getElementById("githubUserLabel");
@@ -167,6 +171,10 @@ const saveToClipboardInput = document.getElementById("saveToClipboardInput");
 const addProofInput = document.getElementById("addProofInput");
 const woleetKeyInput = document.getElementById("woleetKeyInput");
 const saveToGDriveInput = document.getElementById("saveToGDriveInput");
+const saveWithWebDAVInput = document.getElementById("saveWithWebDAVInput");
+const webDAVURLInput = document.getElementById("webDAVURLInput");
+const webDAVUserInput = document.getElementById("webDAVUserInput");
+const webDAVPasswordInput = document.getElementById("webDAVPasswordInput");
 const saveToGitHubInput = document.getElementById("saveToGitHubInput");
 const githubTokenInput = document.getElementById("githubTokenInput");
 const githubUserInput = document.getElementById("githubUserInput");
@@ -440,6 +448,7 @@ saveToFilesystemInput.addEventListener("click", () => disableDestinationPermissi
 saveToClipboardInput.addEventListener("click", () => disableDestinationPermissions(["nativeMessaging"]), false);
 saveWithCompanionInput.addEventListener("click", () => disableDestinationPermissions(["clipboardWrite"]), false);
 saveToGDriveInput.addEventListener("click", () => disableDestinationPermissions(["clipboardWrite", "nativeMessaging"], false), false);
+saveWithWebDAVInput.addEventListener("click", () => disableDestinationPermissions(["clipboardWrite", "nativeMessaging"]), false);
 saveCreatedBookmarksInput.addEventListener("click", saveCreatedBookmarks, false);
 passReferrerOnErrorInput.addEventListener("click", passReferrerOnError, false);
 autoSaveExternalSaveInput.addEventListener("click", () => enableExternalSave(autoSaveExternalSaveInput), false);
@@ -498,6 +507,7 @@ document.body.onchange = async event => {
 		}
 	}
 };
+
 addProfileButton.title = browser.i18n.getMessage("profileAddButtonTooltip");
 deleteProfileButton.title = browser.i18n.getMessage("profileDeleteButtonTooltip");
 renameProfileButton.title = browser.i18n.getMessage("profileRenameButtonTooltip");
@@ -525,6 +535,10 @@ saveToFilesystemLabel.textContent = browser.i18n.getMessage("optionSaveToFilesys
 addProofLabel.textContent = browser.i18n.getMessage("optionAddProof");
 woleetKeyLabel.textContent = browser.i18n.getMessage("optionWoleetKey");
 saveToGDriveLabel.textContent = browser.i18n.getMessage("optionSaveToGDrive");
+saveWithWebDAVLabel.textContent = browser.i18n.getMessage("optionSaveWithWebDAV");
+webDAVURLLabel.textContent = browser.i18n.getMessage("optionWebDAVURL");
+webDAVUserLabel.textContent = browser.i18n.getMessage("optionWebDAVUser");
+webDAVPasswordLabel.textContent = browser.i18n.getMessage("optionWebDAVPassword");
 saveToGitHubLabel.textContent = browser.i18n.getMessage("optionSaveToGitHub");
 githubTokenLabel.textContent = browser.i18n.getMessage("optionGitHubToken");
 githubUserLabel.textContent = browser.i18n.getMessage("optionGitHubUser");
@@ -755,6 +769,13 @@ async function refresh(profileName) {
 	woleetKeyInput.value = profileOptions.woleetKey;
 	woleetKeyInput.disabled = !profileOptions.addProof;
 	saveToGDriveInput.checked = profileOptions.saveToGDrive;
+	saveWithWebDAVInput.checked = profileOptions.saveWithWebDAV;
+	webDAVURLInput.value = profileOptions.webDAVURL;
+	webDAVURLInput.disabled = !profileOptions.saveWithWebDAV;
+	webDAVUserInput.value = profileOptions.webDAVUser;
+	webDAVUserInput.disabled = !profileOptions.saveWithWebDAV;
+	webDAVPasswordInput.value = profileOptions.webDAVPassword;
+	webDAVPasswordInput.disabled = !profileOptions.saveWithWebDAV;
 	saveToGitHubInput.checked = profileOptions.saveToGitHub;
 	githubTokenInput.value = profileOptions.githubToken;
 	githubTokenInput.disabled = !profileOptions.saveToGitHub;
@@ -765,7 +786,7 @@ async function refresh(profileName) {
 	githubBranchInput.value = profileOptions.githubBranch;
 	githubBranchInput.disabled = !profileOptions.saveToGitHub;
 	saveWithCompanionInput.checked = profileOptions.saveWithCompanion;
-	saveToFilesystemInput.checked = !profileOptions.saveToGDrive && !profileOptions.saveToGitHub && !profileOptions.saveWithCompanion && !saveToClipboardInput.checked;
+	saveToFilesystemInput.checked = !profileOptions.saveToGDrive && !profileOptions.saveToGitHub && !profileOptions.saveWithCompanion && !profileOptions.saveToClipboard && !profileOptions.saveWithWebDAV;
 	compressHTMLInput.checked = profileOptions.compressHTML;
 	compressCSSInput.checked = profileOptions.compressCSS;
 	moveStylesInHeadInput.checked = profileOptions.moveStylesInHead;
@@ -870,6 +891,10 @@ async function update() {
 			addProof: addProofInput.checked,
 			woleetKey: woleetKeyInput.value,
 			saveToGDrive: saveToGDriveInput.checked,
+			saveWithWebDAV: saveWithWebDAVInput.checked,
+			webDAVURL: webDAVURLInput.value,
+			webDAVUser: webDAVUserInput.value,
+			webDAVPassword: webDAVPasswordInput.value,
 			saveToGitHub: saveToGitHubInput.checked,
 			githubToken: githubTokenInput.value,
 			githubUser: githubUserInput.value,

+ 14 - 0
src/ui/pages/help.html

@@ -371,6 +371,20 @@
 							the branch on github.io.
 						</p>
 					</li>
+					<li data-options-label="saveWithWebDAVLabel"> <span class="option">Option: upload to a WebDAV
+							server</span>
+						<p>Check this option to save the page on a WebDAV server.</p>
+						<p class="notice">It is recommended to <u>uncheck</u> this option</p>
+					</li>
+					<li data-options-label="webDAVURLLabel"> <span class="option">Option: URL</span>
+						<p>Enter the URL of the WebDAV server.</p>
+					</li>
+					<li data-options-label="webDAVUserLabel"> <span class="option">Option: user identifier</span>
+						<p>Enter your user identifier on the WebDAV server.</p>
+					</li>
+					<li data-options-label="webDAVPasswordLabel"> <span class="option">Option: password</span>
+						<p>Enter your password.</p>
+					</li>
 					<li data-options-label="saveToGDriveLabel"> <span class="option">Option: upload to Google
 							Drive</span>
 						<p>Check this option to save the page on Google Drive.</p>

+ 6 - 3
src/ui/pages/options.css

@@ -32,7 +32,8 @@ button:not([disabled]):hover {
 
 button,
 select,
-input[type=text] {
+input[type=text],
+input[type=password] {
     background-color: transparent;
     border-color: rgb(191, 191, 191);
     border-style: solid;
@@ -58,7 +59,8 @@ input {
     margin-left: 5px;
 }
 
-input[type="text"] {
+input[type="text"],
+input[type="password"] {
     min-width: 70%;
 }
 
@@ -665,7 +667,8 @@ html.maximized {
         opacity: .8;
     }
 
-    input[type="text"] {
+    input[type="text"],
+    input[type="password"] {
         background-color: #fff;
     }
 

+ 16 - 0
src/ui/pages/options.html

@@ -206,6 +206,22 @@
 				<label for="githubBranchInput" id="githubBranchLabel"></label>
 				<input type="text" id="githubBranchInput" class="medium-input">
 			</div>
+			<div class="option">
+				<label for="saveWithWebDAVInput" id="saveWithWebDAVLabel"></label>
+				<input type="radio" id="saveWithWebDAVInput" name="destinationInput">
+			</div>
+			<div class="option second-level">
+				<label for="webDAVURLInput" id="webDAVURLLabel"></label>
+				<input type="text" id="webDAVURLInput" class="medium-input">
+			</div>
+			<div class="option second-level">
+				<label for="webDAVUserInput" id="webDAVUserLabel"></label>
+				<input type="text" id="webDAVUserInput" class="medium-input">
+			</div>
+			<div class="option second-level">
+				<label for="webDAVPasswordInput" id="webDAVPasswordLabel"></label>
+				<input type="password" id="webDAVPasswordInput" class="medium-input">
+			</div>
 			<div class="option">
 				<label for="saveToGDriveInput" id="saveToGDriveLabel"></label>
 				<input type="radio" id="saveToGDriveInput" name="destinationInput">