server

package
v0.0.0-...-86abe10 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const MB int64 = 1024 * 1024

Variables

View Source
var MaxJSONSize int64 = 2 * MB
View Source
var MaxScriptSize int64 = 5 * MB

Functions

func AddAliasAPI

func AddAliasAPI(s *Server)

func CopyFile

func CopyFile(dest io.Writer, path string) error

func LoginRequiredMiddlewareWithConfig

func LoginRequiredMiddlewareWithConfig(a *auth.AuthService) echo.MiddlewareFunc

func MiddlewareErrorHandler

func MiddlewareErrorHandler(middleware echo.MiddlewareFunc, cb func(e error, c echo.Context) error) echo.MiddlewareFunc

func OpenDB

func OpenDB(cfg DBConfig) (*sqlx.DB, error)

func ProjectAccessMiddleware

func ProjectAccessMiddleware(a *auth.AuthService, ps application.ProjectService, basicAuthRealm string) echo.MiddlewareFunc

func SessionMiddlewareWithConfig

func SessionMiddlewareWithConfig(store SessionStore) echo.MiddlewareFunc

func SuperuserAccessMiddleware

func SuperuserAccessMiddleware(a *auth.AuthService) echo.MiddlewareFunc

Types

type Account

type Account struct {
	Username  string         `json:"username"`
	Email     string         `json:"email"`
	FirstName string         `json:"first_name"`
	LastName  string         `json:"last_name"`
	Superuser bool           `json:"superuser"`
	Active    bool           `json:"active"`
	Created   *time.Time     `json:"created_at"`
	Confirmed *time.Time     `json:"confirmed_at"`
	LastLogin *time.Time     `json:"last_login_at"`
	Profile   map[string]any `json:"profile,omitempty"`
}

type AliasManager

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

type AnyTag

type AnyTag struct {
	XMLName xml.Name
	Content string `xml:",innerxml"`
}

type AppConfig

type AppConfig struct {
	Language       string `json:"lang,omitempty"`
	LandingProject string `json:"landing_project,omitempty"`
	Languages      []struct {
		Code string `json:"code"`
		Name string `json:"name"`
	} `json:"languages,omitempty"`
	GoogleStreetAPI string `json:"google_street_api_key,omitempty"`
}

type AppData

type AppData struct {
	AppConfig
	PasswordResetUrl string `json:"reset_password_url,omitempty"`
}

type AppPayload

type AppPayload struct {
	App  AppData     `json:"app"`
	User domain.User `json:"user"`
}

type CDATA

type CDATA string

func (CDATA) MarshalXML

func (c CDATA) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Config

type Config struct {
	Debug                bool
	Language             string
	LandingProject       string
	MapserverURL         string
	MapCacheRoot         string
	ProjectsRoot         string
	SiteURL              string
	SecretKey            string
	SessionExpiration    time.Duration
	SignupAPI            bool
	PluginsURL           string
	MaxProjectSize       int64
	ProjectCustomization bool
}

type DBConfig

type DBConfig struct {
	User               string
	Password           string
	Host               string
	Name               string
	Port               int
	MaxIdleConns       int
	MaxOpenConns       int
	SSLMode            string
	StatementCacheMode string
}

Config is the required properties to use the database.

type Delete

type Delete struct {
	XMLName  xml.Name `xml:"Delete"`
	TypeName string   `xml:"typeName,attr"`
}

type GetFeature

type GetFeature struct {
	XMLName xml.Name `xml:"GetFeature"`
	Query   []Query  `xml:"Query"`
}

type Insert

type Insert struct {
	XMLName xml.Name       `xml:"Insert"`
	Objects []InsertObject `xml:",any"`
}

type InsertObject

type InsertObject struct {
	XMLName    xml.Name
	Properties []InsertProperty `xml:",any"`
}

type InsertProperty

type InsertProperty struct {
	XMLName xml.Name
}

type JSONSerializer

type JSONSerializer struct{}

func (JSONSerializer) Deserialize

func (d JSONSerializer) Deserialize(c echo.Context, i interface{}) error

Deserialize reads a JSON from a request body and converts it into an interface.

func (JSONSerializer) Serialize

func (d JSONSerializer) Serialize(c echo.Context, i interface{}, indent string) error

Serialize converts an interface into a json and writes it to the response. You can optionally use the indent parameter to produce pretty JSONs.

type MediaFile

type MediaFile struct {
	domain.ProjectFile
	Filename string `json:"filename"`
}

type Middlewares

type Middlewares struct {
	LoginRequired          echo.MiddlewareFunc
	SuperuserRequired      echo.MiddlewareFunc
	ProjectAdminAccess     echo.MiddlewareFunc
	ProjectSuperuserAccess echo.MiddlewareFunc
	ProjectAccess          echo.MiddlewareFunc
	ProjectAccessOWS       echo.MiddlewareFunc
}

type OwsGetFeatureRequestParams

type OwsGetFeatureRequestParams struct {
	TypeName     string `query:"TYPENAME"`
	PropertyName string `query:"PROPERTYNAME"`
	FeatureID    string `query:"FEATUREID"`
}

type OwsRequestParams

type OwsRequestParams struct {
	Map     string `query:"map"`
	Service string `query:"service"`
	Request string `query:"request"`
	Layers  string `query:"layers"`
}

type Plugins

type Plugins struct {
	XMLName xml.Name       `xml:"plugins"`
	Plugins []PyQgisPlugin `xml:"plugins"`
}

type ProgressReader

type ProgressReader struct {
	Reader   io.ReadCloser
	Callback func(int, int)
	Step     int
	Progress int
	// contains filtered or unexported fields
}

ProgressReader export

func (*ProgressReader) Close

func (r *ProgressReader) Close() error

func (*ProgressReader) Read

func (r *ProgressReader) Read(p []byte) (n int, err error)

type Property

type Property struct {
	XMLName xml.Name `xml:"Property"`
	Name    string   `xml:"Name"`
	Value   string   `xml:"Value"`
}

type PropertyName

type PropertyName struct {
	XMLName xml.Name `xml:"ogc:PropertyName"`
	Name    string   `xml:",chardata"`
}

type PyQgisPlugin

type PyQgisPlugin struct {
	XMLName        xml.Name `xml:"pyqgis_plugin"`
	Name           string   `xml:"name,attr" json:"name"`
	QgisMinVersion string   `xml:"qgis_minimum_version" json:"qgisMinimumVersion"`
	QgisMaxVersion string   `xml:"qgis_maximum_version,omitempty" json:"qgisMaximumVersion"`
	Description    CDATA    `xml:"description" json:"description"`
	About          CDATA    `xml:"about" json:"about"`
	Version        string   `xml:"version,attr" json:"version"`
	Author         string   `xml:"author_name" json:"author"`
	// Email
	Changelog    CDATA  `xml:"changelog" json:"changelog"`
	Experimental string `xml:"experimental" json:"experimental"`
	Deprecated   string `xml:"deprecated" json:"deprecated"`
	Tags         string `xml:"tags" json:"tags"`
	Homepage     CDATA  `xml:"homepage" json:"homepage"`
	Repository   CDATA  `xml:"repository" json:"repository"`
	Tracker      CDATA  `xml:"tracker" json:"tracker"`
	Icon         string `xml:"icon,omitempty" json:"icon,omitempty"`
	Server       string `xml:"server" json:"server"`

	// not part of qgis metadata
	Updated time.Time `xml:"update_date" json:"updated"`

	// generated data
	DownloadURL string `xml:"download_url"`
	FileName    string `xml:"file_name" json:"filename"`
}

type Query

type Query struct {
	XMLName    xml.Name       `xml:"Query"`
	TypeName   string         `xml:"typeName,attr"`
	Properties []PropertyName `xml:"ogc:PropertyName"`
	Contents   []AnyTag       `xml:",any"`
}

type Server

type Server struct {
	Config Config
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log *zap.SugaredLogger, cfg Config, db *sqlx.DB,
	as *auth.AuthService, signUpService *application.AccountsService, projects application.ProjectService,
	sws *ws.SettingsWS, limiter application.AccountsLimiter, notifications *project.RedisNotificationStore) *Server

func (*Server) AddExtension

func (s *Server) AddExtension(name string) error

func (*Server) AddRoutes

func (s *Server) AddRoutes(e *echo.Echo)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

func (*Server) OnShutdown

func (s *Server) OnShutdown(fn func())

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type SessionData

type SessionData struct {
	User domain.User `json:"user"`
}

type SessionStore

type SessionStore interface {
	Get(ctx context.Context, sessionid string) (string, error)
}

type Transaction

type Transaction struct {
	XMLName xml.Name `xml:"Transaction"`
	Updates []Update `xml:"Update"`
	Inserts []Insert `xml:"Insert"`
	Deletes []Delete `xml:"Delete"`
}

type Update

type Update struct {
	XMLName    xml.Name   `xml:"Update"`
	TypeName   string     `xml:"typeName,attr"`
	Properties []Property `xml:"Property"`
}

type UserDashboard

type UserDashboard struct {
	Projects []string `json:"projects"`
}

type UserInfo

type UserInfo struct {
	Username  string         `json:"username"`
	FirstName string         `json:"first_name"`
	LastName  string         `json:"last_name"`
	FullName  string         `json:"full_name"`
	Active    bool           `json:"active"`
	Profile   map[string]any `json:"profile,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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