Ejemplo n.º 1
0
//Setup setups handlers for 2ch interface.
func Setup(s *cgi.LoggingServeMux) {
	log.Println("start 2ch interface")
	rtr := mux.NewRouter()

	cgi.RegistToRouter(rtr, "/2ch/", boardApp)
	cgi.RegistToRouter(rtr, "/2ch/dat/{datkey:[^\\.]+}.dat", threadApp)
	cgi.RegistToRouter(rtr, "/2ch/{board:[^/]+}/subject.txt", subjectApp)
	cgi.RegistToRouter(rtr, "/2ch/subject.txt", subjectApp)
	cgi.RegistToRouter(rtr, "/2ch/{board:[^/]+}/head.txt", headApp)
	cgi.RegistToRouter(rtr, "/2ch/head.txt", headApp)
	s.Handle("/2ch/", handlers.CompressHandler(rtr))

	s.RegistCompressHandler("/test/bbs.cgi", postCommentApp)
}
Ejemplo n.º 2
0
//Setup setups handlers for thread.cgi
func Setup(s *cgi.LoggingServeMux) {
	rtr := mux.NewRouter()

	cgi.RegistToRouter(rtr, cfg.ThreadURL+"/", printThreadIndex)

	reg := cfg.ThreadURL + "/{datfile:thread_[0-9A-F]+}/{id:[0-9a-f]{32}}/s{stamp:\\d+}.{thumbnailSize:\\d+x\\d+}.{suffix:.*}"
	cgi.RegistToRouter(rtr, reg, printAttach)

	reg = cfg.ThreadURL + "/{datfile:thread_[0-9A-F]+}/{id:[0-9a-f]{32}}/{stamp:\\d+}.{suffix:.*}"
	cgi.RegistToRouter(rtr, reg, printAttach)

	reg = cfg.ThreadURL + "/{path:[^/]+}{end:/?$}"
	cgi.RegistToRouter(rtr, reg, printThread)

	reg = cfg.ThreadURL + "/{path:[^/]+}/{id:[0-9a-f]{8}}{end:$}"
	cgi.RegistToRouter(rtr, reg, printThread)

	reg = cfg.ThreadURL + "/{path:[^/]+}/p{page:[0-9]+}{end:$}"
	cgi.RegistToRouter(rtr, reg, printThread)

	s.Handle(cfg.ThreadURL+"/", handlers.CompressHandler(rtr))
}
Ejemplo n.º 3
0
//Setup setups handlers for server.cgi
func Setup(s *cgi.LoggingServeMux) {
	s.RegistCompressHandler(cfg.ServerURL+"/ping", doPing)
	s.RegistCompressHandler(cfg.ServerURL+"/node", doNode)
	s.RegistCompressHandler(cfg.ServerURL+"/join/", doJoin)
	s.RegistCompressHandler(cfg.ServerURL+"/bye/", doBye)
	s.RegistCompressHandler(cfg.ServerURL+"/have/", doHave)
	s.RegistCompressHandler(cfg.ServerURL+"/get/", doGetHead)
	s.RegistCompressHandler(cfg.ServerURL+"/head/", doGetHead)
	s.RegistCompressHandler(cfg.ServerURL+"/update/", doUpdate)
	s.RegistCompressHandler(cfg.ServerURL+"/recent/", doRecent)
	s.RegistCompressHandler(cfg.ServerURL+"/", doMotd)

}
Ejemplo n.º 4
0
//Setup setups handlers for gateway.cgi
func Setup(s *cgi.LoggingServeMux) {
	s.RegistCompressHandler(cfg.GatewayURL+"/motd", printMotd)
	s.RegistCompressHandler(cfg.GatewayURL+"/mergedjs", printMergedJS)
	s.RegistCompressHandler(cfg.GatewayURL+"/rss", printRSS)
	s.RegistCompressHandler(cfg.GatewayURL+"/recent_rss", printRecentRSS)
	s.RegistCompressHandler(cfg.GatewayURL+"/index", printGatewayIndex)
	s.RegistCompressHandler(cfg.GatewayURL+"/changes", printIndexChanges)
	s.RegistCompressHandler(cfg.GatewayURL+"/recent", printRecent)
	s.RegistCompressHandler(cfg.GatewayURL+"/new", printNew)
	s.RegistCompressHandler(cfg.GatewayURL+"/thread", printGatewayThread)
	s.RegistCompressHandler(cfg.GatewayURL+"/", PrintTitle)
	s.RegistCompressHandler(cfg.GatewayURL+"/csv/index/", printCSV)
	s.RegistCompressHandler(cfg.GatewayURL+"/csv/changes/", printCSVChanges)
	s.RegistCompressHandler(cfg.GatewayURL+"/csv/recent/", printCSVRecent)
}