mdkcontroller 1.0.13 → 1.0.15
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/demoApp.js +2 -2
- package/dk_modules/dkvar.js +2 -38
- package/index.js +7 -0
- package/package.json +3 -2
package/demoApp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {Root} from "./index.js";
|
|
2
2
|
import {Router} from "express";
|
|
3
3
|
// import svInstance from "mdkcontroller";
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ const cfg = {
|
|
|
7
7
|
res.redirect("/pages/DemoHomeV1/home");
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
const _sv = await
|
|
10
|
+
const _sv = await Root("khanhnbd", cfg);
|
|
11
11
|
const app = _sv.server;
|
|
12
12
|
const db = _sv.database;
|
|
13
13
|
const authCrypt = _sv.authen;
|
package/dk_modules/dkvar.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Buffer} from 'node:buffer';
|
|
2
2
|
|
|
3
|
-
const algorithm = "aes-192-cbc";
|
|
4
3
|
export const privateKey = 'eyJzdWIiOiI5Nzc4IiwibmFtZSI6IkRraGFuaE1NTSIsImlhdCI6ODkxMDB9';
|
|
5
4
|
export const allowRegister = true;
|
|
5
|
+
|
|
6
6
|
export function generateRandomToken(length = 100) {
|
|
7
7
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
8
8
|
let token = '';
|
|
@@ -11,40 +11,4 @@ export function generateRandomToken(length = 100) {
|
|
|
11
11
|
token += characters.charAt(randomIndex);
|
|
12
12
|
}
|
|
13
13
|
return token;
|
|
14
|
-
}
|
|
15
|
-
export function decodeMini(text, pass) {
|
|
16
|
-
const byteArray = Buffer.from(text, 'base64');
|
|
17
|
-
const byteArray2 = Buffer.from(pass.toString(), 'utf8');
|
|
18
|
-
|
|
19
|
-
const originalArray1 = [];
|
|
20
|
-
// const originalArray2 = [];
|
|
21
|
-
for (let i = 0; i < byteArray.length; i++) {
|
|
22
|
-
if (i % 2 === 0 && originalArray1.length < (byteArray.length - byteArray2.length)) {
|
|
23
|
-
originalArray1.push(byteArray[i]);
|
|
24
|
-
}
|
|
25
|
-
// else {
|
|
26
|
-
// originalArray2.push(byteArray[i]);
|
|
27
|
-
// }
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const string1 = Buffer.from(originalArray1).toString('utf8');
|
|
31
|
-
// const string2 = Buffer.from(originalArray2).toString('utf8');
|
|
32
|
-
|
|
33
|
-
return string1;
|
|
34
|
-
}
|
|
35
|
-
export function encodeMini(value, pass) {
|
|
36
|
-
const byteArray1 = Buffer.from(value.toString(), 'utf8');
|
|
37
|
-
const byteArray2 = Buffer.from(pass.toString(), 'utf8');
|
|
38
|
-
|
|
39
|
-
const interleavedArray = [];
|
|
40
|
-
const maxLength = Math.max(byteArray1.length, byteArray2.length);
|
|
41
|
-
for (let i = 0; i < maxLength; i++) {
|
|
42
|
-
if (i < byteArray1.length) {
|
|
43
|
-
interleavedArray.push(byteArray1[i]);
|
|
44
|
-
}
|
|
45
|
-
if (i < byteArray2.length) {
|
|
46
|
-
interleavedArray.push(byteArray2[i]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return Buffer.from(interleavedArray).toString('base64');
|
|
50
14
|
}
|
package/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import main from "./main.js"
|
|
2
|
+
import authen from "./dk_modules/authorization.js"
|
|
3
|
+
import ause from "./dk_modules/autoSequence.js"
|
|
4
|
+
|
|
5
|
+
export const Root = async (a, b) => await main(a, b);
|
|
6
|
+
export const Authen = (db) => authen(db);
|
|
7
|
+
export const Sequense = (db) => ause(db);
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"socket.io": "^4.7.2"
|
|
11
11
|
},
|
|
12
12
|
"name": "mdkcontroller",
|
|
13
|
-
"version": "1.0.
|
|
13
|
+
"version": "1.0.15",
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"author": "KHANHNBD <khanh272421@gmail.com>",
|
|
16
16
|
"license": "ISC",
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
"exports": {
|
|
20
20
|
".": "./index.js"
|
|
21
21
|
},
|
|
22
|
-
"types": "./
|
|
22
|
+
"types": "./index.js",
|
|
23
23
|
"files": [
|
|
24
24
|
"demoApp.js",
|
|
25
25
|
"main.js",
|
|
26
|
+
"index.js",
|
|
26
27
|
"Cores/",
|
|
27
28
|
"dk_modules/",
|
|
28
29
|
"Pages/"
|