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
|
return nil, err
|
||||||
}
|
}
|
||||||
if u.AvatarFile != "" {
|
if u.AvatarFile != "" {
|
||||||
os.Remove(u.getAvatarImagePath(u.AvatarFile))
|
// os.Remove(u.getAvatarImagePath(u.AvatarFile))
|
||||||
}
|
}
|
||||||
isAvatarNew = true
|
isAvatarNew = true
|
||||||
}
|
}
|
||||||
|
|
3
user.go
3
user.go
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"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 {
|
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)
|
coll := mainDB.Collection(COLLECTION_USER)
|
||||||
_, err := coll.UpdateOne(ctx,
|
_, err := coll.UpdateOne(ctx,
|
||||||
bson.D{{Key: "audon_id", Value: a.AudonID}},
|
bson.D{{Key: "audon_id", Value: a.AudonID}},
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -69,7 +68,7 @@ func livekitWebhookHandler(c echo.Context) error {
|
||||||
|
|
||||||
<-countdown.C
|
<-countdown.C
|
||||||
webhookTimerCache.Delete(audonID)
|
webhookTimerCache.Delete(audonID)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
// ctx := context.TODO()
|
// ctx := context.TODO()
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ func livekitWebhookHandler(c echo.Context) error {
|
||||||
c.Logger().Warn(err)
|
c.Logger().Warn(err)
|
||||||
}
|
}
|
||||||
user.ClearUserAvatar(ctx)
|
user.ClearUserAvatar(ctx)
|
||||||
os.Remove(avatar)
|
// os.Remove(avatar)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
c.Logger().Error(err)
|
c.Logger().Error(err)
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError)
|
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||||
|
|
Ładowanie…
Reference in New Issue