Documentation ¶
Index ¶
- Constants
- Variables
- func AboutPage(w http.ResponseWriter, r *http.Request)
- func AuthHandler(w http.ResponseWriter, r *http.Request)
- func AuthLogoutHandler(w http.ResponseWriter, r *http.Request)
- func BaseURL() string
- func ConfigureRouter(router *mux.Router)
- func DisturbanceListPage(w http.ResponseWriter, r *http.Request)
- func DisturbancePage(w http.ResponseWriter, r *http.Request)
- func DonatePage(w http.ResponseWriter, r *http.Request)
- func HomePage(w http.ResponseWriter, r *http.Request)
- func Initialize(snode sqalx.Node, webKeybox *keybox.Keybox, log *log.Logger, ...)
- func InternalPage(w http.ResponseWriter, r *http.Request)
- func LinePage(w http.ResponseWriter, r *http.Request)
- func LookingGlass(w http.ResponseWriter, r *http.Request)
- func MapPage(w http.ResponseWriter, r *http.Request)
- func MetaStatsPage(w http.ResponseWriter, r *http.Request)
- func PrivacyPolicyPage(w http.ResponseWriter, r *http.Request)
- func RSSFeed(w http.ResponseWriter, r *http.Request)
- func ReadStationTrivia(stationID, locale string) (string, error)
- func ReloadTemplates()
- func ReportPage(w http.ResponseWriter, r *http.Request)
- func SessionStore() *sessions.CookieStore
- func ShowOfficialDataOnly(w http.ResponseWriter, r *http.Request) bool
- func StationPage(w http.ResponseWriter, r *http.Request)
- func TermsPage(w http.ResponseWriter, r *http.Request)
- type ConnectionData
- type PageCommons
- type PageDependencies
- type Session
Constants ¶
const ( // DEBUG is whether this is a debug build DEBUG = true // MLnetworkID is the ID of the main network MLnetworkID = "pt-ml" // CSRFfieldName is the name of the form field used for CSRF protection CSRFfieldName = "disturbances.csrf" CSRFcookieName = "_disturbances_csrf" )
Variables ¶
var Consts = map[string]reflect.Value{ "CSRFcookieName": reflect.ValueOf(CSRFcookieName), "CSRFfieldName": reflect.ValueOf(CSRFfieldName), "DEBUG": reflect.ValueOf(DEBUG), "MLnetworkID": reflect.ValueOf(MLnetworkID), }
var Functions = map[string]reflect.Value{ "AboutPage": reflect.ValueOf(AboutPage), "AuthGetSession": reflect.ValueOf(AuthGetSession), "AuthHandler": reflect.ValueOf(AuthHandler), "AuthLogoutHandler": reflect.ValueOf(AuthLogoutHandler), "BaseURL": reflect.ValueOf(BaseURL), "ConfigureRouter": reflect.ValueOf(ConfigureRouter), "DisturbanceListPage": reflect.ValueOf(DisturbanceListPage), "DisturbancePage": reflect.ValueOf(DisturbancePage), "DonatePage": reflect.ValueOf(DonatePage), "HomePage": reflect.ValueOf(HomePage), "InitPageCommons": reflect.ValueOf(InitPageCommons), "Initialize": reflect.ValueOf(Initialize), "InternalPage": reflect.ValueOf(InternalPage), "LinePage": reflect.ValueOf(LinePage), "LookingGlass": reflect.ValueOf(LookingGlass), "MapPage": reflect.ValueOf(MapPage), "MetaStatsPage": reflect.ValueOf(MetaStatsPage), "PrivacyPolicyPage": reflect.ValueOf(PrivacyPolicyPage), "RSSFeed": reflect.ValueOf(RSSFeed), "ReadStationConnections": reflect.ValueOf(ReadStationConnections), "ReadStationTrivia": reflect.ValueOf(ReadStationTrivia), "ReloadTemplates": reflect.ValueOf(ReloadTemplates), "ReportPage": reflect.ValueOf(ReportPage), "SessionStore": reflect.ValueOf(SessionStore), "ShowOfficialDataOnly": reflect.ValueOf(ShowOfficialDataOnly), "StationPage": reflect.ValueOf(StationPage), "TermsPage": reflect.ValueOf(TermsPage), }
var Types = map[string]reflect.Type{ "ConnectionData": reflect.TypeOf((*ConnectionData)(nil)).Elem(), "PageCommons": reflect.TypeOf((*PageCommons)(nil)).Elem(), "PageDependencies": reflect.TypeOf((*PageDependencies)(nil)).Elem(), "Session": reflect.TypeOf((*Session)(nil)).Elem(), }
var Variables = map[string]reflect.Value{}
Functions ¶
func AboutPage ¶
func AboutPage(w http.ResponseWriter, r *http.Request)
AboutPage serves the about page
func AuthHandler ¶
func AuthHandler(w http.ResponseWriter, r *http.Request)
AuthHandler serves requests from users that come from the SSO login page
func AuthLogoutHandler ¶
func AuthLogoutHandler(w http.ResponseWriter, r *http.Request)
AuthLogoutHandler serves requests from users that come from the SSO login page
func BaseURL ¶
func BaseURL() string
BaseURL returns the base URL of the website without trailing slash
func ConfigureRouter ¶
ConfigureRouter configures a router to handle website paths
func DisturbanceListPage ¶
func DisturbanceListPage(w http.ResponseWriter, r *http.Request)
DisturbanceListPage serves a page with a list of disturbances
func DisturbancePage ¶
func DisturbancePage(w http.ResponseWriter, r *http.Request)
DisturbancePage serves the page for a specific disturbance
func DonatePage ¶
func DonatePage(w http.ResponseWriter, r *http.Request)
DonatePage serves the donations page
func Initialize ¶
func Initialize(snode sqalx.Node, webKeybox *keybox.Keybox, log *log.Logger, rh *compute.ReportHandler, vh *compute.VehicleHandler, veh *compute.VehicleETAHandler, sh *compute.StatsHandler, a *ankiddie.Ankiddie)
Initialize initializes the package
func InternalPage ¶
func InternalPage(w http.ResponseWriter, r *http.Request)
InternalPage serves a internal page
func LinePage ¶
func LinePage(w http.ResponseWriter, r *http.Request)
LinePage serves the page for a specific line
func LookingGlass ¶
func LookingGlass(w http.ResponseWriter, r *http.Request)
LookingGlass serves the looking glass page
func MapPage ¶
func MapPage(w http.ResponseWriter, r *http.Request)
MapPage serves the network map page
func MetaStatsPage ¶
func MetaStatsPage(w http.ResponseWriter, r *http.Request)
MetaStatsPage serves a page with meta-statistics about the service
func PrivacyPolicyPage ¶
func PrivacyPolicyPage(w http.ResponseWriter, r *http.Request)
PrivacyPolicyPage serves the privacy policy page
func ReadStationTrivia ¶
ReadStationTrivia returns the contents of the HTML file containing trivia for the specified station ID
func ReportPage ¶
func ReportPage(w http.ResponseWriter, r *http.Request)
ReportPage serves the disturbance reporting page
func SessionStore ¶
func SessionStore() *sessions.CookieStore
SessionStore returns the session store used by the website
func ShowOfficialDataOnly ¶
func ShowOfficialDataOnly(w http.ResponseWriter, r *http.Request) bool
ShowOfficialDataOnly analyzes and modifies a request to check if the user wants to see official disturbance data only or not, and returns the result
func StationPage ¶
func StationPage(w http.ResponseWriter, r *http.Request)
StationPage serves the page for a specific station
Types ¶
type ConnectionData ¶
ConnectionData contains the HTML with the connection information for the station with ID ID
func ReadStationConnections ¶
func ReadStationConnections(stationID string) (data []ConnectionData, err error)
ReadStationConnections returns the contents of HTML files containing connection information for the specified station ID
type PageCommons ¶
type PageCommons struct { CSRFfield string PageTitle string Description string ImageURL string Lines []struct { *types.Line Down bool Official bool Minutes int } OfficialOnly bool DebugBuild bool MQTTaddress string Dependencies PageDependencies }
PageCommons contains information that is required by most page templates
func InitPageCommons ¶
func InitPageCommons(node sqalx.Node, w http.ResponseWriter, r *http.Request, title string) (commons PageCommons, err error)
InitPageCommons fills PageCommons with the info that is required by most page templates
type PageDependencies ¶
PageDependencies is used by the header template to include certain dependencies
type Session ¶
Session represents a user session
func AuthGetSession ¶
AuthGetSession retrieves the Session associated with the user of the specified request, if one exists