@uniai-fe/uds-templates 0.6.16 → 0.6.17
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
CHANGED
package/src/cctv/apis/server.ts
CHANGED
|
@@ -206,6 +206,7 @@ export async function getServerCctvToken({
|
|
|
206
206
|
queryUrl,
|
|
207
207
|
req,
|
|
208
208
|
headers,
|
|
209
|
+
tokenPreset,
|
|
209
210
|
}: API_Req_GetCctvTokenParams): Promise<{
|
|
210
211
|
res: API_Res_CctvRtcToken;
|
|
211
212
|
domain: string;
|
|
@@ -224,7 +225,15 @@ export async function getServerCctvToken({
|
|
|
224
225
|
token: "",
|
|
225
226
|
};
|
|
226
227
|
|
|
227
|
-
|
|
228
|
+
const password = reqBody?.password || tokenPreset?.password || "";
|
|
229
|
+
|
|
230
|
+
if (
|
|
231
|
+
!reqBody ||
|
|
232
|
+
!reqBody.username ||
|
|
233
|
+
!reqBody.company_id ||
|
|
234
|
+
!reqBody.cam_id ||
|
|
235
|
+
!password
|
|
236
|
+
) {
|
|
228
237
|
nextAPILog("POST", routeUrl, query_url, { reqBody });
|
|
229
238
|
return {
|
|
230
239
|
res: alternateResponse,
|
|
@@ -240,7 +249,6 @@ export async function getServerCctvToken({
|
|
|
240
249
|
? `farm${reqBody.company_id}`
|
|
241
250
|
: String(reqBody.company_id);
|
|
242
251
|
const username = reqBody.username;
|
|
243
|
-
const password = reqBody.password || reqBody.username;
|
|
244
252
|
const path = !isNaN(Number(reqBody.cam_id))
|
|
245
253
|
? `cam${reqBody.cam_id}`
|
|
246
254
|
: String(reqBody.cam_id);
|
|
@@ -252,8 +260,8 @@ export async function getServerCctvToken({
|
|
|
252
260
|
password,
|
|
253
261
|
action: "read",
|
|
254
262
|
path,
|
|
255
|
-
ttl_seconds: 3600,
|
|
256
|
-
kid: "streaming-auth-1",
|
|
263
|
+
ttl_seconds: tokenPreset?.ttl_seconds ?? 3600,
|
|
264
|
+
kid: tokenPreset?.kid ?? "streaming-auth-1",
|
|
257
265
|
};
|
|
258
266
|
|
|
259
267
|
nextAPILog("POST", routeUrl, query_url, { bodyData });
|
package/src/cctv/types/api.ts
CHANGED
|
@@ -298,6 +298,7 @@ export type API_Res_CctvCompany = API_Res_Base<API_Res_CctvCompanyData>;
|
|
|
298
298
|
* @property {string} company_id 업체 id코드
|
|
299
299
|
* @property {string} cam_id 카메라 id코드
|
|
300
300
|
* @property {string} username 사용자 계정 아이디
|
|
301
|
+
* @property {string} [password] 사용자 계정 비밀번호. 서버 route에서 tokenPreset.password를 주입하는 경우 생략 가능
|
|
301
302
|
*/
|
|
302
303
|
export interface API_Req_CctvRtcToken {
|
|
303
304
|
/**
|
|
@@ -314,6 +315,7 @@ export interface API_Req_CctvRtcToken {
|
|
|
314
315
|
username: string;
|
|
315
316
|
/**
|
|
316
317
|
* 사용자 계정 비밀번호
|
|
318
|
+
* - 서버 route에서 tokenPreset.password를 주입하는 경우 생략 가능
|
|
317
319
|
*/
|
|
318
320
|
password?: string;
|
|
319
321
|
}
|
|
@@ -322,7 +324,7 @@ export interface API_Req_CctvRtcToken {
|
|
|
322
324
|
* CCTV; 실시간 스트리밍 토큰 요청 (백엔드 요청)
|
|
323
325
|
* @property {string} site company_id 맵핑 (ex. farm102)
|
|
324
326
|
* @property {string} username 사용자 계정 아이디
|
|
325
|
-
* @property {string} password 사용자 계정 비밀번호
|
|
327
|
+
* @property {string} password 사용자 계정 비밀번호
|
|
326
328
|
* @property {string} action "read"
|
|
327
329
|
* @property {string} path cam_id 맵핑 (ex. cam3)
|
|
328
330
|
* @property {number} ttl_seconds 시간? (default 3600)
|
|
@@ -340,7 +342,6 @@ export interface API_Req_CctvRtcTokenOrigin {
|
|
|
340
342
|
username: string;
|
|
341
343
|
/**
|
|
342
344
|
* 사용자 계정 비밀번호
|
|
343
|
-
* - 대체로 계정 아이디 맵핑
|
|
344
345
|
*/
|
|
345
346
|
password: string;
|
|
346
347
|
/**
|
|
@@ -419,7 +420,7 @@ export interface API_Req_CctvStreamToken {
|
|
|
419
420
|
* @property {string} username 사용자 아이디
|
|
420
421
|
* @property {string} company_id 업체 id코드(site)
|
|
421
422
|
* @property {string} cam_id 카메라 id코드
|
|
422
|
-
* @property {string} [password]
|
|
423
|
+
* @property {string} [password] 서버 route에서 주입할 사용자 비밀번호
|
|
423
424
|
* @property {number} [ttl_seconds] 토큰 만료시간
|
|
424
425
|
* @property {string} [kid] 키 id
|
|
425
426
|
* @property {Record<string, string>} [headers] 추가 요청 헤더
|
|
@@ -449,4 +450,8 @@ export interface API_Req_GetCctvTokenParams {
|
|
|
449
450
|
* 추가 요청 헤더
|
|
450
451
|
*/
|
|
451
452
|
headers?: Record<string, string>;
|
|
453
|
+
/**
|
|
454
|
+
* 서버 route에서 주입할 CCTV 토큰 요청 preset
|
|
455
|
+
*/
|
|
456
|
+
tokenPreset?: API_Req_CctvTokenPreset;
|
|
452
457
|
}
|
|
@@ -31,22 +31,22 @@ export type API_Req_WeatherKoreaAlert = { farm_idx: number | null };
|
|
|
31
31
|
export type API_Res_WeatherKoreaAlertEach = {
|
|
32
32
|
/**
|
|
33
33
|
* 상위 지역 코드
|
|
34
|
-
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
34
|
+
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
35
35
|
*/
|
|
36
36
|
upper_region_code: string;
|
|
37
37
|
/**
|
|
38
38
|
* 상위 지역 이름
|
|
39
|
-
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
39
|
+
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
40
40
|
*/
|
|
41
41
|
upper_region_name: string;
|
|
42
42
|
/**
|
|
43
43
|
* 특보 지역 코드
|
|
44
|
-
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
44
|
+
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
45
45
|
*/
|
|
46
46
|
alert_region_code: string;
|
|
47
47
|
/**
|
|
48
48
|
* 특보 지역 이름
|
|
49
|
-
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
49
|
+
* @see https://apihub.kma.go.kr/api/typ01/url/wrn_reg.php?tmfc=0
|
|
50
50
|
*/
|
|
51
51
|
alert_region_name: string;
|
|
52
52
|
/**
|