certops 1.1.0 → 1.1.8
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/commands/list.js
CHANGED
|
@@ -27,13 +27,15 @@ export const listCommand = new Command('list')
|
|
|
27
27
|
for (const c of active) {
|
|
28
28
|
const expiry = c.expiryDate ? `expires ${new Date(c.expiryDate).toLocaleDateString()}` : 'no expiry info';
|
|
29
29
|
const covered = c.coveredByWildcardId ? ' [covered by wildcard]' : '';
|
|
30
|
-
|
|
30
|
+
const ids = c.identifiers.length > 0 ? `\n ${c.identifiers.join(', ')}` : '';
|
|
31
|
+
process.stdout.write(` ${pad(c.certName, maxLen)} ${typeTag(c)} ${expiry}${covered}${ids}\n`);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
if (inactive.length > 0) {
|
|
34
35
|
process.stdout.write(`\nOTHER (${inactive.length})\n`);
|
|
35
36
|
for (const c of inactive) {
|
|
36
|
-
|
|
37
|
+
const ids = c.identifiers.length > 0 ? `\n ${c.identifiers.join(', ')}` : '';
|
|
38
|
+
process.stdout.write(` ${pad(c.certName, maxLen)} ${typeTag(c)} ${c.status}${ids}\n`);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
process.stdout.write('\n');
|
|
@@ -7,13 +7,7 @@ import { domainHookPath, GLOBAL_HOOK } from '../../hooks.js';
|
|
|
7
7
|
import { BRAND } from '../../brand.js';
|
|
8
8
|
const UNIT_PATH = `/etc/systemd/system/${BRAND.serviceUnit}.service`;
|
|
9
9
|
const API_KEY_ENV = `${BRAND.envPrefix}_API_KEY`;
|
|
10
|
-
function resolveBinPath() {
|
|
11
|
-
// process.argv[1] is the actual path of the running certops script
|
|
12
|
-
return process.argv[1] ?? `/usr/local/bin/${BRAND.binName}`;
|
|
13
|
-
}
|
|
14
10
|
function buildUnitContent(apiKey) {
|
|
15
|
-
const binPath = resolveBinPath();
|
|
16
|
-
const nodePath = process.execPath;
|
|
17
11
|
return `\
|
|
18
12
|
[Unit]
|
|
19
13
|
Description=${BRAND.displayName} Certificate Monitor
|
|
@@ -23,7 +17,7 @@ Wants=network-online.target
|
|
|
23
17
|
[Service]
|
|
24
18
|
Type=simple
|
|
25
19
|
Environment=${API_KEY_ENV}=${apiKey}
|
|
26
|
-
ExecStart
|
|
20
|
+
ExecStart=/usr/local/bin/${BRAND.binName} service run
|
|
27
21
|
Restart=on-failure
|
|
28
22
|
RestartSec=30
|
|
29
23
|
StandardOutput=journal
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "certops",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.8",
|
|
4
|
+
"description": "CertOps CLI — download and manage your SSL certificates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"postinstall": "node scripts/postinstall.cjs",
|
|
18
18
|
"preuninstall": "node scripts/preuninstall.cjs"
|
|
19
19
|
},
|
|
20
|
+
"optionalDependencies": {
|
|
21
|
+
"certops-linux-x64": "1.1.8",
|
|
22
|
+
"certops-linux-arm64": "1.1.8",
|
|
23
|
+
"certops-darwin-x64": "1.1.8",
|
|
24
|
+
"certops-darwin-arm64": "1.1.8"
|
|
25
|
+
},
|
|
20
26
|
"publishConfig": {
|
|
21
27
|
"access": "public"
|
|
22
28
|
},
|
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
// Only run on global installs (sudo npm install -g certops)
|
|
5
|
+
if (!process.env.npm_config_global) {
|
|
6
|
+
process.exit(0)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { copyFileSync, chmodSync } = require('fs')
|
|
10
|
+
const { join, dirname } = require('path')
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
const REPO = 'Vimosoftdev/ssl-checker-web'
|
|
10
|
-
const BIN_NAME = 'certops'
|
|
11
|
-
const INSTALL_DIR = '/usr/local/bin'
|
|
12
|
-
const INSTALL_PATH = join(INSTALL_DIR, BIN_NAME)
|
|
12
|
+
const INSTALL_PATH = '/usr/local/bin/certops'
|
|
13
13
|
|
|
14
14
|
const platformMap = { linux: 'linux', darwin: 'darwin' }
|
|
15
15
|
const archMap = { x64: 'x64', arm64: 'arm64' }
|
|
@@ -17,56 +17,34 @@ const plat = platformMap[process.platform]
|
|
|
17
17
|
const arc = archMap[process.arch]
|
|
18
18
|
|
|
19
19
|
if (!plat || !arc) {
|
|
20
|
-
console.warn(`[certops] Unsupported platform ${process.platform}-${process.arch}
|
|
21
|
-
console.warn(`[certops] Install manually: https://github.com/${REPO}/releases/latest`)
|
|
20
|
+
console.warn(`[certops] Unsupported platform ${process.platform}-${process.arch} — skipping binary install.`)
|
|
22
21
|
process.exit(0)
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
const
|
|
24
|
+
const pkgName = `certops-${plat}-${arc}`
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
let binarySrc
|
|
27
|
+
try {
|
|
28
|
+
const pkgDir = dirname(require.resolve(`${pkgName}/package.json`))
|
|
29
|
+
binarySrc = join(pkgDir, 'bin', 'certops')
|
|
30
|
+
} catch {
|
|
31
|
+
console.warn(`[certops] Platform package ${pkgName} not found — skipping binary install.`)
|
|
31
32
|
process.exit(0)
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
-
const downloadUrl = `https://github.com/${REPO}/releases/download/v${version}/${assetName}`
|
|
36
|
-
|
|
37
|
-
console.log(`[certops] Installing v${version} binary for ${plat}-${arc}…`)
|
|
38
|
-
console.log(`[certops] Downloading ${downloadUrl}`)
|
|
35
|
+
const isRoot = typeof process.getuid === 'function' && process.getuid() === 0
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.catch(err => {
|
|
46
|
-
// clean up partial download
|
|
47
|
-
try { if (existsSync(INSTALL_PATH)) unlinkSync(INSTALL_PATH) } catch {}
|
|
48
|
-
console.error(`[certops] Binary install failed: ${err.message}`)
|
|
49
|
-
console.error(`[certops] Fallback: curl -fsSL https://github.com/${REPO}/releases/latest/download/install.sh | sudo bash`)
|
|
50
|
-
// non-fatal — npm install still succeeds
|
|
51
|
-
process.exit(0)
|
|
52
|
-
})
|
|
37
|
+
if (!isRoot) {
|
|
38
|
+
console.warn(`[certops] Not root — binary not installed to ${INSTALL_PATH}.`)
|
|
39
|
+
console.warn(`[certops] Re-run: sudo npm install -g certops`)
|
|
40
|
+
process.exit(0)
|
|
41
|
+
}
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (res.statusCode !== 200) {
|
|
62
|
-
return reject(new Error(`HTTP ${res.statusCode} from ${url}`))
|
|
63
|
-
}
|
|
64
|
-
const file = createWriteStream(dest)
|
|
65
|
-
res.pipe(file)
|
|
66
|
-
file.on('finish', () => file.close(resolve))
|
|
67
|
-
file.on('error', err => { unlinkSync(dest); reject(err) })
|
|
68
|
-
}).on('error', reject)
|
|
69
|
-
}
|
|
70
|
-
fetch(url)
|
|
71
|
-
})
|
|
43
|
+
try {
|
|
44
|
+
copyFileSync(binarySrc, INSTALL_PATH)
|
|
45
|
+
chmodSync(INSTALL_PATH, 0o755)
|
|
46
|
+
console.log(`[certops] ✓ Installed to ${INSTALL_PATH}`)
|
|
47
|
+
} catch (err) {
|
|
48
|
+
console.error(`[certops] Install failed: ${err.message}`)
|
|
49
|
+
process.exit(0)
|
|
72
50
|
}
|
package/scripts/preuninstall.cjs
CHANGED
|
@@ -8,7 +8,7 @@ const INSTALL_PATH = '/usr/local/bin/certops'
|
|
|
8
8
|
try {
|
|
9
9
|
if (existsSync(INSTALL_PATH)) {
|
|
10
10
|
unlinkSync(INSTALL_PATH)
|
|
11
|
-
console.log(`[certops] ✓ Removed
|
|
11
|
+
console.log(`[certops] ✓ Removed ${INSTALL_PATH}`)
|
|
12
12
|
}
|
|
13
13
|
} catch (err) {
|
|
14
14
|
console.warn(`[certops] Could not remove ${INSTALL_PATH}: ${err.message}`)
|