🐛 Bug fixes on E2EE
This commit is contained in:
		
							
								
								
									
										13
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										13
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -4,14 +4,10 @@ | |||||||
|     <option name="autoReloadType" value="ALL" /> |     <option name="autoReloadType" value="ALL" /> | ||||||
|   </component> |   </component> | ||||||
|   <component name="ChangeListManager"> |   <component name="ChangeListManager"> | ||||||
|     <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":recycle: Improved the notification subscriber API"> |     <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: E2EE Key Exchange"> | ||||||
|       <change afterPath="$PROJECT_DIR$/pkg/models/unified.go" afterDir="false" /> |  | ||||||
|       <change afterPath="$PROJECT_DIR$/pkg/services/e2ee.go" afterDir="false" /> |  | ||||||
|       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | ||||||
|       <change beforePath="$PROJECT_DIR$/pkg/cmd/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/cmd/main.go" afterDir="false" /> |       <change beforePath="$PROJECT_DIR$/pkg/server/ws.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/server/ws.go" afterDir="false" /> | ||||||
|       <change beforePath="$PROJECT_DIR$/pkg/server/notify_ws.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/server/ws.go" afterDir="false" /> |       <change beforePath="$PROJECT_DIR$/pkg/services/e2ee.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/e2ee.go" afterDir="false" /> | ||||||
|       <change beforePath="$PROJECT_DIR$/pkg/server/startup.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/server/startup.go" afterDir="false" /> |  | ||||||
|       <change beforePath="$PROJECT_DIR$/pkg/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/notifications.go" afterDir="false" /> |  | ||||||
|     </list> |     </list> | ||||||
|     <option name="SHOW_DIALOG" value="false" /> |     <option name="SHOW_DIALOG" value="false" /> | ||||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> |     <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||||
| @@ -168,7 +164,8 @@ | |||||||
|     <MESSAGE value=":bug: Fix new realm owner missing permissions" /> |     <MESSAGE value=":bug: Fix new realm owner missing permissions" /> | ||||||
|     <MESSAGE value=":zap: Use map to improve message delivery time" /> |     <MESSAGE value=":zap: Use map to improve message delivery time" /> | ||||||
|     <MESSAGE value=":recycle: Improved the notification subscriber API" /> |     <MESSAGE value=":recycle: Improved the notification subscriber API" /> | ||||||
|     <option name="LAST_COMMIT_MESSAGE" value=":recycle: Improved the notification subscriber API" /> |     <MESSAGE value=":sparkles: E2EE Key Exchange" /> | ||||||
|  |     <option name="LAST_COMMIT_MESSAGE" value=":sparkles: E2EE Key Exchange" /> | ||||||
|   </component> |   </component> | ||||||
|   <component name="VgoProject"> |   <component name="VgoProject"> | ||||||
|     <settings-migrated>true</settings-migrated> |     <settings-migrated>true</settings-migrated> | ||||||
|   | |||||||
| @@ -60,7 +60,7 @@ func listenWebsocket(c *websocket.Conn) { | |||||||
| 			if len(req.RequestID) <= 0 || len(req.KeypairID) <= 0 { | 			if len(req.RequestID) <= 0 || len(req.KeypairID) <= 0 { | ||||||
| 				message = lo.ToPtr(models.UnifiedCommandFromError(fmt.Errorf("invalid request"))) | 				message = lo.ToPtr(models.UnifiedCommandFromError(fmt.Errorf("invalid request"))) | ||||||
| 			} | 			} | ||||||
| 			services.KexProvide(user.ID, req.RequestID, req.KeypairID, payload) | 			services.KexProvide(user.ID, req.RequestID, req.KeypairID, packet) | ||||||
| 		default: | 		default: | ||||||
| 			message = lo.ToPtr(models.UnifiedCommandFromError(fmt.Errorf("unknown action"))) | 			message = lo.ToPtr(models.UnifiedCommandFromError(fmt.Errorf("unknown action"))) | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -28,8 +28,12 @@ func KexRequest(conn *websocket.Conn, requestId, keypairId string, ownerId uint, | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	flag := false | 	flag := false | ||||||
| 	for conn := range wsConn[ownerId] { | 	for c := range wsConn[ownerId] { | ||||||
| 		if conn.WriteMessage(1, models.UnifiedCommand{ | 		if c == conn { | ||||||
|  | 			continue | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		if c.WriteMessage(1, models.UnifiedCommand{ | ||||||
| 			Action: "kex.request", | 			Action: "kex.request", | ||||||
| 			Payload: fiber.Map{ | 			Payload: fiber.Map{ | ||||||
| 				"request_id": requestId, | 				"request_id": requestId, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user