web

package
v0.0.0-...-2fa03ef Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ISKFormat = accounting.Accounting{Symbol: "", Precision: 2}

ISKFormat defines how ISK is rounded and displayed

Functions

func HumanLargeNumber

func HumanLargeNumber(n float64) string

HumanLargeNumber returns string numbers that are formatted with commas and have X-illion appended.

func IsAppraisalOwner

func IsAppraisalOwner(user *evepraisal.User, appraisal *evepraisal.Appraisal) bool

IsAppraisalOwner determines if a user owns the given appraisal

func NewPrivateAppraisalToken

func NewPrivateAppraisalToken() string

NewPrivateAppraisalToken returns a new token to use for private appraisals

Types

type AppraisalDebugLine

type AppraisalDebugLine struct {
	Number int    `json:"number"`
	Parsed bool   `json:"parsed"`
	Parser string `json:"parser"`
	Text   string `json:"text"`
}

AppraisalDebugLine represents a single line of an appraisal along with how it was parsed

type AppraisalDebugPage

type AppraisalDebugPage struct {
	Appraisal    *evepraisal.Appraisal `json:"appraisal"`
	Lines        []AppraisalDebugLine  `json:"lines"`
	ParserResult parsers.ParserResult  `json:"parser_result"`
}

AppraisalDebugPage is the data needed to render the

type AppraisalPage

type AppraisalPage struct {
	Appraisal *evepraisal.Appraisal `json:"appraisal"`
	ShowFull  bool                  `json:"show_full,omitempty"`
	IsOwner   bool                  `json:"is_owner,omitempty"`
}

AppraisalPage contains data used on the appraisal page

type Context

type Context struct {
	App                 *evepraisal.App
	BaseURL             string
	ExtraJS             string
	ExtraHTMLHeader     string
	AdBlock             string
	CookieStore         *sessions.CookieStore
	OauthConfig         *oauth2.Config
	OauthVerifyURL      string
	ExtraStaticFilePath string
	// contains filtered or unexported fields
}

Context contains all of the 'global' app context for the HTTP app

func NewContext

func NewContext(app *evepraisal.App) *Context

NewContext returns a new Context object given an app instance

func (*Context) GenerateStaticEtags

func (ctx *Context) GenerateStaticEtags()

GenerateStaticEtags generates etags for all of the static files and sets it on the context object

func (*Context) GetCurrentUser

func (ctx *Context) GetCurrentUser(r *http.Request) *evepraisal.User

GetCurrentUser returns the current user, if there is one in the request cookies

func (*Context) HTTPHandler

func (ctx *Context) HTTPHandler() http.Handler

HTTPHandler returns all HTTP handlers for the app

func (*Context) HandleAPIDocs

func (ctx *Context) HandleAPIDocs(w http.ResponseWriter, r *http.Request)

HandleAPIDocs is the handler for /api-docs

func (*Context) HandleAbout

func (ctx *Context) HandleAbout(w http.ResponseWriter, r *http.Request)

HandleAbout is the handler for /about

func (*Context) HandleAppraisal

func (ctx *Context) HandleAppraisal(w http.ResponseWriter, r *http.Request)

HandleAppraisal is the handler for POST /appraisal

func (*Context) HandleAppraisalStructured

func (ctx *Context) HandleAppraisalStructured(w http.ResponseWriter, r *http.Request)

HandleAppraisalStructured is the handler for POST /appraisal/structured.json

func (*Context) HandleAuthCallback

func (ctx *Context) HandleAuthCallback(w http.ResponseWriter, r *http.Request)

HandleAuthCallback handles /oauthcallback

func (*Context) HandleDeleteAppraisal

func (ctx *Context) HandleDeleteAppraisal(w http.ResponseWriter, r *http.Request)

HandleDeleteAppraisal is the handler for POST /a/delete/[id]

func (*Context) HandleFavicon

func (ctx *Context) HandleFavicon(w http.ResponseWriter, r *http.Request)

HandleFavicon is the handler for /favicon.ico

func (*Context) HandleIndex

func (ctx *Context) HandleIndex(w http.ResponseWriter, r *http.Request)

HandleIndex is the handler for /

func (*Context) HandleLatestAppraisals

func (ctx *Context) HandleLatestAppraisals(w http.ResponseWriter, r *http.Request)

HandleLatestAppraisals is the handler for /latest

func (*Context) HandleLegal

func (ctx *Context) HandleLegal(w http.ResponseWriter, r *http.Request)

HandleLegal is the handler for /legal

func (*Context) HandleLogin

func (ctx *Context) HandleLogin(w http.ResponseWriter, r *http.Request)

HandleLogin handles /login

func (*Context) HandleLogout

func (ctx *Context) HandleLogout(w http.ResponseWriter, r *http.Request)

HandleLogout handles /logout

func (*Context) HandleNewAppraisal

func (ctx *Context) HandleNewAppraisal(w http.ResponseWriter, r *http.Request)

HandleNewAppraisal is the handler for /new-appraisal

func (*Context) HandleRobots

func (ctx *Context) HandleRobots(w http.ResponseWriter, r *http.Request)

HandleRobots is the handler for /robots.txt

func (*Context) HandleSearch

func (ctx *Context) HandleSearch(w http.ResponseWriter, r *http.Request)

HandleSearch handles searching for items

func (*Context) HandleUserHistoryAppraisals

func (ctx *Context) HandleUserHistoryAppraisals(w http.ResponseWriter, r *http.Request)

HandleUserHistoryAppraisals is the handler for /user/latest

func (*Context) HandleViewAppraisal

func (ctx *Context) HandleViewAppraisal(w http.ResponseWriter, r *http.Request)

HandleViewAppraisal is the handler for /a/[id]

func (*Context) HandleViewItem

func (ctx *Context) HandleViewItem(w http.ResponseWriter, r *http.Request)

HandleViewItem handles /item/[id]

func (*Context) HandleViewItems

func (ctx *Context) HandleViewItems(w http.ResponseWriter, r *http.Request)

HandleViewItems handles /items

func (*Context) Reload

func (ctx *Context) Reload() error

Reload will re-parse templates and set them on the context object

type FlashMessage

type FlashMessage struct {
	Message  string
	Severity string
}

FlashMessage is used to contain a message that only shows up for a user once

type PageRoot

type PageRoot struct {
	UI struct {
		SelectedMarket       string
		Markets              []namedThing
		SelectedVisibility   string
		Visibilities         []namedThing
		SelectedPersist      bool
		PricePercentage      float64
		ExpireAfter          string
		BaseURL              string
		BaseURLWithoutScheme string
		User                 *evepraisal.User
		LoginEnabled         bool
		RawTextAreaDefault   string
		FlashMessages        []FlashMessage
		Path                 string
	}
	Page interface{}
}

PageRoot is basically the root of the page. It includes some details that are given on every page and page-specific data

type SearchPage

type SearchPage struct {
	Results []typedb.EveType `json:"results"`
}

SearchPage holds the search results to be rendered

Jump to

Keyboard shortcuts

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