@7365admin1/layer-common 4.21.4-staging.345 → 4.21.4-staging.346
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.
|
@@ -433,7 +433,10 @@ const {
|
|
|
433
433
|
bulkPhysicalAccessCard: _bulkPhysicalAccessCard,
|
|
434
434
|
getBlockLevelUnitList: _getBlockLevelUnitList,
|
|
435
435
|
} = useAccessManagement();
|
|
436
|
-
const {
|
|
436
|
+
const {
|
|
437
|
+
getBySiteId: _getEntryPassSettings,
|
|
438
|
+
getEncryptedAcmUrl: _getEncryptedAcmUrl,
|
|
439
|
+
} = useSiteEntryPassSettings();
|
|
437
440
|
const { getFileUrl } = useFile();
|
|
438
441
|
|
|
439
442
|
const config = useRuntimeConfig();
|
|
@@ -588,9 +591,7 @@ watch(uploadMode, (mode) => {
|
|
|
588
591
|
|
|
589
592
|
onMounted(async () => {
|
|
590
593
|
try {
|
|
591
|
-
const
|
|
592
|
-
"/api/encrypt-acm-url"
|
|
593
|
-
);
|
|
594
|
+
const acmUrl = await _getEncryptedAcmUrl(siteId);
|
|
594
595
|
encryptedAcmUrl.value = acmUrl;
|
|
595
596
|
const [doorLevels, liftLevels, groups] = await Promise.all([
|
|
596
597
|
_getDoorAccessLevels(acmUrl),
|
|
@@ -203,6 +203,7 @@ const {
|
|
|
203
203
|
getBlockLevelUnitList: _getBlockLevelUnitList,
|
|
204
204
|
} = useAccessManagement();
|
|
205
205
|
const { requiredRule } = useUtils();
|
|
206
|
+
const { getEncryptedAcmUrl } = useSiteEntryPassSettings();
|
|
206
207
|
|
|
207
208
|
const route = useRoute();
|
|
208
209
|
const siteId = computed(() => props.siteId || (route.params.site as string));
|
|
@@ -294,7 +295,7 @@ onMounted(async () => {
|
|
|
294
295
|
|
|
295
296
|
const [blockLevelResult, acmResult] = await Promise.allSettled([
|
|
296
297
|
_getBlockLevelUnitList(siteId.value),
|
|
297
|
-
|
|
298
|
+
getEncryptedAcmUrl(siteId.value),
|
|
298
299
|
]);
|
|
299
300
|
|
|
300
301
|
// Blocks / Levels / Units
|
|
@@ -309,7 +310,7 @@ onMounted(async () => {
|
|
|
309
310
|
|
|
310
311
|
// ACM levels (door + lift)
|
|
311
312
|
if (acmResult.status === "fulfilled") {
|
|
312
|
-
const acmUrl = acmResult.value
|
|
313
|
+
const acmUrl = acmResult.value;
|
|
313
314
|
try {
|
|
314
315
|
const [doorLevels, liftLevels] = await Promise.all([
|
|
315
316
|
_getDoorAccessLevels(acmUrl),
|
|
@@ -403,6 +403,7 @@ const emit = defineEmits<{
|
|
|
403
403
|
}>();
|
|
404
404
|
|
|
405
405
|
const { getResidents, assignUser } = useAccessManagement();
|
|
406
|
+
const { getEncryptedAcmUrl } = useSiteEntryPassSettings();
|
|
406
407
|
|
|
407
408
|
const historyDialog = ref(false);
|
|
408
409
|
const showAssignForm = ref(false);
|
|
@@ -475,12 +476,12 @@ async function openAssignForm() {
|
|
|
475
476
|
if (!props.unit?._id || !props.orgId || !props.siteId) return;
|
|
476
477
|
peopleLoading.value = true;
|
|
477
478
|
try {
|
|
478
|
-
const [residentsRes,
|
|
479
|
+
const [residentsRes, acmUrl] = await Promise.all([
|
|
479
480
|
getResidents({ orgId: props.orgId, siteId: props.siteId, unitId: props.unit._id }),
|
|
480
|
-
|
|
481
|
+
getEncryptedAcmUrl(props.siteId),
|
|
481
482
|
]);
|
|
482
483
|
peopleItems.value = residentsRes?.data ?? [];
|
|
483
|
-
encryptedAcmUrl.value =
|
|
484
|
+
encryptedAcmUrl.value = acmUrl ?? "";
|
|
484
485
|
} catch {
|
|
485
486
|
peopleItems.value = [];
|
|
486
487
|
} finally {
|
|
@@ -27,9 +27,35 @@ export default function useSiteEntryPassSettings() {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The encrypted ACM URL the access-card screens hand to API-core, which
|
|
32
|
+
* decrypts it and sends the ACM commands to that host.
|
|
33
|
+
*
|
|
34
|
+
* Resolves the site's own "Enter entrypass URL" setting first, the way
|
|
35
|
+
* `VisitorForm` does for contractor passes. The access-card forms used to
|
|
36
|
+
* call `/api/encrypt-acm-url` with no `url`, so every site's door/lift
|
|
37
|
+
* levels and access groups came from the route's hardcoded default host
|
|
38
|
+
* whatever the site had configured. A site with no URL set, or whose
|
|
39
|
+
* settings cannot be read, still gets that default.
|
|
40
|
+
*/
|
|
41
|
+
async function getEncryptedAcmUrl(siteId: string): Promise<string> {
|
|
42
|
+
let rawUrl = "";
|
|
43
|
+
try {
|
|
44
|
+
const settings: any = await getBySiteId(siteId);
|
|
45
|
+
rawUrl = String(settings?.data?.settings?.url ?? "").trim();
|
|
46
|
+
} catch {
|
|
47
|
+
// No entry pass settings for this site yet - the default host applies.
|
|
48
|
+
}
|
|
49
|
+
const { encrypted } = await $fetch<{ encrypted: string }>(
|
|
50
|
+
`/api/encrypt-acm-url${rawUrl ? `?url=${encodeURIComponent(rawUrl)}` : ""}`,
|
|
51
|
+
);
|
|
52
|
+
return encrypted;
|
|
53
|
+
}
|
|
54
|
+
|
|
30
55
|
return {
|
|
31
56
|
getBySiteId,
|
|
32
57
|
getById,
|
|
33
58
|
save,
|
|
59
|
+
getEncryptedAcmUrl,
|
|
34
60
|
};
|
|
35
61
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.21.4-staging.
|
|
5
|
+
"version": "4.21.4-staging.346",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|