underpost 2.7.81 → 2.7.91
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/.github/workflows/ghpkg.yml +41 -1
- package/.github/workflows/publish.yml +17 -18
- package/.github/workflows/pwa-microservices-template.page.yml +54 -0
- package/.vscode/settings.json +7 -0
- package/CHANGELOG.md +64 -16
- package/bin/cron.js +47 -0
- package/bin/db.js +60 -7
- package/bin/deploy.js +345 -15
- package/bin/file.js +17 -1
- package/bin/index.js +1 -1
- package/bin/util.js +31 -1
- package/conf.js +18 -4
- package/docker-compose.yml +1 -1
- package/package.json +3 -3
- package/src/api/core/core.router.js +9 -9
- package/src/api/core/core.service.js +12 -4
- package/src/api/default/default.service.js +4 -4
- package/src/api/file/file.service.js +3 -3
- package/src/api/user/user.service.js +10 -8
- package/src/client/components/core/CommonJs.js +3 -0
- package/src/client/components/core/CssCore.js +30 -3
- package/src/client/components/core/Docs.js +110 -10
- package/src/client/components/core/LoadingAnimation.js +4 -2
- package/src/client/components/core/Modal.js +224 -22
- package/src/client/components/core/Panel.js +1 -1
- package/src/client/components/core/PanelForm.js +2 -1
- package/src/client/components/core/Responsive.js +34 -5
- package/src/client/components/core/RichText.js +4 -2
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Worker.js +13 -15
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/client-schema.svg +1 -1
- package/src/client/public/default/plantuml/cron-conf.svg +1 -1
- package/src/client/public/default/plantuml/cron-schema.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/public/default/site.webmanifest +69 -0
- package/src/client/ssr/components/body/CacheControl.js +1 -1
- package/src/client/ssr/components/head/Production.js +1 -0
- package/src/client/ssr/components/head/Pwa.js +146 -0
- package/src/client/ssr/components/head/Seo.js +14 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +4 -2
- package/src/db/DataBaseProvider.js +12 -1
- package/src/db/mongo/MongooseDB.js +0 -1
- package/src/runtime/lampp/Lampp.js +9 -9
- package/src/server/backup.js +82 -70
- package/src/server/client-build.js +46 -94
- package/src/server/conf.js +82 -18
- package/src/server/crypto.js +91 -0
- package/src/server/dns.js +48 -16
- package/src/server/network.js +94 -7
- package/src/server/proxy.js +27 -27
- package/src/server/runtime.js +4 -2
- package/src/server/ssl.js +2 -2
- package/src/client/ssr/offline/default.index.js +0 -31
- package/src/cron.js +0 -30
- package/src/server/cron.js +0 -35
|
@@ -9,7 +9,47 @@ permissions:
|
|
|
9
9
|
packages: write
|
|
10
10
|
id-token: write
|
|
11
11
|
jobs:
|
|
12
|
-
|
|
12
|
+
pwa-microservices-template:
|
|
13
|
+
if: github.repository == 'underpostnet/engine' && startsWith(github.event.head_commit.message, '[ci][package][pwa-microservices-template]')
|
|
14
|
+
name: Update github repo package Jobs
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
packages: write
|
|
19
|
+
id-token: write
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: '22.x'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: |
|
|
28
|
+
npm install
|
|
29
|
+
|
|
30
|
+
- name: Set git credentials
|
|
31
|
+
run: |
|
|
32
|
+
git config --global credential.helper ""
|
|
33
|
+
git config credential.helper ""
|
|
34
|
+
git config --global user.name 'underpostnet'
|
|
35
|
+
git config --global user.email 'fcoverdugoa@underpost.net'
|
|
36
|
+
git config --global credential.interactive always
|
|
37
|
+
git config user.name 'underpostnet'
|
|
38
|
+
git config user.email 'fcoverdugoa@underpost.net'
|
|
39
|
+
git config credential.interactive always
|
|
40
|
+
|
|
41
|
+
- name: Clone github package repository
|
|
42
|
+
run: |
|
|
43
|
+
cd .. && git clone https://github.com/underpostnet/pwa-microservices-template.git
|
|
44
|
+
cd engine
|
|
45
|
+
npm run update-template
|
|
46
|
+
cd ../pwa-microservices-template
|
|
47
|
+
git remote set-url origin git@github.com:underpostnet/pwa-microservices-template.git
|
|
48
|
+
git add .
|
|
49
|
+
git commit -m "Update github repo package"
|
|
50
|
+
git push https://${{ secrets.GIT_AUTH_TOKEN }}@github.com/underpostnet/pwa-microservices-template.git
|
|
51
|
+
|
|
52
|
+
pwa-microservices-template-ghpk:
|
|
13
53
|
if: github.repository == 'underpostnet/pwa-microservices-template'
|
|
14
54
|
name: Update github repo package Jobs
|
|
15
55
|
runs-on: ubuntu-latest
|
|
@@ -34,25 +34,24 @@ jobs:
|
|
|
34
34
|
name: Publish to npm
|
|
35
35
|
run: npm publish --provenance --access public
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
build-and-publish-ghpkg:
|
|
38
|
+
# prevents this action from running on forks
|
|
39
|
+
if: github.repository == 'underpostnet/pwa-microservices-template-ghpkg'
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
permissions:
|
|
42
|
+
contents: read
|
|
43
|
+
id-token: write
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
- uses: actions/setup-node@v4
|
|
47
|
+
with:
|
|
48
|
+
node-version: '22.x'
|
|
49
|
+
registry-url: 'https://registry.npmjs.org'
|
|
45
50
|
|
|
46
|
-
- name:
|
|
47
|
-
run:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
git config --global user.name 'underpostnet'
|
|
51
|
-
git config --global user.email 'fcoverdugoa@underpost.net'
|
|
52
|
-
git config --global credential.interactive always
|
|
53
|
-
git config user.name 'underpostnet'
|
|
54
|
-
git config user.email 'fcoverdugoa@underpost.net'
|
|
55
|
-
git config credential.interactive always
|
|
51
|
+
- name: Install Dependencies
|
|
52
|
+
run: npm install
|
|
53
|
+
|
|
54
|
+
- run: npm ci
|
|
56
55
|
|
|
57
56
|
# Publish to npm git hub package
|
|
58
57
|
- uses: actions/setup-node@v4
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Simple workflow for deploying static content to GitHub Pages
|
|
2
|
+
name: Deploy static content to Pages
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
# Runs on pushes targeting the default branch
|
|
6
|
+
push:
|
|
7
|
+
branches: ['main']
|
|
8
|
+
|
|
9
|
+
# Allows you to run this workflow manually from the Actions tab
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pages: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
19
|
+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
20
|
+
concurrency:
|
|
21
|
+
group: 'pages'
|
|
22
|
+
cancel-in-progress: false
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
# Single deploy job since we're just deploying
|
|
26
|
+
deploy:
|
|
27
|
+
if: github.repository == 'underpostnet/pwa-microservices-template-ghpkg'
|
|
28
|
+
environment:
|
|
29
|
+
name: github-pages
|
|
30
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- name: Checkout
|
|
34
|
+
uses: actions/checkout@v4
|
|
35
|
+
- uses: actions/setup-node@v4
|
|
36
|
+
with:
|
|
37
|
+
node-version: '22.x'
|
|
38
|
+
|
|
39
|
+
- name: Build the site
|
|
40
|
+
run: |
|
|
41
|
+
npm install
|
|
42
|
+
node bin/deploy update-default-conf
|
|
43
|
+
npm run build-production github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
|
|
44
|
+
|
|
45
|
+
- name: Setup Pages
|
|
46
|
+
uses: actions/configure-pages@v5
|
|
47
|
+
- name: Upload artifact
|
|
48
|
+
uses: actions/upload-pages-artifact@v3
|
|
49
|
+
with:
|
|
50
|
+
# Upload entire repository
|
|
51
|
+
path: './public/underpostnet.github.io/pwa-microservices-template-ghpkg/'
|
|
52
|
+
- name: Deploy to GitHub Pages
|
|
53
|
+
id: deployment
|
|
54
|
+
uses: actions/deploy-pages@v4
|
package/.vscode/settings.json
CHANGED
|
@@ -30,12 +30,15 @@
|
|
|
30
30
|
"fileupload",
|
|
31
31
|
"fontawesome",
|
|
32
32
|
"fortawesome",
|
|
33
|
+
"gameplay",
|
|
33
34
|
"googlebot",
|
|
34
35
|
"Hexa",
|
|
35
36
|
"htdocs",
|
|
36
37
|
"htmls",
|
|
38
|
+
"inet",
|
|
37
39
|
"inlt",
|
|
38
40
|
"ipfs",
|
|
41
|
+
"Itemledger",
|
|
39
42
|
"jsonld",
|
|
40
43
|
"lampp",
|
|
41
44
|
"loadingio",
|
|
@@ -54,6 +57,7 @@
|
|
|
54
57
|
"Scatterplot",
|
|
55
58
|
"sortablejs",
|
|
56
59
|
"supervisord",
|
|
60
|
+
"Tokenomics",
|
|
57
61
|
"underpost",
|
|
58
62
|
"Unequip",
|
|
59
63
|
"webroot",
|
|
@@ -96,5 +100,8 @@
|
|
|
96
100
|
"prometheus_data": true,
|
|
97
101
|
"grafana_data": true,
|
|
98
102
|
".nyc_output": true
|
|
103
|
+
},
|
|
104
|
+
"[solidity]": {
|
|
105
|
+
"editor.defaultFormatter": "JuanBlanco.solidity"
|
|
99
106
|
}
|
|
100
107
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -4,34 +4,82 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
-
#### [v2.7.
|
|
7
|
+
#### [v2.7.83](https://github.com/underpostnet/engine/compare/v2.7.7...v2.7.83)
|
|
8
|
+
|
|
9
|
+
> 28 October 2024
|
|
10
|
+
|
|
11
|
+
- update version 2.7.83 [`3d22671`](https://github.com/underpostnet/engine/commit/3d22671a23f25767cc01c244090e237ab3a300da)
|
|
12
|
+
- ssr refactor [`836b848`](https://github.com/underpostnet/engine/commit/836b8488b8b5156c4c5d376fefd592e25071a212)
|
|
13
|
+
- fix pixi js render [`93aaee3`](https://github.com/underpostnet/engine/commit/93aaee3683b070874b65ca2c00d27f2a787a0a5d)
|
|
14
|
+
|
|
15
|
+
#### [v2.7.7](https://github.com/underpostnet/engine/compare/v2.7.6...v2.7.7)
|
|
16
|
+
|
|
17
|
+
> 25 October 2024
|
|
18
|
+
|
|
19
|
+
- update version 2.7.7 [`df31617`](https://github.com/underpostnet/engine/commit/df316174ca563251fbaca62a6717771f3056e59b)
|
|
20
|
+
- cyberia ssr lore advance [`ad1f214`](https://github.com/underpostnet/engine/commit/ad1f2144bdd2f3b5b1f2ebc4b9f6b83716df800a)
|
|
21
|
+
- advance ssr lore cyberia [`03b2292`](https://github.com/underpostnet/engine/commit/03b2292f6e092fc9b98cfb6aba9eee6eb0f21a06)
|
|
22
|
+
|
|
23
|
+
#### [v2.7.6](https://github.com/underpostnet/engine/compare/v2.7.5...v2.7.6)
|
|
24
|
+
|
|
25
|
+
> 17 October 2024
|
|
26
|
+
|
|
27
|
+
- update version v2.7.6 [`ddbc2c4`](https://github.com/underpostnet/engine/commit/ddbc2c4bd366e75b580be288c28c68830ed390d5)
|
|
28
|
+
- update node version 22.9.0 and hardhat refactor [`8ba9281`](https://github.com/underpostnet/engine/commit/8ba92818cd67438359dd1aa0938fd33bb932e718)
|
|
29
|
+
- remove pinata [`e231b00`](https://github.com/underpostnet/engine/commit/e231b00919d9d0e31c9718d4dc512384779cf2bb)
|
|
30
|
+
|
|
31
|
+
#### [v2.7.5](https://github.com/underpostnet/engine/compare/v2.7.2...v2.7.5)
|
|
32
|
+
|
|
33
|
+
> 10 October 2024
|
|
34
|
+
|
|
35
|
+
- remove os switchs [`78f7c17`](https://github.com/underpostnet/engine/commit/78f7c17bdaa1789101bf3038544d105b51f25309)
|
|
36
|
+
- update version 2.7.5 [`ca059d9`](https://github.com/underpostnet/engine/commit/ca059d99f95121cbd51f4582c60458734e21b70d)
|
|
37
|
+
- add mondo db server daemon [`b3bab7e`](https://github.com/underpostnet/engine/commit/b3bab7e8ba4204da459660d5fdba25c076c6cd33)
|
|
38
|
+
|
|
39
|
+
#### [v2.7.2](https://github.com/underpostnet/engine/compare/v2.7.1...v2.7.2)
|
|
8
40
|
|
|
9
41
|
> 8 October 2024
|
|
10
42
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
43
|
+
- underpost panel advance [`60087d5`](https://github.com/underpostnet/engine/commit/60087d55920ae9ddf7d7a3396606088d028cc996)
|
|
44
|
+
- file explorer content ui ux refactor [`38e87a0`](https://github.com/underpostnet/engine/commit/38e87a0f0bd222e1d8c9d76904d086aa9d2125ea)
|
|
45
|
+
- add macro db restore logic [`9cfd41c`](https://github.com/underpostnet/engine/commit/9cfd41c5d7adcd309976e7d327af800ffcf92dac)
|
|
14
46
|
|
|
15
|
-
#### [v2.7.1](https://github.com/underpostnet/
|
|
47
|
+
#### [v2.7.1](https://github.com/underpostnet/engine/compare/v2.6.3...v2.7.1)
|
|
16
48
|
|
|
17
49
|
> 19 September 2024
|
|
18
50
|
|
|
19
|
-
-
|
|
20
|
-
- update
|
|
21
|
-
-
|
|
51
|
+
- update version 2.7.0 [`03c5c35`](https://github.com/underpostnet/engine/commit/03c5c35a71e7ffb35203a668bfa2f8e2f86125e0)
|
|
52
|
+
- update [`d410da6`](https://github.com/underpostnet/engine/commit/d410da62fadbbb841eb9dcfa5922f105d35ad81d)
|
|
53
|
+
- add changelog generator [`28b3256`](https://github.com/underpostnet/engine/commit/28b3256ab9cebaa9caf2b52426e48f0b3105c8b7)
|
|
22
54
|
|
|
23
|
-
#### [v2.6.3](https://github.com/underpostnet/
|
|
55
|
+
#### [v2.6.3](https://github.com/underpostnet/engine/compare/v2.6.2...v2.6.3)
|
|
24
56
|
|
|
25
57
|
> 14 September 2024
|
|
26
58
|
|
|
27
|
-
- update version 2.6.3 [`
|
|
28
|
-
- update [`
|
|
29
|
-
- update [`
|
|
59
|
+
- update version 2.6.3 [`85c585d`](https://github.com/underpostnet/engine/commit/85c585d1cce30de4389772605cf56e774e2b7d3c)
|
|
60
|
+
- update refactor docs and coverage [`b455016`](https://github.com/underpostnet/engine/commit/b455016f5f2b2bdc142aacb4dfd66ab890125662)
|
|
61
|
+
- update [`b8f01f2`](https://github.com/underpostnet/engine/commit/b8f01f258999c9ebc1173b0616f0f7b8f7171048)
|
|
30
62
|
|
|
31
|
-
#### v2.6.2
|
|
63
|
+
#### [v2.6.2](https://github.com/underpostnet/engine/compare/v2.5.1...v2.6.2)
|
|
32
64
|
|
|
33
65
|
> 13 September 2024
|
|
34
66
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
- update
|
|
67
|
+
- update version 2.6.2 [`0895afb`](https://github.com/underpostnet/engine/commit/0895afbde42dd5a573507ccfcb07c328648b4eb0)
|
|
68
|
+
- update version 2.5.6 [`ca57b87`](https://github.com/underpostnet/engine/commit/ca57b87c56a544e7b7e53baa5a6e15415e16b99b)
|
|
69
|
+
- update [`eec4943`](https://github.com/underpostnet/engine/commit/eec49433f50b4dfa7b7bbff48891a60f5be25545)
|
|
70
|
+
|
|
71
|
+
#### [v2.5.1](https://github.com/underpostnet/engine/compare/v2.0.0...v2.5.1)
|
|
72
|
+
|
|
73
|
+
> 27 August 2024
|
|
74
|
+
|
|
75
|
+
- css refactor [`49b1904`](https://github.com/underpostnet/engine/commit/49b1904e83162f9066fbf843ced37d4e87db5581)
|
|
76
|
+
- refactor [`dad4f95`](https://github.com/underpostnet/engine/commit/dad4f9567629b737254702ce8be6b243e68fb01e)
|
|
77
|
+
- add sitemap builder [`53d05a6`](https://github.com/underpostnet/engine/commit/53d05a62d03ea327df3d37181a4b5c272d417289)
|
|
78
|
+
|
|
79
|
+
#### v2.0.0
|
|
80
|
+
|
|
81
|
+
> 30 March 2024
|
|
82
|
+
|
|
83
|
+
- seed-city assets [`6d9decb`](https://github.com/underpostnet/engine/commit/6d9decbae96b828aa001777f96dd75aab3fc71d1)
|
|
84
|
+
- update [`1069fc5`](https://github.com/underpostnet/engine/commit/1069fc5268aa5ef7c101695393de59edfc14daf8)
|
|
85
|
+
- update [`41ae7d4`](https://github.com/underpostnet/engine/commit/41ae7d4c969cce0608171c820e05ebab42610a7f)
|
package/bin/cron.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { BackUpManagement } from '../src/server/backup.js';
|
|
2
|
+
import { Cmd } from '../src/server/conf.js';
|
|
3
|
+
import { Dns } from '../src/server/dns.js';
|
|
4
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
5
|
+
import { netWorkCron, saveRuntimeCron } from '../src/server/network.js';
|
|
6
|
+
import { shellExec } from '../src/server/process.js';
|
|
7
|
+
import fs from 'fs-extra';
|
|
8
|
+
|
|
9
|
+
const logger = loggerFactory(import.meta);
|
|
10
|
+
|
|
11
|
+
await logger.setUpInfo();
|
|
12
|
+
|
|
13
|
+
switch (process.argv[2]) {
|
|
14
|
+
case 'backups':
|
|
15
|
+
{
|
|
16
|
+
await BackUpManagement.Init({ deployId: process.argv[3] });
|
|
17
|
+
}
|
|
18
|
+
break;
|
|
19
|
+
case 'dns':
|
|
20
|
+
{
|
|
21
|
+
await Dns.InitIpDaemon({ deployId: process.argv[3] });
|
|
22
|
+
}
|
|
23
|
+
break;
|
|
24
|
+
|
|
25
|
+
case 'run': {
|
|
26
|
+
const confCronConfig = JSON.parse(fs.readFileSync(`./engine-private/conf/${process.argv[3]}/conf.cron.json`));
|
|
27
|
+
if (confCronConfig.jobs && Object.keys(confCronConfig.jobs).length > 0) {
|
|
28
|
+
shellExec(`node bin/deploy conf ${process.argv[3]} production`);
|
|
29
|
+
for (const job of Object.keys(confCronConfig.jobs)) {
|
|
30
|
+
if (confCronConfig.jobs[job].enabled) {
|
|
31
|
+
shellExec(Cmd.cron(process.argv[3], job, confCronConfig.jobs[job].expression));
|
|
32
|
+
netWorkCron.push({
|
|
33
|
+
deployId: process.argv[3],
|
|
34
|
+
jobId: job,
|
|
35
|
+
expression: confCronConfig.jobs[job].expression,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
await saveRuntimeCron();
|
|
41
|
+
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
default:
|
|
46
|
+
break;
|
|
47
|
+
}
|
package/bin/db.js
CHANGED
|
@@ -26,14 +26,11 @@ try {
|
|
|
26
26
|
// logger.info('database', confServer[host][`/${path}`].db);
|
|
27
27
|
switch (provider) {
|
|
28
28
|
case 'mariadb':
|
|
29
|
-
// https://www.cyberciti.biz/faq/how-to-show-list-users-in-a-mysql-mariadb-database/
|
|
30
|
-
|
|
31
29
|
// Login:
|
|
32
|
-
// mysql -u root -p
|
|
33
|
-
// mysql -u root -h localhost -p mysql
|
|
30
|
+
// mysql -u root -h localhost -p
|
|
34
31
|
|
|
35
32
|
// Get Users:
|
|
36
|
-
// SELECT
|
|
33
|
+
// SELECT user,authentication_string,plugin,host FROM mysql.user;
|
|
37
34
|
|
|
38
35
|
// Get DB User:
|
|
39
36
|
// SELECT User, Db, Host from mysql.db;
|
|
@@ -46,6 +43,27 @@ try {
|
|
|
46
43
|
// Get all user privileges:
|
|
47
44
|
// select * from information_schema.user_privileges;
|
|
48
45
|
|
|
46
|
+
// Expose public server:
|
|
47
|
+
// '/etc/mysql/my.cnf' Change lines:
|
|
48
|
+
// bind-address = 127.0.0.1 -> bind-address = 0.0.0.0
|
|
49
|
+
// skip-networking -> #skip-networking
|
|
50
|
+
|
|
51
|
+
// Create user:
|
|
52
|
+
// DROP USER 'username'@'%';
|
|
53
|
+
// CREATE USER 'username'@'%' IDENTIFIED BY 'password';
|
|
54
|
+
|
|
55
|
+
// Set DB user:
|
|
56
|
+
// FLUSH PRIVILEGES;
|
|
57
|
+
// ON databasename.*
|
|
58
|
+
// TO 'username'@'%'
|
|
59
|
+
// IDENTIFIED BY 'newpassword';
|
|
60
|
+
// FLUSH PRIVILEGES;
|
|
61
|
+
|
|
62
|
+
// Set admin:
|
|
63
|
+
// FLUSH PRIVILEGES;
|
|
64
|
+
// GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
|
|
65
|
+
// FLUSH PRIVILEGES;
|
|
66
|
+
|
|
49
67
|
switch (operator) {
|
|
50
68
|
case 'show-all':
|
|
51
69
|
await MariaDB.query({ user, password, query: `SHOW DATABASES` });
|
|
@@ -60,8 +78,23 @@ try {
|
|
|
60
78
|
await MariaDB.query({ user, password, query: `DROP DATABASE IF EXISTS ${name}` });
|
|
61
79
|
break;
|
|
62
80
|
case 'select':
|
|
63
|
-
|
|
81
|
+
{
|
|
82
|
+
const pageSize = 10;
|
|
83
|
+
const pageNumber = 1;
|
|
84
|
+
await MariaDB.query({
|
|
85
|
+
user,
|
|
86
|
+
password,
|
|
87
|
+
query: `SELECT ${arg0} FROM ${name}.${arg1} LIMIT ${pageSize} OFFSET ${(pageNumber - 1) * pageSize}`,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
64
90
|
break;
|
|
91
|
+
case 'count': {
|
|
92
|
+
await MariaDB.query({
|
|
93
|
+
user,
|
|
94
|
+
password,
|
|
95
|
+
query: `SELECT COUNT(*) AS total FROM ${name}.${arg0}`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
65
98
|
case 'export':
|
|
66
99
|
{
|
|
67
100
|
const cmdBackupPath = `${arg0 ? `${arg0}/${name}.sql` : backupPath}`;
|
|
@@ -101,6 +134,18 @@ try {
|
|
|
101
134
|
case 'init-lampp-service':
|
|
102
135
|
await Lampp.initService();
|
|
103
136
|
break;
|
|
137
|
+
case 'remote-client-access':
|
|
138
|
+
{
|
|
139
|
+
// https://docs.anaconda.com/miniconda/install/#quick-command-line-install
|
|
140
|
+
// https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/
|
|
141
|
+
// conf: /opt/lampp/etc
|
|
142
|
+
// conf: /etc/mysql/my.cnf
|
|
143
|
+
// conf: /etc/mysql/mariadb.conf.d/50-server.cnf
|
|
144
|
+
// cli: /opt/lampp/bin/mysql
|
|
145
|
+
// cli: mysql -h 127.0.0.1
|
|
146
|
+
// select db: use db0;
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
104
149
|
default:
|
|
105
150
|
break;
|
|
106
151
|
}
|
|
@@ -113,7 +158,7 @@ try {
|
|
|
113
158
|
case 'update':
|
|
114
159
|
{
|
|
115
160
|
await DataBaseProvider.load({ apis: [arg0], host, path, db });
|
|
116
|
-
const models = DataBaseProvider.instance[`${host}${path}`].mongoose[getCapVariableName(arg0)];
|
|
161
|
+
const models = DataBaseProvider.instance[`${host}${path}`].mongoose.models[getCapVariableName(arg0)];
|
|
117
162
|
|
|
118
163
|
const select = JSON.parse(arg1.replaceAll("'", `"`));
|
|
119
164
|
const update = JSON.parse(arg2.replaceAll("'", `"`));
|
|
@@ -133,6 +178,7 @@ try {
|
|
|
133
178
|
runValidators: true,
|
|
134
179
|
});
|
|
135
180
|
logger.info(`successfully updated doc`, doc._doc);
|
|
181
|
+
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
136
182
|
} else throw new Error(`no doc found`);
|
|
137
183
|
}
|
|
138
184
|
break;
|
|
@@ -143,6 +189,13 @@ try {
|
|
|
143
189
|
case 'create':
|
|
144
190
|
break;
|
|
145
191
|
case 'delete':
|
|
192
|
+
{
|
|
193
|
+
await DataBaseProvider.load({ apis: [arg0], host, path, db });
|
|
194
|
+
const models = DataBaseProvider.instance[`${host}${path}`].mongoose.models[getCapVariableName(arg0)];
|
|
195
|
+
await models.collection.drop();
|
|
196
|
+
logger.info(`successfully drop collection`, arg0);
|
|
197
|
+
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
198
|
+
}
|
|
146
199
|
break;
|
|
147
200
|
case 'export':
|
|
148
201
|
// mongodump -d <database_name> -o <directory_backup>
|