Skip to content

Commit 41a7f0a

Browse files
committed
Merge branch hotfix/v9.0.3 into master
2 parents 0ebd3b0 + 106c43f commit 41a7f0a

File tree

5 files changed

+34
-29
lines changed

5 files changed

+34
-29
lines changed

Common/sources/runtimeConfigManager.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ const configFileName = path.basename(configFilePath);
4646

4747
// Initialize cache with TTL and check for expired keys every minute
4848
const nodeCache = new NodeCache(cfgRuntimeConfig.cache);
49-
let isInitConfigWatcher = false;
5049

5150
/**
5251
* Get runtime configuration for the current context
5352
* @param {operationContext} ctx - Operation context
5453
* @returns {Object} Runtime configuration object
5554
*/
5655
async function getConfigFromFile(ctx) {
57-
if (!isInitConfigWatcher) {
58-
isInitConfigWatcher = true;
59-
initConfigWatcher(ctx);
56+
if (!configFilePath) {
57+
return null;
6058
}
6159
try {
6260
const configData = await fs.readFile(configFilePath, 'utf8');
@@ -89,6 +87,9 @@ async function getConfig(ctx) {
8987
* @returns {Object} Saved configuration object
9088
*/
9189
async function saveConfig(ctx, config) {
90+
if (!configFilePath) {
91+
throw new Error('runtimeConfig.filePath is not specified');
92+
}
9293
await fs.mkdir(path.dirname(configFilePath), { recursive: true });
9394
let newConfig = await getConfig(ctx);
9495
newConfig = utils.deepMergeObjects(newConfig || {}, config);
@@ -116,20 +117,24 @@ function handleConfigFileChange(eventType, filename) {
116117
/**
117118
* Initialize the configuration directory watcher
118119
*/
119-
function initConfigWatcher(ctx) {
120+
function initRuntimeConfigWatcher(ctx) {
121+
if (!configFilePath) {
122+
ctx.logger.info(`runtimeConfig.filePath is not specified`);
123+
return;
124+
}
120125
try {
121126
const configDir = path.dirname(configFilePath);
122127
const watcher = fsWatch.watch(configDir, handleConfigFileChange);
123128
watcher.on('error', (err) => {
124-
ctx.logger.error(`initConfigWatcher error: ${err.message}`);
129+
ctx.logger.warn(`initRuntimeConfigWatcher error: ${err.message}`);
125130
});
126-
ctx.logger.info(`initConfigWatcherWatching for changes in: ${configDir}`);
131+
ctx.logger.info(`watching for runtime config changes in: ${configDir}`);
127132
} catch (watchErr) {
128-
ctx.logger.error(`initConfigWatcher error: ${watchErr.message}`);
133+
ctx.logger.warn(`initRuntimeConfigWatcher error: ${watchErr.message}`);
129134
}
130135
}
131-
132136
module.exports = {
137+
initRuntimeConfigWatcher,
133138
getConfig,
134139
saveConfig
135140
};

DocService/sources/DocsCoServer.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const pubsubService = require('./pubsubRabbitMQ');
101101
const wopiClient = require('./wopiClient');
102102
const queueService = require('./../../Common/sources/taskqueueRabbitMQ');
103103
const operationContext = require('./../../Common/sources/operationContext');
104+
const runtimeConfigManager = require('./../../Common/sources/runtimeConfigManager');
104105
const tenantManager = require('./../../Common/sources/tenantManager');
105106
const { notificationTypes, ...notificationService } = require('../../Common/sources/notificationService');
106107
const aiProxyHandler = require('./ai/aiProxyHandler');
@@ -1983,7 +1984,9 @@ exports.install = function(server, callbackFunction) {
19831984
if (needSaveChanges && !conn.encrypted) {
19841985
// Send changes to save server
19851986
let user_lcid = utilsDocService.localeToLCID(conn.lang);
1986-
yield createSaveTimer(ctx, docId, tmpUser.idOriginal, userIndex, user_lcid, undefined, getIsShutdown());
1987+
//noDelay=true if the client intentionally closes connection or server shuts down
1988+
const noDelay = !reason || getIsShutdown();
1989+
yield createSaveTimer(ctx, docId, tmpUser.idOriginal, userIndex, user_lcid, undefined, noDelay);
19871990
} else if (needSendStatus) {
19881991
yield* cleanDocumentOnExitNoChanges(ctx, docId, tmpUser.idOriginal, userIndex);
19891992
} else {
@@ -3999,7 +4002,9 @@ exports.install = function(server, callbackFunction) {
39994002
);
40004003
});
40014004
});
4002-
4005+
4006+
//Initialize watch here to avoid circular import with operationContext
4007+
runtimeConfigManager.initRuntimeConfigWatcher(operationContext.global);
40034008
void aiProxyHandler.getPluginSettings(operationContext.global);
40044009
};
40054010
exports.setLicenseInfo = async function(globalCtx, data, original) {

DocService/sources/canvasservice.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,7 @@ function* commandOpen(ctx, conn, cmd, outputData, opt_upsertRes, opt_bIsRestore)
538538
dataQueue.setCtx(ctx);
539539
dataQueue.setCmd(cmd);
540540
dataQueue.setToFile('Editor.bin');
541-
var priority = constants.QUEUE_PRIORITY_HIGH;
542-
var formatIn = formatChecker.getFormatFromString(cmd.getFormat());
543-
//decrease pdf, djvu, xps convert priority becase long open time
544-
if (constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF === formatIn ||
545-
constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU === formatIn ||
546-
constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS === formatIn) {
547-
priority = constants.QUEUE_PRIORITY_LOW;
548-
}
549-
yield* docsCoServer.addTask(dataQueue, priority);
541+
yield* docsCoServer.addTask(dataQueue, constants.QUEUE_PRIORITY_HIGH);
550542
} else {
551543
yield* commandOpenFillOutput(ctx, conn, cmd, outputData, opt_bIsRestore);
552544
}
@@ -735,7 +727,7 @@ function* commandImgurls(ctx, conn, cmd, outputData) {
735727
var urlSource = urls[i];
736728
var urlParsed;
737729
var data = undefined;
738-
if (urlSource.startsWith('data:')) {
730+
if (urlSource?.startsWith('data:')) {
739731
let delimiterIndex = urlSource.indexOf(',');
740732
if (-1 != delimiterIndex) {
741733
let dataLen = urlSource.length - (delimiterIndex + 1);
@@ -777,10 +769,10 @@ function* commandImgurls(ctx, conn, cmd, outputData) {
777769
}
778770
}
779771

780-
data = yield utilsDocService.fixImageExifRotation(ctx, data);
781-
782772
var outputUrl = {url: 'error', path: 'error'};
783773
if (data) {
774+
data = yield utilsDocService.fixImageExifRotation(ctx, data);
775+
784776
let format = formatChecker.getImageFormat(ctx, data);
785777
let formatStr;
786778
let isAllow = false;

branding/info/js/ai-integration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ const AIIntegration = {
276276
const btnResetActions = document.getElementById('ai-btn-reset-actions');
277277
if (btnResetActions) {
278278
const originalText = btnResetActions.textContent;
279-
btnResetActions.textContent = res ? 'Actions Reset!' : 'Reset Failed!';
279+
btnResetActions.textContent = res ? 'Tasks Reset!' : 'Reset Failed!';
280280
btnResetActions.disabled = true;
281281
setTimeout(() => {
282282
btnResetActions.textContent = originalText;
@@ -293,7 +293,7 @@ const AIIntegration = {
293293
const btnResetAllSettings = document.getElementById('ai-btn-reset-all-settings');
294294
if (btnResetAllSettings) {
295295
const originalText = btnResetAllSettings.textContent;
296-
btnResetAllSettings.textContent = res ? 'Settings Reset!' : 'Reset Failed!';
296+
btnResetAllSettings.textContent = res ? 'Defaults Restored!' : 'Restore Failed!';
297297
btnResetAllSettings.disabled = true;
298298
setTimeout(() => {
299299
btnResetAllSettings.textContent = originalText;

dictionaries/update.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@
7676
testDevelopVersion = sdkjsDirectory + "/.git"
7777
if not os.path.isdir(testDevelopVersion):
7878
print("Not in develop version, skipping x2t cache update")
79+
x2tDir = curDirectory + "/../FileConverter/bin"
80+
cur_dir = os.getcwd()
81+
os.chdir(x2tDir)
7982
x2tBin = curDirectory + "/../FileConverter/bin/x2t"
8083
if ("windows" == platform.system().lower()):
81-
x2tBin += ".exe"
82-
subprocess.call([x2tBin, "-create-js-cache"], stderr=subprocess.STDOUT, shell=True)
83-
command = x2tBin + " -create-js-cache"
84-
subprocess.call(command, stderr=subprocess.STDOUT, shell=True)
84+
subprocess.call(["x2t.exe", "-create-js-cache"], stderr=subprocess.STDOUT, shell=True)
85+
else:
86+
subprocess.call("x2t -create-js-cache", stderr=subprocess.STDOUT, shell=True)
87+
os.chdir(cur_dir)

0 commit comments

Comments
 (0)