mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
parent
b66654787c
commit
cd2ea2e579
1
email.go
1
email.go
@ -60,7 +60,6 @@ func (sm *SMTP) send(address, fromName, fromAddr string, email *Email) error {
|
|||||||
ServerName: sm.server,
|
ServerName: sm.server,
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
fmt.Println(server)
|
|
||||||
// err = e.Send(server, sm.auth)
|
// err = e.Send(server, sm.auth)
|
||||||
if sm.sslTLS {
|
if sm.sslTLS {
|
||||||
err = e.SendWithTLS(server, sm.auth, tlsConfig)
|
err = e.SendWithTLS(server, sm.auth, tlsConfig)
|
||||||
|
10
lang.go
10
lang.go
@ -1,6 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
type langMeta struct {
|
type langMeta struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -76,7 +78,7 @@ type emailLang struct {
|
|||||||
|
|
||||||
type langSection map[string]string
|
type langSection map[string]string
|
||||||
|
|
||||||
func (el *langSection) format(field string, vals ...string) string {
|
func (el langSection) format(field string, vals ...string) string {
|
||||||
text := el.get(field)
|
text := el.get(field)
|
||||||
for _, val := range vals {
|
for _, val := range vals {
|
||||||
text = strings.Replace(text, "{n}", val, 1)
|
text = strings.Replace(text, "{n}", val, 1)
|
||||||
@ -84,8 +86,8 @@ func (el *langSection) format(field string, vals ...string) string {
|
|||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
func (el *langSection) get(field string) string {
|
func (el langSection) get(field string) string {
|
||||||
t, ok := (*el)[field]
|
t, ok := el[field]
|
||||||
if !ok {
|
if !ok {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
3
main.go
3
main.go
@ -524,6 +524,9 @@ func start(asDaemon, firstCall bool) {
|
|||||||
app.info.Fatalf("Failed to load language files: %+v\n", err)
|
app.info.Fatalf("Failed to load language files: %+v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since email depends on language, the email reload in loadConfig won't work first time.
|
||||||
|
app.email = NewEmailer(app)
|
||||||
|
|
||||||
app.authJf, _ = mediabrowser.NewServer(serverType, server, "jfa-go", app.version, "auth", "auth", timeoutHandler, cacheTimeout)
|
app.authJf, _ = mediabrowser.NewServer(serverType, server, "jfa-go", app.version, "auth", "auth", timeoutHandler, cacheTimeout)
|
||||||
|
|
||||||
app.loadStrftime()
|
app.loadStrftime()
|
||||||
|
Loading…
Reference in New Issue
Block a user