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 {
|
class SecureFile {
|
||||||
constructor(server, username, private_key) {
|
constructor(server, username, private_key) {
|
||||||
this.Server = server;
|
this.Server = server;
|
||||||
|
if (this.Server.endsWith("/")) {
|
||||||
|
this.Server += "api";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Server += "/api";
|
||||||
|
}
|
||||||
this.Username = username;
|
this.Username = username;
|
||||||
this.PrivateKey = private_key;
|
this.PrivateKey = private_key;
|
||||||
}
|
}
|
||||||
|
5
index.ts
5
index.ts
@ -23,6 +23,11 @@ export default class SecureFile {
|
|||||||
private PrivateKey: string;
|
private PrivateKey: string;
|
||||||
constructor(server: string, username: string, private_key: string) {
|
constructor(server: string, username: string, private_key: string) {
|
||||||
this.Server = server;
|
this.Server = server;
|
||||||
|
if (this.Server.endsWith("/")) {
|
||||||
|
this.Server += "api";
|
||||||
|
} else {
|
||||||
|
this.Server += "/api";
|
||||||
|
}
|
||||||
this.Username = username;
|
this.Username = username;
|
||||||
this.PrivateKey = private_key;
|
this.PrivateKey = private_key;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "secure-file-wrapper",
|
"name": "secure-file-wrapper",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
2
test.js
2
test.js
@ -20,7 +20,7 @@ module.exports = {
|
|||||||
setUp: function (finished) {
|
setUp: function (finished) {
|
||||||
let pk = fs_1.readFileSync("./private.pem");
|
let pk = fs_1.readFileSync("./private.pem");
|
||||||
private_key = pk.toString("utf8");
|
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();
|
finished();
|
||||||
},
|
},
|
||||||
create: async function (test) {
|
create: async function (test) {
|
||||||
|
2
test.ts
2
test.ts
@ -39,7 +39,7 @@ module.exports = {
|
|||||||
setUp: function (finished) {
|
setUp: function (finished) {
|
||||||
let pk = readFileSync("./private.pem");
|
let pk = readFileSync("./private.pem");
|
||||||
private_key = pk.toString("utf8");
|
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();
|
finished();
|
||||||
},
|
},
|
||||||
create: async function (test: TestType) {
|
create: async function (test: TestType) {
|
||||||
|
Reference in New Issue
Block a user