@infuro/cms-core 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.cjs +21 -16
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +25 -20
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +29 -2
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +27 -1
- package/dist/api.js.map +1 -1
- package/dist/{index-DeO4AnAj.d.ts → index-C4Yl7js9.d.ts} +8 -1
- package/dist/{index-C_CZLmHD.d.cts → index-JrST6EIC.d.cts} +8 -1
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/api.cjs
CHANGED
|
@@ -138,7 +138,8 @@ __export(api_exports, {
|
|
|
138
138
|
createUserAuthApiRouter: () => createUserAuthApiRouter,
|
|
139
139
|
createUserAvatarHandler: () => createUserAvatarHandler,
|
|
140
140
|
createUserProfileHandler: () => createUserProfileHandler,
|
|
141
|
-
createUsersApiHandlers: () => createUsersApiHandlers
|
|
141
|
+
createUsersApiHandlers: () => createUsersApiHandlers,
|
|
142
|
+
getPublicSettingsGroup: () => getPublicSettingsGroup
|
|
142
143
|
});
|
|
143
144
|
module.exports = __toCommonJS(api_exports);
|
|
144
145
|
|
|
@@ -1487,6 +1488,24 @@ function simpleDecrypt(encoded, key) {
|
|
|
1487
1488
|
for (let i = 0; i < buf.length; i++) out[i] = buf[i] ^ keyBuf[i % keyBuf.length];
|
|
1488
1489
|
return out.toString("utf8");
|
|
1489
1490
|
}
|
|
1491
|
+
async function getPublicSettingsGroup(config, group) {
|
|
1492
|
+
const { dataSource, entityMap, encryptionKey } = config;
|
|
1493
|
+
const repo = dataSource.getRepository(entityMap.configs);
|
|
1494
|
+
const rows = await repo.find({ where: { settings: group, deleted: false } });
|
|
1495
|
+
const result = {};
|
|
1496
|
+
for (const row of rows) {
|
|
1497
|
+
const r = row;
|
|
1498
|
+
let val = r.value;
|
|
1499
|
+
if (r.encrypted && encryptionKey) {
|
|
1500
|
+
try {
|
|
1501
|
+
val = simpleDecrypt(val, encryptionKey);
|
|
1502
|
+
} catch {
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
result[r.key] = val;
|
|
1506
|
+
}
|
|
1507
|
+
return result;
|
|
1508
|
+
}
|
|
1490
1509
|
function createSettingsApiHandlers(config) {
|
|
1491
1510
|
const { dataSource, entityMap, json, requireAuth, encryptionKey, publicGetGroups } = config;
|
|
1492
1511
|
const configRepo = () => dataSource.getRepository(entityMap.configs);
|
|
@@ -1496,6 +1515,13 @@ function createSettingsApiHandlers(config) {
|
|
|
1496
1515
|
const authErr = isPublicGroup ? null : await requireAuth(req);
|
|
1497
1516
|
const isAuthed = !authErr;
|
|
1498
1517
|
try {
|
|
1518
|
+
if (isPublicGroup) {
|
|
1519
|
+
const result2 = await getPublicSettingsGroup(
|
|
1520
|
+
{ dataSource, entityMap, encryptionKey },
|
|
1521
|
+
group
|
|
1522
|
+
);
|
|
1523
|
+
return json(result2);
|
|
1524
|
+
}
|
|
1499
1525
|
const where = { settings: group, deleted: false };
|
|
1500
1526
|
if (!isAuthed && !isPublicGroup) where.type = "public";
|
|
1501
1527
|
const rows = await configRepo().find({ where });
|
|
@@ -3119,6 +3145,7 @@ function createStorefrontApiHandler(config) {
|
|
|
3119
3145
|
createUserAuthApiRouter,
|
|
3120
3146
|
createUserAvatarHandler,
|
|
3121
3147
|
createUserProfileHandler,
|
|
3122
|
-
createUsersApiHandlers
|
|
3148
|
+
createUsersApiHandlers,
|
|
3149
|
+
getPublicSettingsGroup
|
|
3123
3150
|
});
|
|
3124
3151
|
//# sourceMappingURL=api.cjs.map
|