controllers

package
v0.0.0-...-30e327d Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2016 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

dcrclient.go

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSetVoteBitsCoolDown = fmt.Errorf("can not set the vote bits because " +
		"last call was too soon")
)

Functions

func APIResponse

func APIResponse(data []string, response string, err error) string

APIResponse formats a response

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func GetLog

func GetLog() btclog.Logger

GetLog returns the currently active logger.

func NewGetTicketsCacheData

func NewGetTicketsCacheData(tfar *dcrjson.TicketsForAddressResult) *getTicketsCacheData

func SetLogWriter

func SetLogWriter(w io.Writer, level string) error

SetLogWriter uses a specified io.Writer to output package logging info. This allows a caller to direct package logging output without needing a dependency on seelog. If the caller is also using btclog, UseLogger should be used instead.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type ApiController

type ApiController struct {
	system.Controller
}

type MainController

type MainController struct {
	system.Controller
	// contains filtered or unexported fields
}

MainController

func NewMainController

func NewMainController(params *chaincfg.Params, baseURL string, closePool bool,
	closePoolMsg string, extPubStr string, poolEmail string, poolFees float64,
	poolLink string, recaptchaSecret string, recaptchaSiteKey string,
	smtpFrom string, smtpHost string, smtpUsername string, smtpPassword string,
	version string, walletHosts []string, walletCerts []string,
	walletUsers []string, walletPasswords []string) (*MainController, error)

NewMainController is the constructor for the entire controller routing.

func (*MainController) API

func (controller *MainController) API(c web.C, r *http.Request) (string, int)

API is the main frontend that handles all API requests. XXX This is very hacky. It can be made more elegant by improving or re-writing the middleware and switching to a more modern framework such as goji2 or something else that utilizes the context package/built-in. This would make it much easier to share code between the web UI and JSON API with less duplication.

func (*MainController) APIAddress

func (controller *MainController) APIAddress(c web.C, r *http.Request) ([]string, string, error)

APIAddress is AddressPost API'd a bit

func (*MainController) APIPurchaseInfo

func (controller *MainController) APIPurchaseInfo(c web.C, r *http.Request) ([]string, string, error)

APIPurchaseInfo fetches and returns the user's info or an error

func (*MainController) APISignIn

func (controller *MainController) APISignIn(c web.C, r *http.Request) ([]string, string, error)

APISignIn is SignInPost API'd a bit

func (*MainController) APISignUp

func (controller *MainController) APISignUp(c web.C, r *http.Request) ([]string, string, error)

APISignUp is SignUpPost API'd a bit

func (*MainController) APIStats

func (controller *MainController) APIStats(c web.C, r *http.Request) ([]string, string, error)

APIStats fetches is Stats() API'd a bit

func (*MainController) Address

func (controller *MainController) Address(c web.C, r *http.Request) (string, int)

Address renders the address page.

func (*MainController) AddressPost

func (controller *MainController) AddressPost(c web.C, r *http.Request) (string, int)

AddressPost is address form submit route.

func (*MainController) EmailUpdate

func (controller *MainController) EmailUpdate(c web.C, r *http.Request) (string, int)

EmailUpdate validates the passed token and updates the user's email address.

func (*MainController) EmailVerify

func (controller *MainController) EmailVerify(c web.C, r *http.Request) (string,
	int)

EmailVerify renders the email verification page.

func (*MainController) Error

func (controller *MainController) Error(c web.C, r *http.Request) (string, int)

Error renders the error page.

func (*MainController) FeeAddressForUserID

func (controller *MainController) FeeAddressForUserID(uid int) (dcrutil.Address,
	error)

FeeAddressForUserID generates a unique payout address per used ID for fees for an individual pool user.

func (*MainController) Index

func (controller *MainController) Index(c web.C, r *http.Request) (string, int)

Index renders the home page.

func (*MainController) Logout

func (controller *MainController) Logout(c web.C, r *http.Request) (string, int)

Logout the user.

func (*MainController) PasswordReset

func (controller *MainController) PasswordReset(c web.C, r *http.Request) (string, int)

PasswordReset renders the password reset page.

func (*MainController) PasswordResetPost

func (controller *MainController) PasswordResetPost(c web.C, r *http.Request) (string, int)

PasswordResetPost handles the posted password reset form.

func (*MainController) PasswordUpdate

func (controller *MainController) PasswordUpdate(c web.C, r *http.Request) (string, int)

PasswordUpdate renders the password update page.

func (*MainController) PasswordUpdatePost

func (controller *MainController) PasswordUpdatePost(c web.C, r *http.Request) (string, int)

PasswordUpdatePost handles updating passwords.

func (*MainController) RPCIsStopped

func (controller *MainController) RPCIsStopped() bool

RPCIsStopped checks to see if w.shutdown is set or not.

func (*MainController) RPCStart

func (controller *MainController) RPCStart()

RPCStart starts the connected rpcServers.

func (*MainController) RPCStop

func (controller *MainController) RPCStop() error

RPCStop stops the connected rpcServers.

func (*MainController) RPCSync

func (controller *MainController) RPCSync(dbMap *gorp.DbMap) error

RPCSync checks to ensure that the wallets are synced on startup.

func (*MainController) SendMail

func (controller *MainController) SendMail(emailaddress string, subject string, body string) error

SendMail sends an email with the passed data using the system's SMTP configuration.

func (*MainController) Settings

func (controller *MainController) Settings(c web.C, r *http.Request) (string, int)

Settings renders the settings page.

func (*MainController) SettingsPost

func (controller *MainController) SettingsPost(c web.C, r *http.Request) (string, int)

SettingsPost handles changing the user's email address or password.

func (*MainController) SignIn

func (controller *MainController) SignIn(c web.C, r *http.Request) (string, int)

SignIn renders the signin page.

func (*MainController) SignInPost

func (controller *MainController) SignInPost(c web.C, r *http.Request) (string, int)

SignInPost is the form submit route. Logs user in or sets an appropriate message in session if login was not successful.

func (*MainController) SignUp

func (controller *MainController) SignUp(c web.C, r *http.Request) (string, int)

SignUp renders the signup page.

func (*MainController) SignUpPost

func (controller *MainController) SignUpPost(c web.C, r *http.Request) (string, int)

SignUpPost form submit route. Registers new user or shows Sign Up route with appropriate messages set in session.

func (*MainController) Stats

func (controller *MainController) Stats(c web.C, r *http.Request) (string, int)

Stats renders the stats page.

func (*MainController) Status

func (controller *MainController) Status(c web.C, r *http.Request) (string, int)

Status renders the status page.

func (*MainController) Tickets

func (controller *MainController) Tickets(c web.C, r *http.Request) (string, int)

Tickets renders the tickets page.

func (*MainController) TicketsPost

func (controller *MainController) TicketsPost(c web.C, r *http.Request) (string, int)

TicketsPost form submit route.

Jump to

Keyboard shortcuts

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