mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Storing DIffs now...might not be compatible?
Former-commit-id: ce50508705b9727b310059116a2c07d2154d7a80 [formerly 5a63af13359b5a8a3d963c014517c709151312cc] [formerly 0703fe06fc408947ca4d70b97cba99e02c75879f [formerly 965989530c
]]
Former-commit-id: 9575b9b87113bd6a2ff0186464671666bbac18cf [formerly f825477fd790918e8d9247e3a540da391dbc687a]
Former-commit-id: 0c1e92517cc0e5ad864135711535021b4c170f19
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
@ -40,21 +39,24 @@ func wshandler(w http.ResponseWriter, r *http.Request) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var p CowyoData
|
||||
err = p.load(m.Title)
|
||||
fmt.Println("LOADED")
|
||||
fmt.Println(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if m.UpdateServer {
|
||||
p := CowyoData{strings.ToLower(m.Title), m.TextData}
|
||||
err := p.save()
|
||||
err := p.save(m.TextData)
|
||||
fmt.Println("SAVED")
|
||||
fmt.Println(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
if m.UpdateClient {
|
||||
p := CowyoData{strings.ToLower(m.Title), ""}
|
||||
err := p.load()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
m.UpdateClient = len(m.TextData) != len(p.Text)
|
||||
m.TextData = p.Text
|
||||
m.UpdateClient = len(m.TextData) != len(p.CurrentText)
|
||||
m.TextData = p.CurrentText
|
||||
}
|
||||
newMsg, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user