mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[feature] Add install:AdminPanel instructions; Fix info.json
This commit is contained in:
@ -14,6 +14,7 @@ try {
|
||||
const config = moduleReloader.requireConfigWithRuntime();
|
||||
const operationContext = require('../../../Common/sources/operationContext');
|
||||
const tenantManager = require('../../../Common/sources/tenantManager');
|
||||
const license = require('../../../Common/sources/license');
|
||||
const utils = require('../../../Common/sources/utils');
|
||||
const commonDefines = require('../../../Common/sources/commondefines');
|
||||
|
||||
@ -30,6 +31,22 @@ app.disable('x-powered-by');
|
||||
|
||||
const server = http.createServer(app);
|
||||
|
||||
// Initialize license on startup
|
||||
(async () => {
|
||||
try {
|
||||
let licenseFile;
|
||||
try {
|
||||
licenseFile = config.get('license.license_file');
|
||||
} catch (_) {
|
||||
licenseFile = null;
|
||||
}
|
||||
const [info, original] = await license.readLicense(licenseFile);
|
||||
tenantManager.setDefLicense(info, original);
|
||||
} catch (e) {
|
||||
operationContext.global.logger.warn('License init error: %s', e.message);
|
||||
}
|
||||
})();
|
||||
|
||||
const corsWithCredentials = cors({
|
||||
origin: true,
|
||||
credentials: true,
|
||||
@ -73,8 +90,7 @@ app.get('/info/info.json', cors(), utils.checkClientIp, async (req, res) => {
|
||||
} catch (e) {
|
||||
ctx.logger && ctx.logger.warn('info.json error: %s', e.stack);
|
||||
} finally {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(output));
|
||||
res.json(output);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -45,6 +45,8 @@
|
||||
"install:DocService": "npm ci --prefix ./DocService",
|
||||
"install:FileConverter": "npm ci --prefix ./FileConverter",
|
||||
"install:Metrics": "npm ci --prefix ./Metrics",
|
||||
"install:AdminPanel/server": "npm ci --prefix ./AdminPanel/server",
|
||||
"install:AdminPanel/client": "npm ci --prefix ./AdminPanel/client",
|
||||
"3d-party-lic-json:Common": "license-report --output=json --package=./Common/package.json --config ./3d-party-lic-report/license-report-config.json > ./3d-party-lic-report/license-report.json",
|
||||
"3d-party-lic-json:DocService": "license-report --output=json --package=./DocService/package.json --config ./3d-party-lic-report/license-report-config.json > ./3d-party-lic-report/license-report.json",
|
||||
"3d-party-lic-json:FileConverter": "license-report --output=json --package=./FileConverter/package.json --config ./3d-party-lic-report/license-report-config.json > ./3d-party-lic-report/license-report.json",
|
||||
|
||||
Reference in New Issue
Block a user