underpost 2.7.1 → 2.7.3

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.
Files changed (214) hide show
  1. package/.dockerignore +13 -13
  2. package/.env.development +7 -7
  3. package/.env.production +7 -7
  4. package/.env.test +7 -7
  5. package/.github/workflows/publish.yml +26 -0
  6. package/.github/workflows/test.yml +80 -0
  7. package/.nycrc +9 -9
  8. package/.prettierignore +12 -12
  9. package/.prettierrc +9 -9
  10. package/.vscode/extensions.json +72 -72
  11. package/.vscode/settings.json +100 -99
  12. package/Dockerfile +89 -89
  13. package/LICENSE +21 -21
  14. package/README.md +96 -96
  15. package/bin/db.js +172 -119
  16. package/bin/deploy.js +607 -661
  17. package/bin/file.js +93 -92
  18. package/bin/index.js +76 -53
  19. package/bin/ssl.js +55 -64
  20. package/bin/util.js +182 -182
  21. package/bin/vs.js +35 -35
  22. package/conf.js +251 -249
  23. package/docker-compose.yml +67 -67
  24. package/jsconfig.json +7 -7
  25. package/jsdoc.json +32 -32
  26. package/nodemon.json +6 -6
  27. package/package.json +137 -132
  28. package/prometheus.yml +36 -36
  29. package/setup.sh +24 -24
  30. package/src/api/core/core.controller.js +69 -69
  31. package/src/api/core/core.model.js +11 -11
  32. package/src/api/core/core.router.js +23 -23
  33. package/src/api/core/core.service.js +29 -29
  34. package/src/api/crypto/crypto.controller.js +51 -51
  35. package/src/api/crypto/crypto.model.js +23 -23
  36. package/src/api/crypto/crypto.router.js +20 -20
  37. package/src/api/crypto/crypto.service.js +64 -64
  38. package/src/api/default/default.controller.js +69 -69
  39. package/src/api/default/default.model.js +20 -20
  40. package/src/api/default/default.router.js +23 -23
  41. package/src/api/default/default.service.js +31 -31
  42. package/src/api/file/file.controller.js +53 -51
  43. package/src/api/file/file.model.js +19 -19
  44. package/src/api/file/file.router.js +21 -20
  45. package/src/api/file/file.service.js +76 -70
  46. package/src/api/instance/instance.controller.js +69 -69
  47. package/src/api/instance/instance.model.js +36 -36
  48. package/src/api/instance/instance.router.js +33 -33
  49. package/src/api/instance/instance.service.js +48 -48
  50. package/src/api/test/test.controller.js +59 -59
  51. package/src/api/test/test.model.js +14 -14
  52. package/src/api/test/test.router.js +21 -21
  53. package/src/api/test/test.service.js +35 -35
  54. package/src/api/user/user.build.js +16 -0
  55. package/src/api/user/user.controller.js +70 -70
  56. package/src/api/user/user.model.js +65 -65
  57. package/src/api/user/user.router.js +345 -345
  58. package/src/api/user/user.service.js +479 -479
  59. package/src/api.js +23 -23
  60. package/src/client/Default.index.js +40 -40
  61. package/src/client/components/core/Account.js +290 -290
  62. package/src/client/components/core/AgGrid.js +160 -160
  63. package/src/client/components/core/Auth.js +19 -19
  64. package/src/client/components/core/Badge.js +32 -32
  65. package/src/client/components/core/{BlockChain.js → Blockchain.js} +41 -41
  66. package/src/client/components/core/Blog.js +9 -9
  67. package/src/client/components/core/BtnIcon.js +101 -94
  68. package/src/client/components/core/CalendarCore.js +458 -319
  69. package/src/client/components/core/Chat.js +64 -64
  70. package/src/client/components/core/ColorPalette.js +5267 -5267
  71. package/src/client/components/core/CommonJs.js +735 -732
  72. package/src/client/components/core/Content.js +193 -49
  73. package/src/client/components/core/Css.js +1064 -1027
  74. package/src/client/components/core/CssCore.js +817 -796
  75. package/src/client/components/core/D3Chart.js +44 -44
  76. package/src/client/components/core/Docs.js +229 -229
  77. package/src/client/components/core/DropDown.js +164 -164
  78. package/src/client/components/core/EventsUI.js +46 -54
  79. package/src/client/components/core/FileExplorer.js +699 -624
  80. package/src/client/components/core/FullScreen.js +45 -45
  81. package/src/client/components/core/Input.js +346 -259
  82. package/src/client/components/core/JoyStick.js +77 -77
  83. package/src/client/components/core/Keyboard.js +73 -73
  84. package/src/client/components/core/LoadingAnimation.js +179 -157
  85. package/src/client/components/core/LogIn.js +187 -181
  86. package/src/client/components/core/LogOut.js +58 -52
  87. package/src/client/components/core/Logger.js +26 -26
  88. package/src/client/components/core/Modal.js +1612 -1596
  89. package/src/client/components/core/NotificationManager.js +84 -84
  90. package/src/client/components/core/Panel.js +613 -413
  91. package/src/client/components/core/PanelForm.js +468 -0
  92. package/src/client/components/core/Polyhedron.js +162 -162
  93. package/src/client/components/core/Recover.js +204 -204
  94. package/src/client/components/core/Responsive.js +53 -53
  95. package/src/client/components/core/RichText.js +51 -27
  96. package/src/client/components/core/Router.js +76 -77
  97. package/src/client/components/core/Scroll.js +34 -0
  98. package/src/client/components/core/SignUp.js +125 -125
  99. package/src/client/components/core/SocketIo.js +72 -72
  100. package/src/client/components/core/Stream.js +113 -113
  101. package/src/client/components/core/ToggleSwitch.js +87 -87
  102. package/src/client/components/core/ToolTip.js +26 -26
  103. package/src/client/components/core/Translate.js +437 -408
  104. package/src/client/components/core/Validator.js +100 -100
  105. package/src/client/components/core/VanillaJs.js +460 -457
  106. package/src/client/components/core/Wallet.js +106 -106
  107. package/src/client/components/core/Webhook.js +25 -25
  108. package/src/client/components/core/Worker.js +272 -272
  109. package/src/client/components/default/CommonDefault.js +29 -29
  110. package/src/client/components/default/CssDefault.js +13 -13
  111. package/src/client/components/default/ElementsDefault.js +38 -38
  112. package/src/client/components/default/LogInDefault.js +41 -41
  113. package/src/client/components/default/LogOutDefault.js +28 -28
  114. package/src/client/components/default/MenuDefault.js +389 -389
  115. package/src/client/components/default/RoutesDefault.js +48 -48
  116. package/src/client/components/default/SettingsDefault.js +16 -16
  117. package/src/client/components/default/SignUpDefault.js +9 -9
  118. package/src/client/components/default/SocketIoDefault.js +54 -54
  119. package/src/client/components/default/TranslateDefault.js +7 -7
  120. package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
  121. package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
  122. package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
  123. package/src/client/public/default/browserconfig.xml +11 -11
  124. package/src/client/public/default/manifest.webmanifest +68 -68
  125. package/src/client/public/default/plantuml/client-conf.svg +1 -0
  126. package/src/client/public/default/plantuml/client-schema.svg +1 -0
  127. package/src/client/public/default/plantuml/cron-conf.svg +1 -0
  128. package/src/client/public/default/plantuml/cron-schema.svg +1 -0
  129. package/src/client/public/default/plantuml/server-conf.svg +1 -0
  130. package/src/client/public/default/plantuml/server-schema.svg +1 -0
  131. package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
  132. package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
  133. package/src/client/public/default/sitemap +147 -147
  134. package/src/client/public/default/yandex-browser-manifest.json +8 -8
  135. package/src/client/public/doc/sitemap +147 -147
  136. package/src/client/public/test/sitemap +147 -147
  137. package/src/client/services/core/core.service.js +170 -152
  138. package/src/client/services/crypto/crypto.service.js +70 -70
  139. package/src/client/services/default/default.management.js +345 -345
  140. package/src/client/services/default/default.service.js +89 -89
  141. package/src/client/services/file/file.service.js +70 -70
  142. package/src/client/services/instance/instance.management.js +74 -74
  143. package/src/client/services/instance/instance.service.js +89 -89
  144. package/src/client/services/test/test.service.js +70 -70
  145. package/src/client/services/user/user.management.js +50 -50
  146. package/src/client/services/user/user.service.js +89 -89
  147. package/src/client/ssr/Render.js +16 -16
  148. package/src/client/ssr/body-components/CacheControl.js +114 -113
  149. package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -79
  150. package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -21
  151. package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -17
  152. package/src/client/ssr/head-components/Css.js +241 -241
  153. package/src/client/ssr/head-components/DefaultScripts.js +3 -3
  154. package/src/client/ssr/head-components/Microdata.js +11 -11
  155. package/src/client/ssr/head-components/Production.js +1 -1
  156. package/src/client/ssr/head-components/PwaDefault.js +59 -59
  157. package/src/client/ssr/head-components/Seo.js +14 -14
  158. package/src/client/sw/default.sw.js +201 -201
  159. package/src/client/sw/template.sw.js +84 -84
  160. package/src/client.build.js +22 -22
  161. package/src/client.dev.js +21 -21
  162. package/src/cron.js +25 -25
  163. package/src/db/DataBaseProvider.js +34 -34
  164. package/src/db/mariadb/MariaDB.js +33 -33
  165. package/src/db/mongo/MongooseDB.js +137 -46
  166. package/src/dns.js +22 -22
  167. package/src/index.js +42 -29
  168. package/src/mailer/EmailRender.js +69 -69
  169. package/src/mailer/MailerProvider.js +96 -96
  170. package/src/proxy.js +22 -22
  171. package/src/runtime/lampp/Lampp.js +115 -44
  172. package/src/runtime/nginx/Nginx.js +3 -3
  173. package/src/runtime/xampp/Xampp.js +49 -49
  174. package/src/server/auth.js +235 -204
  175. package/src/server/backup.js +101 -94
  176. package/src/server/client-build-live.js +72 -72
  177. package/src/server/client-build.js +699 -699
  178. package/src/server/client-dev-server.js +60 -58
  179. package/src/server/client-formatted.js +48 -48
  180. package/src/server/client-icons.js +149 -150
  181. package/src/server/conf.js +860 -611
  182. package/src/server/dns.js +98 -98
  183. package/src/server/downloader.js +42 -42
  184. package/src/server/logger.js +190 -180
  185. package/src/server/network.js +122 -122
  186. package/src/server/peer.js +33 -33
  187. package/src/server/process.js +66 -66
  188. package/src/server/prompt-optimizer.js +28 -28
  189. package/src/server/proxy.js +118 -118
  190. package/src/server/runtime.js +444 -393
  191. package/src/server/ssl.js +120 -107
  192. package/src/server.js +25 -25
  193. package/src/ws/IoInterface.js +45 -45
  194. package/src/ws/IoServer.js +39 -39
  195. package/src/ws/core/channels/core.ws.chat.js +23 -23
  196. package/src/ws/core/channels/core.ws.mailer.js +35 -35
  197. package/src/ws/core/channels/core.ws.stream.js +31 -31
  198. package/src/ws/core/core.ws.connection.js +28 -28
  199. package/src/ws/core/core.ws.emit.js +14 -14
  200. package/src/ws/core/core.ws.server.js +24 -24
  201. package/src/ws/core/management/core.ws.chat.js +8 -8
  202. package/src/ws/core/management/core.ws.mailer.js +16 -16
  203. package/src/ws/core/management/core.ws.stream.js +8 -8
  204. package/src/ws/default/channels/default.ws.main.js +16 -16
  205. package/src/ws/default/default.ws.connection.js +22 -22
  206. package/src/ws/default/default.ws.emit.js +14 -14
  207. package/src/ws/default/default.ws.server.js +20 -20
  208. package/src/ws/default/management/default.ws.main.js +8 -8
  209. package/startup.js +11 -11
  210. package/supervisord-openssh-server.conf +4 -4
  211. package/test/api.test.js +60 -60
  212. package/bin/dns.js +0 -1
  213. package/bin/install.js +0 -357
  214. package/bin/shortcut.js +0 -44
@@ -1,69 +1,69 @@
1
- import { srcFormatted } from '../server/client-formatted.js';
2
- import fs from 'fs-extra';
3
-
4
- const EmailRender = {
5
- style: {
6
- body: {
7
- 'font-family': 'Arial, sans-serif',
8
- 'background-color': '#f4f4f4',
9
- margin: 0,
10
- padding: '20px',
11
- 'min-height': '300px',
12
- width: '100%',
13
- 'max-width': '700px',
14
- display: 'block',
15
- },
16
- '.container': {
17
- 'max-width': '600px',
18
- margin: '0 auto',
19
- 'background-color': '#ffffff',
20
- padding: '20px',
21
- 'border-radius': '5px',
22
- // 'box-shadow': '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)',
23
- },
24
- h1: {
25
- 'font-size': '24px',
26
- 'margin-bottom': '20px',
27
- color: '#333333',
28
- },
29
- p: {
30
- 'font-size': '16px',
31
- 'line-height': 1.5,
32
- 'margin-bottom': '20px',
33
- color: '#666666',
34
- },
35
- button: {
36
- display: 'inline-block',
37
- padding: '10px 20px',
38
- 'background-color': '#007bff',
39
- color: '#ffffff',
40
- 'text-decoration': 'none',
41
- 'border-radius': '5px',
42
- 'font-size': '16px',
43
- },
44
- '.footer': {
45
- 'text-align': 'center',
46
- padding: '20px',
47
- 'font-size': '14px',
48
- color: '#999999',
49
- },
50
- },
51
- renderStyle: function (classObj) {
52
- return Object.keys(this.style[classObj])
53
- .map((classKey) => ` ${classKey}: ${this.style[classObj][classKey]};`)
54
- .join(``);
55
- },
56
-
57
- getTemplates: async function (options = { templates: {} }) {
58
- const templates = {};
59
- for (const templateKey of Object.keys(options.templates)) {
60
- const ssrEmailComponent = options.templates[templateKey];
61
- let SrrComponent;
62
- eval(await srcFormatted(fs.readFileSync(`./src/client/ssr/email-components/${ssrEmailComponent}.js`, 'utf8')));
63
- templates[templateKey] = SrrComponent(this, options);
64
- }
65
- return templates;
66
- },
67
- };
68
-
69
- export { EmailRender };
1
+ import { srcFormatted } from '../server/client-formatted.js';
2
+ import fs from 'fs-extra';
3
+
4
+ const EmailRender = {
5
+ style: {
6
+ body: {
7
+ 'font-family': 'Arial, sans-serif',
8
+ 'background-color': '#f4f4f4',
9
+ margin: 0,
10
+ padding: '20px',
11
+ 'min-height': '300px',
12
+ width: '100%',
13
+ 'max-width': '700px',
14
+ display: 'block',
15
+ },
16
+ '.container': {
17
+ 'max-width': '600px',
18
+ margin: '0 auto',
19
+ 'background-color': '#ffffff',
20
+ padding: '20px',
21
+ 'border-radius': '5px',
22
+ // 'box-shadow': '0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)',
23
+ },
24
+ h1: {
25
+ 'font-size': '24px',
26
+ 'margin-bottom': '20px',
27
+ color: '#333333',
28
+ },
29
+ p: {
30
+ 'font-size': '16px',
31
+ 'line-height': 1.5,
32
+ 'margin-bottom': '20px',
33
+ color: '#666666',
34
+ },
35
+ button: {
36
+ display: 'inline-block',
37
+ padding: '10px 20px',
38
+ 'background-color': '#007bff',
39
+ color: '#ffffff',
40
+ 'text-decoration': 'none',
41
+ 'border-radius': '5px',
42
+ 'font-size': '16px',
43
+ },
44
+ '.footer': {
45
+ 'text-align': 'center',
46
+ padding: '20px',
47
+ 'font-size': '14px',
48
+ color: '#999999',
49
+ },
50
+ },
51
+ renderStyle: function (classObj) {
52
+ return Object.keys(this.style[classObj])
53
+ .map((classKey) => ` ${classKey}: ${this.style[classObj][classKey]};`)
54
+ .join(``);
55
+ },
56
+
57
+ getTemplates: async function (options = { templates: {} }) {
58
+ const templates = {};
59
+ for (const templateKey of Object.keys(options.templates)) {
60
+ const ssrEmailComponent = options.templates[templateKey];
61
+ let SrrComponent;
62
+ eval(await srcFormatted(fs.readFileSync(`./src/client/ssr/email-components/${ssrEmailComponent}.js`, 'utf8')));
63
+ templates[templateKey] = SrrComponent(this, options);
64
+ }
65
+ return templates;
66
+ },
67
+ };
68
+
69
+ export { EmailRender };
@@ -1,96 +1,96 @@
1
- import nodemailer from 'nodemailer';
2
- import { loggerFactory } from '../server/logger.js';
3
- import { EmailRender } from './EmailRender.js';
4
-
5
- const logger = loggerFactory(import.meta);
6
-
7
- const MailerProvider = {
8
- instance: {},
9
- load: async function (
10
- options = {
11
- id: '',
12
- meta: 'mailer',
13
- sender: {
14
- email: '',
15
- name: '',
16
- },
17
- transport: {
18
- host: '', // smtp host
19
- port: 587,
20
- secure: false, // true for 465, false for other ports
21
- auth: {
22
- user: '', // generated ethereal user
23
- pass: '', // generated ethereal password
24
- },
25
- },
26
- host: '',
27
- path: '',
28
- templates: ['SsrTemplate'],
29
- },
30
- ) {
31
- try {
32
- const { id } = options;
33
- // Generate test SMTP service account from ethereal.email
34
- // Only needed if you don't have a real mail account for testing
35
- // let testAccount = await nodemailer.createTestAccount();
36
-
37
- // create reusable transporter object using the default SMTP transport
38
- const transporter = nodemailer.createTransport(options.transport);
39
-
40
- // console.log('load logger', { url: options.meta });
41
- this.instance[id] = {
42
- ...options,
43
- transporter,
44
- templates: await EmailRender.getTemplates(options),
45
- };
46
-
47
- return this.instance[id];
48
- } catch (error) {
49
- logger.error(error, error.stack);
50
- return undefined;
51
- }
52
- },
53
- send: async function (
54
- options = {
55
- id: '',
56
- sendOptions: {
57
- from: '"Fred Foo 👻" <foo@example.com>', // sender address
58
- to: 'bar@example.com, baz@example.com', // list of receivers
59
- subject: 'Hello ✔', // Subject line
60
- text: 'Hello world?', // plain text body
61
- html: '<b>Hello world?</b>', // html body
62
- attachments: [
63
- {
64
- filename: 'logo.png',
65
- path: `./logo.png`,
66
- cid: 'logo', // <img src='cid:logo'>
67
- },
68
- ],
69
- },
70
- },
71
- ) {
72
- try {
73
- const { id, sendOptions } = options;
74
- if (!sendOptions.from) sendOptions.from = `${this.instance[id].sender.name} <${this.instance[id].sender.email}>`;
75
-
76
- // send mail with defined transport object
77
- const info = await this.instance[id].transporter.sendMail(sendOptions);
78
-
79
- // console.log('Message sent: %s', info.messageId);
80
- // logger.info('Message sent', info);
81
-
82
- // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>
83
-
84
- // Preview only available when sending through an Ethereal account
85
- // console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
86
- // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
87
-
88
- return info;
89
- } catch (error) {
90
- logger.error(error, error.stack);
91
- return undefined;
92
- }
93
- },
94
- };
95
-
96
- export { MailerProvider };
1
+ import nodemailer from 'nodemailer';
2
+ import { loggerFactory } from '../server/logger.js';
3
+ import { EmailRender } from './EmailRender.js';
4
+
5
+ const logger = loggerFactory(import.meta);
6
+
7
+ const MailerProvider = {
8
+ instance: {},
9
+ load: async function (
10
+ options = {
11
+ id: '',
12
+ meta: 'mailer',
13
+ sender: {
14
+ email: '',
15
+ name: '',
16
+ },
17
+ transport: {
18
+ host: '', // smtp host
19
+ port: 587,
20
+ secure: false, // true for 465, false for other ports
21
+ auth: {
22
+ user: '', // generated ethereal user
23
+ pass: '', // generated ethereal password
24
+ },
25
+ },
26
+ host: '',
27
+ path: '',
28
+ templates: ['SsrTemplate'],
29
+ },
30
+ ) {
31
+ try {
32
+ const { id } = options;
33
+ // Generate test SMTP service account from ethereal.email
34
+ // Only needed if you don't have a real mail account for testing
35
+ // let testAccount = await nodemailer.createTestAccount();
36
+
37
+ // create reusable transporter object using the default SMTP transport
38
+ const transporter = nodemailer.createTransport(options.transport);
39
+
40
+ // console.log('load logger', { url: options.meta });
41
+ this.instance[id] = {
42
+ ...options,
43
+ transporter,
44
+ templates: await EmailRender.getTemplates(options),
45
+ };
46
+
47
+ return this.instance[id];
48
+ } catch (error) {
49
+ logger.error(error, error.stack);
50
+ return undefined;
51
+ }
52
+ },
53
+ send: async function (
54
+ options = {
55
+ id: '',
56
+ sendOptions: {
57
+ from: '"Fred Foo 👻" <foo@example.com>', // sender address
58
+ to: 'bar@example.com, baz@example.com', // list of receivers
59
+ subject: 'Hello ✔', // Subject line
60
+ text: 'Hello world?', // plain text body
61
+ html: '<b>Hello world?</b>', // html body
62
+ attachments: [
63
+ {
64
+ filename: 'logo.png',
65
+ path: `./logo.png`,
66
+ cid: 'logo', // <img src='cid:logo'>
67
+ },
68
+ ],
69
+ },
70
+ },
71
+ ) {
72
+ try {
73
+ const { id, sendOptions } = options;
74
+ if (!sendOptions.from) sendOptions.from = `${this.instance[id].sender.name} <${this.instance[id].sender.email}>`;
75
+
76
+ // send mail with defined transport object
77
+ const info = await this.instance[id].transporter.sendMail(sendOptions);
78
+
79
+ // console.log('Message sent: %s', info.messageId);
80
+ // logger.info('Message sent', info);
81
+
82
+ // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>
83
+
84
+ // Preview only available when sending through an Ethereal account
85
+ // console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
86
+ // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
87
+
88
+ return info;
89
+ } catch (error) {
90
+ logger.error(error, error.stack);
91
+ return undefined;
92
+ }
93
+ },
94
+ };
95
+
96
+ export { MailerProvider };
package/src/proxy.js CHANGED
@@ -1,22 +1,22 @@
1
- 'use strict';
2
-
3
- // https://nodejs.org/api
4
- // https://expressjs.com/en/4x/api.html
5
-
6
- import dotenv from 'dotenv';
7
- import { loggerFactory } from './server/logger.js';
8
- import { buildProxy } from './server/proxy.js';
9
- import { ProcessController } from './server/process.js';
10
- import { Config } from './server/conf.js';
11
-
12
- dotenv.config();
13
-
14
- await Config.build();
15
-
16
- const logger = loggerFactory(import.meta);
17
-
18
- await logger.setUpInfo();
19
-
20
- await buildProxy();
21
-
22
- ProcessController.init(logger);
1
+ 'use strict';
2
+
3
+ // https://nodejs.org/api
4
+ // https://expressjs.com/en/4x/api.html
5
+
6
+ import dotenv from 'dotenv';
7
+ import { loggerFactory } from './server/logger.js';
8
+ import { buildProxy } from './server/proxy.js';
9
+ import { ProcessController } from './server/process.js';
10
+ import { Config } from './server/conf.js';
11
+
12
+ dotenv.config();
13
+
14
+ await Config.build();
15
+
16
+ const logger = loggerFactory(import.meta);
17
+
18
+ await logger.setUpInfo();
19
+
20
+ await buildProxy();
21
+
22
+ ProcessController.init(logger);
@@ -1,44 +1,115 @@
1
- import fs from 'fs-extra';
2
- import { network } from '../../server/network.js';
3
- import { shellExec } from '../../server/process.js';
4
- import { timer } from '../../client/components/core/CommonJs.js';
5
-
6
- const Lampp = {
7
- ports: [],
8
- initService: async function (options = { daemon: false }) {
9
- let cmd;
10
- // linux
11
- fs.writeFileSync(`/opt/lampp/apache2/conf/httpd.conf`, this.router || '', 'utf8');
12
- cmd = `sudo /opt/lampp/lampp stop`;
13
- shellExec(cmd);
14
- await network.port.portClean(3306);
15
- for (const port of this.ports) await network.port.portClean(port);
16
- cmd = `sudo /opt/lampp/lampp start`;
17
- if (this.router) fs.writeFileSync(`./tmp/lampp-router.conf`, this.router, 'utf-8');
18
- shellExec(cmd, { async: true });
19
- if (options && options.daemon) this.daemon();
20
- },
21
- daemon: async function () {
22
- await timer(1000 * 60 * 2); // 2 minutes
23
- for (const port of this.ports) {
24
- const [portStatus] = await network.port.status([port]);
25
- if (!portStatus.open) return await this.initService();
26
- }
27
- this.daemon();
28
- },
29
- enabled: () => fs.existsSync(`/opt/lampp/apache2/conf/httpd.conf`),
30
- appendRouter: function (render) {
31
- if (!this.router) {
32
- if (fs.existsSync(`./tmp/lampp-router.conf`))
33
- return (this.router = fs.readFileSync(`./tmp/lampp-router.conf`, 'utf-8')) + render;
34
- return (this.router = render);
35
- }
36
- return (this.router += render);
37
- },
38
- removeRouter: function () {
39
- this.router = undefined;
40
- if (fs.existsSync(`./tmp/lampp-router.conf`)) fs.rmSync(`./tmp/lampp-router.conf`);
41
- },
42
- };
43
-
44
- export { Lampp };
1
+ import fs from 'fs-extra';
2
+ import { network } from '../../server/network.js';
3
+ import { shellCd, shellExec } from '../../server/process.js';
4
+ import { timer } from '../../client/components/core/CommonJs.js';
5
+ import { loggerFactory } from '../../server/logger.js';
6
+
7
+ const logger = loggerFactory(import.meta);
8
+
9
+ const Lampp = {
10
+ ports: [],
11
+ initService: async function (options = { daemon: false }) {
12
+ let cmd;
13
+ // linux
14
+ fs.writeFileSync(`/opt/lampp/apache2/conf/httpd.conf`, this.router || '', 'utf8');
15
+ cmd = `sudo /opt/lampp/lampp stop`;
16
+ if (!fs.readFileSync(`/opt/lampp/etc/httpd.conf`, 'utf8').match(`# Listen 80`))
17
+ fs.writeFileSync(
18
+ `/opt/lampp/etc/httpd.conf`,
19
+ fs.readFileSync(`/opt/lampp/etc/httpd.conf`, 'utf8').replace(`Listen 80`, `# Listen 80`),
20
+ 'utf8',
21
+ );
22
+ if (!fs.readFileSync(`/opt/lampp/etc/extra/httpd-ssl.conf`, 'utf8').match(`# Listen 443`))
23
+ fs.writeFileSync(
24
+ `/opt/lampp/etc/extra/httpd-ssl.conf`,
25
+ fs.readFileSync(`/opt/lampp/etc/extra/httpd-ssl.conf`, 'utf8').replace(`Listen 443`, `# Listen 443`),
26
+ 'utf8',
27
+ );
28
+ if (!fs.readFileSync(`/opt/lampp/lampp`, 'utf8').match(`testport 443 && false`))
29
+ fs.writeFileSync(
30
+ `/opt/lampp/lampp`,
31
+ fs.readFileSync(`/opt/lampp/lampp`, 'utf8').replace(`testport 443`, `testport 443 && false`),
32
+ 'utf8',
33
+ );
34
+ if (!fs.readFileSync(`/opt/lampp/lampp`, 'utf8').match(`testport 80 && false`))
35
+ fs.writeFileSync(
36
+ `/opt/lampp/lampp`,
37
+ fs.readFileSync(`/opt/lampp/lampp`, 'utf8').replace(`testport 80`, `testport 80 && false`),
38
+ 'utf8',
39
+ );
40
+
41
+ shellExec(cmd);
42
+ await network.port.portClean(3306);
43
+ for (const port of this.ports) await network.port.portClean(port);
44
+ cmd = `sudo /opt/lampp/lampp start`;
45
+ if (this.router) fs.writeFileSync(`./tmp/lampp-router.conf`, this.router, 'utf-8');
46
+ shellExec(cmd, { async: true });
47
+ if (options && options.daemon) this.daemon();
48
+ },
49
+ daemon: async function () {
50
+ await timer(1000 * 60 * 2); // 2 minutes
51
+ for (const port of this.ports) {
52
+ const [portStatus] = await network.port.status([port]);
53
+ if (!portStatus.open) return await this.initService();
54
+ }
55
+ this.daemon();
56
+ },
57
+ enabled: () => fs.existsSync(`/opt/lampp/apache2/conf/httpd.conf`),
58
+ appendRouter: function (render) {
59
+ if (!this.router) {
60
+ if (fs.existsSync(`./tmp/lampp-router.conf`))
61
+ return (this.router = fs.readFileSync(`./tmp/lampp-router.conf`, 'utf-8')) + render;
62
+ return (this.router = render);
63
+ }
64
+ return (this.router += render);
65
+ },
66
+ removeRouter: function () {
67
+ this.router = undefined;
68
+ if (fs.existsSync(`./tmp/lampp-router.conf`)) fs.rmSync(`./tmp/lampp-router.conf`);
69
+ },
70
+ install: async function () {
71
+ switch (process.platform) {
72
+ case 'linux':
73
+ {
74
+ if (!fs.existsSync(`./engine-private/setup`)) fs.mkdirSync(`./engine-private/setup`, { recursive: true });
75
+
76
+ shellCd(`./engine-private/setup`);
77
+
78
+ if (!process.argv.includes(`server`)) {
79
+ shellExec(
80
+ `curl -Lo xampp-linux-installer.run https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.4.30/xampp-linux-x64-7.4.30-1-installer.run?from_af=true`,
81
+ );
82
+ shellExec(`sudo chmod +x xampp-linux-installer.run`);
83
+ shellExec(
84
+ `sudo ./xampp-linux-installer.run --mode unattended && \\` +
85
+ `ln -sf /opt/lampp/lampp /usr/bin/lampp && \\` +
86
+ `sed -i.bak s'/Require local/Require all granted/g' /opt/lampp/etc/extra/httpd-xampp.conf && \\` +
87
+ `sed -i.bak s'/display_errors=Off/display_errors=On/g' /opt/lampp/etc/php.ini && \\` +
88
+ `mkdir /opt/lampp/apache2/conf.d && \\` +
89
+ `echo "IncludeOptional /opt/lampp/apache2/conf.d/*.conf" >> /opt/lampp/etc/httpd.conf && \\` +
90
+ `mkdir /www && \\` +
91
+ `ln -s /www /opt/lampp/htdocs`,
92
+ );
93
+
94
+ if (fs.existsSync(`/opt/lampp/logs/access_log`))
95
+ fs.copySync(`/opt/lampp/logs/access_log`, `/opt/lampp/logs/access.log`);
96
+ if (fs.existsSync(`/opt/lampp/logs/error_log`))
97
+ fs.copySync(`/opt/lampp/logs/error_log`, `/opt/lampp/logs/error.log`);
98
+ if (fs.existsSync(`/opt/lampp/logs/php_error_log`))
99
+ fs.copySync(`/opt/lampp/logs/php_error_log`, `/opt/lampp/logs/php_error.log`);
100
+ if (fs.existsSync(`/opt/lampp/logs/ssl_request_log`))
101
+ fs.copySync(`/opt/lampp/logs/ssl_request_log`, `/opt/lampp/logs/ssl_request.log`);
102
+ }
103
+
104
+ await Lampp.initService({ daemon: true });
105
+ }
106
+
107
+ break;
108
+
109
+ default:
110
+ break;
111
+ }
112
+ },
113
+ };
114
+
115
+ export { Lampp };
@@ -1,3 +1,3 @@
1
- const Nginx = {};
2
-
3
- export { Nginx };
1
+ const Nginx = {};
2
+
3
+ export { Nginx };
@@ -1,49 +1,49 @@
1
- import fs from 'fs-extra';
2
- import { network } from '../../server/network.js';
3
- import { shellExec } from '../../server/process.js';
4
- import { timer } from '../../client/components/core/CommonJs.js';
5
-
6
- const Xampp = {
7
- ports: [],
8
- initService: async function (options = { daemon: false }) {
9
- let cmd;
10
- // windows
11
- fs.writeFileSync(
12
- `C:/xampp/apache/conf/httpd.conf`,
13
- fs.readFileSync(`C:/xampp/apache/conf/httpd.template.conf`, 'utf8').replace(`Listen 80`, ``),
14
- 'utf8',
15
- );
16
- fs.writeFileSync(`C:/xampp/apache/conf/extra/httpd-ssl.conf`, this.router || '', 'utf8');
17
- cmd = `C:/xampp/xampp_stop.exe`;
18
- shellExec(cmd);
19
- await network.port.portClean(3306);
20
- for (const port of this.ports) await network.port.portClean(port);
21
- cmd = `C:/xampp/xampp_start.exe`;
22
- if (this.router) fs.writeFileSync(`./tmp/xampp-router.conf`, this.router, 'utf-8');
23
- shellExec(cmd);
24
- if (options && options.daemon) this.daemon();
25
- },
26
- daemon: async function () {
27
- await timer(1000 * 60 * 2); // 2 minutes
28
- for (const port of this.ports) {
29
- const [portStatus] = await network.port.status([port]);
30
- if (!portStatus.open) return await this.initService();
31
- }
32
- this.daemon();
33
- },
34
- enabled: () => fs.existsSync(`C:/xampp/apache/conf/httpd.conf`),
35
- appendRouter: function (render) {
36
- if (!this.router) {
37
- if (fs.existsSync(`./tmp/xampp-router.conf`))
38
- return (this.router = fs.readFileSync(`./tmp/xampp-router.conf`, 'utf-8')) + render;
39
- return (this.router = render);
40
- }
41
- return (this.router += render);
42
- },
43
- removeRouter: function () {
44
- this.router = undefined;
45
- if (fs.existsSync(`./tmp/xampp-router.conf`)) fs.rmSync(`./tmp/xampp-router.conf`);
46
- },
47
- };
48
-
49
- export { Xampp };
1
+ import fs from 'fs-extra';
2
+ import { network } from '../../server/network.js';
3
+ import { shellExec } from '../../server/process.js';
4
+ import { timer } from '../../client/components/core/CommonJs.js';
5
+
6
+ const Xampp = {
7
+ ports: [],
8
+ initService: async function (options = { daemon: false }) {
9
+ let cmd;
10
+ // windows
11
+ fs.writeFileSync(
12
+ `C:/xampp/apache/conf/httpd.conf`,
13
+ fs.readFileSync(`C:/xampp/apache/conf/httpd.template.conf`, 'utf8').replace(`Listen 80`, ``),
14
+ 'utf8',
15
+ );
16
+ fs.writeFileSync(`C:/xampp/apache/conf/extra/httpd-ssl.conf`, this.router || '', 'utf8');
17
+ cmd = `C:/xampp/xampp_stop.exe`;
18
+ shellExec(cmd);
19
+ await network.port.portClean(3306);
20
+ for (const port of this.ports) await network.port.portClean(port);
21
+ cmd = `C:/xampp/xampp_start.exe`;
22
+ if (this.router) fs.writeFileSync(`./tmp/xampp-router.conf`, this.router, 'utf-8');
23
+ shellExec(cmd);
24
+ if (options && options.daemon) this.daemon();
25
+ },
26
+ daemon: async function () {
27
+ await timer(1000 * 60 * 2); // 2 minutes
28
+ for (const port of this.ports) {
29
+ const [portStatus] = await network.port.status([port]);
30
+ if (!portStatus.open) return await this.initService();
31
+ }
32
+ this.daemon();
33
+ },
34
+ enabled: () => fs.existsSync(`C:/xampp/apache/conf/httpd.conf`),
35
+ appendRouter: function (render) {
36
+ if (!this.router) {
37
+ if (fs.existsSync(`./tmp/xampp-router.conf`))
38
+ return (this.router = fs.readFileSync(`./tmp/xampp-router.conf`, 'utf-8')) + render;
39
+ return (this.router = render);
40
+ }
41
+ return (this.router += render);
42
+ },
43
+ removeRouter: function () {
44
+ this.router = undefined;
45
+ if (fs.existsSync(`./tmp/xampp-router.conf`)) fs.rmSync(`./tmp/xampp-router.conf`);
46
+ },
47
+ };
48
+
49
+ export { Xampp };