1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

Add FromAlias to the Mail service and some iriscontrol fixes

This commit is contained in:
Makis Maropoulos
2016-06-06 13:25:09 +03:00
parent 48aaca5bc0
commit 86694df84e
7 changed files with 38 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import (
"time"
"github.com/kataras/iris"
"github.com/kataras/iris/config"
"github.com/kataras/iris/plugin/routesinfo"
)
@@ -41,9 +42,10 @@ func (i *irisControlPlugin) startControlPanel() {
// DashboardPage is the main data struct for the index
// contains a boolean if server is running, the routes and the plugins
type DashboardPage struct {
ServerIsRunning bool
Routes []routesinfo.RouteInfo
Plugins []PluginInfo
ServerIsRunning bool
Routes []routesinfo.RouteInfo
Plugins []PluginInfo
LastOperationDateStr string
}
func (i *irisControlPlugin) setPluginsInfo() {
@@ -72,12 +74,18 @@ func (i *irisControlPlugin) setPanelRoutes() {
i.server.Use(i.authFunc)
i.server.Get("/", func(ctx *iris.Context) {
ctx.Render("index.html", DashboardPage{ServerIsRunning: i.station.Server().IsListening(), Routes: i.routes.All(), Plugins: i.plugins})
ctx.Render("index.html", DashboardPage{
ServerIsRunning: i.station.Server().IsListening(),
Routes: i.routes.All(),
Plugins: i.plugins,
LastOperationDateStr: i.lastOperationDate.Format(config.TimeFormat),
})
})
//the controls
i.server.Post("/start_server", func(ctx *iris.Context) {
//println("server start")
i.lastOperationDate = time.Now()
old := i.stationServer
if !old.IsSecure() {
i.station.Listen(old.Config.ListeningAddr)

View File

@@ -28,6 +28,8 @@ type irisControlPlugin struct {
//infos
routes *routesinfo.Plugin
plugins []PluginInfo
// last time the server was on
lastOperationDate time.Time
//
authFunc iris.HandlerFunc
@@ -88,6 +90,7 @@ func (i *irisControlPlugin) PostListen(s *iris.Iris) {
if i.station == nil {
i.station = s
i.stationServer = i.station.Server()
i.lastOperationDate = time.Now()
i.startControlPanel()
}
@@ -106,6 +109,7 @@ func (i *irisControlPlugin) Destroy() {
i.options = config.IrisControl{}
i.routes = nil
i.station = nil
i.lastOperationDate = config.CookieExpireNever
i.server.Close()
i.pluginContainer = nil
i.authFunc = nil