HEAVY: migrate accounts and logs to service/repo architecture
This commit is contained in:
parent
5c255fb34b
commit
49e14b5bc5
37 changed files with 1019 additions and 687 deletions
|
|
@ -1,16 +1,16 @@
|
|||
package cursor
|
||||
|
||||
import (
|
||||
"arimelody-web/model"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"arimelody-web/model/app"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
type CursorClient struct {
|
||||
|
|
@ -49,7 +49,7 @@ var clients = make(map[int32]*CursorClient)
|
|||
var broadcast = make(chan CursorMessage)
|
||||
var mutex = &sync.Mutex{}
|
||||
|
||||
func StartCursor(app *model.AppState) {
|
||||
func StartCursor(app *app.AppState) {
|
||||
var includes = func (clients []*CursorClient, client *CursorClient) bool {
|
||||
for _, c := range clients {
|
||||
if c.ID == client.ID { return true }
|
||||
|
|
@ -145,7 +145,7 @@ func handleClient(client *CursorClient) {
|
|||
}
|
||||
}
|
||||
|
||||
func Handler(app *model.AppState) http.HandlerFunc {
|
||||
func Handler(app *app.AppState) http.HandlerFunc {
|
||||
var upgrader = websocket.Upgrader{
|
||||
CheckOrigin: func (r *http.Request) bool {
|
||||
origin := r.Header.Get("Origin")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue