Documentation ¶
Index ¶
- Constants
- func JSAdminBlock(deleteTitleText, deleteConfirmText, editTitleText *language.LocalizedString) string
- func JSAdminInstanceView(config JSAdminInstanceViewConfig) string
- func JSAdminStatistics(config JSAdminStatisticsConfig) string
- func JSHome(receive logic.MetricsDataPointsTime) string
- func JSInstanceView(config JSInstanceViewConfig) string
- func JSOpenModal(selector string) string
- func JSTooltip() string
- type ContextKey
- type JSAdminInstanceViewConfig
- type JSAdminStatisticsConfig
- type JSInstanceViewConfig
- type Module
- func (m *Module) AdminAccountGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminBlockExportCSVGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminBlockExportGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminBlockExportJSONGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminBlockGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminBlockPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminHomeGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminHomePostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminInstanceGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminInstanceViewGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminInstanceViewPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminJobGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminJobPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminStatisticsGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) BlocksGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) CallbackOauthGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) ForwardToHomeHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) HomeGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) InstanceGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) InstancePostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LogGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LoginGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) LoginPostHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) LogoutGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) Middleware(next http.Handler) http.Handler
- func (m *Module) MiddlewareRequireAdmin(next http.Handler) http.Handler
- func (*Module) Name() string
- func (m *Module) Route(s *http.Server) error
- func (m *Module) SetServer(s *ihttp.Server)
- func (m *Module) SettingsGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) SettingsPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) WrapInMiddlewares(h http.Handler) http.Handler
- type SessionKey
Constants ¶
const ( // COAnonymous is an anonymous cross origin. COAnonymous = "anonymous" // ActionAdd is the value for an add action. ActionAdd = "add" // ActionDelete is the value for a delete action. ActionDelete = "delete" // ActionEdit is the value for an edit action. ActionEdit = "edit" // ActionImport is the value for an import action. ActionImport = "import" // ActionKick is the value for a kick action. ActionKick = "kick" // ActionRunJob is the value for a run job action. ActionRunJob = "run-job" // CSVHeaderBlockSubdomains is the value for a Block Subdomains csv header. CSVHeaderBlockSubdomains = "Block Subdomains" // CSVHeaderDomain is the value for a Domain csv header. CSVHeaderDomain = "Domain" // CSVHeaderObfuscatedDomain is the value for an Obfuscated Domain csv header. CSVHeaderObfuscatedDomain = "Obfuscated Domain" // FormAction is the key for an action form field. FormAction = "action" // FormDomain is the key for a domain form field. FormDomain = "domain" // FormFile is the key for a file form field. FormFile = "file" // FormHomeBody is the key for a home body form field. FormHomeBody = "home-body" // FormInstance is the key for a domain form field. FormInstance = "instance" // FormJob is the key for a job form field. FormJob = "job" // FormRobotsAllowIndexing is the key for an allow indexing form field. FormRobotsAllowIndexing = "robots-allow-indexing" // FormObfuscatedDomain is the key for a domain form field. FormObfuscatedDomain = "obfuscated-domain" // FormSubdomain is the key for a subdomain form field. FormSubdomain = "subdomain" // FormTelegramChatID is the key for a chat ID form field. FormTelegramChatID = "telegram-chat-id" // FormTelegramEnabled is the key for a telegram enabled form field. FormTelegramEnabled = "telegram-enabled" // FormTelegramToken is the key for a telegram token form field. FormTelegramToken = "telegram-token" // FormToken is the key for a token form field. FormToken = "token" )
const ( QueryKeyScale = "scale" QueryKeyDays = "days" QueryDaysWeek = 7 QueryDaysMonth = 30 QueryScaleLinear = "linear" QueryScaleLogarithmic = "logarithmic" )
const SessionMaxAge = 30 * 24 * time.Hour // 30 days
Variables ¶
This section is empty.
Functions ¶
func JSAdminBlock ¶
func JSAdminBlock(deleteTitleText, deleteConfirmText, editTitleText *language.LocalizedString) string
func JSAdminInstanceView ¶ added in v0.4.0
func JSAdminInstanceView(config JSAdminInstanceViewConfig) string
func JSAdminStatistics ¶ added in v0.4.2
func JSAdminStatistics(config JSAdminStatisticsConfig) string
func JSHome ¶ added in v0.4.1
func JSHome(receive logic.MetricsDataPointsTime) string
func JSInstanceView ¶ added in v0.7.0
func JSInstanceView(config JSInstanceViewConfig) string
func JSOpenModal ¶
Types ¶
type ContextKey ¶
type ContextKey int
ContextKey is a key used in http request contexts.
const ( // ContextKeySession is the persistent session. ContextKeySession ContextKey = iota // ContextKeyLocalizer is the language localizer. ContextKeyLocalizer // ContextKeyLanguage is the language. ContextKeyLanguage // ContextKeyAccount is the logged in user's account. ContextKeyAccount // ContextKeyOauthNonce is the oauth nonce. ContextKeyOauthNonce )
type JSAdminInstanceViewConfig ¶ added in v0.7.0
type JSAdminInstanceViewConfig struct {
// contains filtered or unexported fields
}
type JSAdminStatisticsConfig ¶ added in v0.5.7
type JSAdminStatisticsConfig struct {
// contains filtered or unexported fields
}
type JSInstanceViewConfig ¶ added in v0.7.0
type JSInstanceViewConfig struct {
// contains filtered or unexported fields
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module contains a webapp module for the web server. Implements web.Module.
func New ¶
func New( ctx context.Context, d db.DB, f *fedi.Module, lMod *language.Module, l logic.Logic, r redis.UniversalClient, run runner.Runner, tokz *token.Tokenizer, ) (*Module, error)
New returns a new webapp module.
func (*Module) AdminAccountGetHandler ¶ added in v0.4.2
func (m *Module) AdminAccountGetHandler(w http.ResponseWriter, r *http.Request)
AdminAccountGetHandler serves the home page.
func (*Module) AdminBlockExportCSVGetHandler ¶
func (m *Module) AdminBlockExportCSVGetHandler(w http.ResponseWriter, r *http.Request)
AdminBlockExportCSVGetHandler serves the home page.
func (*Module) AdminBlockExportGetHandler ¶
func (m *Module) AdminBlockExportGetHandler(w http.ResponseWriter, r *http.Request)
AdminBlockExportGetHandler serves the home page.
func (*Module) AdminBlockExportJSONGetHandler ¶
func (m *Module) AdminBlockExportJSONGetHandler(w http.ResponseWriter, r *http.Request)
AdminBlockExportJSONGetHandler serves the home page.
func (*Module) AdminBlockGetHandler ¶
func (m *Module) AdminBlockGetHandler(w http.ResponseWriter, r *http.Request)
AdminBlockGetHandler serves the home page.
func (*Module) AdminBlockPostHandler ¶
func (m *Module) AdminBlockPostHandler(w http.ResponseWriter, r *http.Request)
AdminBlockPostHandler serves the home page.
func (*Module) AdminHomeGetHandler ¶
func (m *Module) AdminHomeGetHandler(w http.ResponseWriter, r *http.Request)
AdminHomeGetHandler serves the admin home page.
func (*Module) AdminHomePostHandler ¶
func (m *Module) AdminHomePostHandler(w http.ResponseWriter, r *http.Request)
AdminHomePostHandler handles the admin home page form.
func (*Module) AdminInstanceGetHandler ¶
func (m *Module) AdminInstanceGetHandler(w http.ResponseWriter, r *http.Request)
AdminInstanceGetHandler serves the home page.
func (*Module) AdminInstanceViewGetHandler ¶ added in v0.4.0
func (m *Module) AdminInstanceViewGetHandler(w http.ResponseWriter, r *http.Request)
AdminInstanceViewGetHandler serves the instance info page.
func (*Module) AdminInstanceViewPostHandler ¶ added in v0.7.0
func (m *Module) AdminInstanceViewPostHandler(w http.ResponseWriter, r *http.Request)
AdminInstanceViewPostHandler handles the instance info forms.
func (*Module) AdminJobGetHandler ¶ added in v0.6.0
func (m *Module) AdminJobGetHandler(w http.ResponseWriter, r *http.Request)
AdminJobGetHandler serves the admin jobs page.
func (*Module) AdminJobPostHandler ¶ added in v0.7.0
func (m *Module) AdminJobPostHandler(w http.ResponseWriter, r *http.Request)
AdminJobPostHandler serves the admin jobs page.
func (*Module) AdminStatisticsGetHandler ¶ added in v0.4.2
func (m *Module) AdminStatisticsGetHandler(w http.ResponseWriter, r *http.Request)
AdminStatisticsGetHandler serves the logs page.
func (*Module) BlocksGetHandler ¶ added in v0.2.0
func (m *Module) BlocksGetHandler(w http.ResponseWriter, r *http.Request)
BlocksGetHandler serves the blocks page.
func (*Module) CallbackOauthGetHandler ¶
func (m *Module) CallbackOauthGetHandler(w http.ResponseWriter, r *http.Request)
CallbackOauthGetHandler handles an oauth callback.
func (*Module) ForwardToHomeHandler ¶
func (m *Module) ForwardToHomeHandler(w http.ResponseWriter, r *http.Request)
ForwardToHomeHandler serves a home forwarder.
func (*Module) HomeGetHandler ¶
func (m *Module) HomeGetHandler(w http.ResponseWriter, r *http.Request)
HomeGetHandler serves the home page.
func (*Module) InstanceGetHandler ¶ added in v0.7.0
func (m *Module) InstanceGetHandler(w http.ResponseWriter, r *http.Request)
InstanceGetHandler serves the home page.
func (*Module) InstancePostHandler ¶ added in v0.7.0
func (m *Module) InstancePostHandler(w http.ResponseWriter, r *http.Request)
InstancePostHandler handles the instance info forms.
func (*Module) LogGetHandler ¶ added in v0.3.0
func (m *Module) LogGetHandler(w http.ResponseWriter, r *http.Request)
LogGetHandler serves the logs page.
func (*Module) LoginGetHandler ¶
func (m *Module) LoginGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
LoginGetHandler serves the login page.
func (*Module) LoginPostHandler ¶
func (m *Module) LoginPostHandler(w nethttp.ResponseWriter, r *nethttp.Request)
LoginPostHandler attempts a login.
func (*Module) LogoutGetHandler ¶
func (m *Module) LogoutGetHandler(w http.ResponseWriter, r *http.Request)
LogoutGetHandler logs a user out.
func (*Module) Middleware ¶
Middleware runs on every http request.
func (*Module) MiddlewareRequireAdmin ¶
MiddlewareRequireAdmin will redirect a user to login page if user not in context and will return unauthorized for a non admin user.
func (*Module) SettingsGetHandler ¶ added in v0.2.0
func (m *Module) SettingsGetHandler(w http.ResponseWriter, r *http.Request)
SettingsGetHandler serves the home page.
func (*Module) SettingsPostHandler ¶ added in v0.2.0
func (m *Module) SettingsPostHandler(w http.ResponseWriter, r *http.Request)
SettingsPostHandler serves the home page.
type SessionKey ¶
type SessionKey int
SessionKey is a key used for storing data in a web session.
const ( // SessionKeyAccountID contains the id of the currently logged-in user. SessionKeyAccountID SessionKey = iota // SessionKeyLoginRedirect contains the url to be redirected too after logging in. SessionKeyLoginRedirect )
Source Files ¶
- admin_account.go
- admin_block.go
- admin_block_add.go
- admin_block_delete.go
- admin_block_edit.go
- admin_block_export.go
- admin_block_import.go
- admin_home.go
- admin_home_form.go
- admin_instance.go
- admin_instance_view.go
- admin_instance_view_kick.go
- admin_job.go
- admin_job_run_job.go
- admin_statistics.go
- blocks.go
- callback.go
- const.go
- context_key.go
- error.go
- form.go
- home.go
- instance.go
- instance_kick.go
- js.go
- logger.go
- login.go
- logout.go
- logs.go
- middleware.go
- permission.go
- puny.go
- query.go
- route.go
- session_key.go
- settings.go
- settings_form.go
- template.go
- util.go
- validator.go
- webapp.go