kopia lustrzana https://codeberg.org/nmkj/audon
don't delete old avatars just in case
rodzic
3d24066d2d
commit
44e0b2b3d7
|
@ -48,7 +48,7 @@ func (u *AudonUser) GetIndicator(ctx context.Context, fnew []byte) ([]byte, erro
|
|||
return nil, err
|
||||
}
|
||||
if u.AvatarFile != "" {
|
||||
os.Remove(u.getAvatarImagePath(u.AvatarFile))
|
||||
// os.Remove(u.getAvatarImagePath(u.AvatarFile))
|
||||
}
|
||||
isAvatarNew = true
|
||||
}
|
||||
|
|
3
user.go
3
user.go
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
|
@ -41,7 +40,7 @@ func (a *AudonUser) InLivekit(ctx context.Context) (bool, error) {
|
|||
}
|
||||
|
||||
func (a *AudonUser) ClearUserAvatar(ctx context.Context) error {
|
||||
os.Remove(a.getAvatarImagePath(a.AvatarFile))
|
||||
// os.Remove(a.getAvatarImagePath(a.AvatarFile))
|
||||
coll := mainDB.Collection(COLLECTION_USER)
|
||||
_, err := coll.UpdateOne(ctx,
|
||||
bson.D{{Key: "audon_id", Value: a.AudonID}},
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -69,7 +68,7 @@ func livekitWebhookHandler(c echo.Context) error {
|
|||
|
||||
<-countdown.C
|
||||
webhookTimerCache.Delete(audonID)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
// ctx := context.TODO()
|
||||
|
||||
|
@ -90,7 +89,7 @@ func livekitWebhookHandler(c echo.Context) error {
|
|||
c.Logger().Warn(err)
|
||||
}
|
||||
user.ClearUserAvatar(ctx)
|
||||
os.Remove(avatar)
|
||||
// os.Remove(avatar)
|
||||
} else if err != nil {
|
||||
c.Logger().Error(err)
|
||||
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||
|
|
Ładowanie…
Reference in New Issue