mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-06 22:59:44 +00:00
### Added - [Files] Files can now be selected multiple files and downloaded, deleted, moved, etc. - [Apps] Support to modify the application opening address.([#204](https://github.com/IceWhaleTech/CasaOS/issues/204)) ### Changed - [Apps] Hide the display of non-essential environment variables in the application. - [System] Network, disk, cpu, memory, etc. information is modified to be pushed via socket. - [System] Optimize opening speed.([#214](https://github.com/IceWhaleTech/CasaOS/issues/214)) ### Fixed - [System] Fixed the problem that sync data cannot submit the device ID ([#68](https://github.com/IceWhaleTech/CasaOS/issues/68)) - [Files] Fixed the code editor center alignment display problem.([#210](https://github.com/IceWhaleTech/CasaOS/issues/210)) - [Files] Fixed the problem of wrong name when downloading files.([#240](https://github.com/IceWhaleTech/CasaOS/issues/240)) - [System] Fixed the network display as a negative number problem.([#224](https://github.com/IceWhaleTech/CasaOS/issues/224))
40 lines
870 B
Go
40 lines
870 B
Go
/*
|
|
* @Author: LinkLeong link@icewhale.com
|
|
* @Date: 2022-05-23 17:18:56
|
|
* @LastEditors: LinkLeong
|
|
* @LastEditTime: 2022-05-30 17:06:08
|
|
* @FilePath: /CasaOS/route/socket.go
|
|
* @Description:
|
|
* @Website: https://www.casaos.io
|
|
* Copyright (c) 2022 by icewhale, All Rights Reserved.
|
|
*/
|
|
package route
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/IceWhaleTech/CasaOS/model/notify"
|
|
"github.com/IceWhaleTech/CasaOS/service"
|
|
f "github.com/ambelovsky/gosf"
|
|
)
|
|
|
|
func ScoketInit(port int, msg chan notify.Message) {
|
|
f.OnConnect(func(c *f.Client, request *f.Request) {
|
|
service.ClientCount += 1
|
|
})
|
|
f.OnDisconnect(func(c *f.Client, request *f.Request) {
|
|
service.ClientCount -= 1
|
|
})
|
|
go func(msg chan notify.Message) {
|
|
for v := range msg {
|
|
f.Broadcast("", v.Path, &v.Msg)
|
|
time.Sleep(time.Millisecond * 300)
|
|
}
|
|
|
|
}(msg)
|
|
|
|
f.Startup(map[string]interface{}{
|
|
"port": port})
|
|
|
|
}
|