service

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorsFromBase64

func ColorsFromBase64(name string) (string, string)

func InitializeDetectors

func InitializeDetectors() regexes

InitializeDetectors is heavy and should be initialized once only

func MarkDowner

func MarkDowner(policy *bluemonday.Policy) func(string) template.HTML

Types

type ClientConfig

type ClientConfig struct {
	Enabled                bool
	Markdown               bool // Is markdown allowed on this pod ?
	PublicPods             bool
	SpecificPods           bool
	SpecificPodsList       []string // List of pods requested by the user
	SpecificPodsListString string   // List of pods requested by the user and displayed back into the field
	AllPodsList            []Pod    // List of all pods (public + requested)
}

type GeneralConfig

type GeneralConfig struct {
	Name        string   // Custom name
	URL         string   // URL of the pod
	Description string   // Free text to explain what is this pod
	Info        string   // Contact information and a lot of other things
	TrustedPods []string // Public pods trusted by the admin of this pod
}

type Pod

type Pod struct {
	URL      string
	Selected bool
}

type ServerConfig

type ServerConfig struct {
	Enabled         bool
	Port            int64    // Port to listen
	Debug           bool     // Enable/disable some parameters (limiter, logging...)
	Private         bool     // If set true, a public key must have been uploaded on the server
	LockedByDefault bool     // If set to true, the post route will be disabled
	TrustedKeys     []string // Trusted keys, without heavy limitations
}

type Service

type Service struct {
	DB            *gorm.DB
	GeneralConfig GeneralConfig      // Only loaded on start up - public information
	ServerConfig  ServerConfig       // Only loaded on start up - private configuration
	ClientConfig  ClientConfig       // Can be modified by clients requests and is reset between 2 requests
	Regexes       regexes            // It is here because it is loaded only on server startup
	ContentPolicy *bluemonday.Policy // Loaded on server startup, defines user's input policy
}

The Service struct is used to store server information. Note that it is (should be) only used as a data provider. Storing state is a bad idea.

func (*Service) UpdateClientPodsList

func (s *Service) UpdateClientPodsList()

Jump to

Keyboard shortcuts

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