progress
server is launchable and passkey support works
This commit is contained in:
parent
ee172d84a8
commit
c572066571
21 changed files with 857 additions and 40 deletions
51
main.go
51
main.go
|
@ -2,18 +2,32 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-webauthn/webauthn/webauthn"
|
||||
"github.com/mstarongithub/passkey"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gitlab.com/mstarongitlab/linstrom/ap"
|
||||
|
||||
// "gitlab.com/mstarongitlab/linstrom/ap"
|
||||
"gitlab.com/mstarongitlab/linstrom/config"
|
||||
"gitlab.com/mstarongitlab/linstrom/server"
|
||||
"gitlab.com/mstarongitlab/linstrom/storage"
|
||||
"gitlab.com/mstarongitlab/linstrom/storage/cache"
|
||||
"gitlab.com/mstarongitlab/linstrom/util"
|
||||
)
|
||||
|
||||
//go:embed frontend-reactive/dist/* frontend-reactive/dist/assets
|
||||
var reactiveFS embed.FS
|
||||
|
||||
//go:embed frontend-noscript
|
||||
var nojsFS embed.FS
|
||||
|
||||
func main() {
|
||||
setLogger()
|
||||
setLogLevel()
|
||||
|
@ -23,11 +37,11 @@ func main() {
|
|||
Str("config-file", *flagConfigFile).
|
||||
Msg("Failed to read config and couldn't write default")
|
||||
}
|
||||
res, err := ap.GetAccountWebfinger("@aufricus_athudath@activitypub.academy")
|
||||
log.Info().
|
||||
Err(err).
|
||||
Any("webfinger", res).
|
||||
Msg("Webfinger request result for @aufricus_athudath@activitypub.academy")
|
||||
// res, err := ap.GetAccountWebfinger("@aufricus_athudath@activitypub.academy")
|
||||
// log.Info().
|
||||
// Err(err).
|
||||
// Any("webfinger", res).
|
||||
// Msg("Webfinger request result for @aufricus_athudath@activitypub.academy")
|
||||
storageCache, err := cache.NewCache(
|
||||
config.GlobalConfig.Storage.MaxInMemoryCacheSize,
|
||||
config.GlobalConfig.Storage.RedisUrl,
|
||||
|
@ -48,7 +62,30 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to setup storage")
|
||||
}
|
||||
_ = store
|
||||
|
||||
pkey, err := passkey.New(passkey.Config{
|
||||
WebauthnConfig: &webauthn.Config{
|
||||
RPDisplayName: "Linstrom",
|
||||
RPID: "localhost",
|
||||
RPOrigins: []string{"http://localhost:8000"},
|
||||
},
|
||||
UserStore: store,
|
||||
SessionStore: store,
|
||||
SessionMaxAge: time.Hour * 24,
|
||||
}, passkey.WithLogger(&util.ZerologWrapper{}))
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to setup passkey support")
|
||||
}
|
||||
|
||||
fmt.Println(nojsFS.ReadDir("frontend-noscript"))
|
||||
|
||||
server := server.NewServer(
|
||||
store,
|
||||
pkey,
|
||||
util.NewFSWrapper(reactiveFS, "frontend-reactive/dist/", true),
|
||||
util.NewFSWrapper(nojsFS, "frontend-noscript/", true),
|
||||
)
|
||||
server.Start(":8000")
|
||||
// TODO: Set up media server
|
||||
// TODO: Set up queues
|
||||
// TODO: Set up http server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue