Documentation ¶
Index ¶
- func GenerateMusicFilename(song radio.Song) (string, error)
- func GenerateSongURL(ss secret.Secret, song radio.Song) string
- func Route(ctx context.Context, s State) func(chi.Router)
- type HomeInput
- type PendingForm
- type PendingInput
- type ProfileForm
- type ProfileFormChange
- type SongsForm
- type SongsInput
- type State
- func (s *State) GetHome(w http.ResponseWriter, r *http.Request)
- func (s *State) GetPending(w http.ResponseWriter, r *http.Request)
- func (s *State) GetPendingSong(w http.ResponseWriter, r *http.Request)
- func (s *State) GetProfile(w http.ResponseWriter, r *http.Request)
- func (s *State) GetSongs(w http.ResponseWriter, r *http.Request)
- func (s State) GetUsersList(w http.ResponseWriter, r *http.Request)
- func (s *State) PostPending(w http.ResponseWriter, r *http.Request)
- func (s *State) PostProfile(w http.ResponseWriter, r *http.Request)
- func (s *State) PostSongs(w http.ResponseWriter, r *http.Request)
- func (s *State) PostStreamerStop(w http.ResponseWriter, r *http.Request)
- type UsersForm
- type UsersInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMusicFilename ¶
GenerateMusicFilename generates a filename that can be used to store the song.
Types ¶
type HomeInput ¶
type HomeInput struct { middleware.Input Daypass string }
func (HomeInput) TemplateBundle ¶
type PendingForm ¶
type PendingForm struct { radio.PendingSong Errors map[string]string }
func NewPendingForm ¶
func NewPendingForm(song radio.PendingSong, form url.Values) (PendingForm, error)
NewPendingForm creates a PendingForm with song as a base and updating those values from the form values given.
func (PendingForm) TemplateBundle ¶
func (PendingForm) TemplateBundle() string
func (PendingForm) TemplateName ¶
func (PendingForm) TemplateName() string
func (*PendingForm) ToValues ¶
func (pf *PendingForm) ToValues() url.Values
func (*PendingForm) Update ¶
func (pf *PendingForm) Update(form url.Values)
func (*PendingForm) Validate ¶
func (pf *PendingForm) Validate() bool
type PendingInput ¶
type PendingInput struct { middleware.Input Submissions []PendingForm }
func NewPendingInput ¶
func NewPendingInput(r *http.Request) PendingInput
func (*PendingInput) Hydrate ¶
func (pi *PendingInput) Hydrate(s radio.SubmissionStorage) error
Hydrate hydrates the PendingInput with information from the SubmissionStorage
func (PendingInput) TemplateBundle ¶
func (PendingInput) TemplateBundle() string
type ProfileForm ¶
type ProfileForm struct { radio.User // separate struct for password change handling Change ProfileFormChange // permissions are separate too because gorilla does not like maps Permissions []radio.UserPermission // errors that occured while parsing the form Error error }
ProfileForm defines the form we use for the profile page
type ProfileFormChange ¶
type SongsForm ¶
type SongsForm struct { Errors map[string]string // HasDelete indicates if we should show the delete button HasDelete bool // HasEdit indicates if we should allow editing of the form HasEdit bool Song radio.Song SongURL string }
func NewSongsForm ¶
func (SongsForm) TemplateBundle ¶
func (SongsForm) TemplateName ¶
type SongsInput ¶
type SongsInput struct { middleware.Input Forms []SongsForm Query string Page *shared.Pagination }
func NewSongsInput ¶
func NewSongsInput(s radio.SearchService, ss secret.Secret, r *http.Request) (*SongsInput, error)
func (SongsInput) TemplateBundle ¶
func (SongsInput) TemplateBundle() string
type State ¶
type State struct { config.Config Daypass secret.Secret SongSecret secret.Secret News *shared.NewsCache Storage radio.StorageService Search radio.SearchService Templates *templates.Site TemplateExecutor templates.Executor SessionManager *scs.SessionManager Authentication vmiddleware.Authentication FS afero.Fs }
func NewState ¶
func NewState( _ context.Context, cfg config.Config, dp secret.Secret, songSecret secret.Secret, newsCache *shared.NewsCache, storage radio.StorageService, search radio.SearchService, siteTmpl *templates.Site, exec templates.Executor, sessionManager *scs.SessionManager, auth vmiddleware.Authentication, fs afero.Fs, ) State
func (*State) GetPending ¶
func (s *State) GetPending(w http.ResponseWriter, r *http.Request)
func (*State) GetPendingSong ¶
func (s *State) GetPendingSong(w http.ResponseWriter, r *http.Request)
func (*State) GetProfile ¶
func (s *State) GetProfile(w http.ResponseWriter, r *http.Request)
GetProfile is mounted under /admin/profile and shows the currently logged in users profile
func (State) GetUsersList ¶
func (s State) GetUsersList(w http.ResponseWriter, r *http.Request)
func (*State) PostPending ¶
func (s *State) PostPending(w http.ResponseWriter, r *http.Request)
func (*State) PostProfile ¶
func (s *State) PostProfile(w http.ResponseWriter, r *http.Request)
PostProfile implements the profile form POST parsing and handling
The expected form as input is defined in templates/partials/form_admin_profile
func (*State) PostStreamerStop ¶
func (s *State) PostStreamerStop(w http.ResponseWriter, r *http.Request)
type UsersInput ¶
type UsersInput struct { middleware.Input Users []radio.User }
func NewUsersInput ¶
func NewUsersInput(us radio.UserStorage, r *http.Request) (*UsersInput, error)
func (UsersInput) TemplateBundle ¶
func (UsersInput) TemplateBundle() string
Click to show internal directories.
Click to hide internal directories.