Skip to content

Commit 653a987

Browse files
committed
feat: token check env
1 parent 137c22a commit 653a987

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

svr/conf/cfg.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "10.4.9",
2+
"version": "10.5.0",
33
"socket": {
44
"port": "请到 tlrtcfile.env 中进行配置",
55
"host": "请到 tlrtcfile.env 中进行配置"
@@ -20,7 +20,11 @@
2020
},
2121
"login": {
2222
"appId" : "请到 tlrtcfile.env 中进行配置",
23-
"appSecret" : "请到 tlrtcfile.env 中进行配置"
23+
"appSecret" : "请到 tlrtcfile.env 中进行配置",
24+
"token" : {
25+
"url" : "请到 tlrtcfile.env 中进行配置",
26+
"key" : "请到 tlrtcfile.env 中进行配置"
27+
}
2428
},
2529
"manage": {
2630
"room": "请到 tlrtcfile.env 中进行配置",

svr/src/controller/login/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ async function getLoginInfo(req, res){
269269
let token = req.query.token || "";
270270
let key = req.query.key || "";
271271

272-
if(!token || token.length < 16 || key !== 'iamtsm-socket'){
272+
if(!token || token.length < 16 || key !== conf.login.token.key){
273273
res.json({ code: 403 });
274274
return;
275275
}

svr/src/socket/rtcToken/token.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function token(io, socket, tables, dbClient, data){
2323

2424
request({
2525
method: "POST",
26-
url: `https://im.iamtsm.cn/api/login/info`,
26+
url: `${cfg.login.token.url}/api/login/info`,
2727
json: true,
2828
headers: {
2929
"content-type": "application/json",

tlrtcfile.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,7 @@ tl_rtc_file_notify_qiwei_error=
9494
tl_rtc_file_login_appId=
9595
## appSecret
9696
tl_rtc_file_login_appSecret=
97+
## token url
98+
tl_rtc_file_login_token_url=http://127.0.0.1:9092
99+
## token api key
100+
tl_rtc_file_login_token_key=tlrtcfile

0 commit comments

Comments
 (0)