controllers

package
v0.0.0-...-5d7ca49 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Copyright 2013-2018 Adam Presley. All rights reserved Use of this source code is governed by the MIT license that can be found in the LICENSE file.

Copyright 2013-2018 Adam Presley. All rights reserved Use of this source code is governed by the MIT license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminController

type AdminController struct {
	CacheService   cache.ICacheService
	Config         *mailslurper.Configuration
	ConfigFileName string
	DebugMode      bool
	Renderer       *ui.TemplateRenderer
	Lock           *sync.Mutex
	Logger         *logrus.Entry
	ServerVersion  string
}

AdminController provides methods for handling admin endpoints. This is to primarily support the front-end

func (*AdminController) Admin

func (c *AdminController) Admin(ctx echo.Context) error

Admin is the page for performing administrative tasks in MailSlurper

func (*AdminController) ApplyTheme

func (c *AdminController) ApplyTheme(ctx echo.Context) error

ApplyTheme updates the theme in the config file, and refreshes the renderer

POST: /theme

func (*AdminController) GetPruneOptions

func (c *AdminController) GetPruneOptions(ctx echo.Context) error

GetPruneOptions returns a set of valid pruning options.

GET: /v1/pruneoptions

func (*AdminController) GetServiceSettings

func (c *AdminController) GetServiceSettings(ctx echo.Context) error

GetServiceSettings returns the settings necessary to talk to the MailSlurper back-end service tier.

func (*AdminController) GetVersion

func (c *AdminController) GetVersion(ctx echo.Context) error

GetVersion outputs the current running version of this MailSlurper server instance

func (*AdminController) GetVersionFromMaster

func (c *AdminController) GetVersionFromMaster(ctx echo.Context) error

GetVersionFromMaster returns the current MailSlurper version from GitHub

func (*AdminController) Index

func (c *AdminController) Index(ctx echo.Context) error

Index is the main view. This endpoint provides the email list and email detail views.

func (*AdminController) Login

func (c *AdminController) Login(ctx echo.Context) error

Login renders the login page

func (*AdminController) Logout

func (c *AdminController) Logout(ctx echo.Context) error

Logout logs a user out, and deletes the cookie

func (*AdminController) ManageSavedSearches

func (c *AdminController) ManageSavedSearches(ctx echo.Context) error

ManageSavedSearches is the page for managing saved searches

func (*AdminController) PerformLogin

func (c *AdminController) PerformLogin(ctx echo.Context) error

PerformLogin validates credentials, and if correct, sets the session and redirects to the home page

type ServiceController

type ServiceController struct {
	AuthFactory   authfactory.IAuthFactory
	CacheService  cache.ICacheService
	Config        *mailslurper.Configuration
	Database      mailslurper.IStorage
	JWTService    jwt.IJWTService
	Logger        *logrus.Entry
	ServerVersion string
}

ServiceController provides methods for handling service endpoints. This is to primarily support the API

func (*ServiceController) ConvertFromBase64

func (c *ServiceController) ConvertFromBase64(s string) (string, bool)

func (*ServiceController) DeleteMail

func (c *ServiceController) DeleteMail(ctx echo.Context) error

DeleteMail is a request to delete mail items. This expects a body containing a DeleteMailRequest object.

DELETE: /mail/{pruneCode}

func (*ServiceController) DownloadAttachment

func (c *ServiceController) DownloadAttachment(ctx echo.Context) error

DownloadAttachment retrieves binary database from storage and streams it back to the caller

GET: /mail/{mailID}/attachment/{attachmentID}

func (*ServiceController) GetMail

func (c *ServiceController) GetMail(ctx echo.Context) error

GetMail returns a single mail item by ID.

GET: /mail/{id}

func (*ServiceController) GetMailCollection

func (c *ServiceController) GetMailCollection(ctx echo.Context) error

GetMailCollection returns a collection of mail items. This is constrianed by a page number. A page of data contains 50 items.

GET: /mails?pageNumber={pageNumber}

func (*ServiceController) GetMailCount

func (c *ServiceController) GetMailCount(ctx echo.Context) error

GetMailCount returns the number of mail items in storage.

GET: /mailcount

func (*ServiceController) GetMailMessage

func (c *ServiceController) GetMailMessage(ctx echo.Context) error

GetMailMessage returns the message contents of a single mail item

GET: /mail/{id}/message

func (*ServiceController) GetMailMessageRaw

func (c *ServiceController) GetMailMessageRaw(ctx echo.Context) error

GetMailMessageRaw returns the message contents of a single mail item

GET: /mail/{id}/messageraw

func (*ServiceController) GetPruneOptions

func (c *ServiceController) GetPruneOptions(ctx echo.Context) error

GetPruneOptions retrieves the set of options available to users for pruning

GET: /pruneoptions

func (*ServiceController) Head

func (c *ServiceController) Head(ctx echo.Context) error

func (*ServiceController) Login

func (c *ServiceController) Login(ctx echo.Context) error

Login is an endpoint used to create a JWT token for use in service calls. This also stores that token in an in-memory cache so when a user logs out that token can be rendered invalid

func (*ServiceController) Logout

func (c *ServiceController) Logout(ctx echo.Context) error

func (*ServiceController) Version

func (c *ServiceController) Version(ctx echo.Context) error

Jump to

Keyboard shortcuts

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