@profullstack/threatcrush 0.13.16 → 0.13.17
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/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/systemd/threatcrushd.service +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16304,7 +16304,7 @@ var import_readline = __toESM(require("readline"));
|
|
|
16304
16304
|
var import_node_child_process15 = require("child_process");
|
|
16305
16305
|
var import_node_fs36 = require("fs");
|
|
16306
16306
|
var import_node_path24 = require("path");
|
|
16307
|
-
var
|
|
16307
|
+
var import_node_os11 = require("os");
|
|
16308
16308
|
|
|
16309
16309
|
// src/commands/monitor.ts
|
|
16310
16310
|
var import_node_fs7 = require("fs");
|
|
@@ -35048,6 +35048,7 @@ async function releaseStaleSocket() {
|
|
|
35048
35048
|
var import_node_child_process12 = require("child_process");
|
|
35049
35049
|
var import_node_fs32 = require("fs");
|
|
35050
35050
|
var import_node_path22 = require("path");
|
|
35051
|
+
var import_node_os10 = require("os");
|
|
35051
35052
|
var UNIT_PATH = "/etc/systemd/system/threatcrushd.service";
|
|
35052
35053
|
var DAEMON_UNIT_NAME = "threatcrushd.service";
|
|
35053
35054
|
function resolveTemplate() {
|
|
@@ -35195,7 +35196,8 @@ async function installServiceCommand() {
|
|
|
35195
35196
|
}
|
|
35196
35197
|
}
|
|
35197
35198
|
const exec = execStartCommand(binPath, nodePath, isNodeScript);
|
|
35198
|
-
const
|
|
35199
|
+
const configDir = (0, import_node_path22.join)((0, import_node_os10.homedir)(), ".threatcrush");
|
|
35200
|
+
const unit = resolveTemplate().replace("{{BIN_PATH}} daemon", exec).replace("{{BIN_PATH}}", binPath).replace("{{CONFIG_DIR}}", configDir);
|
|
35199
35201
|
(0, import_node_fs32.writeFileSync)(UNIT_PATH, unit, { mode: 420 });
|
|
35200
35202
|
console.log(source_default.green(` \u2713 Installed unit file: ${UNIT_PATH}`));
|
|
35201
35203
|
console.log(source_default.dim(` ExecStart=${exec}`));
|
|
@@ -35207,7 +35209,7 @@ async function installServiceCommand() {
|
|
|
35207
35209
|
console.log(source_default.dim(` threatcrush for the new Node and re-run ${source_default.white("threatcrush install-service")}.`));
|
|
35208
35210
|
console.log(source_default.dim(" Installing with a system Node (/usr/bin/node or /usr/local/bin/node) avoids this."));
|
|
35209
35211
|
}
|
|
35210
|
-
ensureSystemDirs();
|
|
35212
|
+
ensureSystemDirs(configDir);
|
|
35211
35213
|
stopUserModeDaemon();
|
|
35212
35214
|
try {
|
|
35213
35215
|
(0, import_node_child_process12.execSync)("systemctl daemon-reload", { stdio: "inherit" });
|
|
@@ -35229,13 +35231,16 @@ async function installServiceCommand() {
|
|
|
35229
35231
|
}
|
|
35230
35232
|
console.log();
|
|
35231
35233
|
}
|
|
35232
|
-
function ensureSystemDirs() {
|
|
35234
|
+
function ensureSystemDirs(configDir) {
|
|
35233
35235
|
const dirs = [
|
|
35234
35236
|
{ path: "/etc/threatcrush", groupWritable: true },
|
|
35235
35237
|
{ path: "/etc/threatcrush/modules", groupWritable: true, sticky: true },
|
|
35236
35238
|
{ path: "/etc/threatcrush/threatcrushd.conf.d", groupWritable: true },
|
|
35237
35239
|
{ path: "/var/log/threatcrush", groupWritable: false },
|
|
35238
|
-
{ path: "/var/lib/threatcrush", groupWritable: false }
|
|
35240
|
+
{ path: "/var/lib/threatcrush", groupWritable: false },
|
|
35241
|
+
// The daemon's own session dir, root-only: it holds the cloud access and
|
|
35242
|
+
// refresh tokens, so nobody else may read or write it.
|
|
35243
|
+
{ path: configDir, groupWritable: false }
|
|
35239
35244
|
// /run/threatcrush is deliberately absent: it lives on a tmpfs, so creating
|
|
35240
35245
|
// it here only lasts until the next reboot. The unit's RuntimeDirectory=
|
|
35241
35246
|
// recreates it on every start instead.
|
|
@@ -36665,7 +36670,7 @@ ${source_default.dim(" C R U S H")}
|
|
|
36665
36670
|
var API_URL6 = process.env.THREATCRUSH_API_URL || "https://threatcrush.com";
|
|
36666
36671
|
var PKG_NAME = "@profullstack/threatcrush";
|
|
36667
36672
|
var DESKTOP_PKG_NAME = "@profullstack/threatcrush-desktop";
|
|
36668
|
-
var INSTALL_CONFIG_PATH = (0, import_node_path24.join)((0,
|
|
36673
|
+
var INSTALL_CONFIG_PATH = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".threatcrush", "install.json");
|
|
36669
36674
|
function detectPackageManager() {
|
|
36670
36675
|
try {
|
|
36671
36676
|
const npmGlobal = (0, import_node_child_process15.execSync)("npm ls -g --depth=0 --json 2>/dev/null", { encoding: "utf-8" });
|
|
@@ -37138,7 +37143,7 @@ storeCmd.command("search <query>").description("Search for modules in the store"
|
|
|
37138
37143
|
});
|
|
37139
37144
|
storeCmd.command("publish <url>").description("Publish a module from a git URL or web URL").action(async (url) => {
|
|
37140
37145
|
console.log(LOGO2);
|
|
37141
|
-
const configPath = (0, import_node_path24.join)((0,
|
|
37146
|
+
const configPath = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".threatcrush", "config.json");
|
|
37142
37147
|
let email = "";
|
|
37143
37148
|
try {
|
|
37144
37149
|
const config = JSON.parse((0, import_node_fs36.readFileSync)(configPath, "utf-8"));
|
|
@@ -37158,7 +37163,7 @@ storeCmd.command("publish <url>").description("Publish a module from a git URL o
|
|
|
37158
37163
|
return;
|
|
37159
37164
|
}
|
|
37160
37165
|
try {
|
|
37161
|
-
const dir = (0, import_node_path24.join)((0,
|
|
37166
|
+
const dir = (0, import_node_path24.join)((0, import_node_os11.homedir)(), ".threatcrush");
|
|
37162
37167
|
if (!(0, import_node_fs36.existsSync)(dir)) (0, import_node_fs36.mkdirSync)(dir, { recursive: true });
|
|
37163
37168
|
(0, import_node_fs36.writeFileSync)(configPath, JSON.stringify({ email }, null, 2));
|
|
37164
37169
|
console.log(source_default.dim(` Saved email to ${configPath}`));
|