@uniai-fe/uds-templates 0.6.23 → 0.6.24
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/package.json +1 -1
- package/src/cctv/apis/client.ts +1 -1
- package/src/cctv/apis/server.ts +13 -3
- package/src/cctv/types/api.ts +2 -2
package/package.json
CHANGED
package/src/cctv/apis/client.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
} from "../types";
|
|
9
9
|
|
|
10
10
|
export const CCTV_RTC_TOKEN_FALLBACK_MAX_AGE_MS = 5 * 60 * 1000;
|
|
11
|
-
export const CCTV_RTC_TOKEN_GC_TIME_MS =
|
|
11
|
+
export const CCTV_RTC_TOKEN_GC_TIME_MS = CCTV_RTC_TOKEN_FALLBACK_MAX_AGE_MS;
|
|
12
12
|
|
|
13
13
|
export const getClientCctvCompanyList = async ({
|
|
14
14
|
url,
|
package/src/cctv/apis/server.ts
CHANGED
|
@@ -50,6 +50,8 @@ export const GROUP_PRESET: API_Res_CctvCompanyGroup[] = [
|
|
|
50
50
|
},
|
|
51
51
|
];
|
|
52
52
|
|
|
53
|
+
const CCTV_RTC_TOKEN_DEFAULT_TTL_SECONDS = 5 * 60;
|
|
54
|
+
|
|
53
55
|
export function getMatchedGroupList(
|
|
54
56
|
data: API_Res_CctvCompanyGroup[] = [],
|
|
55
57
|
{ code, method }: { code: string; method: string },
|
|
@@ -235,7 +237,12 @@ export async function getServerCctvToken({
|
|
|
235
237
|
!reqBody.cam_id ||
|
|
236
238
|
!password
|
|
237
239
|
) {
|
|
238
|
-
nextAPILog("POST", routeUrl, query_url, {
|
|
240
|
+
nextAPILog("POST", routeUrl, query_url, {
|
|
241
|
+
hasUsername: Boolean(reqBody?.username),
|
|
242
|
+
hasCompanyId: Boolean(reqBody?.company_id),
|
|
243
|
+
hasCamId: Boolean(reqBody?.cam_id),
|
|
244
|
+
hasPassword: Boolean(password),
|
|
245
|
+
});
|
|
239
246
|
return {
|
|
240
247
|
res: alternateResponse,
|
|
241
248
|
...API_OPTION,
|
|
@@ -261,11 +268,14 @@ export async function getServerCctvToken({
|
|
|
261
268
|
password,
|
|
262
269
|
action: "read",
|
|
263
270
|
path,
|
|
264
|
-
ttl_seconds: tokenPreset?.ttl_seconds ??
|
|
271
|
+
ttl_seconds: tokenPreset?.ttl_seconds ?? CCTV_RTC_TOKEN_DEFAULT_TTL_SECONDS,
|
|
265
272
|
kid: tokenPreset?.kid ?? "streaming-auth-1",
|
|
266
273
|
};
|
|
267
274
|
|
|
268
|
-
nextAPILog("POST", routeUrl, query_url, {
|
|
275
|
+
nextAPILog("POST", routeUrl, query_url, {
|
|
276
|
+
hasRequiredParams: true,
|
|
277
|
+
ttlSeconds: bodyData.ttl_seconds,
|
|
278
|
+
});
|
|
269
279
|
|
|
270
280
|
try {
|
|
271
281
|
const res = await fetchWithBody<string, API_Res_CctvRtcToken>({
|
package/src/cctv/types/api.ts
CHANGED
|
@@ -327,7 +327,7 @@ export interface API_Req_CctvRtcToken {
|
|
|
327
327
|
* @property {string} password 사용자 계정 비밀번호
|
|
328
328
|
* @property {string} action "read"
|
|
329
329
|
* @property {string} path cam_id 맵핑 (ex. cam3)
|
|
330
|
-
* @property {number} ttl_seconds 시간? (default
|
|
330
|
+
* @property {number} ttl_seconds 시간? (default 300)
|
|
331
331
|
* @property {string} kid "streaming-auth-1"
|
|
332
332
|
*/
|
|
333
333
|
export interface API_Req_CctvRtcTokenOrigin {
|
|
@@ -354,7 +354,7 @@ export interface API_Req_CctvRtcTokenOrigin {
|
|
|
354
354
|
*/
|
|
355
355
|
path: string;
|
|
356
356
|
/**
|
|
357
|
-
* default)
|
|
357
|
+
* default) 300
|
|
358
358
|
*/
|
|
359
359
|
ttl_seconds: number;
|
|
360
360
|
/**
|