Feat: add namecheck and tailwind css
This commit is contained in:
@ -27,3 +27,24 @@ func getRoomIDFromCtx(ctx context.Context) string {
|
||||
id, _ := ctx.Value(models.CtxRoomIDKey).(string)
|
||||
return id
|
||||
}
|
||||
|
||||
// cache
|
||||
func getAllNames() []string {
|
||||
names := []string{}
|
||||
// will not scale
|
||||
wholeMemStore := memcache.GetAll()
|
||||
session := &models.Session{}
|
||||
// filter by key size only sessions
|
||||
for k, v := range wholeMemStore {
|
||||
// xid is 20 in len
|
||||
if len(k) != 20 {
|
||||
continue
|
||||
}
|
||||
if err := json.Unmarshal(v, &session); err != nil {
|
||||
log.Error("failed to unmarshal", "error", err)
|
||||
continue
|
||||
}
|
||||
names = append(names, session.Username)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
Reference in New Issue
Block a user