cgi

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2015 License: BSD-3-Clause Imports: 33 Imported by: 6

Documentation

Index

Constants

View Source
const AdminURL = "/admin.cgi"

AdminURL is the url to admin.cgi

View Source
const GatewayURL = "/gateway.cgi"

GatewayURL is the url to gateway.cgi

View Source
const ServerURL = "/server.cgi"

ServerURL is the url to server.cgi

View Source
const ThreadURL = "/thread.cgi"

ThreadURL is the url to thread.cgi

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 AdminCGIConfig

type AdminCGIConfig struct {
	AdminSID          string
	NodeManager       *node.Manager
	Htemplate         *util.Htemplate
	UserTag           *thread.UserTag
	SuggestedTagTable *thread.SuggestedTagTable
	RecentList        *thread.RecentList
	Myself            *node.Myself
}

AdminCGIConfig is config for AdminCGI struct.

var AdminCfg *AdminCGIConfig

AdminCfg is config for AdminCFG struct. it must be setted before using.

type CGIConfig

type CGIConfig struct {
	FileDir           string
	Docroot           string
	MaxConnection     int
	ServerName        string
	ReAdminStr        string
	ReFriendStr       string
	ReVisitorStr      string
	Htemplate         *util.Htemplate
	UserTag           *thread.UserTag
	SuggestedTagTable *thread.SuggestedTagTable
	Version           string
	EnableEmbed       bool
}

CGIConfig is config for CGI struct.

var CGICfg *CGIConfig

CGICfg is cfg for CGI struct. it must be set before using.

type DeleteRecord

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

DeleteRecord is for renderring confirmation to a delete record.

type GatewayConfig

type GatewayConfig struct {
	RSSRange       int64
	Motd           string
	TopRecentRange int64
	RunDir         string
	ServerName     string
	Enable2ch      bool
	RecentList     *thread.RecentList
	Ttemplate      *util.Ttemplate
}

GatewayConfig is config for gatewayCGI struct.

var GatewayCfg *GatewayConfig

GatewayCfg is config for gatewayCGI struct. it must be setted beforehand.

type GatewayLink struct {
	Message     message
	CGIname     string
	Command     string
	Description string
	// contains filtered or unexported fields
}

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.

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       thread.Tagslice
	Sugtags    []*thread.Tag
	Target     string
	Remove     bool
	IsAdmin    bool
	StrOpts    string
	GatewayCGI string
	ThreadURL  string
	Message    message
	CacheInfo  *thread.CacheInfo
	// 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.

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 MchConfig

type MchConfig struct {
	Motd         string
	RecentList   *thread.RecentList
	DatakeyTable *mch.DatakeyTable
	UpdateQue    *thread.UpdateQue
}

MchConfig is config for mchCGI struct.

var MchCfg *MchConfig

MchCfg is config for mchCGI struct. mut be setted beforehand.

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.

type ServerConfig

type ServerConfig struct {
	RecentRange int64
	Motd        string
	NodeManager *node.Manager
	InitNode    *util.ConfList
	UpdateQue   *thread.UpdateQue
	RecentList  *thread.RecentList
}

ServerConfig is config for serverCGI struct.

var ServerCfg *ServerConfig

ServerCfg is config for serverCGI struct. must set beforehand.

type ThreadCGIConfig

type ThreadCGIConfig struct {
	ThreadPageSize       int
	DefaultThumbnailSize string
	RecordLimit          int
	ForceThumbnail       bool
	Htemplate            *util.Htemplate
	UpdateQue            *thread.UpdateQue
}

ThreadCGIConfig is config for threadCGI struct.

var ThreadCfg *ThreadCGIConfig

ThreadCfg is config for threadCGI struct. must set beforehand.

Jump to

Keyboard shortcuts

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