2014-04-26 09:18:56 +00:00
|
|
|
package System
|
|
|
|
|
2014-10-19 17:19:11 +00:00
|
|
|
import (
|
2015-01-30 16:45:30 +00:00
|
|
|
"github.com/SommerEngineering/Ocean/BinaryAssets"
|
2014-10-19 17:19:11 +00:00
|
|
|
"github.com/SommerEngineering/Ocean/ConfigurationDB"
|
2014-11-06 16:49:04 +00:00
|
|
|
"github.com/SommerEngineering/Ocean/Handlers"
|
2014-10-19 17:19:11 +00:00
|
|
|
"github.com/SommerEngineering/Ocean/ICCC"
|
|
|
|
"github.com/SommerEngineering/Ocean/Log"
|
|
|
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
2015-02-03 20:40:29 +00:00
|
|
|
"github.com/SommerEngineering/Ocean/Log/Web"
|
2014-10-19 17:19:11 +00:00
|
|
|
"github.com/SommerEngineering/Ocean/Robots"
|
|
|
|
"github.com/SommerEngineering/Ocean/StaticFiles"
|
|
|
|
"github.com/SommerEngineering/Ocean/WebContent"
|
|
|
|
)
|
2014-04-26 09:18:56 +00:00
|
|
|
|
2015-06-17 15:44:52 +00:00
|
|
|
// Init the system and then the system's handlers.
|
2014-04-26 09:18:56 +00:00
|
|
|
func InitHandlers() {
|
|
|
|
|
|
|
|
initSystem()
|
|
|
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Register now all system handlers.`)
|
|
|
|
|
2015-06-17 15:44:52 +00:00
|
|
|
//
|
2014-11-17 12:04:34 +00:00
|
|
|
// Public Handlers:
|
2015-06-17 15:44:52 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
// Handler for the web frameworks like e.g. jQuery, Bootstrap, etc.
|
2014-11-06 16:49:04 +00:00
|
|
|
Handlers.AddPublicHandler(`/framework/`, WebContent.HandlerDeliverFramework)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for other static files:
|
2014-11-06 16:49:04 +00:00
|
|
|
Handlers.AddPublicHandler(`/staticFiles/`, StaticFiles.HandlerStaticFiles)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for the robots.txt:
|
2014-11-06 16:49:04 +00:00
|
|
|
Handlers.AddPublicHandler(`/robots.txt`, Robots.HandlerRobots)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for the ICCC to the public:
|
2014-11-06 16:49:04 +00:00
|
|
|
Handlers.AddPublicHandler(`/ICCC`, ICCC.ICCCHandler)
|
2014-04-26 09:18:56 +00:00
|
|
|
|
2015-06-17 15:44:52 +00:00
|
|
|
//
|
2014-11-17 12:04:34 +00:00
|
|
|
// Private Handlers:
|
2015-06-17 15:44:52 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
// Handler for the web frameworks like e.g. jQuery, Bootstrap, etc.
|
2014-11-17 12:04:34 +00:00
|
|
|
Handlers.AddAdminHandler(`/framework/`, WebContent.HandlerDeliverFramework)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for other static files:
|
2014-11-17 12:04:34 +00:00
|
|
|
Handlers.AddAdminHandler(`/staticFiles/`, StaticFiles.HandlerStaticFiles)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for the ICCC to the private side:
|
2014-11-17 12:04:34 +00:00
|
|
|
Handlers.AddAdminHandler(`/ICCC`, ICCC.ICCCHandler)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for binary assets, used for the admin pages:
|
2015-01-30 16:45:30 +00:00
|
|
|
Handlers.AddAdminHandler(`/binaryAssets/`, BinaryAssets.HandlerBinaryAssets)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for the web logging:
|
2015-02-04 06:58:23 +00:00
|
|
|
Handlers.AddAdminHandler(`/log`, Web.HandlerWebLog)
|
2015-06-17 15:44:52 +00:00
|
|
|
|
|
|
|
// Handler for the web logging's CSS and JS:
|
2015-02-03 20:40:29 +00:00
|
|
|
Handlers.AddAdminHandler(`/log/css/normalize.css`, Web.HandlerCSSNormalize)
|
|
|
|
Handlers.AddAdminHandler(`/log/css/webflow.css`, Web.HandlerCSSWebflow)
|
|
|
|
Handlers.AddAdminHandler(`/log/css/log.css`, Web.HandlerCSSLog)
|
|
|
|
Handlers.AddAdminHandler(`/log/js/modernizr.js`, Web.HandlerJSModernizr)
|
|
|
|
Handlers.AddAdminHandler(`/log/js/jquery.min.js`, Web.HandlerJSjQuery)
|
|
|
|
Handlers.AddAdminHandler(`/log/js/jquery.min.map`, Web.HandlerJSjQueryMap)
|
|
|
|
Handlers.AddAdminHandler(`/log/js/webflow.js`, Web.HandlerJSWebflow)
|
2014-11-17 12:04:34 +00:00
|
|
|
|
2015-06-17 15:44:52 +00:00
|
|
|
// Are the static files mapped to the public?
|
2014-04-26 09:18:56 +00:00
|
|
|
if ConfigurationDB.Read(`MapStaticFiles2Root`) == "true" {
|
|
|
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `The static files are mapped to the root.`)
|
2014-11-06 16:49:04 +00:00
|
|
|
Handlers.AddPublicHandler(`/`, StaticFiles.HandlerMapStaticFiles2Root)
|
2014-04-26 09:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Done with registering all system handler.`)
|
|
|
|
}
|