fscr 7.3.0 → 7.3.2

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.
@@ -1,6 +1,7 @@
1
1
  import chalk from "chalk";
2
2
  import fcFilepicker from "fc-filepick";
3
3
  import inquirer from "inquirer";
4
+ import fs from "fs";
4
5
  import {decrypt, encrypt} from "../utils/encryption.js";
5
6
  import {appendToFile, boxInform, ensureFile, readFile, readJson, writeFile} from "../utils/helpers.js";
6
7
  import path from "path";
@@ -43,7 +44,7 @@ encrypted.encrypt = async (pass = null, encryptedFile = null, decryptedFile = nu
43
44
  });
44
45
  }
45
46
  if (willEncrypt) {
46
- let toEncrypt = await readFile(decryptedFile);
47
+ const toEncrypt = fs.readFileSync(decryptedFile);
47
48
  const ciphertext = encrypt(toEncrypt, pass);
48
49
  await writeFile(encryptedFile, ciphertext.toString());
49
50
  }
@@ -84,9 +85,9 @@ encrypted.decrypt = async (pass = null, encryptedFileLocation = null, decryptedF
84
85
  });
85
86
  }
86
87
  if (willEncrypt) {
87
- let toDecrypt = await readFile(encryptedFileLocation);
88
+ const toDecrypt = fs.readFileSync(encryptedFileLocation, "utf8");
88
89
  const decryptedData = decrypt(toDecrypt, pass);
89
- await writeFile(decryptedFileLocation, decryptedData);
90
+ fs.writeFileSync(decryptedFileLocation, decryptedData);
90
91
  console.warn(
91
92
  `${chalk.bold.green.underline("DECRYPTED FILE:")} ${chalk.bold.dim(path.join(scriptsDir, decryptedFileLocation))}`
92
93
  );
@@ -1,9 +1,6 @@
1
1
  import promptQuestion from "../../utils/prompt.js";
2
- import fcFilepicker1 from "fc-filepick";
3
2
  import { spawn } from "child_process";
4
3
 
5
- const fcFilepicker = fcFilepicker1.default;
6
-
7
4
  /**
8
5
  * Deploy
9
6
  * @param files
@@ -106,6 +103,8 @@ export default {
106
103
  context.logger.success("Deployment plugin initialized");
107
104
  },
108
105
  async run(ctx) {
106
+ const { default: fcFilepickerMod } = await import("fc-filepick");
107
+ const fcFilepicker = fcFilepickerMod.default ?? fcFilepickerMod;
109
108
  const r = await promptQuestion({}, "Subdomain?");
110
109
  const folder = await fcFilepicker({ type: "folder" });
111
110
  await deployExec(folder, r, ctx);
@@ -23,10 +23,8 @@ const encrypt = (toEncrypt, password) => {
23
23
  const salt = crypto.randomBytes(8);
24
24
  const { key, iv } = deriveKeyIv(password, salt);
25
25
  const cipher = crypto.createCipheriv(algorithm, key, iv);
26
- const ciphertext = Buffer.concat([
27
- cipher.update(Buffer.from(toEncrypt, "utf8")),
28
- cipher.final()
29
- ]);
26
+ const input = Buffer.isBuffer(toEncrypt) ? toEncrypt : Buffer.from(toEncrypt, "utf8");
27
+ const ciphertext = Buffer.concat([cipher.update(input), cipher.final()]);
30
28
  return Buffer.concat([MAGIC, salt, ciphertext]).toString("base64");
31
29
  };
32
30
 
@@ -34,9 +32,10 @@ const decryptLegacy = (toDecrypt, password) => {
34
32
  const key = crypto.scryptSync(password, "salt", 24);
35
33
  const iv = Buffer.alloc(16, 0);
36
34
  const decipher = crypto.createDecipheriv("aes-192-cbc", key, iv);
37
- let decrypted = decipher.update(String(toDecrypt).trim(), "hex", "utf8");
38
- decrypted += decipher.final("utf8");
39
- return decrypted;
35
+ return Buffer.concat([
36
+ decipher.update(Buffer.from(String(toDecrypt).trim(), "hex")),
37
+ decipher.final()
38
+ ]);
40
39
  };
41
40
 
42
41
  const decrypt = (toDecrypt, password) => {
@@ -51,7 +50,7 @@ const decrypt = (toDecrypt, password) => {
51
50
  const { key, iv } = deriveKeyIv(password, salt);
52
51
  const decipher = crypto.createDecipheriv(algorithm, key, iv);
53
52
  try {
54
- return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8");
53
+ return Buffer.concat([decipher.update(ciphertext), decipher.final()]);
55
54
  } catch (e) {
56
55
  throw new Error("Decryption failed — wrong password or corrupted file");
57
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fscr",
3
- "version": "7.3.0",
3
+ "version": "7.3.2",
4
4
  "description": "Runs the fscripts.md file",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,9 +25,7 @@
25
25
  "encryptedFiles": [
26
26
  "config.json"
27
27
  ],
28
- "ignore-upgrade": [
29
- "micromatch"
30
- ],
28
+ "ignore-upgrade": [],
31
29
  "config": "test.json"
32
30
  },
33
31
  "staticPath": {
@@ -46,65 +44,38 @@
46
44
  "fsr": "./bin"
47
45
  },
48
46
  "dependencies": {
49
- "better-md-2-json": "^1.0.6",
50
47
  "boxen": "^8.0.1",
51
48
  "chalk": "^4.1.2",
52
49
  "conf": "^15.0.2",
53
50
  "cross-spawn": "^7.0.1",
54
51
  "detect-indent": "^7.0.2",
55
52
  "enquirer": "^2.3.4",
53
+ "fc-filepick": "^1.3.0",
56
54
  "fs-extra": "^11.3.2",
57
55
  "git-changed-files": "^1.0.0",
58
56
  "git-release-notes": "^5.0.0",
59
57
  "git-state": "^4.1.0",
60
- "github-basic": "^6.0.0",
61
- "ink": "^5.2.1",
62
- "ink-select-input": "^4.2.2",
63
58
  "inquirer": "^12.9.6",
64
- "is-builtin-module": "^5.0.0",
65
59
  "json-colorz": "^0.2.7",
66
60
  "markdown-toc": "^1.2.0",
67
61
  "marked": "^16.3.0",
68
- "md-2-json": "^2.0.0",
69
- "micromatch": "^4.0.2",
70
62
  "moment-mini": "^2.24.0",
71
63
  "open": "^10.2.0",
72
64
  "pretty-ms": "^9.3.0",
73
- "react": "^18.3.1",
74
65
  "require-from-string": "^2.0.2",
75
66
  "server-destroy": "^1.0.1",
76
- "set-value": "^4.1.0",
77
- "shell-quote": "^1.7.2",
78
67
  "simple-git": "^3.28.0",
79
68
  "sort-object-keys": "^2.0.0",
80
69
  "staged-git-files": "^1.2.0",
81
- "term-size": "^4.0.0"
70
+ "term-size": "^4.0.0",
71
+ "yargs": "^18.0.0"
82
72
  },
83
73
  "devDependencies": {
84
74
  "@vitest/coverage-v8": "^3.2.4",
85
- "execa": "8.0.1",
86
- "fancy-log": "^2.0.0",
87
- "fc-filepick": "^1.3.0",
88
- "fkill-cli": "^8.0.0",
89
- "ink-tab": "^5.2.0",
90
- "ink-table": "^3.1.0",
91
- "lodash": "^4.17.15",
92
- "markdown-it": "^14.1.0",
93
- "mixin-deep": "^2.0.1",
94
- "node-run-cmd": "^1.0.1",
95
75
  "nodemon": "^3.1.10",
96
76
  "npm-run-all": "^4.1.5",
97
- "prepend-file": "^2.0.1",
98
- "pretty-console-colors": "^2.0.0",
99
- "pull-request": "^3.0.0",
100
- "remarkable": "^2.0.0",
101
- "rexrex": "^1.3.0",
102
77
  "rimraf": "^6.0.1",
103
- "strip-ansi": "^7.1.2",
104
- "terminal-tree": "^0.0.3",
105
- "underscore.string": "^3.3.5",
106
- "vitest": "^3.2.4",
107
- "yargs": "^18.0.0"
78
+ "vitest": "^3.2.4"
108
79
  },
109
80
  "peerDependencies": {
110
81
  "chalk": "^4.1.2"