Documentation
¶
Index ¶
- Constants
- func AuthMiddleware(db *gorm.DB, cfg *config.Config) gin.HandlerFunc
- func AuthorizeUser(db *gorm.DB, cfg *config.Config) gin.HandlerFunc
- func CreateGroup(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func CreateLink(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func CreateUser(db *gorm.DB, cfg *config.Config) gin.HandlerFunc
- func DeleteGroup(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func DeleteLink(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func GetGinEngine(cfg *config.Config, db *gorm.DB) *gin.Engine
- func GetJWTToken(cfg *config.Config) (string, error)
- func Render(ctx *gin.Context, cfg *config.Config, status int, templatePath string, ...)
- func RequireAuth(c *gin.Context, cfg *config.Config) (*jwt.RegisteredClaims, error)
- func SecurityHeadersMiddleware(c *gin.Context)
- func SetTokenCookie(c *gin.Context, token string, cfg *config.Config)
- func ShowError(ctx *gin.Context, cfg *config.Config, err error)
- func ShowLoginForm(cfg *config.Config) gin.HandlerFunc
- func ShowMainPage(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func ShowRegistrationForm(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func ShowSettings(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func UpdateGroup(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
- func UpdateLink(cfg *config.Config, db *gorm.DB) gin.HandlerFunc
Constants ¶
View Source
const TOKEN_LIFETIME_IN_SECONDS = 60 * 60 * 24 * 30
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthorizeUser ¶
func CreateGroup ¶
func CreateLink ¶
func CreateUser ¶
func DeleteGroup ¶
func DeleteLink ¶
func Render ¶ added in v1.2.0
func Render(ctx *gin.Context, cfg *config.Config, status int, templatePath string, params map[string]any)
Fill in the necessary parameters from the settings and output html.
func RequireAuth ¶
Requires the user to log in before viewing the page. Returns error if the user is not authorized. If `nil` is returned instead of an error, it is safe to display protected content.
func SecurityHeadersMiddleware ¶
Adds several headers to the response to improve security. For example, headers prevent embedding a site and passing information about the referrer.
func SetTokenCookie ¶
Save token in cookies
func ShowLoginForm ¶
func ShowLoginForm(cfg *config.Config) gin.HandlerFunc
func ShowMainPage ¶
func ShowRegistrationForm ¶
func ShowSettings ¶
func UpdateGroup ¶
func UpdateLink ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.