cgi

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2016 License: BSD-3-Clause Imports: 49 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminSetup

func AdminSetup(s *LoggingServeMux)

AdminSetup registers handlers for admin.cgi

func GatewaySetup

func GatewaySetup(s *LoggingServeMux)

GatewaySetup setups handlers for gateway.cgi

func MchSetup

func MchSetup(s *LoggingServeMux)

MchSetup setups handlers for 2ch interface.

func PrintTitle

func PrintTitle(w http.ResponseWriter, r *http.Request)

PrintTitle renders list of newer thread in the disk for the top page

func ServerSetup

func ServerSetup(s *LoggingServeMux)

ServerSetup setups handlers for server.cgi

func ThreadSetup

func ThreadSetup(s *LoggingServeMux)

ThreadSetup setups handlers for thread.cgi

Types

type DeleteRecord

type DeleteRecord struct {
	Message  message
	AdminCGI string
	Datfile  string
	Records  []*record.Record
	Sid      string
}

DeleteRecord is for renderring confirmation to a delete record.

type GatewayLink struct {
	Message     message
	CGIname     string
	Command     string
	Description string
}

GatewayLink is a struct for gateway_link.txt

func (GatewayLink) Render

func (c GatewayLink) Render(cginame, command string) template.HTML

Render renders "gateway_link.txt" and returns its resutl string which is not escaped in template. GatewayLink.Message must be setted up previously. used in templates.

type Htemplate added in v0.1.0

type Htemplate struct {
	*htmlTemplate.Template
}

Htemplate is for rendering html stuff.

func (*Htemplate) ExecuteTemplate added in v0.1.0

func (t *Htemplate) ExecuteTemplate(file string, st interface{}) string

ExecuteTemplate executes template and returns it as string.

func (*Htemplate) RenderTemplate added in v0.1.0

func (t *Htemplate) RenderTemplate(file string, st interface{}, wr io.Writer)

RenderTemplate executes template and write to wr.

type Item

type Item struct {
	Title       string
	Link        string
	Description string
	Creator     string
	Date        int64

	Content string
	Subject []string
	// contains filtered or unexported fields
}

Item represents RSS contents.

type ListItem

type ListItem struct {
	Cache      *thread.Cache
	CacheSize  int64
	Title      string
	Tags       tag.Slice
	Sugtags    []*tag.Tag
	Target     string
	Remove     bool
	IsAdmin    bool
	StrOpts    string
	GatewayCGI string
	ThreadURL  string
	Message    message
	// contains filtered or unexported fields
}

ListItem is for list_item.txt

func (ListItem) Render

func (l ListItem) Render(ca *thread.Cache, remove bool, target string, search bool) template.HTML

Render renders "list_items.txt" and returns its result string which is not escaped in template. ListItem.IsAdmin,filter,tag,Message must be setted up previously. used in templates.

type LoggingServeMux

type LoggingServeMux struct {
	*http.ServeMux
}

LoggingServeMux is ServerMux with logging

func NewLoggingServeMux

func NewLoggingServeMux() *LoggingServeMux

NewLoggingServeMux returns loggingServeMux obj.

func (*LoggingServeMux) RegistCompressHandler

func (s *LoggingServeMux) RegistCompressHandler(path string, fn func(w http.ResponseWriter, r *http.Request))

RegistCompressHandler registers fn to s after registering CompressHandler with path.

func (*LoggingServeMux) RegisterPprof

func (s *LoggingServeMux) RegisterPprof()

RegisterPprof registers pprof relates funcs to s.

func (*LoggingServeMux) ServeHTTP

func (s *LoggingServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP just calles http.ServeMux.ServeHTTP after logging.

type Menubar struct {
	GatewayLink
	GatewayCGI string
	Message    message
	ID         string
	RSS        string
	IsAdmin    bool
	IsFriend   bool
}

Menubar is var set for menubar.txt

type RSS

type RSS struct {
	Encode      string
	Lang        string
	Title       string
	Link        string
	Description string
	Feeds       []*Item

	URI string
	XSL string
	// contains filtered or unexported fields
}

RSS represents RSS info.

func (*RSS) Len

func (r *RSS) Len() int

Len returns # of feeds.

func (*RSS) Less

func (r *RSS) Less(i, j int) bool

Less returns true if date of feed[i]<one of [j]

func (*RSS) Swap

func (r *RSS) Swap(i, j int)

Swap swaps feed[i] and feed[j]

func (RSS) W3cdate

func (r RSS) W3cdate(dat int64) string

W3cdate returns RSS formated date string. used in templates

type Ttemplate added in v0.1.0

type Ttemplate struct {
	*textTemplate.Template
}

Ttemplate is for rendering text rss template.

func (*Ttemplate) RenderTemplate added in v0.1.0

func (t *Ttemplate) RenderTemplate(file string, st interface{}, wr io.Writer)

RenderTemplate executes rss template and write to wr.

Jump to

Keyboard shortcuts

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