Documentation
¶
Index ¶
- Constants
- func DecodeJSON(w http.ResponseWriter, r *http.Request, dst any) bool
- func DecodeJSONMethod(w http.ResponseWriter, r *http.Request, method string, dst any) bool
- func IsAllowedImageMIME(mime string) bool
- func ResolveWithinBase(baseDir, rawPath string) (string, error)
- func RunTray(_ *Server, _ string, _ bool)
- func WithStrictCORS(s *Server, next http.Handler) http.Handler
- func WriteErr(w http.ResponseWriter, status int, err error)
- func WriteJSON(w http.ResponseWriter, status int, v any)
- type AdaptEntriesReq
- type AssetURIReq
- type Audit
- func (a *Audit) AuthFailure(path, remote string)
- func (a *Audit) ConfigReloaded(configPath string, portChanged bool)
- func (a *Audit) ConfigUpdated(fields []string)
- func (a *Audit) MimeRejected(path, mime, remote string)
- func (a *Audit) OriginRejected(origin, path string)
- func (a *Audit) PairCodeRefreshed()
- func (a *Audit) PairFailure(origin, remote string)
- func (a *Audit) PairSuccess(origin, remote string)
- func (a *Audit) SandboxViolation(path, remote string)
- func (a *Audit) Startup(addr, baseDir, allowedOrigin string)
- type Auth
- type CompileReq
- type Config
- type DocJSONReq
- type ImageAsset
- type LibraryProject
- type LibraryProjectsResponse
- type MIMEError
- type MergePageReq
- type SandboxError
- type Server
- func (s *Server) AllowedOrigin() string
- func (s *Server) Auth() *Auth
- func (s *Server) BaseDir() string
- func (s *Server) Config() *Config
- func (s *Server) ConfigPath() string
- func (s *Server) Handler() http.Handler
- func (s *Server) IsOriginAllowed(origin string) bool
- func (s *Server) RegisterRoutes(mux *http.ServeMux)
- func (s *Server) ReloadConfig() error
- func (s *Server) UpdateConfig(next *Config) error
Constants ¶
View Source
const ( DefaultBaseDir = `C:\Documents\psrt` DefaultAllowedOrigin = "https://editor.psrt.app" DefaultPort = 5278 )
View Source
const Version = "1.0.0"
Variables ¶
This section is empty.
Functions ¶
func DecodeJSON ¶
func DecodeJSONMethod ¶
func IsAllowedImageMIME ¶
func ResolveWithinBase ¶
Types ¶
type AdaptEntriesReq ¶
type AssetURIReq ¶
type AssetURIReq struct {
URL string `json:"url"`
}
type Audit ¶
type Audit struct{}
func (*Audit) AuthFailure ¶
func (*Audit) ConfigReloaded ¶
func (*Audit) ConfigUpdated ¶
func (*Audit) MimeRejected ¶
func (*Audit) OriginRejected ¶
func (*Audit) PairCodeRefreshed ¶
func (a *Audit) PairCodeRefreshed()
func (*Audit) PairFailure ¶
func (*Audit) PairSuccess ¶
func (*Audit) SandboxViolation ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) PairCodeForDisplay ¶
func (*Auth) RefreshPairCode ¶
func (*Auth) ValidateToken ¶
type CompileReq ¶
type Config ¶
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
func LoadOrCreateConfig ¶
LoadOrCreateConfig loads the INI at path, creating a default config (and its base_dir) when the file does not exist yet — e.g. first run of the binary.
func (*Config) NormalizeBaseDir ¶
type DocJSONReq ¶
type DocJSONReq struct {
DocJSON string `json:"docJSON"`
}
type ImageAsset ¶
func ReadAllowedImage ¶
func ReadAllowedImage(path string) (ImageAsset, error)
type LibraryProject ¶
type LibraryProjectsResponse ¶
type LibraryProjectsResponse struct {
Projects []LibraryProject `json:"projects"`
}
type MergePageReq ¶
type SandboxError ¶
func (*SandboxError) Error ¶
func (e *SandboxError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AllowedOrigin ¶
func (*Server) ConfigPath ¶
func (*Server) IsOriginAllowed ¶
func (*Server) RegisterRoutes ¶
func (*Server) ReloadConfig ¶
func (*Server) UpdateConfig ¶
Click to show internal directories.
Click to hide internal directories.