feat: token check env

This commit is contained in:
https://blog.iamtsm.cn
2023-10-28 15:18:07 +08:00
parent 137c22a702
commit 653a987bdd
4 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
{
"version": "10.4.9",
"version": "10.5.0",
"socket": {
"port": "请到 tlrtcfile.env 中进行配置",
"host": "请到 tlrtcfile.env 中进行配置"
@@ -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 中进行配置",

View File

@@ -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;
}

View File

@@ -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",