Documentation ¶
Index ¶
- Constants
- Variables
- func DigestSHA3(s string) string
- func NewIdentity() (*identity.FullIdentity, error)
- func PrintJSON(body interface{}) error
- func SetClient(c *Client)
- func SetConfig(config *Config)
- type Client
- func (c *Client) ActiveVotes() (*www.ActiveVoteReply, error)
- func (c *Client) ActiveVotesDCC() (*cms.ActiveVoteReply, error)
- func (c *Client) BatchProposals(bp *www.BatchProposals) (*www.BatchProposalsReply, error)
- func (c *Client) CMSEditUser(uui cms.EditUser) (*cms.EditUserReply, error)
- func (c *Client) CMSManageUser(uui cms.CMSManageUser) (*cms.CMSManageUserReply, error)
- func (c *Client) CMSPolicy() (*cms.PolicyReply, error)
- func (c *Client) CMSUserDetails(userID string) (*cms.UserDetailsReply, error)
- func (c *Client) CMSUsers(cu *cms.CMSUsers) (*cms.CMSUsersReply, error)
- func (c *Client) CastVoteDCC(cv cms.CastVote) (*cms.CastVoteReply, error)
- func (c *Client) ChangePassword(cp *www.ChangePassword) (*www.ChangePasswordReply, error)
- func (c *Client) ChangeUsername(cu *www.ChangeUsername) (*www.ChangeUsernameReply, error)
- func (c *Client) CodeStats(usc cms.UserCodeStats) (*cms.UserCodeStatsReply, error)
- func (c *Client) DCCComments(token string) (*www.GetCommentsReply, error)
- func (c *Client) DCCDetails(token string) (*cms.DCCDetailsReply, error)
- func (c *Client) EditInvoice(ei *cms.EditInvoice) (*cms.EditInvoiceReply, error)
- func (c *Client) EditUser(eu *www.EditUser) (*www.EditUserReply, error)
- func (c *Client) GeneratePayouts(gp *cms.GeneratePayouts) (*cms.GeneratePayoutsReply, error)
- func (c *Client) GetAllVetted(gav *www.GetAllVetted) (*www.GetAllVettedReply, error)
- func (c *Client) GetAllVoteStatus() (*www.GetAllVoteStatusReply, error)
- func (c *Client) GetDCCs(gd *cms.GetDCCs) (*cms.GetDCCsReply, error)
- func (c *Client) InviteNewUser(inu *cms.InviteNewUser) (*cms.InviteNewUserReply, error)
- func (c *Client) InvoiceComments(token string) (*www.GetCommentsReply, error)
- func (c *Client) InvoiceDetails(token string, id *cms.InvoiceDetails) (*cms.InvoiceDetailsReply, error)
- func (c *Client) InvoiceExchangeRate(ier *cms.InvoiceExchangeRate) (*cms.InvoiceExchangeRateReply, error)
- func (c *Client) InvoicePayouts(lip *cms.InvoicePayouts) (*cms.InvoicePayoutsReply, error)
- func (c *Client) Invoices(ai *cms.Invoices) (*cms.InvoicesReply, error)
- func (c *Client) Login(l *www.Login) (*www.LoginReply, error)
- func (c *Client) Logout() (*www.LogoutReply, error)
- func (c *Client) ManageUser(mu *www.ManageUser) (*www.ManageUserReply, error)
- func (c *Client) Me() (*www.LoginReply, error)
- func (c *Client) NewDCC(nd cms.NewDCC) (*cms.NewDCCReply, error)
- func (c *Client) NewDCCComment(nc *www.NewComment) (*www.NewCommentReply, error)
- func (c *Client) NewInvoice(ni *cms.NewInvoice) (*cms.NewInvoiceReply, error)
- func (c *Client) NewUser(nu *www.NewUser) (*www.NewUserReply, error)
- func (c *Client) PayInvoices(pi *cms.PayInvoices) (*cms.PayInvoicesReply, error)
- func (c *Client) Policy() (*www.PolicyReply, error)
- func (c *Client) ProposalBilling(pb *cms.ProposalBilling) (*cms.ProposalBillingReply, error)
- func (c *Client) ProposalBillingDetails(pbd *cms.ProposalBillingDetails) (*cms.ProposalBillingDetailsReply, error)
- func (c *Client) ProposalBillingSummary(pbd *cms.ProposalBillingSummary) (*cms.ProposalBillingSummaryReply, error)
- func (c *Client) ProposalDetails(token string, pd *www.ProposalsDetails) (*www.ProposalDetailsReply, error)
- func (c *Client) ProposalOwner(po *cms.ProposalOwner) (*cms.ProposalOwnerReply, error)
- func (c *Client) RegisterUser(ru *cms.RegisterUser) (*cms.RegisterUserReply, error)
- func (c *Client) ResendVerification(rv www.ResendVerification) (*www.ResendVerificationReply, error)
- func (c *Client) ResetPassword(rp *www.ResetPassword) (*www.ResetPasswordReply, error)
- func (c *Client) Secret() (*www.UserError, error)
- func (c *Client) SetDCCStatus(sd *cms.SetDCCStatus) (*cms.SetDCCStatusReply, error)
- func (c *Client) SetInvoiceStatus(sis *cms.SetInvoiceStatus) (*cms.SetInvoiceStatusReply, error)
- func (c *Client) SetTOTP(st *www.SetTOTP) (*www.SetTOTPReply, error)
- func (c *Client) StartVoteDCC(sv cms.StartVote) (*cms.StartVoteReply, error)
- func (c *Client) SupportOpposeDCC(sd cms.SupportOpposeDCC) (*cms.SupportOpposeDCCReply, error)
- func (c *Client) TokenInventory() (*www.TokenInventoryReply, error)
- func (c *Client) UpdateUserKey(uuk *www.UpdateUserKey) (*www.UpdateUserKeyReply, error)
- func (c *Client) UserDetails(userID string) (*www.UserDetailsReply, error)
- func (c *Client) UserInvoices(up *cms.UserInvoices) (*cms.UserInvoicesReply, error)
- func (c *Client) UserPaymentsRescan(upr *www.UserPaymentsRescan) (*www.UserPaymentsRescanReply, error)
- func (c *Client) UserProposalCredits() (*www.UserProposalCreditsReply, error)
- func (c *Client) UserProposalPaywall() (*www.UserProposalPaywallReply, error)
- func (c *Client) UserProposalPaywallTx() (*www.UserProposalPaywallTxReply, error)
- func (c *Client) UserRegistrationPayment() (*www.UserRegistrationPaymentReply, error)
- func (c *Client) UserSubContractors(usc *cms.UserSubContractors) (*cms.UserSubContractorsReply, error)
- func (c *Client) Users(u *www.Users) (*www.UsersReply, error)
- func (c *Client) VerifyNewUser(vnu *www.VerifyNewUser) (*www.VerifyNewUserReply, error)
- func (c *Client) VerifyResetPassword(vrp www.VerifyResetPassword) (*www.VerifyResetPasswordReply, error)
- func (c *Client) VerifyTOTP(vt *www.VerifyTOTP) (*www.VerifyTOTPReply, error)
- func (c *Client) VerifyUpdateUserKey(vuuk *www.VerifyUpdateUserKey) (*www.VerifyUpdateUserKeyReply, error)
- func (c *Client) Version() (*www.VersionReply, error)
- func (c *Client) VoteDetailsDCC(cv cms.VoteDetails) (*cms.VoteDetailsReply, error)
- func (c *Client) VoteResults(token string) (*www.VoteResultsReply, error)
- func (c *Client) VoteStatus(token string) (*www.VoteStatusReply, error)
- func (c *Client) WWWCensorComment(cc *www.CensorComment) (*www.CensorCommentReply, error)
- func (c *Client) WWWNewComment(nc *www.NewComment) (*www.NewCommentReply, error)
- type Config
- func (cfg *Config) LoadIdentity(username string) (*identity.FullIdentity, error)
- func (cfg *Config) SaveCSRF(csrf string) error
- func (cfg *Config) SaveCookies(cookies []*http.Cookie) error
- func (cfg *Config) SaveIdentity(user string, id *identity.FullIdentity) error
- func (cfg *Config) SaveLoggedInUsername(username string) error
- type LoginCmd
- type LogoutCmd
- type MeCmd
- type SecretCmd
- type TokenInventoryCmd
- type UserKeyUpdateCmd
- type UserManageCmd
- type UserPasswordChangeCmd
- type UserPasswordResetCmd
- type UserTOTPSetCmd
- type UserTOTPVerifyCmd
- type UserUsernameChangeCmd
- type UsersCmd
- type VersionCmd
Constants ¶
const LoginHelpMsg = `` /* 874-byte string literal not displayed */
LoginHelpMsg is the output for the help command when 'login' is specified.
const LogoutHelpMsg = `logout
Logout as a user or admin.
Arguments:
None`
LogoutHelpMsg is the output of the help command when 'logout' is specified.
const MeHelpMsg = `` /* 920-byte string literal not displayed */
MeHelpMsg is the output of the help command when 'me' is specified.
const UserKeyUpdateHelpMsg = `userkeyupdate
Generate a new public key for the currently logged in user.
Arguments:
None`
UserKeyUpdateHelpMsg is the output of the help command when 'userkeyupdate' is specified.
const UserManageHelpMsg = `` /* 716-byte string literal not displayed */
UserManageHelpMsg is the output of the help command when 'edituser' is specified.
const UserPasswordChangeHelpMsg = `` /* 230-byte string literal not displayed */
UserPasswordChangeHelpMsg is the output of the help command when 'userpasswordchange' is specified.
const UserPasswordResetHelpMsg = `` /* 273-byte string literal not displayed */
UserPasswordResetHelpMsg is the output of the help command when 'userpasswordreset' is specified.
const UsersHelpMsg = `` /* 646-byte string literal not displayed */
UsersHelpMsg is the output of the help command when 'users' is specified.
const VersionHelpMsg = `` /* 265-byte string literal not displayed */
VersionHelpMsg is the output of the help command when 'version' is specified.
Variables ¶
var ( // ErrUserIdentityNotFound is emitted when a user identity is // required but the config object does not contain one. ErrUserIdentityNotFound = errors.New("user identity not found; " + "you must either create a new user or update the user key to " + "generate a new identity for the logged in user") )
var UserUsernameChangeHelpMsg = `` /* 218-byte string literal not displayed */
UserUsernameChangeHelpMsg is the output of the help command when 'userusernamechange' is specified.
Functions ¶
func DigestSHA3 ¶
DigestSHA3 returns the hex encoded SHA3-256 of a string.
func NewIdentity ¶
func NewIdentity() (*identity.FullIdentity, error)
NewIdentity generates a new FullIdentity using randomly generated data to create the public/private key pair.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a politeiawww client.
func (*Client) ActiveVotes ¶
func (c *Client) ActiveVotes() (*www.ActiveVoteReply, error)
ActiveVotes retreives the vote status of all public proposals.
func (*Client) ActiveVotesDCC ¶ added in v0.2.0
func (c *Client) ActiveVotesDCC() (*cms.ActiveVoteReply, error)
ActiveVotesDCC retreives all dccs that are currently being voted on.
func (*Client) BatchProposals ¶
func (c *Client) BatchProposals(bp *www.BatchProposals) (*www.BatchProposalsReply, error)
BatchProposals retrieves a list of proposals
func (*Client) CMSEditUser ¶
CMSEditUser edits the current user's information.
func (*Client) CMSManageUser ¶
func (c *Client) CMSManageUser(uui cms.CMSManageUser) (*cms.CMSManageUserReply, error)
CMSManageUser updates the given user's information.
func (*Client) CMSPolicy ¶
func (c *Client) CMSPolicy() (*cms.PolicyReply, error)
CMSPolicy returns the politeiawww policy information.
func (*Client) CMSUserDetails ¶
func (c *Client) CMSUserDetails(userID string) (*cms.UserDetailsReply, error)
CMSUserDetails returns the current cms user's information.
func (*Client) CMSUsers ¶
CMSUsers retrieves a list of cms users that adhere to the specified filtering parameters.
func (*Client) CastVoteDCC ¶ added in v0.2.0
CastVoteDCC issues a signed vote for a given DCC proposal. approval
func (*Client) ChangePassword ¶
func (c *Client) ChangePassword(cp *www.ChangePassword) (*www.ChangePasswordReply, error)
ChangePassword changes the password for the logged in user.
func (*Client) ChangeUsername ¶
func (c *Client) ChangeUsername(cu *www.ChangeUsername) (*www.ChangeUsernameReply, error)
ChangeUsername changes the username of the logged in user.
func (*Client) CodeStats ¶ added in v0.2.0
func (c *Client) CodeStats(usc cms.UserCodeStats) (*cms.UserCodeStatsReply, error)
CodeStats returns the given cms user's code statistics.
func (*Client) DCCComments ¶
func (c *Client) DCCComments(token string) (*www.GetCommentsReply, error)
DCCComments retrieves the comments for the specified proposal.
func (*Client) DCCDetails ¶
func (c *Client) DCCDetails(token string) (*cms.DCCDetailsReply, error)
DCCDetails retrieves the specified dcc.
func (*Client) EditInvoice ¶
func (c *Client) EditInvoice(ei *cms.EditInvoice) (*cms.EditInvoiceReply, error)
EditInvoice edits the specified invoice with the logged in user.
func (*Client) GeneratePayouts ¶
func (c *Client) GeneratePayouts(gp *cms.GeneratePayouts) (*cms.GeneratePayoutsReply, error)
GeneratePayouts generates a list of payouts for all approved invoices that contain an address and amount for an admin to the process
func (*Client) GetAllVetted ¶
func (c *Client) GetAllVetted(gav *www.GetAllVetted) (*www.GetAllVettedReply, error)
GetAllVetted retrieves a page of vetted proposals.
func (*Client) GetAllVoteStatus ¶
func (c *Client) GetAllVoteStatus() (*www.GetAllVoteStatusReply, error)
GetAllVoteStatus retreives the vote status of all public proposals.
func (*Client) GetDCCs ¶
GetDCCs retrieves invoices base on possible field set in the request month/year and/or status
func (*Client) InviteNewUser ¶
func (c *Client) InviteNewUser(inu *cms.InviteNewUser) (*cms.InviteNewUserReply, error)
InviteNewUser creates a new cmswww user.
func (*Client) InvoiceComments ¶
func (c *Client) InvoiceComments(token string) (*www.GetCommentsReply, error)
InvoiceComments retrieves the comments for the specified proposal.
func (*Client) InvoiceDetails ¶
func (c *Client) InvoiceDetails(token string, id *cms.InvoiceDetails) (*cms.InvoiceDetailsReply, error)
InvoiceDetails retrieves the specified invoice.
func (*Client) InvoiceExchangeRate ¶
func (c *Client) InvoiceExchangeRate(ier *cms.InvoiceExchangeRate) (*cms.InvoiceExchangeRateReply, error)
InvoiceExchangeRate changes the status of the specified invoice.
func (*Client) InvoicePayouts ¶
func (c *Client) InvoicePayouts(lip *cms.InvoicePayouts) (*cms.InvoicePayoutsReply, error)
InvoicePayouts retrieves invoices base on possible field set in the request month/year and/or status
func (*Client) Invoices ¶ added in v0.2.0
Invoices retrieves invoices base on possible field set in the request month/year and/or status
func (*Client) Logout ¶
func (c *Client) Logout() (*www.LogoutReply, error)
Logout logs out a user from politeiawww.
func (*Client) ManageUser ¶
func (c *Client) ManageUser(mu *www.ManageUser) (*www.ManageUserReply, error)
ManageUser allows an admin to edit certain attributes of the specified user.
func (*Client) Me ¶
func (c *Client) Me() (*www.LoginReply, error)
Me returns user details for the logged in user.
func (*Client) NewDCCComment ¶
func (c *Client) NewDCCComment(nc *www.NewComment) (*www.NewCommentReply, error)
NewDCCComment submits a new dcc comment for the logged in user.
func (*Client) NewInvoice ¶
func (c *Client) NewInvoice(ni *cms.NewInvoice) (*cms.NewInvoiceReply, error)
NewInvoice submits the specified invoice to politeiawww for the logged in user.
func (*Client) PayInvoices ¶
func (c *Client) PayInvoices(pi *cms.PayInvoices) (*cms.PayInvoicesReply, error)
PayInvoices is a temporary command that allows an administrator to set all approved invoices to the paid status. This will be removed once the address watching for payment is complete and working.
func (*Client) Policy ¶
func (c *Client) Policy() (*www.PolicyReply, error)
Policy returns the politeiawww policy information.
func (*Client) ProposalBilling ¶
func (c *Client) ProposalBilling(pb *cms.ProposalBilling) (*cms.ProposalBillingReply, error)
ProposalBilling retrieves the billing for the requested proposal
func (*Client) ProposalBillingDetails ¶ added in v0.2.0
func (c *Client) ProposalBillingDetails(pbd *cms.ProposalBillingDetails) (*cms.ProposalBillingDetailsReply, error)
ProposalBillingDetails retrieves the billing for the requested proposal
func (*Client) ProposalBillingSummary ¶ added in v0.2.0
func (c *Client) ProposalBillingSummary(pbd *cms.ProposalBillingSummary) (*cms.ProposalBillingSummaryReply, error)
ProposalBillingSummary retrieves the billing for all approved proposals.
func (*Client) ProposalDetails ¶
func (c *Client) ProposalDetails(token string, pd *www.ProposalsDetails) (*www.ProposalDetailsReply, error)
ProposalDetails retrieves the specified proposal.
func (*Client) ProposalOwner ¶
func (c *Client) ProposalOwner(po *cms.ProposalOwner) (*cms.ProposalOwnerReply, error)
ProposalOwner retrieves the subcontractors that are linked to the requesting user
func (*Client) RegisterUser ¶
func (c *Client) RegisterUser(ru *cms.RegisterUser) (*cms.RegisterUserReply, error)
RegisterUser finalizes the signup process for a new cmswww user.
func (*Client) ResendVerification ¶
func (c *Client) ResendVerification(rv www.ResendVerification) (*www.ResendVerificationReply, error)
ResendVerification re-sends the user verification email for an unverified user.
func (*Client) ResetPassword ¶
func (c *Client) ResetPassword(rp *www.ResetPassword) (*www.ResetPasswordReply, error)
ResetPassword resets the password of the specified user.
func (*Client) SetDCCStatus ¶
func (c *Client) SetDCCStatus(sd *cms.SetDCCStatus) (*cms.SetDCCStatusReply, error)
SetDCCStatus issues an status update for a given DCC proposal.
func (*Client) SetInvoiceStatus ¶
func (c *Client) SetInvoiceStatus(sis *cms.SetInvoiceStatus) (*cms.SetInvoiceStatusReply, error)
SetInvoiceStatus changes the status of the specified invoice.
func (*Client) StartVoteDCC ¶ added in v0.2.0
StartVoteDCC sends the provided StartVoteDCC to the politeiawww backend.
func (*Client) SupportOpposeDCC ¶
func (c *Client) SupportOpposeDCC(sd cms.SupportOpposeDCC) (*cms.SupportOpposeDCCReply, error)
SupportOpposeDCC issues support for a given DCC proposal.
func (*Client) TokenInventory ¶
func (c *Client) TokenInventory() (*www.TokenInventoryReply, error)
TokenInventory retrieves the censorship record tokens of all proposals in the inventory.
func (*Client) UpdateUserKey ¶
func (c *Client) UpdateUserKey(uuk *www.UpdateUserKey) (*www.UpdateUserKeyReply, error)
UpdateUserKey updates the identity of the logged in user.
func (*Client) UserDetails ¶
func (c *Client) UserDetails(userID string) (*www.UserDetailsReply, error)
UserDetails retrieves the user details for the specified user.
func (*Client) UserInvoices ¶
func (c *Client) UserInvoices(up *cms.UserInvoices) (*cms.UserInvoicesReply, error)
UserInvoices retrieves the proposals that have been submitted by the specified user.
func (*Client) UserPaymentsRescan ¶
func (c *Client) UserPaymentsRescan(upr *www.UserPaymentsRescan) (*www.UserPaymentsRescanReply, error)
UserPaymentsRescan scans the specified user's paywall address and makes sure that the user's account has been properly credited with all payments.
func (*Client) UserProposalCredits ¶
func (c *Client) UserProposalCredits() (*www.UserProposalCreditsReply, error)
UserProposalCredits retrieves the proposal credit history for the logged in user.
func (*Client) UserProposalPaywall ¶ added in v1.0.0
func (c *Client) UserProposalPaywall() (*www.UserProposalPaywallReply, error)
UserProposalPaywall retrieves proposal credit paywall information for the logged in user.
func (*Client) UserProposalPaywallTx ¶ added in v1.0.0
func (c *Client) UserProposalPaywallTx() (*www.UserProposalPaywallTxReply, error)
UserProposalPaywallTx retrieves payment details of any pending proposal credit payment from the logged in user.
func (*Client) UserRegistrationPayment ¶ added in v1.0.0
func (c *Client) UserRegistrationPayment() (*www.UserRegistrationPaymentReply, error)
UserRegistrationPayment checks whether the logged in user has paid their user registration fee.
func (*Client) UserSubContractors ¶
func (c *Client) UserSubContractors(usc *cms.UserSubContractors) (*cms.UserSubContractorsReply, error)
UserSubContractors retrieves the subcontractors that are linked to the requesting user
func (*Client) Users ¶
Users retrieves a list of users that adhere to the specified filtering parameters.
func (*Client) VerifyNewUser ¶
func (c *Client) VerifyNewUser(vnu *www.VerifyNewUser) (*www.VerifyNewUserReply, error)
VerifyNewUser verifies a user's email address.
func (*Client) VerifyResetPassword ¶
func (c *Client) VerifyResetPassword(vrp www.VerifyResetPassword) (*www.VerifyResetPasswordReply, error)
VerifyResetPassword sends the VerifyResetPassword command to politeiawww.
func (*Client) VerifyTOTP ¶ added in v0.2.0
func (c *Client) VerifyTOTP(vt *www.VerifyTOTP) (*www.VerifyTOTPReply, error)
VerifyTOTP comfirms the logged in user's TOTP Key.
func (*Client) VerifyUpdateUserKey ¶
func (c *Client) VerifyUpdateUserKey(vuuk *www.VerifyUpdateUserKey) (*www.VerifyUpdateUserKeyReply, error)
VerifyUpdateUserKey is used to verify a new user identity.
func (*Client) Version ¶
func (c *Client) Version() (*www.VersionReply, error)
Version returns the version information for the politeiawww instance.
func (*Client) VoteDetailsDCC ¶ added in v0.2.0
func (c *Client) VoteDetailsDCC(cv cms.VoteDetails) (*cms.VoteDetailsReply, error)
VoteDetailsDCC returns all the needed information about a given vote for a DCC proposal.
func (*Client) VoteResults ¶
func (c *Client) VoteResults(token string) (*www.VoteResultsReply, error)
VoteResults retrieves the vote results for a proposal.
func (*Client) VoteStatus ¶
func (c *Client) VoteStatus(token string) (*www.VoteStatusReply, error)
VoteStatus retrieves the vote status for the specified proposal.
func (*Client) WWWCensorComment ¶ added in v1.0.0
func (c *Client) WWWCensorComment(cc *www.CensorComment) (*www.CensorCommentReply, error)
WWWCensorComment censors the specified proposal comment.
func (*Client) WWWNewComment ¶ added in v1.0.0
func (c *Client) WWWNewComment(nc *www.NewComment) (*www.NewCommentReply, error)
WWWNewComment submits a new proposal comment for the logged in user.
type Config ¶
type Config struct { ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` HomeDir string `long:"appdata" description:"Path to application home directory"` Host string `long:"host" description:"politeiawww host"` HTTPSCert string `long:"httpscert" description:"politeiawww https cert"` SkipVerify bool `long:"skipverify" description:"Skip verifying the server's certifcate chain and host name"` RawJSON bool `short:"j" long:"json" description:"Print raw JSON output"` Verbose bool `short:"v" long:"verbose" description:"Print verbose output"` Silent bool `long:"silent" description:"Suppress all output"` Timer bool `long:"timer" description:"Print command execution time stats"` ClientCert string `long:"clientcert" description:"Path to TLS certificate for client authentication"` ClientKey string `long:"clientkey" description:"Path to TLS client authentication key"` DataDir string // Application data dir Version string // CLI version WalletHost string // Wallet host WalletCert string // Wallet GRPC certificate FaucetHost string // Testnet faucet host CSRF string // CSRF header token Identity *identity.FullIdentity // User identity Cookies []*http.Cookie // User cookies }
Config represents the CLI configuration settings.
func LoadConfig ¶
LoadConfig initializes and parses the config using a config file and command line options.
The configuration proceeds as follows:
- Start with a default config with sane settings
- Pre-parse the command line to check for an alternative config file
- Load configuration file overwriting defaults with any specified options
- Parse CLI options and overwrite/add any specified options
The above results in the cli functioning properly without any config settings while still allowing the user to override settings with config files and command line options. Command line options always take precedence.
func (*Config) LoadIdentity ¶
func (cfg *Config) LoadIdentity(username string) (*identity.FullIdentity, error)
func (*Config) SaveCookies ¶
SaveCookies writes the passed in cookies to the host specific cookie file.
func (*Config) SaveIdentity ¶
func (cfg *Config) SaveIdentity(user string, id *identity.FullIdentity) error
SaveIdentity writes the passed in user identity to disk so that it can be persisted between commands. The prepend the hostname and the username onto the idenity filename so that we can keep track of the identities for multiple users per host.
func (*Config) SaveLoggedInUsername ¶
SaveLoggedInUsername saved the passed in username to the on-disk user file. We persist the logged in username between commands so that we know which identity to load.
type LoginCmd ¶
type LoginCmd struct { Args struct { Email string `positional-arg-name:"email" required:"true"` Password string `positional-arg-name:"password" required:"true"` Code string `positional-arg-name:"code"` } `positional-args:"true" optional:"true"` }
LoginCmd logs into Politeia using the specified credentials.
type TokenInventoryCmd ¶ added in v0.2.0
type TokenInventoryCmd struct{}
TokenInventoryCmd retrieves the censorship record tokens of all proposals in the inventory.
func (*TokenInventoryCmd) Execute ¶ added in v0.2.0
func (cmd *TokenInventoryCmd) Execute(args []string) error
Execute executes the token inventory command.
type UserKeyUpdateCmd ¶ added in v1.0.0
type UserKeyUpdateCmd struct {
NoSave bool `long:"nosave"` // Don't save new identity to disk
}
UserKeyUpdateCmd creates a new identity for the logged in user.
func (*UserKeyUpdateCmd) Execute ¶ added in v1.0.0
func (cmd *UserKeyUpdateCmd) Execute(args []string) error
Execute executes the update user key command.
type UserManageCmd ¶ added in v1.0.0
type UserManageCmd struct { Args struct { UserID string `positional-arg-name:"userid"` // User ID Action string `positional-arg-name:"action"` // Edit user action Reason string `positional-arg-name:"reason"` // Reason for editing user } `positional-args:"true" required:"true"` }
UserManageCmd allows an admin to edit certain properties of the specified user.
func (*UserManageCmd) Execute ¶ added in v1.0.0
func (cmd *UserManageCmd) Execute(args []string) error
Execute executes the manage user command.
type UserPasswordChangeCmd ¶ added in v1.0.0
type UserPasswordChangeCmd struct { Args struct { Password string `positional-arg-name:"currentPassword"` // Current password NewPassword string `positional-arg-name:"newPassword"` // New password } `positional-args:"true" required:"true"` }
UserPasswordChangeCmd changes the password for the logged in user.
func (*UserPasswordChangeCmd) Execute ¶ added in v1.0.0
func (cmd *UserPasswordChangeCmd) Execute(args []string) error
Execute executes the change password command.
type UserPasswordResetCmd ¶ added in v1.0.0
type UserPasswordResetCmd struct { Args struct { Username string `positional-arg-name:"username"` // Username Email string `positional-arg-name:"email"` // User email address NewPassword string `positional-arg-name:"newpassword"` // New password } `positional-args:"true" required:"true"` }
UserPasswordResetCmd resets the password of the specified user.
func (*UserPasswordResetCmd) Execute ¶ added in v1.0.0
func (cmd *UserPasswordResetCmd) Execute(args []string) error
Execute executes the reset password command.
type UserTOTPSetCmd ¶ added in v1.0.0
type UserTOTPSetCmd struct { Args struct { Code string `positional-arg-name:"code"` } `positional-args:"true"` }
UserTOTPSetCmd sets the TOTP key for the logged in user.
func (*UserTOTPSetCmd) Execute ¶ added in v1.0.0
func (cmd *UserTOTPSetCmd) Execute(args []string) error
Execute executes the set totp command.
type UserTOTPVerifyCmd ¶ added in v1.0.0
type UserTOTPVerifyCmd struct { Args struct { Code string `positional-arg-name:"code"` } `positional-args:"true"` }
UserTOTPVerifyCmd verifies the TOTP key for the logged in user.
func (*UserTOTPVerifyCmd) Execute ¶ added in v1.0.0
func (cmd *UserTOTPVerifyCmd) Execute(args []string) error
Execute executes the verify totp command.
type UserUsernameChangeCmd ¶ added in v1.0.0
type UserUsernameChangeCmd struct { Args struct { Password string `positional-arg-name:"password"` // User password NewUsername string `positional-arg-name:"newusername"` // New username } `positional-args:"true" required:"true"` }
UserUsernameChangeCmd changes the username for the logged in user.
func (*UserUsernameChangeCmd) Execute ¶ added in v1.0.0
func (cmd *UserUsernameChangeCmd) Execute(args []string) error
Execute executes the change username command.
type UsersCmd ¶
type UsersCmd struct { Email string `long:"email"` // Email filter Username string `long:"username"` // Username filter PublicKey string `long:"pubkey"` // Public key filter }
UsersCmd retreives a list of users that have been filtered using the specified filtering params.
type VersionCmd ¶
type VersionCmd struct{}
VersionCmd retrieves the server version information and CSRF token.
func (*VersionCmd) Execute ¶
func (cmd *VersionCmd) Execute(args []string) error
Execute executes the version command.