From 73be7f9f2483187d2a5d597b6f2f9bdd0d3486ec Mon Sep 17 00:00:00 2001 From: Jett Wang Date: Mon, 29 Jan 2024 14:34:03 +0800 Subject: [PATCH 1/6] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7137d1b..d4a3e767 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ sudo bash -c "$(wget https://raw.githubusercontent.com/talkincode/toughradius/ma ``` -## QABOT +## Q&A AiBot ToughRadius provides an AI-based technical service bot that we hope can help you solve some technical problems. image From afccbb79563ba84c3f9400775743bf62aa78ff9a Mon Sep 17 00:00:00 2001 From: Jett Wang Date: Mon, 29 Jan 2024 14:39:01 +0800 Subject: [PATCH 2/6] doc update --- README.md | 2 +- docs/documents/installer.md | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d4a3e767..a263e025 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ sudo bash -c "$(wget https://raw.githubusercontent.com/talkincode/toughradius/ma ToughRadius provides an AI-based technical service bot that we hope can help you solve some technical problems. image -[QABOT Link](https://qa.toughradius.net/) +[A&A AiBot Link](https://qa.toughradius.net/) ## System structure diff --git a/docs/documents/installer.md b/docs/documents/installer.md index 7f105f8c..a7486722 100644 --- a/docs/documents/installer.md +++ b/docs/documents/installer.md @@ -1,6 +1,18 @@ ## Quick start -[中文](quickstart_cn) +### Quick Install + +- Use curl + +```bash +sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/talkincode/toughradius/main/installer.sh)" +``` + +- Use wget + +```bash +sudo bash -c "$(wget https://raw.githubusercontent.com/talkincode/toughradius/main/installer.sh -O -)" +``` ### System environment dependencies @@ -21,7 +33,7 @@ GRANT ALL PRIVILEGES ON DATABASE toughradius TO toughradius; ### Installation and Configuration -Let's take v8.0.4 as an example +Let's take v8.0.6 as an example Download the software distribution from [Releases Page](https://github.com/talkincode/toughradius/releases) From c01bac5295d59faa3e7ccb5ca2432837476523a0 Mon Sep 17 00:00:00 2001 From: Jett Wang Date: Mon, 29 Jan 2024 21:40:25 +0800 Subject: [PATCH 3/6] Update translations and database privileges --- assets/createdb.sql | 2 +- assets/translate-zh_CN.json | 54 ++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/assets/createdb.sql b/assets/createdb.sql index c593581a..70a5ccee 100644 --- a/assets/createdb.sql +++ b/assets/createdb.sql @@ -1,3 +1,3 @@ CREATE USER toughradius WITH PASSWORD 'toughradius'; CREATE DATABASE toughradius WITH OWNER toughradius; -GRANT ALL PRIVILEGES ON DATABASE toughradius_v8 TO toughradius; +GRANT ALL PRIVILEGES ON DATABASE toughradius TO toughradius; diff --git a/assets/translate-zh_CN.json b/assets/translate-zh_CN.json index 8a0d718f..6807ce78 100644 --- a/assets/translate-zh_CN.json +++ b/assets/translate-zh_CN.json @@ -735,7 +735,7 @@ "lang": "zh_CN", "module": "global", "source": "Save", - "result": "救" + "result": "保存" }, { "lang": "zh_CN", @@ -867,19 +867,19 @@ "lang": "zh_CN", "module": "logging", "source": "Regular match", - "result": "常规比赛" + "result": "正则匹配" }, { "lang": "zh_CN", "module": "menus", "source": "Account", - "result": "帐户" + "result": "帐号管理" }, { "lang": "zh_CN", "module": "menus", "source": "Accounting", - "result": "记账" + "result": "记帐日志" }, { "lang": "zh_CN", @@ -921,7 +921,7 @@ "lang": "zh_CN", "module": "menus", "source": "Online", - "result": "在线" + "result": "在线帐号" }, { "lang": "zh_CN", @@ -957,13 +957,13 @@ "lang": "zh_CN", "module": "menus", "source": "Radius Statistics", - "result": "Radius统计数据" + "result": "Radius 统计数据" }, { "lang": "zh_CN", "module": "menus", "source": "Settings", - "result": "设置" + "result": "系统设置" }, { "lang": "zh_CN", @@ -1011,19 +1011,19 @@ "lang": "zh_CN", "module": "menus", "source": "Tr069 Session", - "result": "Tr069 专场" + "result": "Tr069 会话" }, { "lang": "zh_CN", "module": "menus", "source": "Tr069 Statistics", - "result": "Tr069统计数据" + "result": "Tr069 统计数据" }, { "lang": "zh_CN", "module": "menus", "source": "Translate", - "result": "翻译" + "result": "翻译管理" }, { "lang": "zh_CN", @@ -1065,19 +1065,19 @@ "lang": "zh_CN", "module": "opr", "source": "Clone operator", - "result": "克隆运算符" + "result": "克隆操作员" }, { "lang": "zh_CN", "module": "opr", "source": "Create operator", - "result": "创建运算符" + "result": "创建操作员" }, { "lang": "zh_CN", "module": "opr", "source": "Edit operator", - "result": "编辑运算符" + "result": "编辑操作员" }, { "lang": "zh_CN", @@ -1125,7 +1125,7 @@ "lang": "zh_CN", "module": "radius", "source": "Active num", - "result": "活动编号" + "result": "最大在线数" }, { "lang": "zh_CN", @@ -1179,19 +1179,19 @@ "lang": "zh_CN", "module": "radius", "source": "DownRate (Mbps)", - "result": "降率 (Mbps)" + "result": "下行速率 (Mbps)" }, { "lang": "zh_CN", "module": "radius", "source": "DownRate (kbps)", - "result": "DownRate (kbps)" + "result": "下行速率 (kbps)" }, { "lang": "zh_CN", "module": "radius", "source": "DownTraffic", - "result": "量" + "result": "下行流量" }, { "lang": "zh_CN", @@ -1233,7 +1233,7 @@ "lang": "zh_CN", "module": "radius", "source": "InputPkts", - "result": "输入Pkts" + "result": "输入包" }, { "lang": "zh_CN", @@ -1251,19 +1251,19 @@ "lang": "zh_CN", "module": "radius", "source": "Mac", - "result": "苹果电脑" + "result": "MAC 地址" }, { "lang": "zh_CN", "module": "radius", "source": "NasId", - "result": "纳斯 ID" + "result": "NAS ID" }, { "lang": "zh_CN", "module": "radius", "source": "NasIp", - "result": "纳斯 Ip" + "result": "NAS IP" }, { "lang": "zh_CN", @@ -1287,7 +1287,7 @@ "lang": "zh_CN", "module": "radius", "source": "OutputPkts", - "result": "输出Pkts" + "result": "输出包" }, { "lang": "zh_CN", @@ -1305,7 +1305,7 @@ "lang": "zh_CN", "module": "radius", "source": "Profile", - "result": "轮廓" + "result": "Profile" }, { "lang": "zh_CN", @@ -1389,19 +1389,19 @@ "lang": "zh_CN", "module": "radius", "source": "UpRate (Mbps)", - "result": "上行速率 (Mbps)" + "result": "上行速率 (Mbps)" }, { "lang": "zh_CN", "module": "radius", - "source": "UpRate (kbps", - "result": "UpRate (kbps" + "source": "UpRate (kbps)", + "result": "上行速率 (kbps)" }, { "lang": "zh_CN", "module": "radius", "source": "UpRate (kbps)", - "result": "上行速率 (kbps)" + "result": "上行速率 (kbps)" }, { "lang": "zh_CN", From 9a35cdfdb456782c095a577f196c15f7a02e72d2 Mon Sep 17 00:00:00 2001 From: Jett Wang Date: Mon, 29 Jan 2024 21:44:11 +0800 Subject: [PATCH 4/6] Update translation for "Job" in logging module --- assets/translate-zh_CN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/translate-zh_CN.json b/assets/translate-zh_CN.json index 6807ce78..f0b65a23 100644 --- a/assets/translate-zh_CN.json +++ b/assets/translate-zh_CN.json @@ -825,7 +825,7 @@ "lang": "zh_CN", "module": "logging", "source": "Job", - "result": "工作" + "result": "Job" }, { "lang": "zh_CN", From fa99c640b0816608dd47b754771f6a5318700756 Mon Sep 17 00:00:00 2001 From: Jett Wang Date: Mon, 29 Jan 2024 22:02:57 +0800 Subject: [PATCH 5/6] Update links and translations, and sort user data by username --- assets/templates/cwmp_preset.html | 4 ++-- assets/translate-zh_CN.json | 6 +++--- controllers/radius/user.go | 2 +- toughradius/radius.go | 10 ++++++++++ toughradius/radius_auth.go | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/assets/templates/cwmp_preset.html b/assets/templates/cwmp_preset.html index 06029617..3a6b7e45 100644 --- a/assets/templates/cwmp_preset.html +++ b/assets/templates/cwmp_preset.html @@ -60,7 +60,7 @@ // }, { view: "label", - label: tr("cwmp", "Config content, Preset template"), + label: tr("cwmp", "Config content, Preset template"), align: "left", click: openTemplate }, @@ -103,7 +103,7 @@ elements: [ { view: "label", width: 130, - label: tr("cwmp", "Preset template"), + label: tr("cwmp", "Preset template"), align: "left", click: openTemplate }, diff --git a/assets/translate-zh_CN.json b/assets/translate-zh_CN.json index f0b65a23..bc212374 100644 --- a/assets/translate-zh_CN.json +++ b/assets/translate-zh_CN.json @@ -393,13 +393,13 @@ "lang": "zh_CN", "module": "cwmp", "source": "OID", - "result": "OID的" + "result": "OID" }, { "lang": "zh_CN", "module": "cwmp", "source": "OUI", - "result": "OUI (英语)" + "result": "OUI" }, { "lang": "zh_CN", @@ -1239,7 +1239,7 @@ "lang": "zh_CN", "module": "radius", "source": "LastOnline", - "result": "上一篇在线" + "result": "最后在线" }, { "lang": "zh_CN", diff --git a/controllers/radius/user.go b/controllers/radius/user.go index 46bbaaab..091ffa41 100644 --- a/controllers/radius/user.go +++ b/controllers/radius/user.go @@ -58,7 +58,7 @@ func InitUserRouter() { query := app.GDB().Model(&models.RadiusUser{}).Select("radius_user.*, coalesce(ro.count, 0) as online_count"). Joins("left join (select username, count(1) as count from radius_online group by username) ro on radius_user.username = ro.username") if len(web.ParseSortMap(c)) == 0 { - query = query.Order("radius_user.updated_at desc") + query = query.Order("radius_user.username asc") } else { mobj := models.RadiusUser{} for name, stype := range web.ParseSortMap(c) { diff --git a/toughradius/radius.go b/toughradius/radius.go index c050aad8..dd6a8e05 100644 --- a/toughradius/radius.go +++ b/toughradius/radius.go @@ -179,6 +179,16 @@ func (s *RadiusService) UpdateUserVlanid2(username string, vlanid2 int) { } } +func (s *RadiusService) UpdateUserLastOnline(username string) { + err := app.GDB(). + Model(&models.RadiusUser{}). + Where("username = ?", username). + Update("last_online", time.Now()).Error + if err != nil { + log.Error2("update user last online error", zap.Error(err), zap.String("namespace", "radius")) + } +} + func (s *RadiusService) GetIntConfig(name string, defval int64) int64 { cval := app.GApp().GetSettingsStringValue("radius", name) ival, err := strconv.ParseInt(cval, 10, 64) diff --git a/toughradius/radius_auth.go b/toughradius/radius_auth.go index cc2015ad..0902dd21 100644 --- a/toughradius/radius_auth.go +++ b/toughradius/radius_auth.go @@ -136,6 +136,7 @@ func (s *AuthService) ServeRADIUS(w radius.ResponseWriter, r *radius.Request) { s.AcceptAcceptConfig(user, vpe.VendorCode, response) s.SendAccept(w, r, response) s.UpdateBind(user, vendorReq) + s.UpdateUserLastOnline(user.Username) log.Info2("radius auth sucess", zap.String("namespace", "radius"), zap.String("username", username), From f3fc22b74c54287efa20f89958dc5a34edd4610e Mon Sep 17 00:00:00 2001 From: Jett Wang Date: Mon, 29 Jan 2024 22:03:12 +0800 Subject: [PATCH 6/6] 2024-01-29 22:03:11 : --- assets/buildinfo.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/buildinfo.txt b/assets/buildinfo.txt index 603a577c..4f0bea06 100644 --- a/assets/buildinfo.txt +++ b/assets/buildinfo.txt @@ -1,8 +1,8 @@ -BuildVersion=latest v8.0.6 2024-01-29 14:30:41 +BuildVersion=latest v8.0.6 2024-01-29 22:03:11 ReleaseVersion=v8.0.6 -BuildTime=2024-01-29 14:30:41 +BuildTime=2024-01-29 22:03:11 BuildName=toughradius -CommitID=80de826c23ba093c55b8e2104a2ee3bed283a938 -CommitDate=Mon, 29 Jan 2024 14:28:57 +0800 +CommitID=71a775bdd04e663754497dc3dcae8dd3e42c595b +CommitDate=Mon, 29 Jan 2024 22:02:57 +0800 CommitUser=jamiesun.net@gmail.com -CommitSubject=2024-01-29 14:28:51 : readme +CommitSubject=Update links and translations, and sort user data by username