Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesun committed Jan 29, 2024
2 parents 07ab156 + f3fc22b commit 48ab1df
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 44 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ 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.
<img width="1236" alt="image" src="https://github.com/talkincode/toughradius/assets/377938/b6dafb49-6850-4906-b69f-2c18196459c0">

[QABOT Link](https://qa.toughradius.net/)
[A&A AiBot Link](https://qa.toughradius.net/)

## System structure

Expand Down
10 changes: 5 additions & 5 deletions assets/buildinfo.txt
Original file line number Diff line number Diff line change
@@ -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
[email protected]
CommitSubject=2024-01-29 14:28:51 : readme
CommitSubject=Update links and translations, and sort user data by username
2 changes: 1 addition & 1 deletion assets/createdb.sql
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 2 additions & 2 deletions assets/templates/cwmp_preset.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
// },
{
view: "label",
label: tr("cwmp", "Config content, <a href='javascript:void(0)'>Preset template</a>"),
label: tr("cwmp", "Config content, <a href='#'>Preset template</a>"),
align: "left",
click: openTemplate
},
Expand Down Expand Up @@ -103,7 +103,7 @@
elements: [
{
view: "label", width: 130,
label: tr("cwmp", "<a href='javascript:void(0)'>Preset template</a>"),
label: tr("cwmp", "<a href='#'>Preset template</a>"),
align: "left",
click: openTemplate
},
Expand Down
62 changes: 31 additions & 31 deletions assets/translate-zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -735,7 +735,7 @@
"lang": "zh_CN",
"module": "global",
"source": "Save",
"result": ""
"result": "保存"
},
{
"lang": "zh_CN",
Expand Down Expand Up @@ -825,7 +825,7 @@
"lang": "zh_CN",
"module": "logging",
"source": "Job",
"result": "工作"
"result": "Job"
},
{
"lang": "zh_CN",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -921,7 +921,7 @@
"lang": "zh_CN",
"module": "menus",
"source": "Online",
"result": "在线"
"result": "在线帐号"
},
{
"lang": "zh_CN",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1125,7 +1125,7 @@
"lang": "zh_CN",
"module": "radius",
"source": "Active num",
"result": "活动编号"
"result": "最大在线数"
},
{
"lang": "zh_CN",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1233,13 +1233,13 @@
"lang": "zh_CN",
"module": "radius",
"source": "InputPkts",
"result": "输入Pkts"
"result": "输入包"
},
{
"lang": "zh_CN",
"module": "radius",
"source": "LastOnline",
"result": "上一篇在线"
"result": "最后在线"
},
{
"lang": "zh_CN",
Expand All @@ -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",
Expand All @@ -1287,7 +1287,7 @@
"lang": "zh_CN",
"module": "radius",
"source": "OutputPkts",
"result": "输出Pkts"
"result": "输出包"
},
{
"lang": "zh_CN",
Expand All @@ -1305,7 +1305,7 @@
"lang": "zh_CN",
"module": "radius",
"source": "Profile",
"result": "轮廓"
"result": "Profile"
},
{
"lang": "zh_CN",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion controllers/radius/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 14 additions & 2 deletions docs/documents/installer.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions toughradius/radius.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions toughradius/radius_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 48ab1df

Please sign in to comment.