mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
HTML view encoding fix
- HTML popup now specifies UTF8 encoding - Version and build date are captured from goxc - Version is displayed on status page, and initial log entry
This commit is contained in:
@@ -8,6 +8,6 @@
|
|||||||
"Include": "README*,LICENSE*,inbucket.bat,etc,themes"
|
"Include": "README*,LICENSE*,inbucket.bat,etc,themes"
|
||||||
},
|
},
|
||||||
"PackageVersion": "1.0",
|
"PackageVersion": "1.0",
|
||||||
"PrereleaseInfo": "rc3",
|
"PrereleaseInfo": "rc4",
|
||||||
"FormatVersion": "0.8"
|
"FormatVersion": "0.8"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ type DataStoreConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// Build info, set by main
|
||||||
|
VERSION = ""
|
||||||
|
BUILD_DATE = ""
|
||||||
|
|
||||||
// Global goconfig object
|
// Global goconfig object
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
|
|
||||||
|
|||||||
32
inbucket.go
32
inbucket.go
@@ -19,21 +19,31 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command line flags
|
var (
|
||||||
var help = flag.Bool("help", false, "Displays this help")
|
// Build info, populated during linking by goxc
|
||||||
var pidfile = flag.String("pidfile", "none", "Write our PID into the specified file")
|
VERSION = "1.0"
|
||||||
var logfile = flag.String("logfile", "stderr", "Write out log into the specified file")
|
BUILD_DATE = "undefined"
|
||||||
|
|
||||||
// startTime is used to calculate uptime of Inbucket
|
// Command line flags
|
||||||
var startTime = time.Now()
|
help = flag.Bool("help", false, "Displays this help")
|
||||||
|
pidfile = flag.String("pidfile", "none", "Write our PID into the specified file")
|
||||||
|
logfile = flag.String("logfile", "stderr", "Write out log into the specified file")
|
||||||
|
|
||||||
// The file we send log output to, will be nil for stderr or stdout
|
// startTime is used to calculate uptime of Inbucket
|
||||||
var logf *os.File
|
startTime = time.Now()
|
||||||
|
|
||||||
var smtpServer *smtpd.Server
|
// The file we send log output to, will be nil for stderr or stdout
|
||||||
var pop3Server *pop3d.Server
|
logf *os.File
|
||||||
|
|
||||||
|
// Server instances
|
||||||
|
smtpServer *smtpd.Server
|
||||||
|
pop3Server *pop3d.Server
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
config.VERSION = VERSION
|
||||||
|
config.BUILD_DATE = BUILD_DATE
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if *help {
|
if *help {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
@@ -82,6 +92,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.LogInfo("Inbucket %v (%v) starting...", config.VERSION, config.BUILD_DATE)
|
||||||
|
|
||||||
// Write pidfile if requested
|
// Write pidfile if requested
|
||||||
// TODO: Probably supposed to remove pidfile during shutdown
|
// TODO: Probably supposed to remove pidfile during shutdown
|
||||||
if *pidfile != "none" {
|
if *pidfile != "none" {
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ table.metrics {
|
|||||||
width: 15em;
|
width: 15em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.metrics td {
|
.metrics td.number {
|
||||||
width: 10em;
|
width: 10em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,10 @@
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<h3>Configuration</h3>
|
<h3>Configuration</h3>
|
||||||
<table class="metrics">
|
<table class="metrics">
|
||||||
|
<tr>
|
||||||
|
<th>Version:</th>
|
||||||
|
<td><span>{{.version}}, built on {{.buildDate}}</span></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>SMTP Listener:</th>
|
<th>SMTP Listener:</th>
|
||||||
<td><span>{{.smtpListener}}</span></td>
|
<td><span>{{.smtpListener}}</span></td>
|
||||||
@@ -174,29 +178,29 @@
|
|||||||
<table class="metrics">
|
<table class="metrics">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Uptime:</th>
|
<th>Uptime:</th>
|
||||||
<td><span id="m-uptime">.</span></td>
|
<td class="number"><span id="m-uptime">.</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>System Memory:</th>
|
<th>System Memory:</th>
|
||||||
<td><span id="m-memstatsSys">.</span></td>
|
<td class="number"><span id="m-memstatsSys">.</span></td>
|
||||||
<td class="sparkline"><span id="s-memstatsSys">.</span></td>
|
<td class="sparkline"><span id="s-memstatsSys">.</span></td>
|
||||||
<td>(10min)</td>
|
<td>(10min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Heap Size:</th>
|
<th>Heap Size:</th>
|
||||||
<td><span id="m-memstatsHeapSys">.</span></td>
|
<td class="number"><span id="m-memstatsHeapSys">.</span></td>
|
||||||
<td class="sparkline"><span id="s-memstatsHeapSys">.</span></td>
|
<td class="sparkline"><span id="s-memstatsHeapSys">.</span></td>
|
||||||
<td>(10min)</td>
|
<td>(10min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Heap In-Use:</th>
|
<th>Heap In-Use:</th>
|
||||||
<td><span id="m-memstatsHeapAlloc">.</span></td>
|
<td class="number"><span id="m-memstatsHeapAlloc">.</span></td>
|
||||||
<td class="sparkline"><span id="s-memstatsHeapAlloc">.</span></td>
|
<td class="sparkline"><span id="s-memstatsHeapAlloc">.</span></td>
|
||||||
<td>(10min)</td>
|
<td>(10min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Heap # Objects:</th>
|
<th>Heap # Objects:</th>
|
||||||
<td><span id="m-memstatsHeapObjects">.</span></td>
|
<td class="number"><span id="m-memstatsHeapObjects">.</span></td>
|
||||||
<td class="sparkline"><span id="s-memstatsHeapObjects">.</span></td>
|
<td class="sparkline"><span id="s-memstatsHeapObjects">.</span></td>
|
||||||
<td>(10min)</td>
|
<td>(10min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -208,31 +212,31 @@
|
|||||||
<table class="metrics">
|
<table class="metrics">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Current Connections:</th>
|
<th>Current Connections:</th>
|
||||||
<td><span id="m-smtpConnectsCurrent">.</span></td>
|
<td class="number"><span id="m-smtpConnectsCurrent">.</span></td>
|
||||||
<td class="sparkline"><span id="s-smtpConnectsCurrent">.</span></td>
|
<td class="sparkline"><span id="s-smtpConnectsCurrent">.</span></td>
|
||||||
<td>(10min)</td>
|
<td>(10min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total Connections:</th>
|
<th>Total Connections:</th>
|
||||||
<td><span id="m-smtpConnectsTotal">.</span></td>
|
<td class="number"><span id="m-smtpConnectsTotal">.</span></td>
|
||||||
<td class="sparkline"><span id="s-smtpConnectsTotal">.</span></td>
|
<td class="sparkline"><span id="s-smtpConnectsTotal">.</span></td>
|
||||||
<td>(60min)</td>
|
<td>(60min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Messages Received:</th>
|
<th>Messages Received:</th>
|
||||||
<td><span id="m-smtpReceivedTotal">.</span></td>
|
<td class="number"><span id="m-smtpReceivedTotal">.</span></td>
|
||||||
<td class="sparkline"><span id="s-smtpReceivedTotal">.</span></td>
|
<td class="sparkline"><span id="s-smtpReceivedTotal">.</span></td>
|
||||||
<td>(60min)</td>
|
<td>(60min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Errors Logged:</th>
|
<th>Errors Logged:</th>
|
||||||
<td><span id="m-smtpErrorsTotal">.</span></td>
|
<td class="number"><span id="m-smtpErrorsTotal">.</span></td>
|
||||||
<td class="sparkline"><span id="s-smtpErrorsTotal"></span></td>
|
<td class="sparkline"><span id="s-smtpErrorsTotal"></span></td>
|
||||||
<td>(60min)</td>
|
<td>(60min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Warnings Logged:</th>
|
<th>Warnings Logged:</th>
|
||||||
<td><span id="m-smtpWarnsTotal">.</span></td>
|
<td class="number"><span id="m-smtpWarnsTotal">.</span></td>
|
||||||
<td class="sparkline"><span id="s-smtpWarnsTotal"></span></td>
|
<td class="sparkline"><span id="s-smtpWarnsTotal"></span></td>
|
||||||
<td>(60min)</td>
|
<td>(60min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -264,13 +268,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Retention Deletes:</th>
|
<th>Retention Deletes:</th>
|
||||||
<td><span id="m-retentionDeletesTotal">.</span></td>
|
<td class="number"><span id="m-retentionDeletesTotal">.</span></td>
|
||||||
<td class="sparkline"><span id="s-retentionDeletesTotal"></span></td>
|
<td class="sparkline"><span id="s-retentionDeletesTotal"></span></td>
|
||||||
<td>(60min)</td>
|
<td>(60min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Currently Retained:</th>
|
<th>Currently Retained:</th>
|
||||||
<td><span id="m-retainedCurrent">.</span></td>
|
<td class="number"><span id="m-retainedCurrent">.</span></td>
|
||||||
<td class="sparkline"><span id="s-retainedCurrent"></span></td>
|
<td class="sparkline"><span id="s-retainedCurrent"></span></td>
|
||||||
<td>(60min)</td>
|
<td>(60min)</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ func MailboxHtml(w http.ResponseWriter, req *http.Request, ctx *Context) (err er
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "text/html")
|
w.Header().Set("Content-Type", "text/html; charset=UTF-8")
|
||||||
return RenderPartial("mailbox/_html.html", w, map[string]interface{}{
|
return RenderPartial("mailbox/_html.html", w, map[string]interface{}{
|
||||||
"ctx": ctx,
|
"ctx": ctx,
|
||||||
"name": name,
|
"name": name,
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err erro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to load greeting: %v", err)
|
return fmt.Errorf("Failed to load greeting: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return RenderTemplate("root/index.html", w, map[string]interface{}{
|
return RenderTemplate("root/index.html", w, map[string]interface{}{
|
||||||
"ctx": ctx,
|
"ctx": ctx,
|
||||||
"greeting": template.HTML(string(greeting)),
|
"greeting": template.HTML(string(greeting)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -30,6 +30,8 @@ func RootStatus(w http.ResponseWriter, req *http.Request, ctx *Context) (err err
|
|||||||
config.GetWebConfig().Ip4port)
|
config.GetWebConfig().Ip4port)
|
||||||
return RenderTemplate("root/status.html", w, map[string]interface{}{
|
return RenderTemplate("root/status.html", w, map[string]interface{}{
|
||||||
"ctx": ctx,
|
"ctx": ctx,
|
||||||
|
"version": config.VERSION,
|
||||||
|
"buildDate": config.BUILD_DATE,
|
||||||
"retentionMinutes": retentionMinutes,
|
"retentionMinutes": retentionMinutes,
|
||||||
"smtpListener": smtpListener,
|
"smtpListener": smtpListener,
|
||||||
"pop3Listener": pop3Listener,
|
"pop3Listener": pop3Listener,
|
||||||
|
|||||||
Reference in New Issue
Block a user