@hyperbytes/wappler-2fa-code-generator 1.0.0 → 1.1.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
1
  all details are at:
2
2
 
3
- https://community.wappler.io/t/server-connect-custom-module-node-generate-2fa-style-code/57052
3
+ https://community.wappler.io/t/server-connect-custom-module-node-generate-2fa-style-code/57052
4
+
5
+ improved parsing of dynamic inputs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbytes/wappler-2fa-code-generator",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Generate 2FA style code from character salt with optional repeats and user defined code length",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -11,5 +11,8 @@
11
11
  "server-connect",
12
12
  "generate-2FA-code"
13
13
  ],
14
+ "scripts": {
15
+ "postinstall": "node scripts/copyFiles.js"
16
+ },
14
17
  "dependencies": {}
15
18
  }
@@ -0,0 +1,26 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ // Define Source and Destination Directories
4
+ const srcDir = path.join(__dirname, '../server_connect');
5
+ const destDir = path.join(__dirname, '../../../../extensions/server_connect');
6
+
7
+ // Get All Subdirectories in Source
8
+ const subDirs = fs.readdirSync(srcDir, { withFileTypes: true })
9
+ .filter(dirent => dirent.isDirectory())
10
+ .map(dirent => dirent.name);
11
+
12
+ // Loop Through Each Subdirectory
13
+ for (const subDir of subDirs) {
14
+
15
+ // 🛠️ Build Full Paths for Source and Destination
16
+ const srcSubDir = path.join(srcDir, subDir);
17
+ const destSubDir = path.join(destDir, subDir);
18
+
19
+ // Create Destination Folder If It Doesn’t Exist
20
+ if (!fs.existsSync(destSubDir)) {
21
+ fs.mkdirSync(destSubDir, { recursive: true });
22
+ }
23
+ // Copy Contents from Source to Destination
24
+ fs.copySync(srcSubDir, destSubDir, { overwrite: true });
25
+ }
26
+
@@ -1,7 +1,7 @@
1
1
  // JavaScript Document
2
2
  exports.code_generator = async function (options) {
3
3
  // retrieves a file via remote http request and saves the file to the local server
4
-
4
+ options = this.parse(options);
5
5
  let salt = this.parse(options.salt);
6
6
  let repeats = this.parse(options.repeats);
7
7
  let length = this.parse(options.length);