more stuff
This commit is contained in:
parent
ef022499e7
commit
15a2fe7420
|
|
@ -5,23 +5,14 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="8a64704d-5500-41a6-aa4c-e275933fc58c" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/internal/ws/client.go" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/internal/ws/handlers.go" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/internal/ws/hub.go" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/internal/ws/message.go" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/internal/ws/structs.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/cmd/watchtogether/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/watchtogether/main.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docker-compose.yml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/driver/driver.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/logger/logger.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/server/middleware.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/server/routes.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/server/server.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/services/logger.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/ws/handlers.go" beforeDir="false" afterPath="$PROJECT_DIR$/internal/ws/handlers.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal/ws/message.go" beforeDir="false" afterPath="$PROJECT_DIR$/internal/ws/message.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/package.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/interfaces/IUser.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/interfaces/IUser.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/interfaces/Identity.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/interfaces/Identity.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/yarn.lock" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/yarn.lock" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../yarn-error.log" beforeDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
@ -54,12 +45,15 @@
|
|||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2456l5ltkI1NptLGqpacBxKAWdj" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
<ConfirmationsSetting value="2" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
||||
<property name="DefaultGoTemplateProperty" value="Go File" />
|
||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
|
|
@ -103,7 +97,26 @@
|
|||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<integration-enabled>true</integration-enabled>
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/internal/ws/message.go</url>
|
||||
<line>69</line>
|
||||
<option name="timeStamp" value="5" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/internal/ws/message.go</url>
|
||||
<line>59</line>
|
||||
<option name="timeStamp" value="6" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,12 +1,25 @@
|
|||
package ws
|
||||
|
||||
//todo better data deserialization
|
||||
|
||||
type IdentityData struct {
|
||||
ClientID string `json:"client_id"`
|
||||
User User `json:"user"`
|
||||
}
|
||||
|
||||
func handleIdentifyEvent(message *Message) {
|
||||
|
||||
d := message.Data.(map[string]interface{})
|
||||
m := Message{
|
||||
MessageData: MessageData{
|
||||
Type: Identify,
|
||||
Data: map[string]interface{}{
|
||||
"playlist": "",
|
||||
"playHead": 0,
|
||||
"user": d["user"],
|
||||
},
|
||||
},
|
||||
}
|
||||
message.send <- m.SerializeMessage().Data
|
||||
}
|
||||
|
||||
func handlePingEvent(message *Message) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const (
|
|||
type MessageData struct {
|
||||
Type MessageTypes `json:"type"`
|
||||
RawData json.RawMessage `json:"data,omitempty"`
|
||||
Data map[string]interface{} `json:"-"`
|
||||
Data interface{} `json:"-"`
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
|
|
@ -41,13 +41,7 @@ func (rm RawMessage) UnSerializeData() Message {
|
|||
if err := json.Unmarshal([]byte(s), &md); err != nil {
|
||||
log.Errorf("error unmarshalling message, %s", err.Error())
|
||||
}
|
||||
if md.RawData != nil && len(md.RawData) > 0 && md.RawData[0] == '"' {
|
||||
var s string
|
||||
if err := json.Unmarshal(md.RawData, &s); err != nil {
|
||||
// handle error
|
||||
log.Errorf("error unmarshalling message, %s", err.Error())
|
||||
}
|
||||
md.RawData = json.RawMessage(s)
|
||||
if md.RawData != nil && len(md.RawData) > 0 {
|
||||
if err := json.Unmarshal(md.RawData, &md.Data); err != nil {
|
||||
// handle error
|
||||
log.Errorf("error unmarshalling message, %s", err.Error())
|
||||
|
|
@ -62,7 +56,14 @@ func (rm RawMessage) UnSerializeData() Message {
|
|||
}
|
||||
|
||||
func (m Message) SerializeMessage() RawMessage {
|
||||
data, err := json.Marshal(m)
|
||||
var err error
|
||||
if m.Data != nil {
|
||||
m.RawData, err = json.Marshal(m.Data)
|
||||
if err != nil {
|
||||
log.Errorf("unable to marshal data, %s", err.Error())
|
||||
}
|
||||
}
|
||||
data, err := json.Marshal(m.MessageData)
|
||||
if err != nil {
|
||||
log.Errorf("unable to marshal message, %s", err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,14 @@
|
|||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-player": "^2.9.0",
|
||||
"uuid": "^8.3.2",
|
||||
"websocket": "^1.0.34"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.6.0",
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@types/websocket": "^1.0.4",
|
||||
"typescript": "4.3.2"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,3 +3,5 @@ interface IUser {
|
|||
userID: string;
|
||||
admin: boolean;
|
||||
}
|
||||
|
||||
export default IUser;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
import IUser from "./IUser";
|
||||
|
||||
interface IdentityData {
|
||||
clientID: string;
|
||||
clientID?: string;
|
||||
playlist?: string;
|
||||
playHead?: number;
|
||||
user: IUser;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ declare namespace NodeJS {
|
|||
export interface ProcessEnv {
|
||||
DISCORD_ID: string;
|
||||
DISCORD_SECRET: string;
|
||||
API_PORT: string;
|
||||
SECRET: string;
|
||||
CLIENT_ID: string;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1000,6 +1000,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/tinycolor2/-/tinycolor2-1.4.2.tgz#721ca5c5d1a2988b4a886e35c2ffc5735b6afbdf"
|
||||
integrity sha512-PeHg/AtdW6aaIO2a+98Xj7rWY4KC1E6yOy7AFknJQ7VXUGNrMlyxDFxJo7HqLtjQms/ZhhQX52mLVW/EX3JGOw==
|
||||
|
||||
"@types/uuid@^8.3.4":
|
||||
version "8.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
|
||||
integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==
|
||||
|
||||
"@types/warning@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/warning/-/warning-3.0.0.tgz#0d2501268ad8f9962b740d387c4654f5f8e23e52"
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
Arguments:
|
||||
/home/pixel/.volta/tools/image/node/16.13.2/bin/node /home/pixel/.volta/tools/image/yarn/1.22.17/bin/yarn.js add -D @types/zib
|
||||
|
||||
PATH:
|
||||
/home/pixel/.volta/tools/image/yarn/1.22.17/bin:/home/pixel/.volta/tools/image/node/16.13.2/bin:/home/pixel/.volta/bin:/home/pixel/.volta/bin:/home/pixel/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
|
||||
|
||||
Yarn version:
|
||||
1.22.17
|
||||
|
||||
Node version:
|
||||
16.13.2
|
||||
|
||||
Platform:
|
||||
linux x64
|
||||
|
||||
Trace:
|
||||
Error: https://registry.yarnpkg.com/@types%2fzib: Not found
|
||||
at Request.params.callback [as _callback] (/home/pixel/.volta/tools/image/yarn/1.22.17/lib/cli.js:67029:18)
|
||||
at Request.self.callback (/home/pixel/.volta/tools/image/yarn/1.22.17/lib/cli.js:140883:22)
|
||||
at Request.emit (node:events:390:28)
|
||||
at Request.<anonymous> (/home/pixel/.volta/tools/image/yarn/1.22.17/lib/cli.js:141855:10)
|
||||
at Request.emit (node:events:390:28)
|
||||
at IncomingMessage.<anonymous> (/home/pixel/.volta/tools/image/yarn/1.22.17/lib/cli.js:141777:12)
|
||||
at Object.onceWrapper (node:events:509:28)
|
||||
at IncomingMessage.emit (node:events:402:35)
|
||||
at endReadableNT (node:internal/streams/readable:1343:12)
|
||||
at processTicksAndRejections (node:internal/process/task_queues:83:21)
|
||||
|
||||
npm manifest:
|
||||
No manifest
|
||||
|
||||
yarn manifest:
|
||||
No manifest
|
||||
|
||||
Lockfile:
|
||||
No lockfile
|
||||
Loading…
Reference in New Issue