Adding new prefix
This commit is contained in:
parent
d778a36ea8
commit
09d996d8bc
6
index.js
6
index.js
@ -6,6 +6,12 @@ const btb = require("blob-to-buffer");
|
||||
class SecureFile {
|
||||
constructor(server, username, private_key) {
|
||||
this.Server = server;
|
||||
if (this.Server.endsWith("/")) {
|
||||
this.Server += "api";
|
||||
}
|
||||
else {
|
||||
this.Server += "/api";
|
||||
}
|
||||
this.Username = username;
|
||||
this.PrivateKey = private_key;
|
||||
}
|
||||
|
5
index.ts
5
index.ts
@ -23,6 +23,11 @@ export default class SecureFile {
|
||||
private PrivateKey: string;
|
||||
constructor(server: string, username: string, private_key: string) {
|
||||
this.Server = server;
|
||||
if (this.Server.endsWith("/")) {
|
||||
this.Server += "api";
|
||||
} else {
|
||||
this.Server += "/api";
|
||||
}
|
||||
this.Username = username;
|
||||
this.PrivateKey = private_key;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "secure-file-wrapper",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"main": "index.js",
|
||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||
"license": "MIT",
|
||||
|
2
test.js
2
test.js
@ -20,7 +20,7 @@ module.exports = {
|
||||
setUp: function (finished) {
|
||||
let pk = fs_1.readFileSync("./private.pem");
|
||||
private_key = pk.toString("utf8");
|
||||
sf = new index_1.default("http://localhost:3005/api", "test", private_key);
|
||||
sf = new index_1.default("http://localhost:3005", "test", private_key);
|
||||
finished();
|
||||
},
|
||||
create: async function (test) {
|
||||
|
2
test.ts
2
test.ts
@ -39,7 +39,7 @@ module.exports = {
|
||||
setUp: function (finished) {
|
||||
let pk = readFileSync("./private.pem");
|
||||
private_key = pk.toString("utf8");
|
||||
sf = new SecureFile("http://localhost:3005/api", "test", private_key);
|
||||
sf = new SecureFile("http://localhost:3005", "test", private_key);
|
||||
finished();
|
||||
},
|
||||
create: async function (test: TestType) {
|
||||
|
Reference in New Issue
Block a user