Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloud-filelink.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz (oparoz) <github@oparoz.com>2017-04-11 00:48:59 +0300
committerOlivier Paroz (oparoz) <github@oparoz.com>2017-04-11 00:48:59 +0300
commit790a780c1c451c028ab183deb3ba8a3a80ad257c (patch)
treea68a5d95a6449519289b9fbe63954f2531bb8a80
parent37f887094c1dcbed879add9e0c348be3f8f50c44 (diff)
Various small fixesa-few-fixes
Signed-off-by: Olivier Paroz (oparoz) <github@oparoz.com>
-rw-r--r--README.md2
-rw-r--r--src/components/nsNextcloud.js104
-rw-r--r--src/install.rdf2
3 files changed, 55 insertions, 53 deletions
diff --git a/README.md b/README.md
index 3ae54fc..1ea4830 100644
--- a/README.md
+++ b/README.md
@@ -56,8 +56,6 @@ Once setup is complete, Thunderbird will always ask you if you want to upload bi
## Known issues
* It's not possible to use the same Filelink provider more than once
-* You need to create the folder in Nextcloud yourself
-* Stats will be wrong if the account's storage space is unlimited
* You can only create public links
* Public links will always have the same password
* You cannot edit your Filelink account. You have to delete and re-create it if you need a change (password, folder, link password, port, etc.)
diff --git a/src/components/nsNextcloud.js b/src/components/nsNextcloud.js
index ed7881f..746b629 100644
--- a/src/components/nsNextcloud.js
+++ b/src/components/nsNextcloud.js
@@ -272,14 +272,14 @@ Nextcloud.prototype = {
// XXX: replace this with a better function
let successCb = function () {
let folderExists = function (exists) {
- if (exists) {
- aRequestObserver.onStopRequest(null, this, Cr.NS_OK);
- }
- else {
- aRequestObserver.onStopRequest(null, this, Ci.nsIMsgCloudFileProvider.authErr);
- }
- }.bind(this);
- this._checkFolderExists(folderExists);
+ if (exists) {
+ aRequestObserver.onStopRequest(null, this, Cr.NS_OK);
+ }
+ else {
+ aRequestObserver.onStopRequest(null, this, Ci.nsIMsgCloudFileProvider.authErr);
+ }
+ }.bind(this);
+ this._checkFolderExists(folderExists);
}.bind(this);
let failureCb = function () {
@@ -306,7 +306,7 @@ Nextcloud.prototype = {
return this._maxFileSize;
},
get remainingFileSpace () {
- return this._totalStorage > 0 : this._totalStorage - this._fileSpaceUsed : -1;
+ return this._totalStorage > 0 ? this._totalStorage - this._fileSpaceUsed : -1;
},
get fileSpaceUsed () {
return this._fileSpaceUsed;
@@ -413,7 +413,8 @@ Nextcloud.prototype = {
req.open("GET", this._serverUrl + ":" + this._serverPort + kAuthPath + args, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.setRequestHeader("OCS-APIREQUEST", "true");
- req.setRequestHeader("Authorization", "Basic " + btoa(this._userName + ':' + this._password));
+ req.setRequestHeader("Authorization",
+ "Basic " + btoa(this._userName + ':' + this._password));
req.onerror = function () {
this.log.info("logon failure");
@@ -496,7 +497,7 @@ Nextcloud.prototype = {
* ending states of the upload.
* @private
*/
- _finishUpload: function nsNc__finishUpload (aFile, aCallback) {
+ _finishUpload: function nsNc_finishUpload (aFile, aCallback) {
let exceedsQuota = Ci.nsIMsgCloudFileProvider.uploadWouldExceedQuota;
if ((this._totalStorage > 0) && (aFile.fileSize > this.remainingFileSpace)) {
return aCallback.onStopRequest(null, null, exceedsQuota);
@@ -523,7 +524,7 @@ Nextcloud.prototype = {
* @param failureCallback the function called if information retrieval fails
* @private
*/
- _getUserInfo: function nsNc__getUserInfo (successCallback, failureCallback) {
+ _getUserInfo: function nsNc_getUserInfo (successCallback, failureCallback) {
if (!successCallback) {
successCallback = function () {
this.requestObserver
@@ -589,49 +590,52 @@ Nextcloud.prototype = {
* @returns {NodeList|number}
* @private
*/
- _getQuota: function nsNc__getUserQuota (req, davVariable) {
+ _getQuota: function nsNc_getUserQuota (req, davVariable) {
let quota = req.documentElement.getElementsByTagNameNS("DAV:", davVariable);
return quota && quota.length && Number(quota[0].textContent) || -1;
},
/**
- * A private function that checks that the folder entered in the
- * settings screen exists on the server.
- *
- * @param callback callback function called with true or false as an argument
- */
- _checkFolderExists: function nsOwncloud_checkFolderExists(callback) {
- if (this._storageFolder !== '/') {
- let body = '<propfind xmlns="DAV:">' +
- '<prop>' +
- '<resourcetype />' +
- '</prop>' +
- '</propfind>';
-
- let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
- .createInstance(Ci.nsIXMLHttpRequest);
-
- req.open("PROPFIND", this._serverUrl + kWebDavPath + ("/" + this._storageFolder + "/").replace(/\/+/g,'/'), true, this._userName, this._password);
- req.onerror = function() {
- this.log.info("failure checking folder");
- callback(false);
- }.bind(this);
-
- req.onload = function() {
- if (req.status === 207) {
- return callback(true);
- }
- else {
- return callback(false);
- }
- }.bind(this);
-
- req.send(body);
- }
- else {
- return callback(true);
- }
- },
+ * A private function which makes sure that the folder entered in the
+ * settings screen exists on the server.
+ *
+ * @param callback callback function called with true or false as an argument
+ * @private
+ */
+ _checkFolderExists: function nsNc_checkFolderExists (callback) {
+ if (this._storageFolder !== '/') {
+ let body = '<propfind xmlns="DAV:">' +
+ '<prop>' +
+ '<resourcetype />' +
+ '</prop>' +
+ '</propfind>';
+
+ let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
+ .createInstance(Ci.nsIXMLHttpRequest);
+
+ req.open("PROPFIND", this._serverUrl + kWebDavPath +
+ ("/" + this._storageFolder + "/").replace(/\/+/g, '/'), true, this._userName,
+ this._password);
+ req.onerror = function () {
+ this.log.info("Failed to check if folder exists");
+ callback(false);
+ }.bind(this);
+
+ req.onload = function () {
+ if (req.status === 207) {
+ return callback(true);
+ }
+ else {
+ return callback(false);
+ }
+ }.bind(this);
+
+ req.send(body);
+ }
+ else {
+ return callback(true);
+ }
+ },
/**
* A private function that first ensures that the user is logged in, and then
diff --git a/src/install.rdf b/src/install.rdf
index 67c578f..e318f94 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -21,7 +21,7 @@
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>17.0</em:minVersion>
- <em:maxVersion>55.*</em:maxVersion>
+ <em:maxVersion>45.*</em:maxVersion>
</Description>
</em:targetApplication>