channel get tbd
This commit is contained in:
@@ -269,6 +269,25 @@ func HandleGetHubs(response http.ResponseWriter, request *http.Request) {
|
|||||||
response.Write(converted)
|
response.Write(converted)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HandleGetChannels(response http.ResponseWriter, request *http.Request) {
|
||||||
|
if !validCheckWithResponseOnFail(response, request, normal) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx := request.Context()
|
||||||
|
user, hubUser, hub, err := getHubUserIfValidWithResponseOnFail(ctx, response, request)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
channelMap := make(map[uint8]*types.HubChannel)
|
||||||
|
hub.Mu.RLock()
|
||||||
|
for i, channel := range hub.Channels {
|
||||||
|
if channel == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
channelMap[uint8(i)] = channel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func hubPermissionContext(response http.ResponseWriter, request *http.Request, rt bodyLimit, needed types.Permissions) (*types.HubUser, *types.Hub, context.Context, uint8, bool) {
|
func hubPermissionContext(response http.ResponseWriter, request *http.Request, rt bodyLimit, needed types.Permissions) (*types.HubUser, *types.Hub, context.Context, uint8, bool) {
|
||||||
if !validCheckWithResponseOnFail(response, request, rt) {
|
if !validCheckWithResponseOnFail(response, request, rt) {
|
||||||
return nil, nil, nil, 0, false
|
return nil, nil, nil, 0, false
|
||||||
|
|||||||
Reference in New Issue
Block a user