parent
c032987952
commit
4d71f3b0be
|
@ -174,6 +174,17 @@ cool
|
|||
oh, but if i'm using nginx i'll need my own certificate, that makes sence
|
||||
*** maybe things are ok?
|
||||
let's try to plaintext deploy?
|
||||
*** quoting of the '' in multiline string
|
||||
https://nixos.org/manual/nix/stable/language/values.html
|
||||
*** not accessible still
|
||||
sudo journalctl -u nginx --since "1 day ago"
|
||||
*** oh, i forgot to add subname in gandi ui
|
||||
now works
|
||||
*** now i need a way to pass in the hostname
|
||||
because front-end is setting up js 'new PocketBase' with 127.0.0.1 connection
|
||||
*** adding a custom flag:
|
||||
https://github.com/pocketbase/pocketbase/discussions/1900
|
||||
|
||||
|
||||
|
||||
** TODO add docker image from nix
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
|
@ -23,10 +21,6 @@ func AddCookieSessionMiddleware(app *pocketbase.PocketBase) {
|
|||
|
||||
// fires for every auth collection
|
||||
app.OnRecordAuthRequest().Add(func(e *core.RecordAuthEvent) error {
|
||||
log.Println(e.HttpContext)
|
||||
log.Println(e.Record)
|
||||
log.Println(e.Token)
|
||||
log.Println(e.Meta)
|
||||
e.HttpContext.SetCookie(&http.Cookie{
|
||||
Name: AuthCookieName,
|
||||
Value: e.Token,
|
||||
|
@ -39,9 +33,6 @@ func AddCookieSessionMiddleware(app *pocketbase.PocketBase) {
|
|||
return nil
|
||||
})
|
||||
app.OnAdminAuthRequest().Add(func(e *core.AdminAuthEvent) error {
|
||||
log.Println(e.HttpContext)
|
||||
log.Println(e.Admin)
|
||||
log.Println(e.Token)
|
||||
e.HttpContext.SetCookie(&http.Cookie{
|
||||
Name: AuthCookieName,
|
||||
Value: e.Token,
|
||||
|
@ -74,14 +65,6 @@ func loadAuthContextFromCookie(app core.App) echo.MiddlewareFunc {
|
|||
if err == nil && admin != nil {
|
||||
// "authenticate" the admin
|
||||
c.Set(apis.ContextAdminKey, admin)
|
||||
someData := struct {
|
||||
username string
|
||||
email string
|
||||
} {
|
||||
admin.Email,
|
||||
admin.Created.String(),
|
||||
}
|
||||
fmt.Printf("triggering the middlewar for cookie %v and err %v\n", someData, err)
|
||||
}
|
||||
|
||||
case tokens.TypeAuthRecord:
|
||||
|
@ -92,15 +75,6 @@ func loadAuthContextFromCookie(app core.App) echo.MiddlewareFunc {
|
|||
if err == nil && record != nil {
|
||||
// "authenticate" the app user
|
||||
c.Set(apis.ContextAuthRecordKey, record)
|
||||
someData := struct {
|
||||
username string
|
||||
email string
|
||||
} {
|
||||
record.Username(),
|
||||
record.Email(),
|
||||
}
|
||||
fmt.Printf("triggering the middlewar for cookie %v and err %v\n", someData, err)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package pages
|
|||
import (
|
||||
"bytes"
|
||||
"embed"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
|
@ -47,8 +46,6 @@ func getIndexPageRoute(app *pocketbase.PocketBase) func(*core.ServeEvent) error
|
|||
record := info.AuthRecord // nil if not authenticated as regular auth record
|
||||
|
||||
isGuest := admin == nil && record == nil
|
||||
coolMessage := fmt.Sprintf("got admin %v and record %v. is guest: %t", admin, record, isGuest)
|
||||
fmt.Print(coolMessage)
|
||||
|
||||
username := ""
|
||||
switch {
|
||||
|
@ -65,7 +62,6 @@ func getIndexPageRoute(app *pocketbase.PocketBase) func(*core.ServeEvent) error
|
|||
oauthProviderNames = append(oauthProviderNames, name)
|
||||
}
|
||||
}
|
||||
fmt.Printf(">> enabled providers names %+v\n", oauthProviderNames)
|
||||
|
||||
indexPageData := struct {
|
||||
IsGuest, IsAdmin bool
|
||||
|
|
Loading…
Reference in New Issue