vortez 4.1.1
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/.gitignore +13 -0
- package/LICENSE +201 -0
- package/Notes.md +12 -0
- package/README.md +372 -0
- package/build/Beta/JwtManager.d.ts +114 -0
- package/build/Beta/JwtManager.js +249 -0
- package/build/Beta/JwtManager.js.map +1 -0
- package/build/Beta/Mail.d.ts +60 -0
- package/build/Beta/Mail.js +192 -0
- package/build/Beta/Mail.js.map +1 -0
- package/build/Config.d.ts +39 -0
- package/build/Config.js +33 -0
- package/build/Config.js.map +1 -0
- package/build/ConsoleUI.d.ts +57 -0
- package/build/ConsoleUI.js +110 -0
- package/build/ConsoleUI.js.map +1 -0
- package/build/Debug.d.ts +154 -0
- package/build/Debug.js +256 -0
- package/build/Debug.js.map +1 -0
- package/build/LoggerManager/Logger.d.ts +23 -0
- package/build/LoggerManager/Logger.js +23 -0
- package/build/LoggerManager/Logger.js.map +1 -0
- package/build/LoggerManager/LoggerManager.d.ts +18 -0
- package/build/LoggerManager/LoggerManager.js +30 -0
- package/build/LoggerManager/LoggerManager.js.map +1 -0
- package/build/Server/BodyParser.d.ts +125 -0
- package/build/Server/BodyParser.js +162 -0
- package/build/Server/BodyParser.js.map +1 -0
- package/build/Server/Cookie.d.ts +72 -0
- package/build/Server/Cookie.js +102 -0
- package/build/Server/Cookie.js.map +1 -0
- package/build/Server/Request.d.ts +61 -0
- package/build/Server/Request.js +79 -0
- package/build/Server/Request.js.map +1 -0
- package/build/Server/Response.d.ts +90 -0
- package/build/Server/Response.js +241 -0
- package/build/Server/Response.js.map +1 -0
- package/build/Server/Rule.d.ts +81 -0
- package/build/Server/Rule.js +146 -0
- package/build/Server/Rule.js.map +1 -0
- package/build/Server/Server.d.ts +157 -0
- package/build/Server/Server.js +330 -0
- package/build/Server/Server.js.map +1 -0
- package/build/Server/Session.d.ts +66 -0
- package/build/Server/Session.js +97 -0
- package/build/Server/Session.js.map +1 -0
- package/build/Server/WebSocket/Chunk.d.ts +36 -0
- package/build/Server/WebSocket/Chunk.js +81 -0
- package/build/Server/WebSocket/Chunk.js.map +1 -0
- package/build/Server/WebSocket/WebSocket.d.ts +70 -0
- package/build/Server/WebSocket/WebSocket.js +184 -0
- package/build/Server/WebSocket/WebSocket.js.map +1 -0
- package/build/Template.d.ts +32 -0
- package/build/Template.js +69 -0
- package/build/Template.js.map +1 -0
- package/build/Utilities/Env.d.ts +75 -0
- package/build/Utilities/Env.js +123 -0
- package/build/Utilities/Env.js.map +1 -0
- package/build/Utilities/Path.d.ts +18 -0
- package/build/Utilities/Path.js +27 -0
- package/build/Utilities/Path.js.map +1 -0
- package/build/Utilities/Utilities.d.ts +147 -0
- package/build/Utilities/Utilities.js +110 -0
- package/build/Utilities/Utilities.js.map +1 -0
- package/build/Vortez.d.ts +20 -0
- package/build/Vortez.js +22 -0
- package/build/Vortez.js.map +1 -0
- package/changes.md +89 -0
- package/examples/in-docs.js +96 -0
- package/global/Source/Logo_960.png +0 -0
- package/global/Source/Logo_SM_960.png +0 -0
- package/global/Style/Template/Error.css +30 -0
- package/global/Style/Template/Folder.css +77 -0
- package/global/Style/Template/Template.css +128 -0
- package/global/Template/Error.vhtml +29 -0
- package/global/Template/Folder.vhtml +41 -0
- package/package.json +47 -0
- package/tests/Template/template.js +18 -0
- package/tests/Template/template.txt +13 -0
- package/tests/Template/template.vhtml +23 -0
- package/tests/debug.js +28 -0
- package/tests/jwtManager/jwtManager.js +110 -0
- package/tests/test.js +129 -0
- package/tests/test.vhtml +14 -0
- package/tests/utilities.js +28 -0
- package/tests/websocket.vhtml +86 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//@ts-check
|
|
2
|
+
// en caso de haber instalado el modulo desde npm usar:
|
|
3
|
+
// import Vortez from 'vortez';
|
|
4
|
+
import Vortez from '../build/Vortez.js';
|
|
5
|
+
|
|
6
|
+
const server = new Vortez(3000, undefined, {
|
|
7
|
+
privKey: "",
|
|
8
|
+
pubKey: "",
|
|
9
|
+
port: 443
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// | RULE PARAMS EXAMPLE |
|
|
13
|
+
server.addAction('ALL', '/User/$UserID/Post/$PostID', (request, response) => {
|
|
14
|
+
response.sendJson({
|
|
15
|
+
url: request.url,
|
|
16
|
+
ruleParams: request.ruleParams
|
|
17
|
+
});
|
|
18
|
+
/* Esto devolverá lo siguiente si la ruta fuera /User/111111/Post/222222
|
|
19
|
+
{
|
|
20
|
+
"Url": "/User/111111/Post/222222"
|
|
21
|
+
"RuleParams": {
|
|
22
|
+
"UserID": "111111",
|
|
23
|
+
"PostID": "222222"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
*/
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// | AUTH EXEC EXAMPLE |
|
|
30
|
+
server.addFile('/FileWA', 'changes.md', (Request) => {
|
|
31
|
+
return Request.queryParams.has('Auth') && Request.queryParams.get('Auth') == 'AuthYes'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// | FOLDER RULE EXAMPLE |
|
|
35
|
+
server.addFolder('/MyFolder', 'Test');
|
|
36
|
+
|
|
37
|
+
// | FILE RULE EXAMPLE |
|
|
38
|
+
server.addFile('/MyFile', 'changes.md');
|
|
39
|
+
|
|
40
|
+
// | ACTION RULE EXAMPLE |
|
|
41
|
+
|
|
42
|
+
server.addAction('GET', '/', (request, response) => {
|
|
43
|
+
if (request.cookies.has('User_ID')) {
|
|
44
|
+
response.send("El User_ID que estas usando es:" + request.cookies.get('User_ID'));
|
|
45
|
+
} else {
|
|
46
|
+
response.sendFile('./ErrorUsuario.html');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// | WBB SOCKET RULE EXAMPLE |
|
|
52
|
+
|
|
53
|
+
const Conexiones = new Set();
|
|
54
|
+
server.addWebSocket('/Test/WS-Chat', (request, socket) => {
|
|
55
|
+
console.log('[WS] CM: Conexión nueva')
|
|
56
|
+
Conexiones.forEach((Usuario) => Usuario.Send("Un usuario se conecto"));
|
|
57
|
+
Conexiones.add(socket);
|
|
58
|
+
socket.on('finish', () => Conexiones.delete(socket));
|
|
59
|
+
socket.on('error', (error) => console.log('[WS-Error]:', error));
|
|
60
|
+
socket.on('message', (data, info) => {
|
|
61
|
+
//console.log(Info.OPCode);
|
|
62
|
+
if (info.opCode == 1) {
|
|
63
|
+
console.log('[WS] MSS:', data.toString());
|
|
64
|
+
Conexiones.forEach((Usuario) => {
|
|
65
|
+
if (Usuario !== socket) Usuario.Send(data.toString());
|
|
66
|
+
});
|
|
67
|
+
} else if (info.opCode == 8) {
|
|
68
|
+
Conexiones.forEach((Usuario) => Usuario.Send("Un usuario se desconecto"));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// | ADD RULE METHOD EXAMPLE |
|
|
74
|
+
server.addRules(
|
|
75
|
+
/*
|
|
76
|
+
este constructor acepta 5 parámetros para crearse correctamente:
|
|
77
|
+
Tipo, Método, UrlRule, Content, AuthExec.
|
|
78
|
+
AuthExec es opcional.
|
|
79
|
+
*/
|
|
80
|
+
new Vortez.Rule('Folder', 'GET', '/MyFolder2/', 'Test/', () => true),
|
|
81
|
+
new Vortez.Rule('File', 'GET', '/MyFile2/*', 'changes.md', () => true),
|
|
82
|
+
new Vortez.Rule('Action', 'GET', '/2', (request, response) => {
|
|
83
|
+
if (request.cookies.has('User_ID')) {
|
|
84
|
+
response.send("El User_ID que estas usando es:" + request.cookies.get('User_ID'));
|
|
85
|
+
} else {
|
|
86
|
+
response.sendFile('./ErrorUsuario.html');
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
new Vortez.Rule('Action', 'GET', '/2', (request, response) => {
|
|
90
|
+
if (request.cookies.has('User_ID')) {
|
|
91
|
+
response.send("El User_ID que estas usando es:" + request.cookies.get('User_ID'));
|
|
92
|
+
} else {
|
|
93
|
+
response.sendFile('./ErrorUsuario.html');
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
);
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#Error {
|
|
2
|
+
--Color_Fondo: rgb(255,180,220);
|
|
3
|
+
--Color_Código: rgb(255,0,0);
|
|
4
|
+
--Color_Mensaje: rgb(0,0,0);
|
|
5
|
+
--Color_Fondo_Imagen: rgba(255,0,0,0.1);
|
|
6
|
+
}
|
|
7
|
+
#Error {
|
|
8
|
+
background: var(--Color_Fondo);
|
|
9
|
+
height: 100%;
|
|
10
|
+
position: fixed;
|
|
11
|
+
width: 100%;
|
|
12
|
+
overflow: visible;
|
|
13
|
+
}
|
|
14
|
+
#Error .Información {
|
|
15
|
+
text-align: center;
|
|
16
|
+
width: 90%;
|
|
17
|
+
overflow: visible;
|
|
18
|
+
}
|
|
19
|
+
#Error .Código {
|
|
20
|
+
color: var(--Color_Código);
|
|
21
|
+
font-size: 3em;
|
|
22
|
+
}
|
|
23
|
+
#Error .Mensaje {
|
|
24
|
+
color: var(--Color_Mensaje);
|
|
25
|
+
font-size: 1em;
|
|
26
|
+
margin-bottom: 1em;
|
|
27
|
+
}
|
|
28
|
+
#Error .Carga {
|
|
29
|
+
width: 30%;
|
|
30
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#Carpeta {
|
|
2
|
+
--Color_Fondo: rgb(255,180,220);
|
|
3
|
+
--Color_Fondo_Contenido: rgba(255,0,0,0.1);
|
|
4
|
+
--Color_Fondo_Atrás: rgba(180,220,255,0.5);
|
|
5
|
+
--Color_Fondo_Atrás_Acción: rgba(180,220,255,0.75);
|
|
6
|
+
--Color_Fondo_Búsqueda: rgba(255,180,220,0.5);
|
|
7
|
+
--Color_Fondo_Búsqueda_Acción: rgba(255,180,220,0.75);
|
|
8
|
+
--Color_Fondo_Elemento: rgba(220,255,180,0.25);
|
|
9
|
+
--Color_Fondo_Elemento_Acción: rgba(220,255,180,0.5);
|
|
10
|
+
--Color_Borde_Búsqueda_Acción: rgb(180,220,255);
|
|
11
|
+
}
|
|
12
|
+
#Carpeta {
|
|
13
|
+
align-items: center;
|
|
14
|
+
background: var(--Color_Fondo);
|
|
15
|
+
height: 100%;
|
|
16
|
+
overflow: visible scroll;
|
|
17
|
+
position: fixed;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
#Carpeta .Contenido {
|
|
21
|
+
background: var(--Color_Fondo_Contenido);
|
|
22
|
+
border-radius: 2em;
|
|
23
|
+
margin-top: 2em;
|
|
24
|
+
padding: 2em;
|
|
25
|
+
text-align: center;
|
|
26
|
+
width: 70%;
|
|
27
|
+
}
|
|
28
|
+
#Carpeta .Opciones {
|
|
29
|
+
display: flex;
|
|
30
|
+
text-align: start;
|
|
31
|
+
}
|
|
32
|
+
#Carpeta #Carpeta_Cambiar {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
#Carpeta .Atrás,
|
|
36
|
+
#Carpeta #Carpeta_Ruta,
|
|
37
|
+
#Carpeta #Carpeta_Cambiar {
|
|
38
|
+
background: var(--Color_Fondo_Atrás);
|
|
39
|
+
border-radius: 1em;
|
|
40
|
+
color: rgb(0,0,0);
|
|
41
|
+
display: inline-block;
|
|
42
|
+
margin: 0.5em;
|
|
43
|
+
padding: 1em;
|
|
44
|
+
text-decoration: none;
|
|
45
|
+
}
|
|
46
|
+
#Carpeta #Carpeta_Ruta,
|
|
47
|
+
#Carpeta #Carpeta_Cambiar {
|
|
48
|
+
background: var(--Color_Fondo_Búsqueda);
|
|
49
|
+
border: none;
|
|
50
|
+
}
|
|
51
|
+
#Carpeta .Lista {
|
|
52
|
+
list-style: none;
|
|
53
|
+
}
|
|
54
|
+
#Carpeta .Elemento {
|
|
55
|
+
background: var(--Color_Fondo_Elemento);
|
|
56
|
+
border-radius: 1em;
|
|
57
|
+
color: rgb(0,0,0);
|
|
58
|
+
display: block;
|
|
59
|
+
margin: 0.25em;
|
|
60
|
+
padding: 1em;
|
|
61
|
+
text-decoration: none;
|
|
62
|
+
}
|
|
63
|
+
#Carpeta .Atrás:hover {
|
|
64
|
+
background: var(--Color_Fondo_Atrás_Acción);
|
|
65
|
+
}
|
|
66
|
+
#Carpeta #Carpeta_Ruta:focus {
|
|
67
|
+
border: var(--Color_Borde_Búsqueda_Acción) 3px double;
|
|
68
|
+
margin: calc(0.5em - 3px);
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
#Carpeta #Carpeta_Ruta:focus,
|
|
72
|
+
#Carpeta #Carpeta_Cambiar:hover {
|
|
73
|
+
background: var(--Color_Fondo_Búsqueda_Acción);
|
|
74
|
+
}
|
|
75
|
+
#Carpeta .Elemento:hover {
|
|
76
|
+
background: var(--Color_Fondo_Elemento_Acción);
|
|
77
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
@import './Folder.css';
|
|
2
|
+
@import './Error.css';
|
|
3
|
+
|
|
4
|
+
* {
|
|
5
|
+
padding: 0px;
|
|
6
|
+
margin: 0px;
|
|
7
|
+
}
|
|
8
|
+
.Centrar-X {
|
|
9
|
+
align-items: center;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
/* justify-content: center; */
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
overflow: visible;
|
|
16
|
+
}
|
|
17
|
+
.Centrar-Y {
|
|
18
|
+
/* align-items: center; */
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
overflow: visible;
|
|
25
|
+
}
|
|
26
|
+
.Carga {
|
|
27
|
+
align-items: center;
|
|
28
|
+
animation: Entrada 0.2s linear 0s 1, Fluctuar 4s linear 1s infinite;
|
|
29
|
+
background: var(--Color_Fondo);
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
box-sizing: content-box;
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
padding: 2%;
|
|
36
|
+
position: relative;
|
|
37
|
+
width: 40%;
|
|
38
|
+
z-index: 0;
|
|
39
|
+
}
|
|
40
|
+
.Carga .C_Fondo,
|
|
41
|
+
.Carga .C_Fondo2 {
|
|
42
|
+
align-items: center;
|
|
43
|
+
background: var(--Color_Fondo, rgb(0,0,0));
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
box-sizing: content-box;
|
|
46
|
+
display: flex;
|
|
47
|
+
height: 96%;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
position: absolute;
|
|
51
|
+
width: 96%;
|
|
52
|
+
}
|
|
53
|
+
.Carga .C_Fondo2 {
|
|
54
|
+
height: 92%;
|
|
55
|
+
width: 92%;
|
|
56
|
+
}
|
|
57
|
+
.Carga .C_Logo {
|
|
58
|
+
/*background: var(--Color_Fondo) url('/Src/Recursos/Íconos/NetFeez-Labs/[Ícono] - SM - 960.png');
|
|
59
|
+
background-attachment: local;
|
|
60
|
+
background-position:center top;
|
|
61
|
+
background-repeat: no-repeat;
|
|
62
|
+
background-size: cover;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
height: 0px;
|
|
65
|
+
padding-bottom: 100%;*/
|
|
66
|
+
animation: FluctuarImg 4s linear 0s infinite;
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
.Carga .C_Fondo::before,
|
|
72
|
+
.Carga .C_Fondo::after,
|
|
73
|
+
.Carga::before,
|
|
74
|
+
.Carga::after {
|
|
75
|
+
animation: Girar 5s linear 0s infinite;
|
|
76
|
+
background: linear-gradient(90deg, rgb(100,100,0), rgb(0,100,180));
|
|
77
|
+
content: '';
|
|
78
|
+
height: 25%;
|
|
79
|
+
position: absolute;
|
|
80
|
+
width: 125%;
|
|
81
|
+
z-index: -1;
|
|
82
|
+
}
|
|
83
|
+
.Carga .C_Fondo::after,
|
|
84
|
+
.Carga::after {
|
|
85
|
+
animation-direction: reverse;
|
|
86
|
+
animation-duration: 3s;
|
|
87
|
+
background: linear-gradient(0deg, rgb(255,0,255), rgb(0,255,0));
|
|
88
|
+
height: 125%;
|
|
89
|
+
width: 25%;
|
|
90
|
+
}
|
|
91
|
+
.Carga .C_Fondo::before,
|
|
92
|
+
.Carga .C_Fondo::after {
|
|
93
|
+
background: linear-gradient(90deg, rgb(0,0,255), rgb(255,255,0));
|
|
94
|
+
animation-duration: 4s;
|
|
95
|
+
z-index: 0;
|
|
96
|
+
}
|
|
97
|
+
.Carga .C_Fondo::after {
|
|
98
|
+
background: linear-gradient(0deg, rgb(255,0,0), rgb(0,255,255));
|
|
99
|
+
animation-duration: 2s;
|
|
100
|
+
z-index: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes Entrada {
|
|
104
|
+
0% {opacity: 0;}
|
|
105
|
+
100% {opacity: 1;}
|
|
106
|
+
}
|
|
107
|
+
@keyframes Girar {
|
|
108
|
+
0% {transform: rotate(0deg);}
|
|
109
|
+
100% {transform: rotate(360deg);}
|
|
110
|
+
}
|
|
111
|
+
@keyframes Fluctuar {
|
|
112
|
+
0% {box-shadow: rgba(180,220,255,0) 0px 0px 0px 0px;}
|
|
113
|
+
25% {box-shadow: rgba(180,220,255,1) 0px 0px 0px 3em;}
|
|
114
|
+
50% {box-shadow: rgba(180,220,255,0) 0px 0px 0px 6em;}
|
|
115
|
+
75% {box-shadow: rgba(180,220,255,0) 0px 0px 0px 0px;}
|
|
116
|
+
100% {box-shadow: rgba(180,220,255,0) 0px 0px 0px 0px;}
|
|
117
|
+
}
|
|
118
|
+
@keyframes FluctuarImg {
|
|
119
|
+
0% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0em);}
|
|
120
|
+
2% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0.4em);}
|
|
121
|
+
25% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0em);}
|
|
122
|
+
27% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0.4em);}
|
|
123
|
+
50% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0em);}
|
|
124
|
+
52% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0.4em);}
|
|
125
|
+
75% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0em);}
|
|
126
|
+
77% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0.4em);}
|
|
127
|
+
100% {filter: drop-shadow(rgba(255,0,0,1) 0px 0px 0em);}
|
|
128
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="es">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<link rel="stylesheet" href="/NetFeez-Labs:Global/Style/Template/Template.css">
|
|
8
|
+
<title>[SV-C] - ${status}</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="Error" class="Centrar-X Centrar-Y">
|
|
12
|
+
<div class="Información">
|
|
13
|
+
<h1 class="Código">Error: ${status}</h1>
|
|
14
|
+
<p class="Mensaje">${message}</p>
|
|
15
|
+
<div class="Centrar-X Centrar-Y">
|
|
16
|
+
<div class="Carga">
|
|
17
|
+
<div class="C_Fondo"></div>
|
|
18
|
+
<div class="C_Fondo2"></div>
|
|
19
|
+
<picture>
|
|
20
|
+
<source srcset="/NetFeez-Labs:Global/Source/Logo_SM_960.png"/>
|
|
21
|
+
<source srcset="/favicon.ico"/>
|
|
22
|
+
<img class="C_Logo">
|
|
23
|
+
</picture>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="es">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<link rel="stylesheet" href="/NetFeez-Labs:Global/Style/Template/Template.css">
|
|
8
|
+
<title>[SA-ML] - Dir</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="Carpeta" class="Centrar-X">
|
|
12
|
+
<div class="Contenido">
|
|
13
|
+
<h1 class="Ruta">Carpeta: ${Url}</h1>
|
|
14
|
+
<div class="Opciones">
|
|
15
|
+
<a class="Atrás" href="${Url}../">Atrás</a>
|
|
16
|
+
<input id="Carpeta_Ruta" type="search" placeholder="Cambiar de ruta... ${Url}" value="${Url}"/>
|
|
17
|
+
<input id="Carpeta_Cambiar"type="button" value="Cambiar Ruta"/>
|
|
18
|
+
</div>
|
|
19
|
+
<ul class="Lista">
|
|
20
|
+
$(folder,, name) {
|
|
21
|
+
<li>
|
|
22
|
+
<a class="Elemento" href="${Url}%name%">%name%</a>
|
|
23
|
+
</li>
|
|
24
|
+
}
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
<script>
|
|
28
|
+
const Carpeta_Cambiar = document.querySelector('#Carpeta_Cambiar');
|
|
29
|
+
const Carpeta_Ruta = document.querySelector('#Carpeta_Ruta');
|
|
30
|
+
Carpeta_Cambiar.addEventListener('click', () => {
|
|
31
|
+
window.location.href = Carpeta_Ruta.value;
|
|
32
|
+
});
|
|
33
|
+
Carpeta_Ruta.addEventListener('keydown', (Evento) => {
|
|
34
|
+
Carpeta_Ruta.value.length <= '${Url}'.length && Evento.key == 'Backspace'
|
|
35
|
+
? Evento.preventDefault()
|
|
36
|
+
: false;
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
39
|
+
</div>
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vortez",
|
|
3
|
+
"version": "4.1.1",
|
|
4
|
+
"description": "a module for http/s and ws/s servers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/Vortez.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "npm run compile && tsc --watch",
|
|
9
|
+
"test": "node tests/test.js",
|
|
10
|
+
"compile": "rm -rf build && tsc",
|
|
11
|
+
"dev.publish": "npm run compile && npm publish --tag Dev"
|
|
12
|
+
},
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "NetFeez",
|
|
15
|
+
"email": "codefeez.dev@gmail.com",
|
|
16
|
+
"url": "https://NetFeez.github.io"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/NetFeez/Vortez"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"build/",
|
|
25
|
+
"examples/",
|
|
26
|
+
"global/",
|
|
27
|
+
"tests/",
|
|
28
|
+
".gitignore",
|
|
29
|
+
"changes.md",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"Notes.md",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"keywords": [
|
|
35
|
+
"server",
|
|
36
|
+
"core",
|
|
37
|
+
"http",
|
|
38
|
+
"https",
|
|
39
|
+
"ws",
|
|
40
|
+
"wss",
|
|
41
|
+
"socket"
|
|
42
|
+
],
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^20.14.12",
|
|
45
|
+
"typescript": "^5.5.4"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Template from "../../build/Template.js";
|
|
2
|
+
|
|
3
|
+
console.log(await Template.load('tests/Template/template.txt', {
|
|
4
|
+
tittle: "Hola mundo",
|
|
5
|
+
users: {
|
|
6
|
+
diego: true,
|
|
7
|
+
juan: false,
|
|
8
|
+
pedro: true,
|
|
9
|
+
maria: false,
|
|
10
|
+
jorge: true
|
|
11
|
+
}
|
|
12
|
+
}))
|
|
13
|
+
console.log('----------------------------------------')
|
|
14
|
+
console.log(await Template.load('tests/Template/template.vhtml', {
|
|
15
|
+
Titulo: 'Titulo de la prueba',
|
|
16
|
+
Des: 'Descripción xD',
|
|
17
|
+
Tests: ["algo", "algo2"]
|
|
18
|
+
}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>${Titulo}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
${Des}
|
|
10
|
+
<table>
|
|
11
|
+
<tr>
|
|
12
|
+
<th>Test</th>
|
|
13
|
+
<th>Enlace</th>
|
|
14
|
+
</tr>
|
|
15
|
+
$(Tests) {
|
|
16
|
+
<tr>
|
|
17
|
+
<td>%key%</td>
|
|
18
|
+
<td><a href="%value%">%value%</a></td>
|
|
19
|
+
</tr>
|
|
20
|
+
}
|
|
21
|
+
</table>
|
|
22
|
+
</body>
|
|
23
|
+
</html>
|
package/tests/debug.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Debug from "../build/Debug.js";
|
|
2
|
+
|
|
3
|
+
Debug.log('Hola mundo');
|
|
4
|
+
Debug.log([
|
|
5
|
+
'Prueba de envió de multiples datos',
|
|
6
|
+
'Para saber el comportamiento'
|
|
7
|
+
]);
|
|
8
|
+
|
|
9
|
+
const X = Debug.getInstance('_Debug');
|
|
10
|
+
|
|
11
|
+
X.log('Prueba para ver si creando una instancia con una ID existente se devuelve la instancia con dicha ID');
|
|
12
|
+
X.log('Prueba para ver si no se crea un archivo diferente con ID igual');
|
|
13
|
+
|
|
14
|
+
const Y = Debug.getInstance('SEA', undefined, false);
|
|
15
|
+
|
|
16
|
+
Y.log('Prueba para verificar que no se muestra en consola si se inicializa con EnConsola = false');
|
|
17
|
+
|
|
18
|
+
Debug.showAll = true;
|
|
19
|
+
|
|
20
|
+
Y.log('Prueba para verificar que al cambiar el atributo MostrarTodo a true se muestran incluso los Debug con EnConsola = false');
|
|
21
|
+
|
|
22
|
+
Debug.showAll = false;
|
|
23
|
+
|
|
24
|
+
Y.log('Prueba para ver si vuelven a ocultarse los mensajes en consola de los EnConsola = false después de poner MostrarTodo nuevamente en false');
|
|
25
|
+
|
|
26
|
+
Debug.log('Fin de la prueba');
|
|
27
|
+
|
|
28
|
+
export default true;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { JwtManager } from "../../build/Beta/JwtManager/JwtManager.js";
|
|
2
|
+
import CRYPTO from 'crypto';
|
|
3
|
+
import Utilities from "../../build/Utilities.js";
|
|
4
|
+
import { strict as assert } from 'assert';
|
|
5
|
+
|
|
6
|
+
const MASKS = ['256', '384', '512'];
|
|
7
|
+
const SECRET = 'secret';
|
|
8
|
+
|
|
9
|
+
const { publicKey: RSA_PUB_KEY, privateKey: RSA_PRIV_KEY } = CRYPTO.generateKeyPairSync('rsa', {
|
|
10
|
+
modulusLength: 2048,
|
|
11
|
+
publicKeyEncoding: {
|
|
12
|
+
type: 'spki',
|
|
13
|
+
format: 'pem'
|
|
14
|
+
},
|
|
15
|
+
privateKeyEncoding: {
|
|
16
|
+
type: 'pkcs8',
|
|
17
|
+
format: 'pem'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const { publicKey: PSS_PUB_KEY, privateKey: PSS_PRIV_KEY } = CRYPTO.generateKeyPairSync('rsa-pss', {
|
|
22
|
+
modulusLength: 2048,
|
|
23
|
+
publicKeyEncoding: {
|
|
24
|
+
type: 'spki',
|
|
25
|
+
format: 'pem'
|
|
26
|
+
},
|
|
27
|
+
privateKeyEncoding: {
|
|
28
|
+
type: 'pkcs8',
|
|
29
|
+
format: 'pem'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const { publicKey: EC_PUB_KEY, privateKey: EC_PRIV_KEY } = CRYPTO.generateKeyPairSync('ec', {
|
|
34
|
+
namedCurve: 'secp256k1',
|
|
35
|
+
publicKeyEncoding: {
|
|
36
|
+
type: 'spki',
|
|
37
|
+
format: 'pem'
|
|
38
|
+
},
|
|
39
|
+
privateKeyEncoding: {
|
|
40
|
+
type: 'pkcs8',
|
|
41
|
+
format: 'pem'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const body = {
|
|
46
|
+
test: 'test',
|
|
47
|
+
XD: "xd"
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const options = {
|
|
51
|
+
expire: new Date(Date.now() + 10000)
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const testBase64UrlEncode = () => {
|
|
55
|
+
assert.equal(Utilities.base64UrlEncode('hello world'), 'aGVsbG8gd29ybGQ');
|
|
56
|
+
console.log('Utilities.base64UrlEncode passed');
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const testBase64UrlDecode = () => {
|
|
60
|
+
assert.equal(Utilities.base64UrlDecode('aGVsbG8gd29ybGQ'), 'hello world');
|
|
61
|
+
console.log('Utilities.base64UrlDecode passed');
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const testJwtManagerSignVerify = (algorithm, key, pubKey) => {
|
|
65
|
+
const jwt = new JwtManager(algorithm, key);
|
|
66
|
+
console.log('--------------------------')
|
|
67
|
+
const JWTObject = jwt.sign(body, options);
|
|
68
|
+
console.log('jwt:', JWTObject);
|
|
69
|
+
if (algorithm.startsWith('HS')) {
|
|
70
|
+
console.log('secret:', key);
|
|
71
|
+
} else {
|
|
72
|
+
console.log('Private Key:', key);
|
|
73
|
+
if (pubKey) {
|
|
74
|
+
console.log('Public Key:', pubKey);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const verificationResult = jwt.verify(JWTObject);
|
|
78
|
+
console.log(verificationResult, '\n');
|
|
79
|
+
assert.equal(verificationResult.verify, true);
|
|
80
|
+
assert.deepEqual(verificationResult.body, body);
|
|
81
|
+
console.log(`${algorithm} test passed`);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const runTests = () => {
|
|
85
|
+
try {
|
|
86
|
+
testBase64UrlEncode();
|
|
87
|
+
testBase64UrlDecode();
|
|
88
|
+
|
|
89
|
+
for (let index = 0; index < MASKS.length; index++) {
|
|
90
|
+
const algorithm = 'HS' + MASKS[index];
|
|
91
|
+
testJwtManagerSignVerify(algorithm, SECRET);
|
|
92
|
+
|
|
93
|
+
const algorithmRS = 'RS' + MASKS[index];
|
|
94
|
+
testJwtManagerSignVerify(algorithmRS, RSA_PRIV_KEY, RSA_PUB_KEY);
|
|
95
|
+
|
|
96
|
+
const algorithmPS = 'PS' + MASKS[index];
|
|
97
|
+
testJwtManagerSignVerify(algorithmPS, PSS_PRIV_KEY, PSS_PUB_KEY);
|
|
98
|
+
|
|
99
|
+
const algorithmES = 'ES' + MASKS[index];
|
|
100
|
+
testJwtManagerSignVerify(algorithmES, EC_PRIV_KEY, EC_PUB_KEY);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
console.log('All tests passed');
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error('Test failed:', error.message);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
runTests();
|