Migrate shroom
This commit is contained in:
parent
72f7d5d1c1
commit
72b079cc2e
@ -1,21 +1,36 @@
|
|||||||
package shroom
|
package shroom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/internal/hyphae"
|
"github.com/bouncepaw/mycorrhiza/internal/hyphae"
|
||||||
"github.com/bouncepaw/mycorrhiza/internal/user"
|
"github.com/bouncepaw/mycorrhiza/internal/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
slog.Info("Reject rename",
|
||||||
|
"hyphaName", h.CanonicalName(),
|
||||||
|
"username", u.Name,
|
||||||
|
"errmsg", errmsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func rejectRemoveMediaLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectRemoveMediaLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject remove media ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
slog.Info("Reject remove media",
|
||||||
|
"hyphaName", h.CanonicalName(),
|
||||||
|
"username", u.Name,
|
||||||
|
"errmsg", errmsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func rejectEditLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectEditLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject edit ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
slog.Info("Reject edit",
|
||||||
|
"hyphaName", h.CanonicalName(),
|
||||||
|
"username", u.Name,
|
||||||
|
"errmsg", errmsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func rejectUploadMediaLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
func rejectUploadMediaLog(h hyphae.Hypha, u *user.User, errmsg string) {
|
||||||
log.Printf("Reject upload media ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg)
|
slog.Info("Reject upload media",
|
||||||
|
"hyphaName", h.CanonicalName(),
|
||||||
|
"username", u.Name,
|
||||||
|
"errmsg", errmsg)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log/slog"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -201,7 +201,7 @@ func UploadBinary(h hyphae.Hypha, mime string, file multipart.File, u *user.User
|
|||||||
if err := history.Rename(prevFilePath, uploadedFilePath); err != nil {
|
if err := history.Rename(prevFilePath, uploadedFilePath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("Move ‘%s’ to ‘%s’\n", prevFilePath, uploadedFilePath)
|
slog.Info("Move file", "from", prevFilePath, "to", uploadedFilePath)
|
||||||
h.SetMediaFilePath(uploadedFilePath)
|
h.SetMediaFilePath(uploadedFilePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user