Compare commits
No commits in common. "9cca79ec4cdb6e30f04743f6bc48c3c959689bf3" and "4ef9e19fbcea233411fd33598ca548a6eddb7cc7" have entirely different histories.
9cca79ec4c
...
4ef9e19fbc
26 changed files with 140 additions and 167 deletions
|
@ -1,4 +0,0 @@
|
||||||
package feeds
|
|
||||||
|
|
||||||
type Feed struct {
|
|
||||||
}
|
|
5
mailer/NewUserRequest.go
Normal file
5
mailer/NewUserRequest.go
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package mailer
|
||||||
|
|
||||||
|
type NewUserMailData struct {
|
||||||
|
Domain string
|
||||||
|
}
|
12
mailer/mail.go
Normal file
12
mailer/mail.go
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package mailer
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/fs"
|
||||||
|
|
||||||
|
mail "github.com/xhit/go-simple-mail/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MailClient struct {
|
||||||
|
mailServer *mail.SMTPServer
|
||||||
|
templatesFs fs.FS
|
||||||
|
}
|
23
mailer/templates/NewUserRequest.html
Normal file
23
mailer/templates/NewUserRequest.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>New user request</title>
|
||||||
|
<link href="{{ .Domain }}/static/css/NewUserRequest.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>New account request</h1>
|
||||||
|
<p>New user is awaiting account approval</p>
|
||||||
|
<h3>Information</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Account name: {{ .Username }}</li>
|
||||||
|
<li>Account mail: {{ .MailAddress }}</li>
|
||||||
|
</ul>
|
||||||
|
<h4>Request reason</h4>
|
||||||
|
<p>{{ .Reason }}</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
11
main.go
11
main.go
|
@ -16,6 +16,7 @@ import (
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
"git.mstar.dev/mstar/linstrom/shared"
|
||||||
"git.mstar.dev/mstar/linstrom/storage"
|
"git.mstar.dev/mstar/linstrom/storage"
|
||||||
"git.mstar.dev/mstar/linstrom/storage/cache"
|
"git.mstar.dev/mstar/linstrom/storage/cache"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Add frontend overwrite
|
// TODO: Add frontend overwrite
|
||||||
|
@ -28,7 +29,7 @@ var reactiveFS embed.FS
|
||||||
var nojsFS embed.FS
|
var nojsFS embed.FS
|
||||||
|
|
||||||
//go:embed duck.webp
|
//go:embed duck.webp
|
||||||
var defaultDuck string
|
var placeholderFile string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
other.SetupFlags()
|
other.SetupFlags()
|
||||||
|
@ -76,7 +77,7 @@ func main() {
|
||||||
UserStore: store,
|
UserStore: store,
|
||||||
SessionStore: store,
|
SessionStore: store,
|
||||||
SessionMaxAge: time.Hour * 24,
|
SessionMaxAge: time.Hour * 24,
|
||||||
}, passkey.WithLogger(&shared.ZerologWrapper{}))
|
}, passkey.WithLogger(&util.ZerologWrapper{}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Failed to setup passkey support")
|
log.Fatal().Err(err).Msg("Failed to setup passkey support")
|
||||||
}
|
}
|
||||||
|
@ -84,9 +85,9 @@ func main() {
|
||||||
server := server.NewServer(
|
server := server.NewServer(
|
||||||
store,
|
store,
|
||||||
pkey,
|
pkey,
|
||||||
shared.NewFSWrapper(reactiveFS, "frontend-reactive/dist/", false),
|
util.NewFSWrapper(reactiveFS, "frontend-reactive/dist/", false),
|
||||||
shared.NewFSWrapper(nojsFS, "frontend-noscript/", false),
|
util.NewFSWrapper(nojsFS, "frontend-noscript/", false),
|
||||||
&defaultDuck,
|
&placeholderFile,
|
||||||
)
|
)
|
||||||
server.Start(":8000")
|
server.Start(":8000")
|
||||||
// TODO: Set up media server
|
// TODO: Set up media server
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"github.com/google/jsonapi"
|
"github.com/google/jsonapi"
|
||||||
"github.com/rs/zerolog/hlog"
|
"github.com/rs/zerolog/hlog"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage"
|
"git.mstar.dev/mstar/linstrom/storage"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Notes
|
// Notes
|
||||||
|
@ -98,7 +98,7 @@ func linstromNewNote(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rawTags := shared.TagsFromText(newNote.RawContent)
|
rawTags := util.TagsFromText(newNote.RawContent)
|
||||||
|
|
||||||
note, err := store.CreateNoteLocal(
|
note, err := store.CreateNoteLocal(
|
||||||
actorId,
|
actorId,
|
||||||
|
|
|
@ -31,20 +31,3 @@ type MediaMetadata struct {
|
||||||
// Whether the media is to be blurred by default
|
// Whether the media is to be blurred by default
|
||||||
Blurred bool
|
Blurred bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement special handling for the linstrom URI type
|
|
||||||
// Linstrom URIs indicate resource either generated on the fly, like identicons,
|
|
||||||
// or embedded data, such as the default duck
|
|
||||||
// For external users, transform them into normal http URIs with a "special" path
|
|
||||||
const DefaultDuckLocationName = "linstrom://default-media"
|
|
||||||
|
|
||||||
var DefaultDuckMedia = MediaMetadata{
|
|
||||||
ID: "3b562a45-36b7-4c42-a944-3672f319ff7b",
|
|
||||||
OwnedById: "", // FIXME: Add default user ID here
|
|
||||||
Remote: false,
|
|
||||||
Location: DefaultDuckLocationName,
|
|
||||||
Type: "image/webp",
|
|
||||||
Name: "default-duck.webp",
|
|
||||||
AltText: "a greyscale image of a pidgeon on some smooth surface, likely a liquid. It is captioned with the text \"Duck\"",
|
|
||||||
Blurred: false,
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package models
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/config"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,17 +17,3 @@ type RemoteServer struct {
|
||||||
IconId sql.NullString // ID of a media file
|
IconId sql.NullString // ID of a media file
|
||||||
IsSelf bool // Whether this server is yours truly
|
IsSelf bool // Whether this server is yours truly
|
||||||
}
|
}
|
||||||
|
|
||||||
func BuildDefaultServer() *RemoteServer {
|
|
||||||
return &RemoteServer{
|
|
||||||
Model: gorm.Model{
|
|
||||||
ID: 1,
|
|
||||||
},
|
|
||||||
ServerType: ServerSoftwareLinstrom,
|
|
||||||
Domain: config.GlobalConfig.General.GetFullDomain(),
|
|
||||||
Name: config.GlobalConfig.Self.ServerDisplayName,
|
|
||||||
Icon: &DefaultDuckMedia,
|
|
||||||
IconId: sql.NullString{String: DefaultDuckMedia.ID, Valid: true},
|
|
||||||
IsSelf: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ var ServerActorRole = Role{
|
||||||
CanSendAnnouncements: other.IntoPointer(true),
|
CanSendAnnouncements: other.IntoPointer(true),
|
||||||
}
|
}
|
||||||
|
|
||||||
var AllDefaultRoles = []*Role{
|
var allDefaultRoles = []*Role{
|
||||||
&DefaultUserRole,
|
&DefaultUserRole,
|
||||||
&FullAdminRole,
|
&FullAdminRole,
|
||||||
&AccountFreezeRole,
|
&AccountFreezeRole,
|
||||||
|
|
|
@ -6,8 +6,6 @@ import (
|
||||||
|
|
||||||
"gorm.io/gen"
|
"gorm.io/gen"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// A user describes an account for creating content and events.
|
// A user describes an account for creating content and events.
|
||||||
|
@ -39,7 +37,7 @@ type User struct {
|
||||||
// Soft delete means that this entry still exists in the db, but gorm won't include it anymore unless specifically told to
|
// Soft delete means that this entry still exists in the db, but gorm won't include it anymore unless specifically told to
|
||||||
// If not null, this entry is marked as deleted
|
// If not null, this entry is marked as deleted
|
||||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||||
Server RemoteServer
|
// Server RemoteServer // `gorm:"foreignKey:ServerId;references:ID"` // The server this user is from
|
||||||
ServerId uint // Id of the server this user is from, needed for including RemoteServer
|
ServerId uint // Id of the server this user is from, needed for including RemoteServer
|
||||||
DisplayName string // The display name of the user. Can be different from the handle
|
DisplayName string // The display name of the user. Can be different from the handle
|
||||||
Description string // The description of a user account
|
Description string // The description of a user account
|
||||||
|
@ -80,25 +78,6 @@ type User struct {
|
||||||
AuthMethods []UserAuthMethod
|
AuthMethods []UserAuthMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
func BuildLinstromUser() *User {
|
|
||||||
server := BuildDefaultServer()
|
|
||||||
return &User{
|
|
||||||
ID: "e3f4bb33-6d39-4349-b13e-f5c6fde56141",
|
|
||||||
Username: "linstrom",
|
|
||||||
Server: *server,
|
|
||||||
ServerId: server.ID,
|
|
||||||
DisplayName: config.GlobalConfig.Self.ServerActorDisplayName,
|
|
||||||
Description: "The default linstrom server user",
|
|
||||||
IsBot: true,
|
|
||||||
Icon: DefaultDuckMedia,
|
|
||||||
IconId: DefaultDuckMedia.ID,
|
|
||||||
Background: nil,
|
|
||||||
BackgroundId: sql.NullString{Valid: false},
|
|
||||||
Banner: nil,
|
|
||||||
BannerId: sql.NullString{Valid: false},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type IUser interface {
|
type IUser interface {
|
||||||
// Get a user by a username
|
// Get a user by a username
|
||||||
//
|
//
|
||||||
|
|
|
@ -6,8 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// various prefixes for accessing items in the cache (since it's a simple key-value store)
|
// various prefixes for accessing items in the cache (since it's a simple key-value store)
|
||||||
|
@ -27,7 +26,7 @@ var errCacheNotFound = errors.New("not found in cache")
|
||||||
// err contains an error describing why an account's id couldn't be found
|
// err contains an error describing why an account's id couldn't be found
|
||||||
// The most common one should be errCacheNotFound
|
// The most common one should be errCacheNotFound
|
||||||
func (s *Storage) cacheHandleToAccUid(handle string) (accId *string, err error) {
|
func (s *Storage) cacheHandleToAccUid(handle string) (accId *string, err error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// Where to put the data (in case it's found)
|
// Where to put the data (in case it's found)
|
||||||
var target string
|
var target string
|
||||||
found, err := s.cache.Get(cacheUserHandleToIdPrefix+strings.TrimLeft(handle, "@"), &target)
|
found, err := s.cache.Get(cacheUserHandleToIdPrefix+strings.TrimLeft(handle, "@"), &target)
|
||||||
|
@ -49,7 +48,7 @@ func (s *Storage) cacheHandleToAccUid(handle string) (accId *string, err error)
|
||||||
// err contains an error describing why an account's id couldn't be found
|
// err contains an error describing why an account's id couldn't be found
|
||||||
// The most common one should be errCacheNotFound
|
// The most common one should be errCacheNotFound
|
||||||
func (s *Storage) cacheLocalUsernameToAccUid(username string) (accId *string, err error) {
|
func (s *Storage) cacheLocalUsernameToAccUid(username string) (accId *string, err error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// Where to put the data (in case it's found)
|
// Where to put the data (in case it's found)
|
||||||
var target string
|
var target string
|
||||||
found, err := s.cache.Get(cacheLocalUsernameToIdPrefix+username, &target)
|
found, err := s.cache.Get(cacheLocalUsernameToIdPrefix+username, &target)
|
||||||
|
@ -67,7 +66,7 @@ func (s *Storage) cacheLocalUsernameToAccUid(username string) (accId *string, er
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) cachePkeyIdToAccId(pkeyId []byte) (accId *string, err error) {
|
func (s *Storage) cachePkeyIdToAccId(pkeyId []byte) (accId *string, err error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// Where to put the data (in case it's found)
|
// Where to put the data (in case it's found)
|
||||||
var target string
|
var target string
|
||||||
found, err := s.cache.Get(cachePasskeyIdToAccIdPrefix+string(pkeyId), &target)
|
found, err := s.cache.Get(cachePasskeyIdToAccIdPrefix+string(pkeyId), &target)
|
||||||
|
@ -89,7 +88,7 @@ func (s *Storage) cachePkeyIdToAccId(pkeyId []byte) (accId *string, err error) {
|
||||||
// err contains an error describing why an account couldn't be found
|
// err contains an error describing why an account couldn't be found
|
||||||
// The most common one should be errCacheNotFound
|
// The most common one should be errCacheNotFound
|
||||||
func (s *Storage) cacheAccIdToData(id string) (acc *Account, err error) {
|
func (s *Storage) cacheAccIdToData(id string) (acc *Account, err error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
var target Account
|
var target Account
|
||||||
found, err := s.cache.Get(cacheUserIdToAccPrefix+id, &target)
|
found, err := s.cache.Get(cacheUserIdToAccPrefix+id, &target)
|
||||||
if !found {
|
if !found {
|
||||||
|
@ -107,7 +106,7 @@ func (s *Storage) cacheAccIdToData(id string) (acc *Account, err error) {
|
||||||
// err contains an error describing why a note couldn't be found
|
// err contains an error describing why a note couldn't be found
|
||||||
// The most common one should be errCacheNotFound
|
// The most common one should be errCacheNotFound
|
||||||
func (s *Storage) cacheNoteIdToData(id string) (note *Note, err error) {
|
func (s *Storage) cacheNoteIdToData(id string) (note *Note, err error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
target := Note{}
|
target := Note{}
|
||||||
found, err := s.cache.Get(cacheNoteIdToNotePrefix+id, &target)
|
found, err := s.cache.Get(cacheNoteIdToNotePrefix+id, &target)
|
||||||
if !found {
|
if !found {
|
||||||
|
|
9
storage/cache/cache.go
vendored
9
storage/cache/cache.go
vendored
|
@ -12,9 +12,8 @@ import (
|
||||||
ristretto_store "github.com/eko/gocache/store/ristretto/v4"
|
ristretto_store "github.com/eko/gocache/store/ristretto/v4"
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/config"
|
"git.mstar.dev/mstar/linstrom/config"
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cache struct {
|
type Cache struct {
|
||||||
|
@ -74,7 +73,7 @@ func NewCache(maxSize int64, redisUrl *string) (*Cache, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) Get(key string, target any) (bool, error) {
|
func (c *Cache) Get(key string, target any) (bool, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return false, nil
|
return false, nil
|
||||||
data, err := c.cache.Get(ctxBackground, key)
|
data, err := c.cache.Get(ctxBackground, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -88,7 +87,7 @@ func (c *Cache) Get(key string, target any) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) Set(key string, value any) error {
|
func (c *Cache) Set(key string, value any) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return nil
|
return nil
|
||||||
data, err := c.encoders.Encode(value)
|
data, err := c.encoders.Encode(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -99,7 +98,7 @@ func (c *Cache) Set(key string, value any) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) Delete(key string) {
|
func (c *Cache) Delete(key string) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// Error return doesn't matter here. Delete is delete is gone
|
// Error return doesn't matter here. Delete is delete is gone
|
||||||
_ = c.cache.Delete(ctxBackground, key)
|
_ = c.cache.Delete(ctxBackground, key)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,8 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Auto-generate string names for the various constants
|
// Auto-generate string names for the various constants
|
||||||
|
@ -38,7 +37,7 @@ type InboundJob struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) AddNewInboundJob(data []byte, source InboundJobSource, inboxOwner *string) {
|
func (s *Storage) AddNewInboundJob(data []byte, source InboundJobSource, inboxOwner *string) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
newJob := InboundJob{
|
newJob := InboundJob{
|
||||||
RawData: data,
|
RawData: data,
|
||||||
Source: source,
|
Source: source,
|
||||||
|
@ -49,7 +48,7 @@ func (s *Storage) AddNewInboundJob(data []byte, source InboundJobSource, inboxOw
|
||||||
|
|
||||||
// Get the specified amount of jobs, sorted by age (oldest first)
|
// Get the specified amount of jobs, sorted by age (oldest first)
|
||||||
func (s *Storage) GetOldestInboundJobs(amount uint) ([]InboundJob, error) {
|
func (s *Storage) GetOldestInboundJobs(amount uint) ([]InboundJob, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
jobs := []InboundJob{}
|
jobs := []InboundJob{}
|
||||||
switch err := s.db.Order("id asc, created_at asc").Limit(int(amount)).Find(jobs).Error; err {
|
switch err := s.db.Order("id asc, created_at asc").Limit(int(amount)).Find(jobs).Error; err {
|
||||||
case gorm.ErrRecordNotFound:
|
case gorm.ErrRecordNotFound:
|
||||||
|
@ -62,7 +61,7 @@ func (s *Storage) GetOldestInboundJobs(amount uint) ([]InboundJob, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) CompleteInboundJob(id uint) error {
|
func (s *Storage) CompleteInboundJob(id uint) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
s.db.Delete(InboundJob{Model: gorm.Model{ID: id}})
|
s.db.Delete(InboundJob{Model: gorm.Model{ID: id}})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MediaMetadata contains metadata about some media
|
// MediaMetadata contains metadata about some media
|
||||||
|
@ -37,7 +36,7 @@ type MediaMetadata struct {
|
||||||
func (s *Storage) NewMediaMetadata(
|
func (s *Storage) NewMediaMetadata(
|
||||||
ownerId, location, mediaType, name string,
|
ownerId, location, mediaType, name string,
|
||||||
) (*MediaMetadata, error) {
|
) (*MediaMetadata, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
newMedia := MediaMetadata{
|
newMedia := MediaMetadata{
|
||||||
OwnedBy: ownerId,
|
OwnedBy: ownerId,
|
||||||
Location: location,
|
Location: location,
|
||||||
|
@ -49,7 +48,7 @@ func (s *Storage) NewMediaMetadata(
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FuzzyFindMediaMetadataByName(name string) ([]MediaMetadata, error) {
|
func (s *Storage) FuzzyFindMediaMetadataByName(name string) ([]MediaMetadata, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
notes := []MediaMetadata{}
|
notes := []MediaMetadata{}
|
||||||
err := s.db.Where("name LIKE %?%", name).Find(notes).Error
|
err := s.db.Where("name LIKE %?%", name).Find(notes).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -59,7 +58,7 @@ func (s *Storage) FuzzyFindMediaMetadataByName(name string) ([]MediaMetadata, er
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) GetMediaMetadataById(id string) (*MediaMetadata, error) {
|
func (s *Storage) GetMediaMetadataById(id string) (*MediaMetadata, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
media := MediaMetadata{ID: id}
|
media := MediaMetadata{ID: id}
|
||||||
err := s.db.First(&media).Error
|
err := s.db.First(&media).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -69,7 +68,7 @@ func (s *Storage) GetMediaMetadataById(id string) (*MediaMetadata, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FuzzyFindMediaMetadataByLocation(location string) ([]MediaMetadata, error) {
|
func (s *Storage) FuzzyFindMediaMetadataByLocation(location string) ([]MediaMetadata, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
data := []MediaMetadata{}
|
data := []MediaMetadata{}
|
||||||
if err := s.db.Where("location LIKE %?%", location).Find(data).Error; err != nil {
|
if err := s.db.Where("location LIKE %?%", location).Find(data).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -78,18 +77,18 @@ func (s *Storage) FuzzyFindMediaMetadataByLocation(location string) ([]MediaMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteMediaMetadataById(id string) error {
|
func (s *Storage) DeleteMediaMetadataById(id string) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Delete(MediaMetadata{ID: id}).Error
|
return s.db.Delete(MediaMetadata{ID: id}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteMediaMetadataByFuzzyLocation(location string) error {
|
func (s *Storage) DeleteMediaMetadataByFuzzyLocation(location string) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
var tmp MediaMetadata
|
var tmp MediaMetadata
|
||||||
return s.db.Where("location LIKE %?%", location).Delete(&tmp).Error
|
return s.db.Where("location LIKE %?%", location).Delete(&tmp).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteMediaMetadataByFuzzyName(name string) error {
|
func (s *Storage) DeleteMediaMetadataByFuzzyName(name string) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
var tmp MediaMetadata
|
var tmp MediaMetadata
|
||||||
return s.db.Where("name LIKE %?%", name).Delete(&tmp).Error
|
return s.db.Where("name LIKE %?%", name).Delete(&tmp).Error
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Note represents an ActivityPub note
|
// Note represents an ActivityPub note
|
||||||
|
@ -42,7 +41,7 @@ type Note struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindNoteById(id string) (*Note, error) {
|
func (s *Storage) FindNoteById(id string) (*Note, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
note := &Note{}
|
note := &Note{}
|
||||||
cacheNote, err := s.cacheNoteIdToData(id)
|
cacheNote, err := s.cacheNoteIdToData(id)
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -71,7 +70,7 @@ func (s *Storage) FindNoteById(id string) (*Note, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindNotesByFuzzyContent(fuzzyContent string) ([]Note, error) {
|
func (s *Storage) FindNotesByFuzzyContent(fuzzyContent string) ([]Note, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
notes := []Note{}
|
notes := []Note{}
|
||||||
// TODO: Figure out if cache can be used here too
|
// TODO: Figure out if cache can be used here too
|
||||||
err := s.db.Where("raw_content LIKE %?%", fuzzyContent).Find(notes).Error
|
err := s.db.Where("raw_content LIKE %?%", fuzzyContent).Find(notes).Error
|
||||||
|
@ -82,7 +81,7 @@ func (s *Storage) FindNotesByFuzzyContent(fuzzyContent string) ([]Note, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindNotesByAuthorHandle(handle string) ([]Note, error) {
|
func (s *Storage) FindNotesByAuthorHandle(handle string) ([]Note, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
acc, err := s.FindAccountByFullHandle(handle)
|
acc, err := s.FindAccountByFullHandle(handle)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("account with handle %s not found: %w", handle, err)
|
return nil, fmt.Errorf("account with handle %s not found: %w", handle, err)
|
||||||
|
@ -91,7 +90,7 @@ func (s *Storage) FindNotesByAuthorHandle(handle string) ([]Note, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindNotesByAuthorId(id string) ([]Note, error) {
|
func (s *Storage) FindNotesByAuthorId(id string) ([]Note, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
notes := []Note{}
|
notes := []Note{}
|
||||||
err := s.db.Where("creator = ?", id).Find(notes).Error
|
err := s.db.Where("creator = ?", id).Find(notes).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -105,7 +104,7 @@ func (s *Storage) FindNotesByAuthorId(id string) ([]Note, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) UpdateNote(note *Note) error {
|
func (s *Storage) UpdateNote(note *Note) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
if note == nil || note.ID == "" {
|
if note == nil || note.ID == "" {
|
||||||
return ErrInvalidData
|
return ErrInvalidData
|
||||||
}
|
}
|
||||||
|
@ -134,7 +133,7 @@ func (s *Storage) CreateNoteLocal(
|
||||||
accessLevel NoteAccessLevel,
|
accessLevel NoteAccessLevel,
|
||||||
tags []string,
|
tags []string,
|
||||||
) (*Note, error) {
|
) (*Note, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// TODO: Implement me
|
// TODO: Implement me
|
||||||
panic("not implemented")
|
panic("not implemented")
|
||||||
}
|
}
|
||||||
|
@ -152,13 +151,13 @@ func (s *Storage) CreateNoteRemote(
|
||||||
tags []string,
|
tags []string,
|
||||||
originId string,
|
originId string,
|
||||||
) (*Note, error) {
|
) (*Note, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// TODO: Implement me
|
// TODO: Implement me
|
||||||
panic("not implemented")
|
panic("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteNote(id string) {
|
func (s *Storage) DeleteNote(id string) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
s.cache.Delete(cacheNoteIdToNotePrefix + id)
|
s.cache.Delete(cacheNoteIdToNotePrefix + id)
|
||||||
s.db.Delete(Note{ID: id})
|
s.db.Delete(Note{ID: id})
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,8 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type OutboundJob struct {
|
type OutboundJob struct {
|
||||||
|
@ -16,7 +15,7 @@ type OutboundJob struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) AddNewOutboundJob(data []byte, targetDomain string, targetUrl string) {
|
func (s *Storage) AddNewOutboundJob(data []byte, targetDomain string, targetUrl string) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
newJob := OutboundJob{
|
newJob := OutboundJob{
|
||||||
Data: data,
|
Data: data,
|
||||||
TargetServer: targetDomain,
|
TargetServer: targetDomain,
|
||||||
|
@ -27,7 +26,7 @@ func (s *Storage) AddNewOutboundJob(data []byte, targetDomain string, targetUrl
|
||||||
|
|
||||||
// Get the specified amount of jobs, sorted by age (oldest first)
|
// Get the specified amount of jobs, sorted by age (oldest first)
|
||||||
func (s *Storage) GetOldestOutboundJobs(amount uint) ([]OutboundJob, error) {
|
func (s *Storage) GetOldestOutboundJobs(amount uint) ([]OutboundJob, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
jobs := []OutboundJob{}
|
jobs := []OutboundJob{}
|
||||||
err := s.db.Order("id asc, created_at asc").Limit(int(amount)).Find(jobs).Error
|
err := s.db.Order("id asc, created_at asc").Limit(int(amount)).Find(jobs).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -41,7 +40,7 @@ func (s *Storage) GetOldestOutboundJobs(amount uint) ([]OutboundJob, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) GetOutboundJobsForDomain(domain string, amount uint) ([]OutboundJob, error) {
|
func (s *Storage) GetOutboundJobsForDomain(domain string, amount uint) ([]OutboundJob, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
jobs := []OutboundJob{}
|
jobs := []OutboundJob{}
|
||||||
err := s.db.Where("target_server = ?", domain).
|
err := s.db.Where("target_server = ?", domain).
|
||||||
Order("id asc, created_at asc").
|
Order("id asc, created_at asc").
|
||||||
|
@ -59,7 +58,7 @@ func (s *Storage) GetOutboundJobsForDomain(domain string, amount uint) ([]Outbou
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) CompleteOutboundJob(id uint) error {
|
func (s *Storage) CompleteOutboundJob(id uint) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
s.db.Delete(OutboundJob{Model: gorm.Model{ID: id}})
|
s.db.Delete(OutboundJob{Model: gorm.Model{ID: id}})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ import (
|
||||||
"github.com/go-webauthn/webauthn/webauthn"
|
"github.com/go-webauthn/webauthn/webauthn"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Session data used during login attempts with a passkey
|
// Session data used during login attempts with a passkey
|
||||||
|
@ -20,7 +19,7 @@ type PasskeySession struct {
|
||||||
|
|
||||||
// Generate some id for a new session. Just returns a new uuid
|
// Generate some id for a new session. Just returns a new uuid
|
||||||
func (s *Storage) GenSessionID() (string, error) {
|
func (s *Storage) GenSessionID() (string, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
x := uuid.NewString()
|
x := uuid.NewString()
|
||||||
log.Debug().Str("session-id", x).Msg("Generated new passkey session id")
|
log.Debug().Str("session-id", x).Msg("Generated new passkey session id")
|
||||||
return x, nil
|
return x, nil
|
||||||
|
@ -29,7 +28,7 @@ func (s *Storage) GenSessionID() (string, error) {
|
||||||
// Look for an active session with a given id
|
// Look for an active session with a given id
|
||||||
// Returns the session if found and a bool indicating if a session was found
|
// Returns the session if found and a bool indicating if a session was found
|
||||||
func (s *Storage) GetSession(sessionId string) (*webauthn.SessionData, bool) {
|
func (s *Storage) GetSession(sessionId string) (*webauthn.SessionData, bool) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Str("id", sessionId).Msg("Looking for passkey session")
|
log.Debug().Str("id", sessionId).Msg("Looking for passkey session")
|
||||||
session := PasskeySession{}
|
session := PasskeySession{}
|
||||||
res := s.db.Where("id = ?", sessionId).First(&session)
|
res := s.db.Where("id = ?", sessionId).First(&session)
|
||||||
|
@ -42,7 +41,7 @@ func (s *Storage) GetSession(sessionId string) (*webauthn.SessionData, bool) {
|
||||||
|
|
||||||
// Save (or update) a session with the new data
|
// Save (or update) a session with the new data
|
||||||
func (s *Storage) SaveSession(token string, data *webauthn.SessionData) {
|
func (s *Storage) SaveSession(token string, data *webauthn.SessionData) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Str("id", token).Any("webauthn-data", data).Msg("Saving passkey session")
|
log.Debug().Str("id", token).Any("webauthn-data", data).Msg("Saving passkey session")
|
||||||
session := PasskeySession{
|
session := PasskeySession{
|
||||||
ID: token,
|
ID: token,
|
||||||
|
@ -54,7 +53,7 @@ func (s *Storage) SaveSession(token string, data *webauthn.SessionData) {
|
||||||
// Delete a session
|
// Delete a session
|
||||||
// NOTE: This is a hard delete since the session struct contains no DeletedAt field
|
// NOTE: This is a hard delete since the session struct contains no DeletedAt field
|
||||||
func (s *Storage) DeleteSession(token string) {
|
func (s *Storage) DeleteSession(token string) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Str("id", token).Msg("Deleting passkey session (if one exists)")
|
log.Debug().Str("id", token).Msg("Deleting passkey session (if one exists)")
|
||||||
s.db.Delete(&PasskeySession{ID: token})
|
s.db.Delete(&PasskeySession{ID: token})
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,8 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type RemoteServer struct {
|
type RemoteServer struct {
|
||||||
|
@ -17,7 +16,7 @@ type RemoteServer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindRemoteServerByDomain(url string) (*RemoteServer, error) {
|
func (s *Storage) FindRemoteServerByDomain(url string) (*RemoteServer, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
server := RemoteServer{}
|
server := RemoteServer{}
|
||||||
err := s.db.Where("domain = ?").First(&server).Error
|
err := s.db.Where("domain = ?").First(&server).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -32,7 +31,7 @@ func (s *Storage) FindRemoteServerByDomain(url string) (*RemoteServer, error) {
|
||||||
|
|
||||||
// Find a remote server with a given display name
|
// Find a remote server with a given display name
|
||||||
func (s *Storage) FindRemoteServerByDisplayName(displayName string) (*RemoteServer, error) {
|
func (s *Storage) FindRemoteServerByDisplayName(displayName string) (*RemoteServer, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
server := RemoteServer{}
|
server := RemoteServer{}
|
||||||
err := s.db.Where("name = ?", displayName).First(&server).Error
|
err := s.db.Where("name = ?", displayName).First(&server).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -46,7 +45,7 @@ func (s *Storage) FindRemoteServerByDisplayName(displayName string) (*RemoteServ
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindRemoteServerById(id uint) (*RemoteServer, error) {
|
func (s *Storage) FindRemoteServerById(id uint) (*RemoteServer, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
server := RemoteServer{}
|
server := RemoteServer{}
|
||||||
err := s.db.First(&server, id).Error
|
err := s.db.First(&server, id).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -64,7 +63,7 @@ func (s *Storage) NewRemoteServer(
|
||||||
url, displayName, icon string,
|
url, displayName, icon string,
|
||||||
serverType RemoteServerType,
|
serverType RemoteServerType,
|
||||||
) (*RemoteServer, error) {
|
) (*RemoteServer, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
_, err := s.FindRemoteServerByDomain(url)
|
_, err := s.FindRemoteServerByDomain(url)
|
||||||
switch err {
|
switch err {
|
||||||
case nil:
|
case nil:
|
||||||
|
@ -91,7 +90,7 @@ func (s *Storage) NewRemoteServer(
|
||||||
// If icon is set, update that
|
// If icon is set, update that
|
||||||
// Returns the updated version
|
// Returns the updated version
|
||||||
func (s *Storage) UpdateRemoteServer(url string, displayName, icon *string) (*RemoteServer, error) {
|
func (s *Storage) UpdateRemoteServer(url string, displayName, icon *string) (*RemoteServer, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
if displayName == nil && icon == nil {
|
if displayName == nil && icon == nil {
|
||||||
return nil, ErrNothingToChange
|
return nil, ErrNothingToChange
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,9 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.mstar.dev/mstar/goutils/sliceutils"
|
"git.mstar.dev/mstar/goutils/sliceutils"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Could I collapse all these go:generate command into more condensed ones?
|
// Could I collapse all these go:generate command into more condensed ones?
|
||||||
|
@ -15,7 +14,7 @@ import (
|
||||||
// This is explicit in what is being done. And easier to understand
|
// This is explicit in what is being done. And easier to understand
|
||||||
|
|
||||||
//go:generate go build -o RolesGenerator ../cmd/RolesGenerator/main.go
|
//go:generate go build -o RolesGenerator ../cmd/RolesGenerator/main.go
|
||||||
//go:generate ./RolesGenerator -input=roles.go -output=rolesshared_generated.go
|
//go:generate ./RolesGenerator -input=roles.go -output=rolesUtil_generated.go
|
||||||
//go:generate rm RolesGenerator
|
//go:generate rm RolesGenerator
|
||||||
|
|
||||||
//go:generate go build -o ApiGenerator ../cmd/RolesApiTypeGenerator/main.go
|
//go:generate go build -o ApiGenerator ../cmd/RolesApiTypeGenerator/main.go
|
||||||
|
@ -187,7 +186,7 @@ Misskey "permissions" (no order):
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (s *Storage) NewEmptyRole(name string) (*Role, error) {
|
func (s *Storage) NewEmptyRole(name string) (*Role, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// Check if a role with the given name already exists
|
// Check if a role with the given name already exists
|
||||||
_, err := s.FindRoleByName(name)
|
_, err := s.FindRoleByName(name)
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -208,7 +207,7 @@ func (s *Storage) NewEmptyRole(name string) (*Role, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindRoleByName(name string) (*Role, error) {
|
func (s *Storage) FindRoleByName(name string) (*Role, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
role := Role{}
|
role := Role{}
|
||||||
err := s.db.Where("name = ?", name).First(&role).Error
|
err := s.db.Where("name = ?", name).First(&role).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -222,7 +221,7 @@ func (s *Storage) FindRoleByName(name string) (*Role, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindRolesByNames(names []string) ([]Role, error) {
|
func (s *Storage) FindRolesByNames(names []string) ([]Role, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
roles := []Role{}
|
roles := []Role{}
|
||||||
err := s.db.Where("name IN ?", names).Find(&roles).Error
|
err := s.db.Where("name IN ?", names).Find(&roles).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -236,7 +235,7 @@ func (s *Storage) FindRolesByNames(names []string) ([]Role, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) UpdateRole(role *Role) error {
|
func (s *Storage) UpdateRole(role *Role) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Save(role).Error
|
return s.db.Save(role).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +247,6 @@ func (s *Storage) DeleteRoleByName(name string) error {
|
||||||
) {
|
) {
|
||||||
return ErrNotAllowed
|
return ErrNotAllowed
|
||||||
}
|
}
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Where(&Role{Name: name, IsBuiltIn: false}).Delete(&Role{}).Error
|
return s.db.Where(&Role{Name: name, IsBuiltIn: false}).Delete(&Role{}).Error
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/config"
|
||||||
|
"git.mstar.dev/mstar/linstrom/storage/cache"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/driver/postgres"
|
"gorm.io/driver/postgres"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/config"
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
"git.mstar.dev/mstar/linstrom/storage/cache"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Always keep a reference of the server's own RemoteServer entry here
|
// Always keep a reference of the server's own RemoteServer entry here
|
||||||
|
@ -31,7 +30,7 @@ type Storage struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorage(dbUrl string, cache *cache.Cache) (*Storage, error) {
|
func NewStorage(dbUrl string, cache *cache.Cache) (*Storage, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
db, err := gorm.Open(postgres.Open(dbUrl), &gorm.Config{
|
db, err := gorm.Open(postgres.Open(dbUrl), &gorm.Config{
|
||||||
Logger: newGormLogger(log.Logger),
|
Logger: newGormLogger(log.Logger),
|
||||||
})
|
})
|
||||||
|
@ -74,7 +73,7 @@ func NewStorage(dbUrl string, cache *cache.Cache) (*Storage, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) insertSelfFromConfig() error {
|
func (s *Storage) insertSelfFromConfig() error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
const ServerActorId = "self"
|
const ServerActorId = "self"
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
@ -140,7 +139,7 @@ func (s *Storage) insertSelfFromConfig() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) insertDefaultRoles() error {
|
func (s *Storage) insertDefaultRoles() error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
for _, role := range allDefaultRoles {
|
for _, role := range allDefaultRoles {
|
||||||
log.Debug().Str("role-name", role.Name).Msg("Inserting default role")
|
log.Debug().Str("role-name", role.Name).Msg("Inserting default role")
|
||||||
if err := s.db.FirstOrCreate(role).Error; err != nil {
|
if err := s.db.FirstOrCreate(role).Error; err != nil {
|
||||||
|
@ -151,7 +150,7 @@ func (s *Storage) insertDefaultRoles() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) insertPlaceholderFile() error {
|
func (s *Storage) insertPlaceholderFile() error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Model(&MediaMetadata{}).Assign(&MediaMetadata{
|
return s.db.Model(&MediaMetadata{}).Assign(&MediaMetadata{
|
||||||
ID: "placeholder",
|
ID: "placeholder",
|
||||||
Type: "image/webp",
|
Type: "image/webp",
|
||||||
|
|
|
@ -8,12 +8,12 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/ap"
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
"github.com/go-webauthn/webauthn/webauthn"
|
"github.com/go-webauthn/webauthn/webauthn"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/mstarongithub/passkey"
|
"github.com/mstarongithub/passkey"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/ap"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ type RemoteAccountLinks struct {
|
||||||
// Find an account in the db using a given full handle (@max@example.com)
|
// Find an account in the db using a given full handle (@max@example.com)
|
||||||
// Returns an account and nil if an account is found, otherwise nil and the error
|
// Returns an account and nil if an account is found, otherwise nil and the error
|
||||||
func (s *Storage) FindAccountByFullHandle(handle string) (*Account, error) {
|
func (s *Storage) FindAccountByFullHandle(handle string) (*Account, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Str("account-handle", handle).Msg("Looking for account by handle")
|
log.Debug().Str("account-handle", handle).Msg("Looking for account by handle")
|
||||||
log.Debug().Str("account-handle", handle).Msg("Checking if there's a cache hit")
|
log.Debug().Str("account-handle", handle).Msg("Checking if there's a cache hit")
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ func (s *Storage) FindAccountByFullHandle(handle string) (*Account, error) {
|
||||||
|
|
||||||
// Find an account given a specific ID
|
// Find an account given a specific ID
|
||||||
func (s *Storage) FindAccountById(id string) (*Account, error) {
|
func (s *Storage) FindAccountById(id string) (*Account, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Str("account-id", id).Msg("Looking for account by id")
|
log.Debug().Str("account-id", id).Msg("Looking for account by id")
|
||||||
log.Debug().Str("account-id", id).Msg("First trying to hit cache")
|
log.Debug().Str("account-id", id).Msg("First trying to hit cache")
|
||||||
acc, err := s.cacheAccIdToData(id)
|
acc, err := s.cacheAccIdToData(id)
|
||||||
|
@ -187,7 +187,7 @@ func (s *Storage) FindAccountById(id string) (*Account, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindLocalAccountByUsername(username string) (*Account, error) {
|
func (s *Storage) FindLocalAccountByUsername(username string) (*Account, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Str("account-username", username).Msg("Looking for local account")
|
log.Debug().Str("account-username", username).Msg("Looking for local account")
|
||||||
log.Debug().Str("account-username", username).Msg("Checking cache first")
|
log.Debug().Str("account-username", username).Msg("Checking cache first")
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ func (s *Storage) FindLocalAccountByUsername(username string) (*Account, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindAccountByPasskeyId(pkeyId []byte) (*Account, error) {
|
func (s *Storage) FindAccountByPasskeyId(pkeyId []byte) (*Account, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Bytes("account-passkey-id", pkeyId).Msg("Looking for account")
|
log.Debug().Bytes("account-passkey-id", pkeyId).Msg("Looking for account")
|
||||||
log.Debug().Bytes("account-passkey-id", pkeyId).Msg("Checking cache first")
|
log.Debug().Bytes("account-passkey-id", pkeyId).Msg("Checking cache first")
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ func (s *Storage) FindAccountByPasskeyId(pkeyId []byte) (*Account, error) {
|
||||||
|
|
||||||
// Update a given account in storage and cache
|
// Update a given account in storage and cache
|
||||||
func (s *Storage) UpdateAccount(acc *Account) error {
|
func (s *Storage) UpdateAccount(acc *Account) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
// If the account is nil or doesn't have an id, error out
|
// If the account is nil or doesn't have an id, error out
|
||||||
if acc == nil || acc.ID == "" {
|
if acc == nil || acc.ID == "" {
|
||||||
return ErrInvalidData
|
return ErrInvalidData
|
||||||
|
@ -307,7 +307,7 @@ func (s *Storage) UpdateAccount(acc *Account) error {
|
||||||
|
|
||||||
// Create a new empty account for future use
|
// Create a new empty account for future use
|
||||||
func (s *Storage) NewEmptyAccount() (*Account, error) {
|
func (s *Storage) NewEmptyAccount() (*Account, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Msg("Creating new empty account")
|
log.Debug().Msg("Creating new empty account")
|
||||||
acc := Account{}
|
acc := Account{}
|
||||||
// Generate the 64 bit id for passkey and webauthn stuff
|
// Generate the 64 bit id for passkey and webauthn stuff
|
||||||
|
@ -353,7 +353,7 @@ func (s *Storage) NewEmptyAccount() (*Account, error) {
|
||||||
// The handle in this case is only the part before the domain (example: @bob@example.com would have a handle of bob)
|
// The handle in this case is only the part before the domain (example: @bob@example.com would have a handle of bob)
|
||||||
// It also sets up a bunch of values that tend to be obvious for local accounts
|
// It also sets up a bunch of values that tend to be obvious for local accounts
|
||||||
func (s *Storage) NewLocalAccount(handle string) (*Account, error) {
|
func (s *Storage) NewLocalAccount(handle string) (*Account, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Trace().Caller().Send()
|
log.Trace().Caller().Send()
|
||||||
log.Debug().Str("account-handle", handle).Msg("Creating new local account")
|
log.Debug().Str("account-handle", handle).Msg("Creating new local account")
|
||||||
acc, err := s.NewEmptyAccount()
|
acc, err := s.NewEmptyAccount()
|
||||||
|
@ -391,7 +391,7 @@ func (s *Storage) NewLocalAccount(handle string) (*Account, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteAccount(accId string) error {
|
func (s *Storage) DeleteAccount(accId string) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Delete(&Account{ID: accId}).Error
|
return s.db.Delete(&Account{ID: accId}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,27 +399,27 @@ func (s *Storage) DeleteAccount(accId string) error {
|
||||||
// Implements the webauthn.User interface for interaction with passkeys
|
// Implements the webauthn.User interface for interaction with passkeys
|
||||||
|
|
||||||
func (a *Account) WebAuthnID() []byte {
|
func (a *Account) WebAuthnID() []byte {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return a.WebAuthnId
|
return a.WebAuthnId
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Account) WebAuthnName() string {
|
func (u *Account) WebAuthnName() string {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return u.Username
|
return u.Username
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Account) WebAuthnDisplayName() string {
|
func (u *Account) WebAuthnDisplayName() string {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return u.DisplayName
|
return u.DisplayName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Account) WebAuthnCredentials() []webauthn.Credential {
|
func (u *Account) WebAuthnCredentials() []webauthn.Credential {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return u.PasskeyCredentials
|
return u.PasskeyCredentials
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *Account) WebAuthnIcon() string {
|
func (u *Account) WebAuthnIcon() string {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ func (u *Account) WebAuthnIcon() string {
|
||||||
// Implements the passkey.User interface
|
// Implements the passkey.User interface
|
||||||
|
|
||||||
func (u *Account) PutCredential(new webauthn.Credential) {
|
func (u *Account) PutCredential(new webauthn.Credential) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
u.PasskeyCredentials = append(u.PasskeyCredentials, new)
|
u.PasskeyCredentials = append(u.PasskeyCredentials, new)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ func (u *Account) PutCredential(new webauthn.Credential) {
|
||||||
// Implements the passkey.UserStore interface
|
// Implements the passkey.UserStore interface
|
||||||
|
|
||||||
func (s *Storage) GetOrCreateUser(userID string) passkey.User {
|
func (s *Storage) GetOrCreateUser(userID string) passkey.User {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("account-handle", userID).
|
Str("account-handle", userID).
|
||||||
Msg("Looking for or creating account for passkey stuff")
|
Msg("Looking for or creating account for passkey stuff")
|
||||||
|
@ -458,7 +458,7 @@ func (s *Storage) GetOrCreateUser(userID string) passkey.User {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) GetUserByWebAuthnId(id []byte) passkey.User {
|
func (s *Storage) GetUserByWebAuthnId(id []byte) passkey.User {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
log.Debug().Bytes("webauthn-id", id).Msg("Looking for account with webauthn id")
|
log.Debug().Bytes("webauthn-id", id).Msg("Looking for account with webauthn id")
|
||||||
acc := Account{}
|
acc := Account{}
|
||||||
res := s.db.Where(Account{WebAuthnId: id}).First(&acc)
|
res := s.db.Where(Account{WebAuthnId: id}).First(&acc)
|
||||||
|
@ -474,7 +474,7 @@ func (s *Storage) GetUserByWebAuthnId(id []byte) passkey.User {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) SaveUser(rawUser passkey.User) {
|
func (s *Storage) SaveUser(rawUser passkey.User) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
user, ok := rawUser.(*Account)
|
user, ok := rawUser.(*Account)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error().Any("raw-user", rawUser).Msg("Failed to cast raw user to db account")
|
log.Error().Any("raw-user", rawUser).Msg("Failed to cast raw user to db account")
|
||||||
|
|
|
@ -4,9 +4,8 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"git.mstar.dev/mstar/linstrom/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/shared"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Describes a custom attribute field for accounts
|
// Describes a custom attribute field for accounts
|
||||||
|
@ -25,7 +24,7 @@ type UserInfoField struct {
|
||||||
// TODO: Add functions to store, load, update and delete these
|
// TODO: Add functions to store, load, update and delete these
|
||||||
|
|
||||||
func (s *Storage) FindUserFieldById(id uint) (*UserInfoField, error) {
|
func (s *Storage) FindUserFieldById(id uint) (*UserInfoField, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
entry := UserInfoField{}
|
entry := UserInfoField{}
|
||||||
err := s.db.First(&entry, id).Error
|
err := s.db.First(&entry, id).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -39,7 +38,7 @@ func (s *Storage) FindUserFieldById(id uint) (*UserInfoField, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) FindMultipleUserFieldsById(ids []uint) ([]UserInfoField, error) {
|
func (s *Storage) FindMultipleUserFieldsById(ids []uint) ([]UserInfoField, error) {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
entries := []UserInfoField{}
|
entries := []UserInfoField{}
|
||||||
err := s.db.Where(ids).Find(&entries).Error
|
err := s.db.Where(ids).Find(&entries).Error
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -58,12 +57,12 @@ func (s *Storage) AddNewUserField(name, value, belongsToId string) (*UserInfoFie
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteUserField(id uint) error {
|
func (s *Storage) DeleteUserField(id uint) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Delete(UserInfoField{Model: gorm.Model{ID: id}}).Error
|
return s.db.Delete(UserInfoField{Model: gorm.Model{ID: id}}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Storage) DeleteAllUserFieldsForAccountId(id string) error {
|
func (s *Storage) DeleteAllUserFieldsForAccountId(id string) error {
|
||||||
defer shared.Untrace(shared.Trace(&log.Logger))
|
defer util.Untrace(util.Trace(&log.Logger))
|
||||||
return s.db.Model(&UserInfoField{}).
|
return s.db.Model(&UserInfoField{}).
|
||||||
Where(&UserInfoField{BelongsTo: id}).
|
Where(&UserInfoField{BelongsTo: id}).
|
||||||
Delete(&UserInfoField{}).
|
Delete(&UserInfoField{}).
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package shared
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/fs"
|
"io/fs"
|
|
@ -1,4 +1,4 @@
|
||||||
package shared
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"regexp"
|
"regexp"
|
|
@ -1,4 +1,4 @@
|
||||||
package shared
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
|
@ -1,4 +1,4 @@
|
||||||
package shared
|
package util
|
||||||
|
|
||||||
import "github.com/rs/zerolog/log"
|
import "github.com/rs/zerolog/log"
|
||||||
|
|
Loading…
Reference in a new issue