@cubetiq/hlt
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -0,1 +1,7 @@ | ||
### 11/11/2022 | ||
- Fixed axios is not a function | ||
- Add generate token with data (clientId, apiKey) to server | ||
- Add generate token with options (-f | --force) to regenerate and override | ||
### 20/10/2022 | ||
@@ -2,0 +8,0 @@ |
@@ -216,2 +216,3 @@ "use strict"; | ||
.option("-p --profile <string>", "setting profile name", PROFILE_DEFAULT) | ||
.option("-f --force", "force to generate new client and token", false) | ||
.action(function (options) { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -248,7 +249,12 @@ var configDir, config, configFilename, configFilePath; | ||
} | ||
if (!!config.token) return [3 /*break*/, 2]; | ||
if (!(!config.token || options.force)) return [3 /*break*/, 2]; | ||
console.log("Generating token..."); | ||
return [4 /*yield*/, (0, sdk_1.getTokenFree)(config.server) | ||
return [4 /*yield*/, (0, sdk_1.getTokenFree)(config.server, { | ||
timestamp: (new Date().getTime()), | ||
clientId: config.clientId, | ||
apiKey: config.apiKey, | ||
}) | ||
.then(function (resp) { | ||
var _a, _b; | ||
console.log("Token generated successfully!"); | ||
if ((_a = resp.data) === null || _a === void 0 ? void 0 : _a.token) { | ||
@@ -255,0 +261,0 @@ config.token = (_b = resp.data) === null || _b === void 0 ? void 0 : _b.token; |
@@ -51,3 +51,3 @@ "use strict"; | ||
exports.getTokenFree = void 0; | ||
var axios = require("axios").default; | ||
var axios = require("axios"); | ||
var getTokenFree = function (baseUrl, data) { | ||
@@ -54,0 +54,0 @@ if (data === void 0) { data = {}; } |
{ | ||
"name": "@cubetiq/hlt", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A lightweight http tunnel client using nodejs and socket.io client", | ||
@@ -5,0 +5,0 @@ "main": "dist/client.js", |
@@ -12,3 +12,3 @@ # CUBETIQ HTTP Tunnel Client | ||
npx @cubetiq/hlt | ||
npx -y @cubetiq/hlt | ||
@@ -29,6 +29,6 @@ ``` | ||
# Initialize a client and token for connect (default's profile) | ||
npx @cubetiq/hlt init | ||
npx -y @cubetiq/hlt init | ||
# Start port 3000 to remote server | ||
npx @cubetiq/hlt start 3000 | ||
npx -y @cubetiq/hlt start 3000 | ||
``` | ||
@@ -38,3 +38,3 @@ | ||
npx @cubetiq/hlt start 3000 -s mytest | ||
npx -y @cubetiq/hlt start 3000 -s mytest | ||
@@ -47,6 +47,6 @@ ```` | ||
# Initialize a client and token for connect (mytest's profile) | ||
npx @cubetiq/hlt init -p mytest | ||
npx -y @cubetiq/hlt init -p mytest | ||
# Start port 3000 to remote server (mytest's profile) | ||
npx @cubetiq/hlt start 3000 -p mytest | ||
npx -y @cubetiq/hlt start 3000 -p mytest | ||
```` | ||
@@ -59,3 +59,3 @@ | ||
```shell | ||
npx @cubetiq/hlt config client new | ||
npx -y @cubetiq/hlt config client new | ||
``` | ||
@@ -66,3 +66,3 @@ | ||
```shell | ||
npx @cubetiq/hlt config token $TOKEN | ||
npx -y @cubetiq/hlt config token $TOKEN | ||
``` | ||
@@ -73,3 +73,3 @@ | ||
```shell | ||
npx @cubetiq/hlt config server https://lt.ctdn.net | ||
npx -y @cubetiq/hlt config server https://lt.ctdn.net | ||
``` | ||
@@ -80,3 +80,3 @@ | ||
```shell | ||
npx @cubetiq/hlt start $YOUR_PORT | ||
npx -y @cubetiq/hlt start $YOUR_PORT | ||
``` | ||
@@ -83,0 +83,0 @@ |
35721
744