bug fixes

This commit is contained in:
undefined committed 2025-03-31 23:25:38 +08:00
1 parent baa9436c30
commit 1a8232899c
12 files changed
+46 -35

No files matched your search

+2 -1
View File
@@ -4,7 +4,7 @@ import moment from 'moment-timezone';
import type { Context } from '../context';
import {
CannotDeleteSystemDomainError, DomainJoinAlreadyMemberError, DomainJoinForbiddenError, ForbiddenError,
InvalidJoinInvitationCodeError, OnlyOwnerCanDeleteDomainError, PermissionError, RoleAlreadyExistError, ValidationError,
InvalidJoinInvitationCodeError, NotFoundError, OnlyOwnerCanDeleteDomainError, PermissionError, RoleAlreadyExistError, ValidationError,
} from '../error';
import type { DomainDoc } from '../interface';
import avatar from '../lib/avatar';
@@ -337,6 +337,7 @@ class DomainJoinHandler extends Handler {
domain.get(target),
domain.collUser.findOne({ domainId: target, uid: this.user._id }),
]);
if (!dudoc) throw new NotFoundError(target);
const assignedRole = this.user.hasPriv(PRIV.PRIV_MANAGE_ALL_DOMAIN)
? 'root'
: dudoc?.role || 'default';
+5 -1
View File
@@ -198,7 +198,11 @@ class SystemConfigHandler extends SystemHandler {
};
try {
value = Schema.intersect(this.ctx.config.settings)(yaml.load(this.ctx.config.configSource));
try {
value = Schema.intersect(this.ctx.config.settings)(yaml.load(this.ctx.config.configSource));
} catch (e) {
value = yaml.load(this.ctx.config.configSource);
}
for (const schema of this.ctx.config.settings) processNode(value, schema);
} catch (e) { }
this.response.body = {
+9 -10
View File
@@ -139,16 +139,15 @@ export class ConfigService extends Service {
});
}
let curValue = s(this.systemConfig);
if (dynamic) {
this.ctx.on('system/setting', () => {
try {
curValue = s(this.systemConfig);
} catch (e) {
logger.warn('Cannot read config: ', e.message);
curValue = null;
}
});
}
if (!dynamic) return curValue;
this.ctx.on('system/setting', () => {
try {
curValue = s(this.systemConfig);
} catch (e) {
logger.warn('Cannot read config: ', e.message);
curValue = null;
}
});
const that = this;
const getAccess = (path: (string | symbol)[]) => {
if (path.some((p) => ConfigService.blacklist.includes(p.toString()))) throw new Error('Invalid path');