**Motivations:** - Ensure all application directories have systemd services enabled at boot - Complete service installation for api-relay, filigrane-api, and clamav-api - Fix dependencies and import issues preventing clamav-api from starting **Root causes:** - Three services (api-relay, filigrane-api, clamav-api) had service files but were not installed in systemd - api-clamav had incorrect node-clamav version (0.12.1) that doesn't exist - api-clamav dependencies were not installed (node_modules missing) - ES module import syntax incompatible with CommonJS node-clamav package **Correctifs:** - Installed api-relay.service, filigrane-api.service, and clamav-api.service in /etc/systemd/system/ - Enabled all three services for automatic startup at boot - Updated api-clamav/package.json: changed node-clamav version from ^0.12.1 to ^1.0.11 - Installed npm dependencies for api-clamav - Fixed ES module import in api-clamav/src/routes/scan.js to use CommonJS-compatible syntax **Evolutions:** - All 7 application services now have systemd services enabled at boot - Complete service coverage: anchorage-api, faucet-api, signet-dashboard, userwallet, api-relay, filigrane-api, clamav-api - All services verified active and listening on their respective ports **Pages affectées:** - api-clamav/package.json - api-clamav/src/routes/scan.js - api-clamav/node_modules/ (new) - api-clamav/package-lock.json (new) - /etc/systemd/system/api-relay.service (new) - /etc/systemd/system/filigrane-api.service (new) - /etc/systemd/system/clamav-api.service (new)
78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
/* eslint-disable node/no-deprecated-api */
|
|
|
|
'use strict'
|
|
|
|
var buffer = require('buffer')
|
|
var Buffer = buffer.Buffer
|
|
|
|
var safer = {}
|
|
|
|
var key
|
|
|
|
for (key in buffer) {
|
|
if (!buffer.hasOwnProperty(key)) continue
|
|
if (key === 'SlowBuffer' || key === 'Buffer') continue
|
|
safer[key] = buffer[key]
|
|
}
|
|
|
|
var Safer = safer.Buffer = {}
|
|
for (key in Buffer) {
|
|
if (!Buffer.hasOwnProperty(key)) continue
|
|
if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
|
|
Safer[key] = Buffer[key]
|
|
}
|
|
|
|
safer.Buffer.prototype = Buffer.prototype
|
|
|
|
if (!Safer.from || Safer.from === Uint8Array.from) {
|
|
Safer.from = function (value, encodingOrOffset, length) {
|
|
if (typeof value === 'number') {
|
|
throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
|
|
}
|
|
if (value && typeof value.length === 'undefined') {
|
|
throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
|
|
}
|
|
return Buffer(value, encodingOrOffset, length)
|
|
}
|
|
}
|
|
|
|
if (!Safer.alloc) {
|
|
Safer.alloc = function (size, fill, encoding) {
|
|
if (typeof size !== 'number') {
|
|
throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
|
|
}
|
|
if (size < 0 || size >= 2 * (1 << 30)) {
|
|
throw new RangeError('The value "' + size + '" is invalid for option "size"')
|
|
}
|
|
var buf = Buffer(size)
|
|
if (!fill || fill.length === 0) {
|
|
buf.fill(0)
|
|
} else if (typeof encoding === 'string') {
|
|
buf.fill(fill, encoding)
|
|
} else {
|
|
buf.fill(fill)
|
|
}
|
|
return buf
|
|
}
|
|
}
|
|
|
|
if (!safer.kStringMaxLength) {
|
|
try {
|
|
safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
|
|
} catch (e) {
|
|
// we can't determine kStringMaxLength in environments where process.binding
|
|
// is unsupported, so let's not set it
|
|
}
|
|
}
|
|
|
|
if (!safer.constants) {
|
|
safer.constants = {
|
|
MAX_LENGTH: safer.kMaxLength
|
|
}
|
|
if (safer.kStringMaxLength) {
|
|
safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
|
|
}
|
|
}
|
|
|
|
module.exports = safer
|