Skip to content

Commit

Permalink
prepare sysinfo and login-options
Browse files Browse the repository at this point in the history
  • Loading branch information
eltorio committed Apr 4, 2024
1 parent 4b66f01 commit 595cd81
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:


- name: Create release on GitHub
uses: docker://goreleaser/goreleaser:latest
uses: docker://goreleaser/goreleaser-cross:latest
with:
args: release
env:
Expand Down
7 changes: 7 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ builds:
- -v
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- '386'
ignore:
- goos: darwin
goarch: '386'
- goos: windows
goarch: 'arm64'
checksum:
name_template: 'checksums.txt'
archives:
Expand Down
18 changes: 18 additions & 0 deletions app/controllers/sysinfo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package controllers

import (
"rustdesk-api-server/utils/beegoHelper"
"time"
)

type SysinfoController struct {
BaseController
}

// Heartbeat detection POST
func (ctl *SysinfoController) Sysinfo() {

ctl.JSON(beegoHelper.H{
"modified_at": time.Now().Unix(),
})
}
28 changes: 28 additions & 0 deletions app/models/clients.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package models

import (
"log"

"github.com/beego/beego/v2/client/orm"
)

type Clients struct {
DeviceId int32 `json:"device_id" orm:"column(deviceid);auto"`
Cpu string `json:"cpu"`
Uuid int32 `json:"uuid"`
Username string `json:"username"`
Hostname string `json:"hostname"`
Os string `json:"os"`
Version string `json:"version"`
Heart string `json:"int64"`
}

func (u *Clients) TableName() string {
return "rustdesk_clients"
}

func init() {
log.Printf("Initialize the model")
// Initialize the model
orm.RegisterModel(new(Clients))
}
2 changes: 2 additions & 0 deletions routers/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func init() {
// Set the routing information
beego.Router("/", &controllers.IndexController{}, "get:Index")
beego.Router("/api/heartbeat", &controllers.HeartController{}, "post:Heart")
beego.Router("/api/sysinfo", &controllers.SysinfoController{}, "post:Sysinfo")
beego.Router("/api/login", &controllers.LoginController{}, "post:Login")
beego.Router("/api/login-options", &controllers.LoginController{}, "post:Login")
beego.Router("/api/ab", &controllers.AddressBookController{}, "post:Update")
// for v1.2.2 client compatiblity
beego.Router("/api/ab", &controllers.AddressBookController{}, "get:List")
Expand Down
10 changes: 10 additions & 0 deletions sysinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"cpu": "Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz, 2.54GHz, 12/6 cores",
"hostname": "blingster.lesmuids.windows",
"id": "1384536162",
"memory": "32GB",
"os": "macos / MacOS 14.4.1 ",
"username": "rlemeill",
"uuid": "RTlENEQxQ0UtMkY5Mi01ODg2LUE4QzEtMkQ4QjRFOEMwNDUz",
"version": "1.2.4"
}

0 comments on commit 595cd81

Please sign in to comment.