Skip to content

Commit

Permalink
chore: update version
Browse files Browse the repository at this point in the history
  • Loading branch information
fatrex committed Apr 21, 2023
1 parent fefa40e commit 88b1c0b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 46 deletions.
10 changes: 3 additions & 7 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
interface Proxy {
host: string;
port: number;
}
interface SocksProxy extends Proxy {
protocol: 'socks5' | 'socks4';
protocol: 'http' | 'https' | 'socks4' | 'socks5';
}
interface Options {
httpProxy?: Proxy;
httpsProxy?: Proxy;
socksProxy?: SocksProxy;
proxy: Proxy;
}
interface Collection {
name: string;
Expand Down Expand Up @@ -44,4 +40,4 @@ declare class nextdav {
private buildContentsObject;
}

export { Collection, File, Options, Proxy, SocksProxy, nextdav as default };
export { Collection, File, Options, Proxy, nextdav as default };
44 changes: 25 additions & 19 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module.exports = __toCommonJS(src_exports);
// src/nextdav.class.ts
var import_url = require("url");
var import_path = require("path");
var import_crypto = __toESM(require("crypto"));
var import_fast_xml_parser = require("fast-xml-parser");
var import_http_proxy_agent = __toESM(require("http-proxy-agent"));
var import_https_proxy_agent = __toESM(require("https-proxy-agent"));
Expand All @@ -52,27 +51,34 @@ var nextdav = class {
* Create WebDav client
*/
async getClient() {
var _a, _b, _c;
var _a;
const gotModule = await import("got");
let httpAgent;
if ((_a = this.options) == null ? void 0 : _a.httpProxy) {
httpAgent = (0, import_http_proxy_agent.default)(this.options.httpProxy);
}
let httpsAgent;
if ((_b = this.options) == null ? void 0 : _b.httpsProxy) {
httpsAgent = (0, import_https_proxy_agent.default)({
host: this.options.httpsProxy.host,
port: this.options.httpsProxy.port,
secureOptions: import_crypto.default.constants.SSL_OP_LEGACY_SERVER_CONNECT
});
}
if ((_c = this.options) == null ? void 0 : _c.socksProxy) {
httpAgent = new import_socks_proxy_agent.SocksProxyAgent(
`${this.options.socksProxy.protocol}://${this.options.socksProxy.host}:${this.options.socksProxy.port}`
);
httpsAgent = new import_socks_proxy_agent.SocksProxyAgent(
`${this.options.socksProxy.protocol}://${this.options.socksProxy.host}:${this.options.socksProxy.port}`
);
if ((_a = this.options) == null ? void 0 : _a.proxy) {
switch (this.options.proxy.protocol) {
case "http":
httpAgent = (0, import_http_proxy_agent.default)({
host: this.options.proxy.host,
port: this.options.proxy.port
});
break;
case "https":
httpsAgent = (0, import_https_proxy_agent.default)({
host: this.options.proxy.host,
port: this.options.proxy.port
});
break;
case "socks4":
case "socks5":
httpAgent = new import_socks_proxy_agent.SocksProxyAgent(
`${this.options.proxy.protocol}://${this.options.proxy.host}:${this.options.proxy.port}`
);
httpsAgent = new import_socks_proxy_agent.SocksProxyAgent(
`${this.options.proxy.protocol}://${this.options.proxy.host}:${this.options.proxy.port}`
);
break;
}
}
return gotModule.default.extend({
headers: {
Expand Down
44 changes: 25 additions & 19 deletions dist/index.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// src/nextdav.class.ts
import { URL } from "url";
import { join, basename, dirname } from "path";
import crypto from "crypto";
import { XMLParser } from "fast-xml-parser";
import HttpProxyAgent from "http-proxy-agent";
import HttpsProxyAgent from "https-proxy-agent";
Expand All @@ -16,27 +15,34 @@ var nextdav = class {
* Create WebDav client
*/
async getClient() {
var _a, _b, _c;
var _a;
const gotModule = await import("got");
let httpAgent;
if ((_a = this.options) == null ? void 0 : _a.httpProxy) {
httpAgent = HttpProxyAgent(this.options.httpProxy);
}
let httpsAgent;
if ((_b = this.options) == null ? void 0 : _b.httpsProxy) {
httpsAgent = HttpsProxyAgent({
host: this.options.httpsProxy.host,
port: this.options.httpsProxy.port,
secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT
});
}
if ((_c = this.options) == null ? void 0 : _c.socksProxy) {
httpAgent = new SocksProxyAgent(
`${this.options.socksProxy.protocol}://${this.options.socksProxy.host}:${this.options.socksProxy.port}`
);
httpsAgent = new SocksProxyAgent(
`${this.options.socksProxy.protocol}://${this.options.socksProxy.host}:${this.options.socksProxy.port}`
);
if ((_a = this.options) == null ? void 0 : _a.proxy) {
switch (this.options.proxy.protocol) {
case "http":
httpAgent = HttpProxyAgent({
host: this.options.proxy.host,
port: this.options.proxy.port
});
break;
case "https":
httpsAgent = HttpsProxyAgent({
host: this.options.proxy.host,
port: this.options.proxy.port
});
break;
case "socks4":
case "socks5":
httpAgent = new SocksProxyAgent(
`${this.options.proxy.protocol}://${this.options.proxy.host}:${this.options.proxy.port}`
);
httpsAgent = new SocksProxyAgent(
`${this.options.proxy.protocol}://${this.options.proxy.host}:${this.options.proxy.port}`
);
break;
}
}
return gotModule.default.extend({
headers: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextdav",
"version": "0.0.11-dev",
"version": "0.0.12-dev",
"description": "A WebDav client specifically created for Nextcloud",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down

0 comments on commit 88b1c0b

Please sign in to comment.