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

git.mdns.eu/nextcloud/passwords-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius David Wieschollek <passwords.public@mdns.eu>2020-12-23 14:27:52 +0300
committerMarius David Wieschollek <passwords.public@mdns.eu>2020-12-23 14:27:52 +0300
commit4644509da59a2794df5277461b1b8eedc02ab7eb (patch)
tree9fac0782528c785f2f2a8ae1760b03ede91532c3
parent71f138364f84fe1a27db7e26cf3e685a149050c8 (diff)
Replace need for dom element in url parser
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
-rw-r--r--package.json41
-rw-r--r--src/Classes/EnhancedApi.js19
-rw-r--r--src/Classes/SimpleApi.js20
3 files changed, 40 insertions, 40 deletions
diff --git a/package.json b/package.json
index 584ef96..6ef0391 100644
--- a/package.json
+++ b/package.json
@@ -1,22 +1,23 @@
{
- "name": "passwords-client",
- "version": "0.0.10",
- "description": "JS client library for the Nextcloud Passwords app",
- "main": "src/main.js",
- "author": "Marius Wieschollek",
- "license": "ISC",
- "keywords": [
- "crypto",
- "passwords",
- "api",
- "nextcloud"
- ],
- "repository": {
- "type": "git",
- "url": "https://git.mdns.eu/nextcloud/passwords-client.git"
- },
- "dependencies": {
- "eventemitter3": "^3.1.2",
- "libsodium-wrappers": "^0.7.6"
- }
+ "name" : "passwords-client",
+ "version" : "0.0.10",
+ "description" : "JS client library for the Nextcloud Passwords app",
+ "main" : "src/main.js",
+ "author" : "Marius Wieschollek",
+ "license" : "ISC",
+ "keywords" : [
+ "crypto",
+ "passwords",
+ "api",
+ "nextcloud"
+ ],
+ "repository" : {
+ "type": "git",
+ "url" : "https://git.mdns.eu/nextcloud/passwords-client.git"
+ },
+ "dependencies": {
+ "url-parse" : "^1.4.7",
+ "eventemitter3" : "^3.1.2",
+ "libsodium-wrappers": "^0.7.6"
+ }
}
diff --git a/src/Classes/EnhancedApi.js b/src/Classes/EnhancedApi.js
index 301b286..03c5a0d 100644
--- a/src/Classes/EnhancedApi.js
+++ b/src/Classes/EnhancedApi.js
@@ -1,3 +1,4 @@
+import Url from 'url-parse';
import SimpleApi from './SimpleApi';
import Encryption from './Encryption';
import EventEmitter from 'eventemitter3';
@@ -1355,4 +1356,22 @@ export default class EnhancedApi extends SimpleApi {
}
};
}
+
+ // noinspection JSMethodCanBeStatic
+ /**
+ *
+ * @param url
+ * @param component
+ * @returns {*}
+ */
+ parseUrl(url, component = null) {
+ if(url === undefined) return null;
+
+ if(url.indexOf('://') === -1) url = `http://${url}`;
+
+ let link = Url(url);
+ if(component !== null) return link[component];
+
+ return link;
+ }
} \ No newline at end of file
diff --git a/src/Classes/SimpleApi.js b/src/Classes/SimpleApi.js
index a9d569b..0a577c2 100644
--- a/src/Classes/SimpleApi.js
+++ b/src/Classes/SimpleApi.js
@@ -902,26 +902,6 @@ export default class SimpleApi {
/**
*
* @param url
- * @param component
- * @returns {*}
- */
- parseUrl(url, component = null) {
- if(url === undefined) return null;
- let link = document.createElement('a');
-
- if(url.indexOf('://') === -1) url = `http://${url}`;
-
- link.setAttribute('href', url);
-
- if(component !== null) return link[component];
-
- return link;
- }
-
- // noinspection JSMethodCanBeStatic
- /**
- *
- * @param url
* @param data
* @returns {*}
*/