@infuro/cms-core 1.0.11 → 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/api.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AnalyticsHandlerConfig, b as AuthHandlersConfig, B as BlogBySlugConfig, c as ChangePasswordConfig, d as CmsApiHandlerConfig, e as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, g as EntityMap, F as ForgotPasswordConfig, h as FormBySlugConfig, I as InviteAcceptConfig, i as SetPasswordConfig, j as SettingsApiConfig, l as StorefrontApiConfig, U as UploadHandlerConfig, m as UserAuthApiConfig, n as UserAvatarConfig, o as UserProfileConfig, p as UsersApiConfig, q as createAnalyticsHandlers, r as createBlogBySlugHandler, s as createChangePasswordHandler, t as createCmsApiHandler, u as createCrudByIdHandler, v as createCrudHandler, w as createDashboardStatsHandler, x as createForgotPasswordHandler, y as createFormBySlugHandler, z as createInviteAcceptHandler, G as createSetPasswordHandler, H as createSettingsApiHandlers, J as createStorefrontApiHandler, K as createUploadHandler, L as createUserAuthApiRouter, M as createUserAvatarHandler, N as createUserProfileHandler, P as createUsersApiHandlers } from './index-C_CZLmHD.cjs';
1
+ export { A as AnalyticsHandlerConfig, b as AuthHandlersConfig, B as BlogBySlugConfig, c as ChangePasswordConfig, d as CmsApiHandlerConfig, e as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, g as EntityMap, F as ForgotPasswordConfig, h as FormBySlugConfig, G as GetPublicSettingsGroupConfig, I as InviteAcceptConfig, i as SetPasswordConfig, j as SettingsApiConfig, l as StorefrontApiConfig, U as UploadHandlerConfig, m as UserAuthApiConfig, n as UserAvatarConfig, o as UserProfileConfig, p as UsersApiConfig, q as createAnalyticsHandlers, r as createBlogBySlugHandler, s as createChangePasswordHandler, t as createCmsApiHandler, u as createCrudByIdHandler, v as createCrudHandler, w as createDashboardStatsHandler, x as createForgotPasswordHandler, y as createFormBySlugHandler, z as createInviteAcceptHandler, H as createSetPasswordHandler, J as createSettingsApiHandlers, K as createStorefrontApiHandler, L as createUploadHandler, M as createUserAuthApiRouter, N as createUserAvatarHandler, P as createUserProfileHandler, Q as createUsersApiHandlers, V as getPublicSettingsGroup } from './index-JrST6EIC.cjs';
2
2
  import 'typeorm';
3
3
  import './helpers-dlrF_49e.cjs';
package/dist/api.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AnalyticsHandlerConfig, b as AuthHandlersConfig, B as BlogBySlugConfig, c as ChangePasswordConfig, d as CmsApiHandlerConfig, e as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, g as EntityMap, F as ForgotPasswordConfig, h as FormBySlugConfig, I as InviteAcceptConfig, i as SetPasswordConfig, j as SettingsApiConfig, l as StorefrontApiConfig, U as UploadHandlerConfig, m as UserAuthApiConfig, n as UserAvatarConfig, o as UserProfileConfig, p as UsersApiConfig, q as createAnalyticsHandlers, r as createBlogBySlugHandler, s as createChangePasswordHandler, t as createCmsApiHandler, u as createCrudByIdHandler, v as createCrudHandler, w as createDashboardStatsHandler, x as createForgotPasswordHandler, y as createFormBySlugHandler, z as createInviteAcceptHandler, G as createSetPasswordHandler, H as createSettingsApiHandlers, J as createStorefrontApiHandler, K as createUploadHandler, L as createUserAuthApiRouter, M as createUserAvatarHandler, N as createUserProfileHandler, P as createUsersApiHandlers } from './index-DeO4AnAj.js';
1
+ export { A as AnalyticsHandlerConfig, b as AuthHandlersConfig, B as BlogBySlugConfig, c as ChangePasswordConfig, d as CmsApiHandlerConfig, e as CmsGetter, f as CrudHandlerOptions, D as DashboardStatsConfig, g as EntityMap, F as ForgotPasswordConfig, h as FormBySlugConfig, G as GetPublicSettingsGroupConfig, I as InviteAcceptConfig, i as SetPasswordConfig, j as SettingsApiConfig, l as StorefrontApiConfig, U as UploadHandlerConfig, m as UserAuthApiConfig, n as UserAvatarConfig, o as UserProfileConfig, p as UsersApiConfig, q as createAnalyticsHandlers, r as createBlogBySlugHandler, s as createChangePasswordHandler, t as createCmsApiHandler, u as createCrudByIdHandler, v as createCrudHandler, w as createDashboardStatsHandler, x as createForgotPasswordHandler, y as createFormBySlugHandler, z as createInviteAcceptHandler, H as createSetPasswordHandler, J as createSettingsApiHandlers, K as createStorefrontApiHandler, L as createUploadHandler, M as createUserAuthApiRouter, N as createUserAvatarHandler, P as createUserProfileHandler, Q as createUsersApiHandlers, V as getPublicSettingsGroup } from './index-C4Yl7js9.js';
2
2
  import 'typeorm';
3
3
  import './helpers-dlrF_49e.js';
package/dist/api.js CHANGED
@@ -1441,6 +1441,24 @@ function simpleDecrypt(encoded, key) {
1441
1441
  for (let i = 0; i < buf.length; i++) out[i] = buf[i] ^ keyBuf[i % keyBuf.length];
1442
1442
  return out.toString("utf8");
1443
1443
  }
1444
+ async function getPublicSettingsGroup(config, group) {
1445
+ const { dataSource, entityMap, encryptionKey } = config;
1446
+ const repo = dataSource.getRepository(entityMap.configs);
1447
+ const rows = await repo.find({ where: { settings: group, deleted: false } });
1448
+ const result = {};
1449
+ for (const row of rows) {
1450
+ const r = row;
1451
+ let val = r.value;
1452
+ if (r.encrypted && encryptionKey) {
1453
+ try {
1454
+ val = simpleDecrypt(val, encryptionKey);
1455
+ } catch {
1456
+ }
1457
+ }
1458
+ result[r.key] = val;
1459
+ }
1460
+ return result;
1461
+ }
1444
1462
  function createSettingsApiHandlers(config) {
1445
1463
  const { dataSource, entityMap, json, requireAuth, encryptionKey, publicGetGroups } = config;
1446
1464
  const configRepo = () => dataSource.getRepository(entityMap.configs);
@@ -1450,6 +1468,13 @@ function createSettingsApiHandlers(config) {
1450
1468
  const authErr = isPublicGroup ? null : await requireAuth(req);
1451
1469
  const isAuthed = !authErr;
1452
1470
  try {
1471
+ if (isPublicGroup) {
1472
+ const result2 = await getPublicSettingsGroup(
1473
+ { dataSource, entityMap, encryptionKey },
1474
+ group
1475
+ );
1476
+ return json(result2);
1477
+ }
1453
1478
  const where = { settings: group, deleted: false };
1454
1479
  if (!isAuthed && !isPublicGroup) where.type = "public";
1455
1480
  const rows = await configRepo().find({ where });
@@ -3072,6 +3097,7 @@ export {
3072
3097
  createUserAuthApiRouter,
3073
3098
  createUserAvatarHandler,
3074
3099
  createUserProfileHandler,
3075
- createUsersApiHandlers
3100
+ createUsersApiHandlers,
3101
+ getPublicSettingsGroup
3076
3102
  };
3077
3103
  //# sourceMappingURL=api.js.map