Documentation ¶
Index ¶
- Variables
- func APIMux() (*chi.Mux, error)
- func APINotFound(w http.ResponseWriter, r *http.Request)
- func AddAdminUser(w http.ResponseWriter, r *http.Request)
- func AuthMux(a *Auth) (*chi.Mux, error)
- func ClearUpdates(w http.ResponseWriter, r *http.Request)
- func CreateApp(w http.ResponseWriter, r *http.Request)
- func CreateObject(w http.ResponseWriter, r *http.Request)
- func CreateUser(w http.ResponseWriter, r *http.Request)
- func DeleteApp(w http.ResponseWriter, r *http.Request)
- func DeleteObject(w http.ResponseWriter, r *http.Request)
- func DeleteUser(w http.ResponseWriter, r *http.Request)
- func DeleteUserSession(w http.ResponseWriter, r *http.Request)
- func EventWebsocket(w http.ResponseWriter, r *http.Request)
- func FireEvent(w http.ResponseWriter, r *http.Request)
- func FrontendMux() (*chi.Mux, error)
- func GetAdminUsers(w http.ResponseWriter, r *http.Request)
- func GetAllPlugins(w http.ResponseWriter, r *http.Request)
- func GetAppScope(w http.ResponseWriter, r *http.Request)
- func GetConfigFile(w http.ResponseWriter, r *http.Request)
- func GetObjectScope(w http.ResponseWriter, r *http.Request)
- func GetPluginApps(w http.ResponseWriter, r *http.Request)
- func GetPluginReadme(w http.ResponseWriter, r *http.Request)
- func GetUConfig(w http.ResponseWriter, r *http.Request)
- func GetUpdateOptions(w http.ResponseWriter, r *http.Request)
- func GetUpdateStatus(w http.ResponseWriter, r *http.Request)
- func GetUpdates(w http.ResponseWriter, r *http.Request)
- func GetUserSettingSchemas(w http.ResponseWriter, r *http.Request)
- func GetVersion(w http.ResponseWriter, r *http.Request)
- func HandleTemplate(fname string, fbytes []byte) (http.HandlerFunc, error)
- func ListApps(w http.ResponseWriter, r *http.Request)
- func ListObjects(w http.ResponseWriter, r *http.Request)
- func ListUserSessions(w http.ResponseWriter, r *http.Request)
- func ListUsers(w http.ResponseWriter, r *http.Request)
- func NewStaticHandler(root http.FileSystem, nocache bool) http.Handler
- func PatchUConfig(w http.ResponseWriter, r *http.Request)
- func PostConfigFile(w http.ResponseWriter, r *http.Request)
- func PostPlugin(w http.ResponseWriter, r *http.Request)
- func PostUpdateOptions(w http.ResponseWriter, r *http.Request)
- func ReadApp(w http.ResponseWriter, r *http.Request)
- func ReadObject(w http.ResponseWriter, r *http.Request)
- func ReadUser(w http.ResponseWriter, r *http.Request)
- func ReadUserPluginSettings(w http.ResponseWriter, r *http.Request)
- func ReadUserSettings(w http.ResponseWriter, r *http.Request)
- func RemoveAdminUser(w http.ResponseWriter, r *http.Request)
- func Run(a *assets.Assets, o *RunOptions) error
- func Setup(sc SetupContext) error
- func SetupCreate(sc SetupContext) error
- func UpdateApp(w http.ResponseWriter, r *http.Request)
- func UpdateObject(w http.ResponseWriter, r *http.Request)
- func UpdateUser(w http.ResponseWriter, r *http.Request)
- func UpdateUserPluginSettings(w http.ResponseWriter, r *http.Request)
- func VerboseLoggingMiddleware(h http.Handler, log *logrus.Entry) http.Handler
- type Auth
- type CodeRequest
- type FrontendContext
- type RequestHandler
- type RunOptions
- type SetupContext
- type SetupTemplate
- type SetupUser
- type WebsocketEventHandler
Constants ¶
This section is empty.
Variables ¶
var RunID string
Functions ¶
func APINotFound ¶
func APINotFound(w http.ResponseWriter, r *http.Request)
func AddAdminUser ¶
func AddAdminUser(w http.ResponseWriter, r *http.Request)
func ClearUpdates ¶
func ClearUpdates(w http.ResponseWriter, r *http.Request)
func CreateObject ¶
func CreateObject(w http.ResponseWriter, r *http.Request)
func CreateUser ¶
func CreateUser(w http.ResponseWriter, r *http.Request)
func DeleteObject ¶
func DeleteObject(w http.ResponseWriter, r *http.Request)
func DeleteUser ¶
func DeleteUser(w http.ResponseWriter, r *http.Request)
func DeleteUserSession ¶
func DeleteUserSession(w http.ResponseWriter, r *http.Request)
func EventWebsocket ¶
func EventWebsocket(w http.ResponseWriter, r *http.Request)
func GetAdminUsers ¶
func GetAdminUsers(w http.ResponseWriter, r *http.Request)
func GetAllPlugins ¶
func GetAllPlugins(w http.ResponseWriter, r *http.Request)
func GetAppScope ¶
func GetAppScope(w http.ResponseWriter, r *http.Request)
func GetConfigFile ¶
func GetConfigFile(w http.ResponseWriter, r *http.Request)
func GetObjectScope ¶
func GetObjectScope(w http.ResponseWriter, r *http.Request)
func GetPluginApps ¶
func GetPluginApps(w http.ResponseWriter, r *http.Request)
func GetPluginReadme ¶
func GetPluginReadme(w http.ResponseWriter, r *http.Request)
func GetUConfig ¶
func GetUConfig(w http.ResponseWriter, r *http.Request)
func GetUpdateOptions ¶
func GetUpdateOptions(w http.ResponseWriter, r *http.Request)
func GetUpdateStatus ¶
func GetUpdateStatus(w http.ResponseWriter, r *http.Request)
func GetUpdates ¶
func GetUpdates(w http.ResponseWriter, r *http.Request)
func GetUserSettingSchemas ¶
func GetUserSettingSchemas(w http.ResponseWriter, r *http.Request)
func GetVersion ¶
func GetVersion(w http.ResponseWriter, r *http.Request)
func HandleTemplate ¶ added in v0.5.1
func HandleTemplate(fname string, fbytes []byte) (http.HandlerFunc, error)
func ListObjects ¶
func ListObjects(w http.ResponseWriter, r *http.Request)
func ListUserSessions ¶
func ListUserSessions(w http.ResponseWriter, r *http.Request)
func NewStaticHandler ¶ added in v0.5.1
func NewStaticHandler(root http.FileSystem, nocache bool) http.Handler
NewStaticHandler tries to serve the original files, but if they are not found, it will serve a compressed version of the file. Usually this is reversed, but in heedy, the build process actually *removes* the original files, so when the compressed files exist, the originals are not present. It also sets up the correct caching headers for static files
func PatchUConfig ¶
func PatchUConfig(w http.ResponseWriter, r *http.Request)
func PostConfigFile ¶
func PostConfigFile(w http.ResponseWriter, r *http.Request)
func PostPlugin ¶
func PostPlugin(w http.ResponseWriter, r *http.Request)
func PostUpdateOptions ¶
func PostUpdateOptions(w http.ResponseWriter, r *http.Request)
func ReadObject ¶
func ReadObject(w http.ResponseWriter, r *http.Request)
func ReadUserPluginSettings ¶
func ReadUserPluginSettings(w http.ResponseWriter, r *http.Request)
func ReadUserSettings ¶
func ReadUserSettings(w http.ResponseWriter, r *http.Request)
func RemoveAdminUser ¶
func RemoveAdminUser(w http.ResponseWriter, r *http.Request)
func Setup ¶
func Setup(sc SetupContext) error
Setup runs the setup server. All of the arguments are optional - include empty strings for the directory and configFile if they are not given, and nil for configuration if no settings were given. This will load the default config, overwritten with configFile, overwritten with c, and use that as the "defaults" for fields given to the user.
func SetupCreate ¶
func SetupCreate(sc SetupContext) error
func UpdateObject ¶
func UpdateObject(w http.ResponseWriter, r *http.Request)
func UpdateUser ¶
func UpdateUser(w http.ResponseWriter, r *http.Request)
func UpdateUserPluginSettings ¶
func UpdateUserPluginSettings(w http.ResponseWriter, r *http.Request)
Types ¶
type Auth ¶
Auth handles the oauth flow
func (*Auth) Authenticate ¶
func (*Auth) RequestCode ¶
func (a *Auth) RequestCode(r *http.Request) (*CodeRequest, error)
RequestCode returns the information relevant to an authorization code request
func (*Auth) ServeCode ¶
func (a *Auth) ServeCode(w http.ResponseWriter, r *http.Request)
ServeCode handles a post request to the code endpoint
func (*Auth) ServeToken ¶
func (a *Auth) ServeToken(w http.ResponseWriter, r *http.Request)
ServeToken handles a post request to the token endpoint. It handles password grants and authorization code requests
type CodeRequest ¶
type CodeRequest struct { // These are parameters of an authorization request on Oauth2 // https://www.oauth.com/oauth2-servers/authorization/the-authorization-request/ ClientID string `json:"client_id,omitempty"` RedirectURI string `json:"redirect_uri,omitempty"` State string `json:"state,omitempty"` Scope string `json:"scope,omitempty"` // The app object to create - if clientID is not set App *database.App }
CodeRequest is sent in by the client trying to create a app. It is identical to a standard oauth request authorization code request if the client is known. If it is an unknown client, allows the client to request creation of a specific app on its behalf.
type FrontendContext ¶ added in v0.5.1
type FrontendContext struct { User *database.User `json:"user"` Settings map[string]map[string]interface{} `json:"settings"` Admin bool `json:"admin"` Plugins []frontendPlugin `json:"plugins"` Preload []string `json:"preload"` Verbose bool `json:"verbose"` DevMode bool `json:"dev_mode"` RunID string `json:"run_id"` }
func GetFrontendContext ¶ added in v0.5.1
func GetFrontendContext(ctx *rest.Context) (*FrontendContext, error)
type RequestHandler ¶
type RequestHandler struct { Plugins *plugins.PluginManager // The auth system also allows special token-based access. This is specifically built // to support plugins. Each request that is forwarded through the plugin system // is first authenticated here, and given an auth token. Plugins can then make requests // with that auth token which will have the same permissions, and be linked to the original // request. sync.RWMutex // contains filtered or unexported fields }
RequestHandler is a middleware that authenticates requests and generates a Context object containing the info necessary to complete the request. It also handles generating and parsing the relevant X-Heedy headers that are used for interaction with plugin backend servers.
func NewRequestHandler ¶
func NewRequestHandler(auth *Auth, p *plugins.PluginManager) *RequestHandler
NewRequestHandler generates a new Auth middleware
func (*RequestHandler) ServeHTTP ¶
func (a *RequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP - http.Handler implementation
type SetupContext ¶
type SetupContext struct { assets.CreateOptions User SetupUser `json:"user,omitempty"` }
This is the context that is passed to creator function
type SetupTemplate ¶ added in v0.5.1
type WebsocketEventHandler ¶
type WebsocketEventHandler struct { Ws *websocket.Conn R *http.Request Heartbeat time.Duration WriteTimeout time.Duration Haderror chan error sync.Mutex // contains filtered or unexported fields }
func (*WebsocketEventHandler) Close ¶ added in v0.5.1
func (eh *WebsocketEventHandler) Close()
func (*WebsocketEventHandler) Fire ¶
func (eh *WebsocketEventHandler) Fire(e *events.Event)
func (*WebsocketEventHandler) ResetHeartbeat ¶ added in v0.5.1
func (eh *WebsocketEventHandler) ResetHeartbeat()