router

package
v0.0.0-...-033ff5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(w http.ResponseWriter, r *http.Request, err error)

func FilterEntriesMessages

func FilterEntriesMessages(entries []models.Entry, viewerMemberID *int64)

FilterEntriesMessages applies FilterEntryMessage to a slice of entries

func FilterEntryMessage

func FilterEntryMessage(entry *models.Entry, viewerMemberID *int64)

FilterEntryMessage applies permission-based message filtering Logic matches stored procedure ReadEntries: - No permissions (public) → show full message - user_id=0 (secret to everyone) → show full message - Has specific user_ids and (requester in list OR requester is author) → show message with prefix - Has specific user_ids and requester NOT in list → show only "hemlis" and clear all other fields

func GetMemberFromContext

func GetMemberFromContext(r *http.Request) *models.Member

GetMemberFromContext retrieves member from auth context or returns nil

func LogHTTP

func LogHTTP(handler http.Handler) http.HandlerFunc

func MakeDefaultBool

func MakeDefaultBool(r *http.Request, variableName string, defaultValue string) bool

func MakeDefaultInt

func MakeDefaultInt(r *http.Request, variableName string, defaultValue string) int

func Mux

func Mux(db data.Database) http.Handler

Types

type ArrHandler

type ArrHandler struct {
	// contains filtered or unexported fields
}

func NewArrHandler

func NewArrHandler(db data.Database) ArrHandler

type ArticleHandler

type ArticleHandler struct {
	// contains filtered or unexported fields
}

func NewArticleHandler

func NewArticleHandler(db data.Database) ArticleHandler

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

func NewAuthHandler

func NewAuthHandler(db data.Database) *AuthHandler

NewAuthHandler creates auth handlers with database access

func (*AuthHandler) Callback

func (h *AuthHandler) Callback(w http.ResponseWriter, r *http.Request)

Callback handles OAuth2 callback GET /auth/web/callback?state=...&code=...

func (*AuthHandler) DevicePoll

func (h *AuthHandler) DevicePoll(w http.ResponseWriter, r *http.Request)

DevicePoll polls for device flow completion and returns a sidan JWT when approved POST /auth/device/poll Body: {"session_id": "..."}

func (*AuthHandler) DeviceRefresh

func (h *AuthHandler) DeviceRefresh(w http.ResponseWriter, r *http.Request)

DeviceRefresh exchanges a stored provider refresh token for a new sidan JWT POST /auth/device/refresh Body: {"refresh_token": "...", "provider": "google"}

func (*AuthHandler) DeviceStart

func (h *AuthHandler) DeviceStart(w http.ResponseWriter, r *http.Request)

DeviceStart initiates the device authorization flow via the server POST /auth/device/start Body: {"provider": "google"}

func (*AuthHandler) GetSession

func (h *AuthHandler) GetSession(w http.ResponseWriter, r *http.Request)

GetSession returns current JWT claims and member info GET /auth/session Authorization: Bearer <token>

func (*AuthHandler) Login

func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)

Login initiates OAuth2 flow GET /auth/web/login?provider=google&redirect_uri=https://...

func (*AuthHandler) Logout

func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)

Logout ends authentication (JWT remains valid until expiry) POST /auth/web/logout Authorization: Bearer <token>

func (*AuthHandler) Token

func (h *AuthHandler) Token(w http.ResponseWriter, r *http.Request)

Token exchanges a sidan refresh token for a new JWT and rotated refresh token POST /auth/web/refresh Body: {"refresh_token": "..."}

type EntryHandler

type EntryHandler struct {
	// contains filtered or unexported fields
}

func NewEntryHandler

func NewEntryHandler(db data.Database) EntryHandler

type FDroidHandler

type FDroidHandler struct{}

func NewFDroidHandler

func NewFDroidHandler() FDroidHandler

type File

type File struct {
	Filename string `json:"filename"`
}

type FileHandler

type FileHandler struct {
}

type Mail

type Mail struct {
	FromEmail string   `json:"from_email"`
	ToEmails  []string `json:"to_emails"`
	Message   string   `json:"message"`
	Title     string   `json:"title"`
}

func (Mail) Fmt

func (m Mail) Fmt() string

type MailHandler

type MailHandler struct {
	Host     string
	Port     int
	Username string
	Password string
}

type MemberHandler

type MemberHandler struct {
	// contains filtered or unexported fields
}

func NewMemberHandler

func NewMemberHandler(db data.Database) MemberHandler

type ProspectHandler

type ProspectHandler struct {
	// contains filtered or unexported fields
}

func NewProspectHandler

func NewProspectHandler(db data.Database) ProspectHandler

type ReturnMail

type ReturnMail struct {
	Result string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL