@kevisual/cnb 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/opencode.js +12 -5
- package/dist/routes.js +12 -5
- package/package.json +4 -3
- package/src/cnb-core.ts +11 -5
package/dist/opencode.js
CHANGED
|
@@ -22509,9 +22509,12 @@ class InitEnv2 {
|
|
|
22509
22509
|
InitEnv2.init();
|
|
22510
22510
|
|
|
22511
22511
|
// src/cnb-core.ts
|
|
22512
|
+
var API_BASER_URL = "https://api.cnb.cool";
|
|
22513
|
+
var API_HACK_URL = "https://cnb.cool";
|
|
22514
|
+
|
|
22512
22515
|
class CNBCore {
|
|
22513
|
-
baseURL =
|
|
22514
|
-
hackURL =
|
|
22516
|
+
baseURL = API_BASER_URL;
|
|
22517
|
+
hackURL = API_HACK_URL;
|
|
22515
22518
|
token;
|
|
22516
22519
|
cookie;
|
|
22517
22520
|
constructor(options) {
|
|
@@ -22526,8 +22529,8 @@ class CNBCore {
|
|
|
22526
22529
|
}
|
|
22527
22530
|
}
|
|
22528
22531
|
if (options?.cors?.baseUrl) {
|
|
22529
|
-
this.baseURL = options.cors.baseUrl + "/" +
|
|
22530
|
-
this.hackURL = options.cors.baseUrl + "/" +
|
|
22532
|
+
this.baseURL = options.cors.baseUrl + "/" + API_BASER_URL.replace("https://", "");
|
|
22533
|
+
this.hackURL = options.cors.baseUrl + "/" + API_HACK_URL.replace("https://", "");
|
|
22531
22534
|
}
|
|
22532
22535
|
}
|
|
22533
22536
|
async request({ url: url2, method = "GET", data, params, headers, body, useCookie, useOrigin }) {
|
|
@@ -22592,7 +22595,11 @@ class CNBCore {
|
|
|
22592
22595
|
if (url2 && url2.startsWith("http")) {
|
|
22593
22596
|
return url2;
|
|
22594
22597
|
}
|
|
22595
|
-
|
|
22598
|
+
console.log("url", url2, this.baseURL);
|
|
22599
|
+
if (url2.startsWith("/")) {
|
|
22600
|
+
return this.baseURL + url2;
|
|
22601
|
+
}
|
|
22602
|
+
return this.baseURL + "/" + url2;
|
|
22596
22603
|
}
|
|
22597
22604
|
get({ url: url2, ...REST }) {
|
|
22598
22605
|
const fullUrl = this.makeUrl(url2);
|
package/dist/routes.js
CHANGED
|
@@ -22509,9 +22509,12 @@ class InitEnv2 {
|
|
|
22509
22509
|
InitEnv2.init();
|
|
22510
22510
|
|
|
22511
22511
|
// src/cnb-core.ts
|
|
22512
|
+
var API_BASER_URL = "https://api.cnb.cool";
|
|
22513
|
+
var API_HACK_URL = "https://cnb.cool";
|
|
22514
|
+
|
|
22512
22515
|
class CNBCore {
|
|
22513
|
-
baseURL =
|
|
22514
|
-
hackURL =
|
|
22516
|
+
baseURL = API_BASER_URL;
|
|
22517
|
+
hackURL = API_HACK_URL;
|
|
22515
22518
|
token;
|
|
22516
22519
|
cookie;
|
|
22517
22520
|
constructor(options) {
|
|
@@ -22526,8 +22529,8 @@ class CNBCore {
|
|
|
22526
22529
|
}
|
|
22527
22530
|
}
|
|
22528
22531
|
if (options?.cors?.baseUrl) {
|
|
22529
|
-
this.baseURL = options.cors.baseUrl + "/" +
|
|
22530
|
-
this.hackURL = options.cors.baseUrl + "/" +
|
|
22532
|
+
this.baseURL = options.cors.baseUrl + "/" + API_BASER_URL.replace("https://", "");
|
|
22533
|
+
this.hackURL = options.cors.baseUrl + "/" + API_HACK_URL.replace("https://", "");
|
|
22531
22534
|
}
|
|
22532
22535
|
}
|
|
22533
22536
|
async request({ url: url2, method = "GET", data, params, headers, body, useCookie, useOrigin }) {
|
|
@@ -22592,7 +22595,11 @@ class CNBCore {
|
|
|
22592
22595
|
if (url2 && url2.startsWith("http")) {
|
|
22593
22596
|
return url2;
|
|
22594
22597
|
}
|
|
22595
|
-
|
|
22598
|
+
console.log("url", url2, this.baseURL);
|
|
22599
|
+
if (url2.startsWith("/")) {
|
|
22600
|
+
return this.baseURL + url2;
|
|
22601
|
+
}
|
|
22602
|
+
return this.baseURL + "/" + url2;
|
|
22596
22603
|
}
|
|
22597
22604
|
get({ url: url2, ...REST }) {
|
|
22598
22605
|
const fullUrl = this.makeUrl(url2);
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cnb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "bun
|
|
7
|
+
"build": "bun bun.config.ts",
|
|
8
|
+
"flow":"ev npm patch && pnpm build && ev npm publish npm -p"
|
|
8
9
|
},
|
|
9
10
|
"keywords": [],
|
|
10
11
|
"files": [
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"@kevisual/types": "^0.0.12",
|
|
25
26
|
"@opencode-ai/plugin": "^1.1.51",
|
|
26
27
|
"@types/bun": "^1.3.8",
|
|
27
|
-
"@types/node": "^25.2.
|
|
28
|
+
"@types/node": "^25.2.1",
|
|
28
29
|
"@types/ws": "^8.18.1",
|
|
29
30
|
"dayjs": "^1.11.19",
|
|
30
31
|
"dotenv": "^17.2.3"
|
package/src/cnb-core.ts
CHANGED
|
@@ -20,9 +20,11 @@ export type RequestOptions = {
|
|
|
20
20
|
useCookie?: boolean;
|
|
21
21
|
useOrigin?: boolean;
|
|
22
22
|
};
|
|
23
|
+
const API_BASER_URL = 'https://api.cnb.cool'
|
|
24
|
+
const API_HACK_URL = 'https://cnb.cool'
|
|
23
25
|
export class CNBCore {
|
|
24
|
-
baseURL =
|
|
25
|
-
hackURL =
|
|
26
|
+
baseURL = API_BASER_URL;
|
|
27
|
+
hackURL = API_HACK_URL;
|
|
26
28
|
public token: string;
|
|
27
29
|
public cookie?: string;
|
|
28
30
|
constructor(options: CNBCoreOptions) {
|
|
@@ -37,8 +39,8 @@ export class CNBCore {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
if (options?.cors?.baseUrl) {
|
|
40
|
-
this.baseURL = options.cors.baseUrl + '/' +
|
|
41
|
-
this.hackURL = options.cors.baseUrl + '/' +
|
|
42
|
+
this.baseURL = options.cors.baseUrl + '/' + API_BASER_URL.replace('https://', '');
|
|
43
|
+
this.hackURL = options.cors.baseUrl + '/' + API_HACK_URL.replace('https://', '');
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -107,7 +109,11 @@ export class CNBCore {
|
|
|
107
109
|
if (url && url.startsWith('http')) {
|
|
108
110
|
return url;
|
|
109
111
|
}
|
|
110
|
-
|
|
112
|
+
console.log('url', url, this.baseURL)
|
|
113
|
+
if (url.startsWith('/')) {
|
|
114
|
+
return this.baseURL + url;
|
|
115
|
+
}
|
|
116
|
+
return this.baseURL + '/' + url;
|
|
111
117
|
}
|
|
112
118
|
get<T = any>({ url, ...REST }: RequestOptions): Promise<T> {
|
|
113
119
|
const fullUrl = this.makeUrl(url);
|