@@ -1,3 +1,5 @@
|
|||||||
|
# Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
|
||||||
|
# See License.txt for license information.
|
||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
|
|
||||||
# Install Dependancies
|
# Install Dependancies
|
||||||
@@ -83,15 +85,15 @@ RUN wget http://download.redis.io/redis-stable.tar.gz; \
|
|||||||
ADD . /go/src/github.com/mattermost/platform
|
ADD . /go/src/github.com/mattermost/platform
|
||||||
|
|
||||||
# Insert postfix config
|
# Insert postfix config
|
||||||
ADD ./config/main.cf /etc/postfix/
|
ADD ./docker/main.cf /etc/postfix/
|
||||||
|
|
||||||
RUN go get github.com/tools/godep
|
RUN go get github.com/tools/godep
|
||||||
RUN cd /go/src/github.com/mattermost/platform; godep restore
|
RUN cd /go/src/github.com/mattermost/platform; godep restore
|
||||||
RUN go install github.com/mattermost/platform
|
RUN go install github.com/mattermost/platform
|
||||||
RUN cd /go/src/github.com/mattermost/platform/web/react; npm install
|
RUN cd /go/src/github.com/mattermost/platform/web/react; npm install
|
||||||
|
|
||||||
RUN chmod +x /go/src/github.com/mattermost/platform/docker-entry.sh
|
RUN chmod +x /go/src/github.com/mattermost/platform/docker/docker-entry.sh
|
||||||
ENTRYPOINT /go/src/github.com/mattermost/platform/docker-entry.sh
|
ENTRYPOINT /go/src/github.com/mattermost/platform/docker/docker-entry.sh
|
||||||
|
|
||||||
# Ports
|
# Ports
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"ServiceSettings": {
|
"ServiceSettings": {
|
||||||
"SiteName": "Mattermost Preview",
|
"SiteName": "Mattermost Preview",
|
||||||
"Domain": "",
|
"Domain": "xxxxxxmustbefilledin.com",
|
||||||
"Mode" : "dev",
|
"Mode" : "dev",
|
||||||
"AllowTesting" : false,
|
"AllowTesting" : false,
|
||||||
"UseSSL": false,
|
"UseSSL": false,
|
||||||
|
|||||||
85
config/config_docker.json
Обычный файл
85
config/config_docker.json
Обычный файл
@@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
"LogSettings": {
|
||||||
|
"ConsoleEnable": false,
|
||||||
|
"ConsoleLevel": "DEBUG",
|
||||||
|
"FileEnable": true,
|
||||||
|
"FileLevel": "INFO",
|
||||||
|
"FileFormat": "",
|
||||||
|
"FileLocation": ""
|
||||||
|
},
|
||||||
|
"ServiceSettings": {
|
||||||
|
"SiteName": "Mattermost Preview",
|
||||||
|
"Domain": "",
|
||||||
|
"Mode" : "prod",
|
||||||
|
"AllowTesting" : false,
|
||||||
|
"UseSSL": false,
|
||||||
|
"Port": "80",
|
||||||
|
"Version": "developer",
|
||||||
|
"Shards": {
|
||||||
|
},
|
||||||
|
"InviteSalt": "gxHVDcKUyP2y1eiyW8S8na1UYQAfq6J6",
|
||||||
|
"PublicLinkSalt": "TO3pTyXIZzwHiwyZgGql7lM7DG3zeId4",
|
||||||
|
"ResetSalt": "IPxFzSfnDFsNsRafZxz8NaYqFKhf9y2t",
|
||||||
|
"AnalyticsUrl": ""
|
||||||
|
},
|
||||||
|
"SqlSettings": {
|
||||||
|
"DriverName": "mysql",
|
||||||
|
"DataSource": "mmuser:mostest@tcp(localhost:3306)/mattermost_test",
|
||||||
|
"DataSourceReplicas": ["mmuser:mostest@tcp(localhost:3306)/mattermost_test"],
|
||||||
|
"MaxIdleConns": 10,
|
||||||
|
"MaxOpenConns": 10,
|
||||||
|
"Trace": false,
|
||||||
|
"AtRestEncryptKey": "Ya0xMrybACJ3sZZVWQC7e31h5nSDWZFS"
|
||||||
|
},
|
||||||
|
"RedisSettings": {
|
||||||
|
"DataSource": "localhost:6379",
|
||||||
|
"MaxOpenConns": 1000
|
||||||
|
},
|
||||||
|
"AWSSettings": {
|
||||||
|
"S3AccessKeyId": "",
|
||||||
|
"S3SecretAccessKey": "",
|
||||||
|
"S3Bucket": "",
|
||||||
|
"S3Region": "",
|
||||||
|
"Route53AccessKeyId": "",
|
||||||
|
"Route53SecretAccessKey": "",
|
||||||
|
"Route53ZoneId": "",
|
||||||
|
"Route53Region": ""
|
||||||
|
},
|
||||||
|
"ImageSettings": {
|
||||||
|
"ThumbnailWidth": 200,
|
||||||
|
"ThumbnailHeight": 0,
|
||||||
|
"PreviewWidth": 1024,
|
||||||
|
"PreviewHeight": 0,
|
||||||
|
"ProfileWidth": 128,
|
||||||
|
"ProfileHeight": 128
|
||||||
|
},
|
||||||
|
"EmailSettings": {
|
||||||
|
"SMTPUsername": "",
|
||||||
|
"SMTPPassword": "",
|
||||||
|
"SMTPServer": "localhost:25",
|
||||||
|
"UseTLS": false,
|
||||||
|
"FeedbackEmail": "feedback@xxxxxxmustbefilledin.com",
|
||||||
|
"FeedbackName": "",
|
||||||
|
"ApplePushServer": "",
|
||||||
|
"ApplePushCertPublic": "",
|
||||||
|
"ApplePushCertPrivate": ""
|
||||||
|
},
|
||||||
|
"PrivacySettings": {
|
||||||
|
"ShowEmailAddress": true,
|
||||||
|
"ShowPhoneNumber": true,
|
||||||
|
"ShowSkypeId": true,
|
||||||
|
"ShowFullName": true
|
||||||
|
},
|
||||||
|
"TeamSettings": {
|
||||||
|
"MaxUsersPerTeam": 150,
|
||||||
|
"AllowPublicLink": true,
|
||||||
|
"AllowValet": false,
|
||||||
|
"TermsLink": "/static/help/configure_links.html",
|
||||||
|
"PrivacyLink": "/static/help/configure_links.html",
|
||||||
|
"AboutLink": "/static/help/configure_links.html",
|
||||||
|
"HelpLink": "/static/help/configure_links.html",
|
||||||
|
"ReportProblemLink": "/static/help/configure_links.html",
|
||||||
|
"TourLink": "/static/help/configure_links.html",
|
||||||
|
"DefaultThemeColor": "#2389D7"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
|
||||||
|
# See License.txt for license information.
|
||||||
|
|
||||||
mkdir -p web/static/js
|
mkdir -p web/static/js
|
||||||
|
|
||||||
@@ -114,7 +116,7 @@ echo starting react processor
|
|||||||
cd /go/src/github.com/mattermost/platform/web/react && npm start &
|
cd /go/src/github.com/mattermost/platform/web/react && npm start &
|
||||||
|
|
||||||
echo starting go web server
|
echo starting go web server
|
||||||
cd /go/src/github.com/mattermost/platform/; go run mattermost.go -config=config.json &
|
cd /go/src/github.com/mattermost/platform/; go run mattermost.go -config=config_docker.json &
|
||||||
|
|
||||||
echo starting compass watch
|
echo starting compass watch
|
||||||
cd /go/src/github.com/mattermost/platform/web/sass-files && compass watch
|
cd /go/src/github.com/mattermost/platform/web/sass-files && compass watch
|
||||||
@@ -1,21 +1,11 @@
|
|||||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
|
||||||
|
|
||||||
|
|
||||||
# Debian specific: Specifying a file name will cause the first
|
|
||||||
# line of that file to be used as the name. The Debian default
|
|
||||||
# is /etc/mailname.
|
|
||||||
myorigin = mattermost.com
|
myorigin = mattermost.com
|
||||||
myhostname = mattermost.com
|
myhostname = mattermost.com
|
||||||
|
|
||||||
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
||||||
biff = no
|
biff = no
|
||||||
|
|
||||||
# appending .domain is the MUA's job.
|
|
||||||
append_dot_mydomain = no
|
append_dot_mydomain = no
|
||||||
|
|
||||||
# Uncomment the next line to generate "delayed mail" warnings
|
|
||||||
#delay_warning_time = 4h
|
|
||||||
|
|
||||||
readme_directory = no
|
readme_directory = no
|
||||||
|
|
||||||
# TLS parameters
|
# TLS parameters
|
||||||
@@ -26,9 +16,6 @@ smtp_use_tls=no
|
|||||||
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
||||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||||
|
|
||||||
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
|
|
||||||
# information on enabling SSL in the smtp client.
|
|
||||||
|
|
||||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||||
alias_maps = hash:/etc/aliases
|
alias_maps = hash:/etc/aliases
|
||||||
alias_database = hash:/etc/aliases
|
alias_database = hash:/etc/aliases
|
||||||
@@ -222,6 +222,11 @@ func LoadConfig(fileName string) {
|
|||||||
config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN")
|
config.ServiceSettings.Domain = os.Getenv("MATTERMOST_DOMAIN")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validates our mail settings
|
||||||
|
if err := CheckMailSettings(); err != nil {
|
||||||
|
l4g.Error("Email settings are not valid err=%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
configureLog(config.LogSettings)
|
configureLog(config.LogSettings)
|
||||||
|
|
||||||
Cfg = &config
|
Cfg = &config
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ func TestConfig(t *testing.T) {
|
|||||||
LoadConfig("config.json")
|
LoadConfig("config.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func TestEnvOverride(t *testing.T) {
|
func TestEnvOverride(t *testing.T) {
|
||||||
os.Setenv("MATTERMOST_DOMAIN", "testdomain.com")
|
os.Setenv("MATTERMOST_DOMAIN", "testdomain.com")
|
||||||
|
|
||||||
@@ -26,4 +25,3 @@ func TestEnvOverride(t *testing.T) {
|
|||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|||||||
108
utils/mail.go
108
utils/mail.go
@@ -13,6 +13,69 @@ import (
|
|||||||
"net/smtp"
|
"net/smtp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func CheckMailSettings() *model.AppError {
|
||||||
|
if len(Cfg.EmailSettings.SMTPServer) == 0 {
|
||||||
|
return model.NewAppError("CheckMailSettings", "No email settings present, mail will not be sent", "")
|
||||||
|
}
|
||||||
|
conn, err := connectToSMTPServer()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
c, err2 := newSMTPClient(conn)
|
||||||
|
if err2 != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer c.Quit()
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func connectToSMTPServer() (net.Conn, *model.AppError) {
|
||||||
|
host, _, _ := net.SplitHostPort(Cfg.EmailSettings.SMTPServer)
|
||||||
|
|
||||||
|
var conn net.Conn
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if Cfg.EmailSettings.UseTLS {
|
||||||
|
tlsconfig := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
ServerName: host,
|
||||||
|
}
|
||||||
|
|
||||||
|
conn, err = tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
conn, err = net.Dial("tcp", Cfg.EmailSettings.SMTPServer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, model.NewAppError("SendMail", "Failed to open connection", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return conn, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func newSMTPClient(conn net.Conn) (*smtp.Client, *model.AppError) {
|
||||||
|
host, _, _ := net.SplitHostPort(Cfg.EmailSettings.SMTPServer)
|
||||||
|
c, err := smtp.NewClient(conn, host)
|
||||||
|
if err != nil {
|
||||||
|
l4g.Error("Failed to open a connection to SMTP server %v", err)
|
||||||
|
return nil, model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
|
||||||
|
}
|
||||||
|
// GO does not support plain auth over a non encrypted connection.
|
||||||
|
// so if not tls then no auth
|
||||||
|
auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host)
|
||||||
|
if Cfg.EmailSettings.UseTLS {
|
||||||
|
if err = c.Auth(auth); err != nil {
|
||||||
|
return nil, model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
func SendMail(to, subject, body string) *model.AppError {
|
func SendMail(to, subject, body string) *model.AppError {
|
||||||
|
|
||||||
fromMail := mail.Address{"", Cfg.EmailSettings.FeedbackEmail}
|
fromMail := mail.Address{"", Cfg.EmailSettings.FeedbackEmail}
|
||||||
@@ -36,53 +99,24 @@ func SendMail(to, subject, body string) *model.AppError {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
host, _, _ := net.SplitHostPort(Cfg.EmailSettings.SMTPServer)
|
conn, err1 := connectToSMTPServer()
|
||||||
|
if err1 != nil {
|
||||||
auth := smtp.PlainAuth("", Cfg.EmailSettings.SMTPUsername, Cfg.EmailSettings.SMTPPassword, host)
|
return err1
|
||||||
|
|
||||||
var conn net.Conn
|
|
||||||
var err error
|
|
||||||
|
|
||||||
if Cfg.EmailSettings.UseTLS {
|
|
||||||
tlsconfig := &tls.Config{
|
|
||||||
InsecureSkipVerify: true,
|
|
||||||
ServerName: host,
|
|
||||||
}
|
|
||||||
|
|
||||||
conn, err = tls.Dial("tcp", Cfg.EmailSettings.SMTPServer, tlsconfig)
|
|
||||||
if err != nil {
|
|
||||||
return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
conn, err = net.Dial("tcp", Cfg.EmailSettings.SMTPServer)
|
|
||||||
if err != nil {
|
|
||||||
return model.NewAppError("SendMail", "Failed to open connection", err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
c, err := smtp.NewClient(conn, host)
|
c, err2 := newSMTPClient(conn)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
l4g.Error("Failed to open a connection to SMTP server %v", err)
|
return err2
|
||||||
return model.NewAppError("SendMail", "Failed to open TLS connection", err.Error())
|
|
||||||
}
|
}
|
||||||
defer c.Quit()
|
defer c.Quit()
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
// GO does not support plain auth over a non encrypted connection.
|
if err := c.Mail(fromMail.Address); err != nil {
|
||||||
// so if not tls then no auth
|
|
||||||
if Cfg.EmailSettings.UseTLS {
|
|
||||||
if err = c.Auth(auth); err != nil {
|
|
||||||
return model.NewAppError("SendMail", "Failed to authenticate on SMTP server", err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = c.Mail(fromMail.Address); err != nil {
|
|
||||||
return model.NewAppError("SendMail", "Failed to add from email address", err.Error())
|
return model.NewAppError("SendMail", "Failed to add from email address", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = c.Rcpt(toMail.Address); err != nil {
|
if err := c.Rcpt(toMail.Address); err != nil {
|
||||||
return model.NewAppError("SendMail", "Failed to add to email address", err.Error())
|
return model.NewAppError("SendMail", "Failed to add to email address", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
// If there is a space after the last @, nothing to do.
|
// If there is a space after the last @, nothing to do.
|
||||||
if (lastSpace > atIndex || lastCharSpace > atIndex) {
|
if (lastSpace > atIndex || lastCharSpace > atIndex) {
|
||||||
this.setState({ mentionText: '-1' });
|
this.updateMentionTab('-1', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user