mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[linter] Turn on require-yield, no-useless-escape
This commit is contained in:
@ -469,14 +469,17 @@ function healthCheckRabbit(taskqueue) {
|
||||
return !!exchange;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Check ActiveMQ connection health without using a generator.
|
||||
* @param {TaskQueueRabbitMQ} taskqueue - Queue instance holding the connection
|
||||
* @returns {Promise<boolean>} true if connection is open
|
||||
*/
|
||||
function healthCheckActive(taskqueue) {
|
||||
return co(function* () {
|
||||
//todo better check
|
||||
if (!taskqueue.connection) {
|
||||
return false;
|
||||
}
|
||||
return taskqueue.connection.is_open();
|
||||
});
|
||||
// todo better check
|
||||
if (!taskqueue.connection) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
return Promise.resolve(taskqueue.connection.is_open());
|
||||
}
|
||||
|
||||
function initSenderActive(sender, senderData) {
|
||||
|
||||
@ -67,7 +67,7 @@ function getTenant(ctx, domain) {
|
||||
let tenant = getDefautTenant();
|
||||
if (domain) {
|
||||
//remove port
|
||||
domain = domain.replace(/\:.*$/, '');
|
||||
domain = domain.replace(/:.*$/, '');
|
||||
|
||||
if (cfgTenantsBaseDomain && domain.endsWith('.' + cfgTenantsBaseDomain)) {
|
||||
tenant = domain.substring(0, domain.length - cfgTenantsBaseDomain.length - 1);
|
||||
|
||||
@ -2272,7 +2272,13 @@ exports.install = function (server, callbackFunction) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function* setLockDocumentTimer(ctx, docId, userId) {
|
||||
/**
|
||||
* Schedule lock cleanup for a document after the configured timeout.
|
||||
* @param {operationContext} ctx - Operation context
|
||||
* @param {string} docId - Document identifier
|
||||
* @param {string} userId - User identifier associated with the lock
|
||||
*/
|
||||
function setLockDocumentTimer(ctx, docId, userId) {
|
||||
const tenExpLockDoc = ctx.getCfg('services.CoAuthoring.expire.lockDoc', cfgExpLockDoc);
|
||||
const timerId = setTimeout(() => {
|
||||
return co(function* () {
|
||||
@ -3180,7 +3186,7 @@ exports.install = function (server, callbackFunction) {
|
||||
if (lockDocumentTimer) {
|
||||
cleanLockDocumentTimer(docId, lockDocumentTimer);
|
||||
}
|
||||
yield* setLockDocumentTimer(ctx, docId, lockDocument.id);
|
||||
setLockDocumentTimer(ctx, docId, lockDocument.id);
|
||||
}
|
||||
}
|
||||
if (constants.CONN_CLOSED === conn.conn.readyState) {
|
||||
@ -3955,7 +3961,7 @@ exports.install = function (server, callbackFunction) {
|
||||
if (lockDocumentTimer) {
|
||||
ctx.logger.debug('lockDocumentsTimerId update c_oPublishType.changes');
|
||||
cleanLockDocumentTimer(data.docId, lockDocumentTimer);
|
||||
yield* setLockDocumentTimer(ctx, data.docId, lockDocumentTimer.userId);
|
||||
setLockDocumentTimer(ctx, data.docId, lockDocumentTimer.userId);
|
||||
}
|
||||
participants = getParticipants(data.docId, true, data.userId);
|
||||
if (participants.length > 0) {
|
||||
@ -3985,7 +3991,7 @@ exports.install = function (server, callbackFunction) {
|
||||
if (lockDocumentTimer) {
|
||||
ctx.logger.debug('lockDocumentsTimerId update c_oPublishType.changesNotify');
|
||||
cleanLockDocumentTimer(data.docId, lockDocumentTimer);
|
||||
yield* setLockDocumentTimer(ctx, data.docId, lockDocumentTimer.userId);
|
||||
setLockDocumentTimer(ctx, data.docId, lockDocumentTimer.userId);
|
||||
}
|
||||
break;
|
||||
case commonDefines.c_oPublishType.auth:
|
||||
|
||||
@ -324,9 +324,9 @@ TaskQueueDataConvert.prototype = {
|
||||
serializeXmlAttr(name, value) {
|
||||
let xml = '';
|
||||
if (null != value) {
|
||||
xml += ' ' + name + '=\"';
|
||||
xml += ' ' + name + '="';
|
||||
xml += utils.encodeXml(value.toString());
|
||||
xml += '\"';
|
||||
xml += '"';
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
@ -375,7 +375,14 @@ async function changeFormatToExtendedPdf(ctx, dataConvert, cmd) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function* replaceEmptyFile(ctx, fileFrom, ext, _lcid) {
|
||||
/**
|
||||
* Replace an empty file with a localized template of the requested format, if available.
|
||||
* @param {operationContext} ctx - Operation context for config and logging
|
||||
* @param {string} fileFrom - Path to the file to check/replace
|
||||
* @param {string} ext - Target extension (e.g., 'docx', 'xlsx', 'pptx')
|
||||
* @param {number} _lcid - Optional locale identifier to select template locale
|
||||
*/
|
||||
function replaceEmptyFile(ctx, fileFrom, ext, _lcid) {
|
||||
const tenNewFileTemplate = ctx.getCfg('services.CoAuthoring.server.newFileTemplate', cfgNewFileTemplate);
|
||||
if (!fs.existsSync(fileFrom) || 0 === fs.lstatSync(fileFrom).size) {
|
||||
let locale = constants.TEMPLATES_DEFAULT_LOCALE;
|
||||
@ -1115,7 +1122,7 @@ function* ExecuteTask(ctx, task) {
|
||||
error = yield* downloadFile(ctx, url, dataConvert.fileFrom, withAuthorization, isInJwtToken, headers);
|
||||
}
|
||||
if (constants.NO_ERROR === error) {
|
||||
yield* replaceEmptyFile(ctx, dataConvert.fileFrom, format, cmd.getLCID());
|
||||
replaceEmptyFile(ctx, dataConvert.fileFrom, format, cmd.getLCID());
|
||||
}
|
||||
if (clientStatsD) {
|
||||
clientStatsD.timing('conv.downloadFile', new Date() - curDate);
|
||||
|
||||
@ -53,8 +53,7 @@ module.exports = [
|
||||
'no-console': 'off', // Allow console in server code
|
||||
'no-continue': 'off', // Allow continue statements
|
||||
'no-plusplus': 'off',
|
||||
'require-yield': 'off',
|
||||
'no-useless-escape': 'off',
|
||||
|
||||
// Modern JavaScript practices
|
||||
'prefer-const': 'error', // Enforce const for immutable bindings
|
||||
'no-var': 'error', // Enforce let/const over var
|
||||
|
||||
Reference in New Issue
Block a user