Skip to content

Commit

Permalink
feat: token check env
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtsm committed Oct 28, 2023
1 parent 137c22a commit 653a987
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions svr/conf/cfg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "10.4.9",
"version": "10.5.0",
"socket": {
"port": "请到 tlrtcfile.env 中进行配置",
"host": "请到 tlrtcfile.env 中进行配置"
Expand All @@ -20,7 +20,11 @@
},
"login": {
"appId" : "请到 tlrtcfile.env 中进行配置",
"appSecret" : "请到 tlrtcfile.env 中进行配置"
"appSecret" : "请到 tlrtcfile.env 中进行配置",
"token" : {
"url" : "请到 tlrtcfile.env 中进行配置",
"key" : "请到 tlrtcfile.env 中进行配置"
}
},
"manage": {
"room": "请到 tlrtcfile.env 中进行配置",
Expand Down
2 changes: 1 addition & 1 deletion svr/src/controller/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async function getLoginInfo(req, res){
let token = req.query.token || "";
let key = req.query.key || "";

if(!token || token.length < 16 || key !== 'iamtsm-socket'){
if(!token || token.length < 16 || key !== conf.login.token.key){
res.json({ code: 403 });
return;
}
Expand Down
2 changes: 1 addition & 1 deletion svr/src/socket/rtcToken/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function token(io, socket, tables, dbClient, data){

request({
method: "POST",
url: `https://im.iamtsm.cn/api/login/info`,
url: `${cfg.login.token.url}/api/login/info`,
json: true,
headers: {
"content-type": "application/json",
Expand Down
4 changes: 4 additions & 0 deletions tlrtcfile.env
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,7 @@ tl_rtc_file_notify_qiwei_error=
tl_rtc_file_login_appId=
## appSecret
tl_rtc_file_login_appSecret=
## token url
tl_rtc_file_login_token_url=http://127.0.0.1:9092
## token api key
tl_rtc_file_login_token_key=tlrtcfile

0 comments on commit 653a987

Please sign in to comment.