im 服务端
This commit is contained in:
+13
-1
@@ -1062,6 +1062,16 @@ func serveIMBootstrap(wrt http.ResponseWriter, req *http.Request) {
|
||||
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
|
||||
return
|
||||
}
|
||||
var modules []types.WorkbenchModule
|
||||
workbenchVersion := 1
|
||||
if store.Workbench != nil {
|
||||
var err error
|
||||
modules, workbenchVersion, err = store.Workbench.Get(principal.TenantID, principal.Uid)
|
||||
if err != nil && !errors.Is(err, types.ErrNotFound) && !errors.Is(err, types.ErrUnsupported) {
|
||||
writeIMRelationError(wrt, req, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
writeIMSuccess(wrt, req, map[string]any{
|
||||
"features": map[string]any{
|
||||
"create_group": true,
|
||||
@@ -1076,6 +1086,8 @@ func serveIMBootstrap(wrt http.ResponseWriter, req *http.Request) {
|
||||
"user_search": true,
|
||||
"scan_qr": true,
|
||||
},
|
||||
"modules": workbenchModulePayloads(modules),
|
||||
"workbench_version": workbenchVersion,
|
||||
"system_topic": map[string]any{
|
||||
"topic": "sys",
|
||||
"type": "system",
|
||||
@@ -5968,7 +5980,7 @@ func authenticateTopicReader(wrt http.ResponseWriter, req *http.Request, topic s
|
||||
}
|
||||
sub, err := store.Subs.Get(principal.TenantID, topic, principal.Uid, false)
|
||||
if err != nil {
|
||||
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
|
||||
writeIMRelationError(wrt, req, err)
|
||||
return nil, "", false
|
||||
}
|
||||
if sub == nil || !(sub.ModeGiven & sub.ModeWant).IsReader() {
|
||||
|
||||
Reference in New Issue
Block a user