Esempio n. 1
0
func init() {
	beego.ErrorController(&controllers.ErrorController{})
	beego.Handler("/mocku/detect/websocket", detect.WebSocketHandler())

	// beego.Router("/", &controllers.MainController{})
	beego.Router("/mocku", &controllers.MainController{})
	beego.Router("/mocku/projects/:id", &controllers.MainController{}, "get:ShowProject")
	beego.Router("/mocku/rules/create", &controllers.MainController{}, "get:EditRule")
	beego.Router("/mocku/rules/:id", &controllers.MainController{}, "get:EditRule")
	beego.Router("/mocku/detect", &controllers.MainController{}, "get:Detect")

	beego.Router("/mocku/api/projects", &controllers.ProjectController{}, "get:List")
	beego.Router("/mocku/api/projects", &controllers.ProjectController{}, "post:Post")
	beego.Router("/mocku/api/projects/:id", &controllers.ProjectController{})
	beego.Router("/mocku/api/projects/:id/toggle", &controllers.ProjectController{}, "post:Toggle")

	beego.Router("/mocku/api/projects/:pid/rules", &controllers.MockRuleController{}, "get:List")
	beego.Router("/mocku/api/rules", &controllers.MockRuleController{}, "get:List")
	beego.Router("/mocku/api/rules", &controllers.MockRuleController{}, "post:Post")
	beego.Router("/mocku/api/rules/:id", &controllers.MockRuleController{})
	beego.Router("/mocku/api/rules/:id/toggle", &controllers.MockRuleController{}, "post:Toggle")

	beego.Router("/mocku/api/contents/:id", &controllers.MockContentController{})
	beego.Router("/mocku/api/contents/:id/enable", &controllers.MockContentController{}, "post:Enable")

	// beego.Router("/**", &controllers.MockHandlerController{}, "*:Handler")
}
Esempio n. 2
0
func init() {
	beego.Router("/", &controllers.RootController{})
	beego.Router("/login/?:dest", &controllers.LoginController{})
	beego.Router("/logout/?:dest", &controllers.LogoutController{})
	beego.Router("/signup/?:dest", &controllers.SignupController{})
	beego.Router("/live-editor/", &controllers.LiveEditorController{})
	beego.Router("/graphics-animation/", &controllers.GraphicsController{})
	beego.Router("/external/:file", &controllers.LiveEditorController{})

	beego.SetStaticPath("/build", "bootstrap/live-editor/build")

	var FilterUser = func(ctx *context.Context) {
		_, ok := ctx.Input.Session("uid").(int)
		if !ok {
			ctx.Redirect(302, "/login")
		}
	}

	beego.InsertFilter("/user/:id([0-9]+)", beego.BeforeRouter, FilterUser)

	beego.ErrorController(&controllers.ErrorController{})
	beego.SetLogger("file", `{"filename":"log/spielplatz.log"}`)

	loadLanguages()
}
Esempio n. 3
0
// main starts the application
func main() {

	beego.ErrorController(&controllers.ErrorController{})
	beego.Router("/", &controllers.MainController{})
	beego.Router("/streams", &controllers.StreamController{})
	beego.Run()
}
Esempio n. 4
0
func init() {
	beego.Router("/", &index.MainController{})
	beego.Router("/page/:page", &index.MainController{})
	beego.Router("/tag/:tag/:page", &index.TagController{})
	beego.Router("/article/:uri", &article.ArticleController{})
	beego.Router("/article", &article.ArticleController{})
	beego.Router("/archive/:year/:month/:page", &article.ArchiveController{})
	beego.Router("/list", &article.ArticleListPageController{})
	beego.Router("/list/:page", &article.ArticleListPageController{})
	beego.Router("/project", &project.ProjectListController{})
	beego.Router("/project/:page", &project.ProjectListController{})
	beego.Router("/about/statistics", &index.StatisticsController{})
	beego.Router("/about/blog", &index.AboutBlogController{})
	beego.Router("/about/resume", &index.ResumeController{})
	beego.Router("/logo", &index.LogoController{})
	beego.Router("/favicon", &index.SiteIconController{})

	beego.ErrorController(&controllers.ErrorController{})

	model := beego.AppConfig.String("runmode")
	if "dev" == model {
		beego.Router("/test", &admin.TestController{})
	}

}
Esempio n. 5
0
func main() {
	beego.SetLogger("file", `{"filename":"logs/output.log"}`)
	beego.SetLogFuncCall(true)

	controllers.DIYFunc()
	beego.ErrorController(&controllers.ErrorController{})

	beego.Run()
}
Esempio n. 6
0
func main() {
	// 注册静态文件
	beego.SetStaticPath("/static", "static")

	// 自定义404错误页
	beego.ErrorController(&controllers.ErrorController{})

	// 首页路由
	beego.Router("/", &controllers.IndexController{}, "get:Index")
	// 文章路由
	beego.Router("/:slug", &controllers.IndexController{}, "get:View")
	// 内链跳转
	beego.Router("/go/:caption", &controllers.IndexController{}, "get:GoLink")
	// 搜索
	beego.Router("/search", &controllers.IndexController{}, "get:Search")
	// 标签页面
	beego.Router("/tag/:tag", &controllers.IndexController{}, "get:TagList")

	// 后台验证码
	beego.Router("/captcha", &controllers.LoginController{}, "get:Captcha")
	// 后台登录
	beego.Router("/admin/login", &controllers.LoginController{}, "*:Index")
	// 退出登录
	beego.Router("/admin/logout", &controllers.LoginController{}, "*:Logout")
	// 后台首页
	beego.Router("/admin", &controllers.AdminController{}, "get:Index")
	// 新建文章
	beego.Router("/admin/new", &controllers.AdminController{}, "get:New")
	// 编辑文章
	beego.Router("/admin/edit/:id", &controllers.AdminController{}, "get:Edit")
	// 提交文章
	beego.Router("/admin/edit", &controllers.AdminController{}, "post:Edit")
	// 删除文章
	beego.Router("/admin/del/:id", &controllers.AdminController{}, "get:Del")
	// 内链管理
	beego.Router("/admin/redirect", &controllers.AdminController{}, "*:External")
	// 内链修改
	beego.Router("/admin/redirect/:id", &controllers.AdminController{}, "get:External")
	// 内链删除
	beego.Router("/admin/redirect/del/:id", &controllers.AdminController{}, "get:DelExternal")
	// 系统设置
	beego.Router("/admin/setting", &controllers.AdminController{}, "*:Setting")
	// 获取汉字转拼音
	beego.Router("/admin/pinyin/:str", &controllers.AdminController{}, "get:PinYin")
	// 上传文件
	beego.Router("/admin/upload", &controllers.AdminController{}, "post:Upload")

	// 注册函数
	beego.AddFuncMap("Preview", common.Preview)
	beego.AddFuncMap("GetId", common.GetId)
	beego.AddFuncMap("Gravatar", common.Gravatar)
	beego.AddFuncMap("GetTagSlug", common.GetTagSlug)
	beego.AddFuncMap("LoadTimes", common.LoadTimes)

	beego.Run()
}
Esempio n. 7
0
func Init() {
	beego.Router("/", &controllers.MainController{})
	beego.ErrorController(&controllers.ErrorController{})

	User()
	Problem()
	Teacher()
	Api()
	Teach()
}
Esempio n. 8
0
File: router.go Progetto: shaalx/bbs
func init() {
	beego.Include(&controllers.MainController{}, &controllers.RegisterController{})
	beego.ErrorController(&controllers.ErrorController{})
	// ns := beego.NewNamespace("/",
	// 	// beego.NSRouter("/", &controllers.MainController{}),
	// 	beego.NSInclude(&controllers.MainController{}),
	// 	beego.NSInclude(&controllers.RegisterController{}),
	// )
	// beego.AddNamespace(ns)
}
Esempio n. 9
0
File: main.go Progetto: ruoL/code
func main() {
	orm.Debug = true
	beego.SessionOn = true
	beego.ErrorController(&controllers.ErrorController{})
	beego.SetStaticPath("/upload", "upload")
	// beego.SetLogger("file", `{"filename":"./logs/logs.log"}`)
	// beego.BeeLogger.DelLogger("console")
	//注册模板函数
	beego.AddFuncMap("getarticletrash", GetArticleTrashCount)
	beego.Run()
}
Esempio n. 10
0
func main() {
	beego.SessionOn = true
	beego.ErrorController(&controllers.ErrorController{})
	beego.AddFuncMap("i18n", i18n.Tr)

	beego.EnableAdmin = true // Port 8088

	beego.SetLogger("file", `{"filename":"logs/juna.log"}`)
	beego.SetLevel(beego.LevelInformational)
	beego.SetLogFuncCall(true)

	beego.AddFuncMap("news", news)
	beego.Run()
}
Esempio n. 11
0
func init() {

	//Filter
	beego.InsertFilter("/", beego.BeforeRouter, FilterHome)
	beego.InsertFilter("/*", beego.BeforeRouter, FilterHome)

	beego.InsertFilter("/incident-manager/admin/*", beego.BeforeRouter, FilterAdmin)
	beego.InsertFilter("/incident-manager/admin/", beego.BeforeRouter, FilterAdmin)

	beego.InsertFilter("/incident-manager/user/*", beego.BeforeRouter, FilterUser)
	beego.InsertFilter("/incident-manager/user/", beego.BeforeRouter, FilterUser)
	beego.InsertFilter("/incident-manager/", beego.BeforeRouter, FilterUser)

	beego.InsertFilter("/incident-manager/user/*", beego.BeforeRouter, FilterLogin)
	beego.InsertFilter("/incident-manager/admin/*", beego.BeforeRouter, FilterLogin)

	//User Router
	beego.Router("/incident-manager/", &user.IndexController{}, "post,get:Get")
	beego.Router("/incident-manager/login", &auth.LoginController{}, "post,get:Login")
	beego.Router("/incident-manager/register", &auth.RegisterController{}, "post,get:Register")
	beego.Router("/mail/confirmation/:mail([-0-9a-z]+)", &auth.RegisterController{}, "post,get:Password")
	beego.Router("/incident-manager/logout", &auth.LogoutController{}, "post,get:Logout")
	beego.Router("/incident-manager/user/declaration", &user.IndexController{}, "get,post:Add")
	beego.Router("/incident-manager/user/myincident", &user.IndexController{}, "get,post:ByMail")
	beego.Router("/incident-manager/user/incident/:id([0-9]+)", &user.IndexController{}, "get:GetOne")
	beego.Router("/incident-manager/user/incident/update/:id([0-9]+)", &user.IndexController{}, "post,get:Edit")

	// admin Router
	beego.Router("/incident-manager/admin", &admin.AdminController{}, "post,get:GetIncident")
	beego.Router("/incident-manager/admin/user", &admin.AdminController{}, "post,get:GetUser")
	beego.Router("/incident-manager/admin/user/add", &admin.AdminController{}, "post,get:AddUser")
	beego.Router("/incident-manager/admin/user/update/:id([0-9]+)", &admin.AdminController{}, "post,get:EditUser")
	beego.Router("/incident-manager/admin/user/delete/:id([0-9]+)", &admin.AdminController{}, "post,get:DeleteUser")
	beego.Router("/incident-manager/admin/declaration", &admin.AdminController{}, "post,get:AddIncident")
	beego.Router("/incident-manager/admin/myincident", &admin.AdminController{}, "post,get:ByMailIncident")
	beego.Router("/incident-manager/admin/incident/:id([0-9]+)", &admin.AdminController{}, "get:GetOneIncident")
	beego.Router("/incident-manager/admin/incident/update/:id([0-9]+)", &admin.AdminController{}, "post,get:EditIncident")
	beego.Router("/incident-manager/admin/incident/delete/:id([0-9]+)", &admin.AdminController{}, "post,get:DeleteIncident")
	beego.Router("/incident-manager/admin/register", &admin.AdminController{}, "post,get:RegisterDemand")
	beego.Router("/incident-manager/admin/register/delete/:id([0-9]+)", &admin.AdminController{}, "post,get:DeleteDemand")
	// beego.Router("/admin/incident/:id([0-9]+)", &admin.AdminController{}, "get:GetOne")

	//Static Router
	beego.SetStaticPath("/static", "static")

	//Erreurs
	beego.ErrorController(&controllers.ErrorController{})
}
Esempio n. 12
0
func main() {
	models.O = orm.NewOrm()
	models.O.Using("default") // 默认使用 default,你可以指定为其他数据库

	var err error
	models.PageCache, err = cache.NewCache("memory", `{"interval":60}`)
	if err != nil {
		println(err.Error())
		return
	}

	models.CDNInit()

	beego.ErrorController(&controllers.Error{})
	beego.Run()
}
Esempio n. 13
0
func main() {

	beego.ErrorController(&controllers.FaultDataController{})

	if beego.RunMode == "dev" {
		beego.DirectoryIndex = true
		beego.StaticDir["/swagger"] = "swagger"
	}
	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowOrigins:     []string{"*"},
		AllowMethods:     []string{"PUT", "PATCH", "POST", "DELETE"},
		AllowHeaders:     []string{"accept, content-type"},
		ExposeHeaders:    []string{"Content-Length"},
		AllowCredentials: true,
	}))
	beego.Run()
}
Esempio n. 14
0
func main() {
	beego.AddFuncMap("VaildError", vaildError)
	beego.SetStaticPath("amaze", "static/amaze")
	beego.SetStaticPath("hp", "static/hp")
	beego.SetStaticPath("term", "static/term")
	beego.SetStaticPath("static", "static")
	beego.ErrorController(&controllers.ErrorController{})
	router()
	loggerConfig := `{
		"filename":"log/beego.log",
		"maxlines" : 1000,
		"maxsize"  : 10240,
		"rotate": true,
		"daily":true,
		"maxdays":10
	}`
	beego.SetLogger("file", loggerConfig)
	beego.Run()
}
Esempio n. 15
0
func init() {
	beego.SetStaticPath("/static", "static")

	beego.ErrorController(&controllers.ErrorController{})

	beego.Router("/", &controllers.UserController{}, "get:Index")
	beego.Router("/:slug", &controllers.UserController{}, "get:View")
	beego.Router("/tag/:tag", &controllers.UserController{}, "get:TagList")

	beego.Router("/admin", &controllers.AdminController{})
	beego.Router("/admin/login", &controllers.AdminController{}, "get:Login")
	beego.Router("/admin/logout", &controllers.AdminController{}, "get:Logout")

	beego.Router("/admin/new", &controllers.ArticlesController{}, "get:New")
	beego.Router("/admin/edit/:id", &controllers.ArticlesController{}, "get:Edit")
	beego.Router("/admin/del/:id", &controllers.ArticlesController{}, "get:Del")
	beego.Router("/admin/update", &controllers.ArticlesController{}, "post:Update")

	beego.Router("/admin/setting", &controllers.SettingController{}, "get:Get")
}
Esempio n. 16
0
func main() {
	// 初始化
	models.Init()

	// 启动dht
	go common.Dht()
	// 启动入库
	go common.Put()

	// 主页路由
	beego.Router("/", &controllers.IndexController{}, "get:Index")
	// 搜索页路由
	beego.Router("/search/:k", &controllers.IndexController{}, "get:Search")
	// 搜索页排序路由
	beego.Router("/search/:k/:sort", &controllers.IndexController{}, "get:Search")
	// 种子转磁力链
	beego.Router("/magnet", &controllers.IndexController{}, "*:Magnet")
	// 最新入库
	beego.Router("/new", &controllers.IndexController{}, "get:Newly")
	// 磁力链转种子
	beego.Router("/torrent", &controllers.IndexController{}, "*:Torrent")
	// 显示页路由
	beego.Router("/:infohash", &controllers.IndexController{}, "get:View")
	// 设置静态目录
	beego.SetStaticPath("/static", "static")

	// 增加自定义函数
	beego.AddFuncMap("HightLight", common.HightLight)
	beego.AddFuncMap("SizeFormat", common.Size)
	beego.AddFuncMap("DateFormat", common.DateFormat)
	beego.AddFuncMap("FileFormat", common.FileType)
	beego.AddFuncMap("Thunder", common.Thunder)
	beego.AddFuncMap("FileList", common.TreeShow)
	beego.AddFuncMap("i18n", i18n.Tr)

	// 自定义错误页
	beego.ErrorController(&controllers.ErrorController{})

	// 启动Web
	beego.Run()
}
Esempio n. 17
0
func main() {
	//setUserId()

	graceful, _ := beego.AppConfig.Bool("graceful")
	if !graceful {
		sigs := make(chan os.Signal, 1)
		signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM,
			syscall.SIGQUIT)
		go handleSignals(sigs)
	}

	beego.SetLogger("file", `{"filename":"logs/test.log"}`)
	mode := beego.AppConfig.String("runmode")
	if mode == "prod" {
		beego.SetLevel(beego.LevelInformational)
	}

	beego.ErrorController(&controllers.ErrorController{})

	beego.Run()
}
Esempio n. 18
0
func init() {
	beego.InsertFilter("/", beego.BeforeRouter, FilterLogin)
	beego.InsertFilter("/*", beego.BeforeRouter, FilterLogin)

	beego.Router("/login", &controllers.AuthController{}, "post,get:Login")
	beego.Router("/register", &controllers.AuthController{}, "post,get:Register")

	beego.Router("/", &controllers.ListController{})
	beego.Router("/list/:dir*", &controllers.ListController{})
	beego.Router("/vues/:files*.*", &controllers.VuesController{})
	beego.Router("/pas-vues/:files*.*", &controllers.PasVuesController{})
	beego.Router("/edit/:name*.*", &controllers.ChdirController{}, "get:Chdir;post:ChangeDir")
	beego.Router("/srt/:video*.*", &controllers.CmdController{}, "*:Srt")
	beego.Router("/delete/:f*.*", &controllers.DeleteController{}, "*:Delete")
	beego.Router("/rename/:old*.*", &controllers.RenameController{}, "*:Rename")
	beego.Router("/mkdir/:folder*.*", &controllers.CmdController{}, "*:Mkdir")
	beego.Router("/chown", &controllers.CmdController{}, "*:Chown")
	beego.Router("/cmdperso/:lien*.*", &controllers.CmdController{}, "*:CmdPerso")
	beego.Router("/dtstoac3/:video*.*", &controllers.CmdController{}, "*:DtsToAc3")
	beego.Router("/oneaudio/:video*.*", &controllers.CmdController{}, "*:KeepOneAudio")

	//Erreurs
	beego.ErrorController(&controllers.ErrorController{})
}
Esempio n. 19
0
File: main.go Progetto: migege/milog
func init() {
	beego.ErrorController(&controllers.ErrorController{})
	beego.AddFuncMap("add", Add)
}
Esempio n. 20
0
func init() {
	beego.InsertFilter("/", beego.BeforeRouter, StaticFileServer)
	beego.InsertFilter("/*", beego.BeforeRouter, StaticFileServer)
	beego.ErrorController(&controllers.ErrorController{})
	ns := beego.NewNamespace("/api/v1",
		beego.NSNamespace("/hosts",
			beego.NSInclude(
				&controllers.HostsController{},
			),
		),
		beego.NSNamespace("/client",
			beego.NSInclude(
				&controllers.ClientController{},
			),
		),
		beego.NSNamespace("/appSets",
			beego.NSInclude(
				&controllers.AppSetsController{},
			),
		),
		beego.NSNamespace("/backupSets",
			beego.NSInclude(
				&controllers.BackupSetsController{},
			),
		),
		beego.NSNamespace("/clientJobs",
			beego.NSInclude(
				&controllers.ClientJobsController{},
			),
		),
		beego.NSNamespace("/oss",
			beego.NSInclude(
				&controllers.OssController{},
			),
		),
		beego.NSNamespace("/oas",
			beego.NSInclude(
				&controllers.OasController{},
			),
		),
		beego.NSNamespace("/oasJobs",
			beego.NSInclude(
				&controllers.OasJobsController{},
			),
		),
		beego.NSNamespace("/users",
			beego.NSInclude(
				&controllers.UserController{},
			),
		),
		beego.NSNamespace("/paths",
			beego.NSInclude(
				&controllers.PathsController{},
			),
		),
		beego.NSNamespace("/policies",
			beego.NSInclude(
				&controllers.PolicyController{},
			),
		),
		beego.NSNamespace("/records",
			beego.NSInclude(
				&controllers.RecordsController{},
			),
		),
		beego.NSNamespace("/auth",
			beego.NSInclude(
				&controllers.LoginController{},
			),
		),
		beego.NSNamespace("/roles",
			beego.NSInclude(
				&controllers.RolesController{},
			),
		),
		beego.NSNamespace("/version",
			beego.NSInclude(
				&controllers.VersionController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
Esempio n. 21
0
func init() {
	// beego.Router("/", &controllers.MainController{})
	beego.Include(&controllers.JudgeController{}, &controllers.LoginController{}, &controllers.RegistController{}, &controllers.PuzzleController{}, &controllers.UserController{}, &controllers.ListController{})
	beego.ErrorController(&controllers.ErrorController{})
	beego.SetStaticPath("public", "static")
}
Esempio n. 22
0
func main() {
	beego.SetLogger("file", `{"filename":"./log/inote.log"}`)
	beego.ErrorController(&controllers.ErrorController{})
	beego.Run()
}
Esempio n. 23
0
func main() {
	app := beego.Include(&controllers.FileServerController{})
	beego.ErrorController(&controllers.ErrorController{})
	// beego.InsertFilter("/*", beego.BeforeRouter, CheckLogin)
	app.Run()
}
Esempio n. 24
0
func main() {

	beego.ErrorController(&controllers.Errors{})
	beego.Run()
}
Esempio n. 25
0
func init() {
	beego.ErrorController(&controllers.ErrorController{})
	beego.Router("/", &controllers.MainController{})
	beego.Router("/bla", &controllers.BlaController{})
	beego.Router("/tab", &controllers.TabController{})
}
Esempio n. 26
0
func setErrorPage() {
	beego.ErrorController(&errorController{})
}