From 788fc4373b8d22930b3420f7906e626e2bd63394 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 15 Sep 2015 14:20:25 -0700 Subject: removing loggly --- web/react/utils/client.jsx | 3 --- web/react/utils/config.js | 4 ---- web/templates/head.html | 11 ----------- 3 files changed, 18 deletions(-) diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 75ffdb274..ebd6640d7 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -14,8 +14,6 @@ export function trackPage() { } function handleError(methodName, xhr, status, err) { - var LTracker = global.window.LTracker || []; - var e = null; try { e = JSON.parse(xhr.responseText); @@ -39,7 +37,6 @@ function handleError(methodName, xhr, status, err) { console.error(msg); //eslint-disable-line no-console console.error(e); //eslint-disable-line no-console - LTracker.push(msg); track('api', 'api_weberror', methodName, 'message', msg); diff --git a/web/react/utils/config.js b/web/react/utils/config.js index c7d1aa2bc..823d71894 100644 --- a/web/react/utils/config.js +++ b/web/react/utils/config.js @@ -3,10 +3,6 @@ export var config = { - // Loggly configs - LogglyWriteKey: '', - LogglyConsoleErrors: true, - // Segment configs SegmentWriteKey: '', diff --git a/web/templates/head.html b/web/templates/head.html index 55c729476..b70ddd311 100644 --- a/web/templates/head.html +++ b/web/templates/head.html @@ -55,17 +55,6 @@ window.config.ProfileHeight = '{{ .Props.ProfileHeight }}' - - @@ -12,9 +12,9 @@
-

{{ .SiteName }} needs your help:

+

{{ .ClientProps.SiteName }} needs your help:

{{.Message}}

- Go back to team site + Go back to team site
diff --git a/api/templates/find_teams_body.html b/api/templates/find_teams_body.html index 00c5628dd..fe134811a 100644 --- a/api/templates/find_teams_body.html +++ b/api/templates/find_teams_body.html @@ -9,7 +9,7 @@ @@ -33,7 +33,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -42,7 +42,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/find_teams_subject.html b/api/templates/find_teams_subject.html index e5ba2d23f..3c2bef589 100644 --- a/api/templates/find_teams_subject.html +++ b/api/templates/find_teams_subject.html @@ -1 +1 @@ -{{define "find_teams_subject"}}Your {{ .SiteName }} Teams{{end}} +{{define "find_teams_subject"}}Your {{ .ClientProps.SiteName }} Teams{{end}} diff --git a/api/templates/invite_body.html b/api/templates/invite_body.html index 568a0d893..401111b75 100644 --- a/api/templates/invite_body.html +++ b/api/templates/invite_body.html @@ -9,7 +9,7 @@ @@ -18,7 +18,7 @@
- +

You've been invited

-

{{.Props.TeamDisplayName}} started using {{.SiteName}}.
The team {{.Props.SenderStatus}} {{.Props.SenderName}}, has invited you to join {{.Props.TeamDisplayName}}.

+

{{.Props.TeamDisplayName}} started using {{.ClientProps.SiteName}}.
The team {{.Props.SenderStatus}} {{.Props.SenderName}}, has invited you to join {{.Props.TeamDisplayName}}.

Join Team

@@ -28,7 +28,7 @@
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/invite_subject.html b/api/templates/invite_subject.html index 6a1e57dcc..f46bdcfaf 100644 --- a/api/templates/invite_subject.html +++ b/api/templates/invite_subject.html @@ -1 +1 @@ -{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.SiteName}}{{end}} +{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.ClientProps.SiteName}}{{end}} diff --git a/api/templates/password_change_body.html b/api/templates/password_change_body.html index 6fc9f2822..6a32e89db 100644 --- a/api/templates/password_change_body.html +++ b/api/templates/password_change_body.html @@ -9,7 +9,7 @@ @@ -25,7 +25,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -34,7 +34,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/password_change_subject.html b/api/templates/password_change_subject.html index 55daefdb1..283fda1af 100644 --- a/api/templates/password_change_subject.html +++ b/api/templates/password_change_subject.html @@ -1 +1 @@ -{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .SiteName }}{{end}} +{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .ClientProps.SiteName }}{{end}} diff --git a/api/templates/post_body.html b/api/templates/post_body.html index a1df5b4c9..0c906807a 100644 --- a/api/templates/post_body.html +++ b/api/templates/post_body.html @@ -9,7 +9,7 @@ @@ -28,7 +28,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/post_subject.html b/api/templates/post_subject.html index 7d8941549..944cd5a42 100644 --- a/api/templates/post_subject.html +++ b/api/templates/post_subject.html @@ -1 +1 @@ -{{define "post_subject"}}[{{.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}} +{{define "post_subject"}}[{{.ClientProps.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}} diff --git a/api/templates/reset_body.html b/api/templates/reset_body.html index a6e6269c0..3e4938a09 100644 --- a/api/templates/reset_body.html +++ b/api/templates/reset_body.html @@ -9,7 +9,7 @@ @@ -28,7 +28,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/signup_team_body.html b/api/templates/signup_team_body.html index b49cf5f36..ef58aa92c 100644 --- a/api/templates/signup_team_body.html +++ b/api/templates/signup_team_body.html @@ -9,7 +9,7 @@ @@ -21,7 +21,7 @@

Set up your team

- {{ .SiteName }} is one place for all your team communication, searchable and available anywhere.
You'll get more out of {{ .SiteName }} when your team is in constant communication--let's get them on board.

+ {{ .ClientProps.SiteName }} is one place for all your team communication, searchable and available anywhere.
You'll get more out of {{ .ClientProps.SiteName }} when your team is in constant communication--let's get them on board.

Learn more by taking a tour

@@ -31,7 +31,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -40,7 +40,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/signup_team_subject.html b/api/templates/signup_team_subject.html index 1cd3427d2..7bc0cc640 100644 --- a/api/templates/signup_team_subject.html +++ b/api/templates/signup_team_subject.html @@ -1 +1 @@ -{{define "signup_team_subject"}}Invitation to {{ .SiteName }}{{end}} \ No newline at end of file +{{define "signup_team_subject"}}Invitation to {{ .ClientProps.SiteName }}{{end}} \ No newline at end of file diff --git a/api/templates/verify_body.html b/api/templates/verify_body.html index 6ba11d845..ac60e4fad 100644 --- a/api/templates/verify_body.html +++ b/api/templates/verify_body.html @@ -9,7 +9,7 @@ @@ -28,7 +28,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/verify_subject.html b/api/templates/verify_subject.html index a66150735..7990df84a 100644 --- a/api/templates/verify_subject.html +++ b/api/templates/verify_subject.html @@ -1 +1 @@ -{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .SiteName }}] Email Verification{{end}} +{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .ClientProps.SiteName }}] Email Verification{{end}} diff --git a/api/templates/welcome_body.html b/api/templates/welcome_body.html index f16f50e14..4d4f03a2d 100644 --- a/api/templates/welcome_body.html +++ b/api/templates/welcome_body.html @@ -9,7 +9,7 @@ @@ -17,15 +17,15 @@
- +
-

You joined the {{.Props.TeamDisplayName}} team at {{.SiteName}}!

-

Please let me know if you have any questions.
Enjoy your stay at {{.SiteName}}.

+

You joined the {{.Props.TeamDisplayName}} team at {{.ClientProps.SiteName}}!

+

Please let me know if you have any questions.
Enjoy your stay at {{.ClientProps.SiteName}}.

Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -34,7 +34,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/welcome_subject.html b/api/templates/welcome_subject.html index 106cc3ae6..2214f7a38 100644 --- a/api/templates/welcome_subject.html +++ b/api/templates/welcome_subject.html @@ -1 +1 @@ -{{define "welcome_subject"}}Welcome to {{ .SiteName }}{{end}} \ No newline at end of file +{{define "welcome_subject"}}Welcome to {{ .ClientProps.SiteName }}{{end}} \ No newline at end of file diff --git a/api/user.go b/api/user.go index c87b89c7a..cdd9a68be 100644 --- a/api/user.go +++ b/api/user.go @@ -216,8 +216,10 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User { func fireAndForgetWelcomeEmail(name, email, teamDisplayName, link, siteURL string) { go func() { - subjectPage := NewServerTemplatePage("welcome_subject", siteURL) - bodyPage := NewServerTemplatePage("welcome_body", siteURL) + subjectPage := NewServerTemplatePage("welcome_subject") + subjectPage.Props["SiteURL"] = siteURL + bodyPage := NewServerTemplatePage("welcome_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["Nickname"] = name bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["FeedbackName"] = utils.Cfg.EmailSettings.FeedbackName @@ -235,9 +237,11 @@ func FireAndForgetVerifyEmail(userId, userEmail, teamName, teamDisplayName, site link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, userEmail) - subjectPage := NewServerTemplatePage("verify_subject", siteURL) + subjectPage := NewServerTemplatePage("verify_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName - bodyPage := NewServerTemplatePage("verify_body", siteURL) + bodyPage := NewServerTemplatePage("verify_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["VerifyUrl"] = link @@ -1133,8 +1137,10 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) { link := fmt.Sprintf("%s/reset_password?d=%s&h=%s", c.GetTeamURLFromTeam(team), url.QueryEscape(data), url.QueryEscape(hash)) - subjectPage := NewServerTemplatePage("reset_subject", c.GetSiteURL()) - bodyPage := NewServerTemplatePage("reset_body", c.GetSiteURL()) + subjectPage := NewServerTemplatePage("reset_subject") + subjectPage.Props["SiteURL"] = c.GetSiteURL() + bodyPage := NewServerTemplatePage("reset_body") + bodyPage.Props["SiteURL"] = c.GetSiteURL() bodyPage.Props["ResetUrl"] = link if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil { @@ -1233,9 +1239,11 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) { func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, method string) { go func() { - subjectPage := NewServerTemplatePage("password_change_subject", siteURL) + subjectPage := NewServerTemplatePage("password_change_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName - bodyPage := NewServerTemplatePage("password_change_body", siteURL) + bodyPage := NewServerTemplatePage("password_change_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamURL"] = teamURL bodyPage.Props["Method"] = method @@ -1250,9 +1258,11 @@ func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, func fireAndForgetEmailChangeEmail(email, teamDisplayName, teamURL, siteURL string) { go func() { - subjectPage := NewServerTemplatePage("email_change_subject", siteURL) + subjectPage := NewServerTemplatePage("email_change_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName - bodyPage := NewServerTemplatePage("email_change_body", siteURL) + bodyPage := NewServerTemplatePage("email_change_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamURL"] = teamURL diff --git a/config/config.json b/config/config.json index cd7e221e7..b97f3f310 100644 --- a/config/config.json +++ b/config/config.json @@ -86,16 +86,14 @@ "ShowSkypeId": true, "ShowFullName": true }, + "ClientSettings": { + "SegmentDeveloperKey": "", + "GoogleDeveloperKey": "" + }, "TeamSettings": { "MaxUsersPerTeam": 150, "AllowPublicLink": true, "AllowValetDefault": 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", "DisableTeamCreation": false, "RestrictCreationToDomains": "" diff --git a/model/client.go b/model/client.go index 5aac09289..204d08e69 100644 --- a/model/client.go +++ b/model/client.go @@ -347,6 +347,15 @@ func (c *Client) GetLogs() (*Result, *AppError) { } } +func (c *Client) GetClientProperties() (*Result, *AppError) { + if r, err := c.DoGet("/admin/client_props", "", ""); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil + } +} + func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) { if r, err := c.DoPost("/channels/create", channel.ToJson()); err != nil { return nil, err diff --git a/utils/config.go b/utils/config.go index a1d282c29..eb78cd08a 100644 --- a/utils/config.go +++ b/utils/config.go @@ -4,10 +4,13 @@ package utils import ( - l4g "code.google.com/p/log4go" "encoding/json" + "fmt" "os" "path/filepath" + "strconv" + + l4g "code.google.com/p/log4go" ) const ( @@ -109,15 +112,15 @@ type PrivacySettings struct { ShowFullName bool } +type ClientSettings struct { + SegmentDeveloperKey string + GoogleDeveloperKey string +} + type TeamSettings struct { MaxUsersPerTeam int AllowPublicLink bool AllowValetDefault bool - TermsLink string - PrivacyLink string - AboutLink string - HelpLink string - ReportProblemLink string TourLink string DefaultThemeColor string DisableTeamCreation bool @@ -133,6 +136,7 @@ type Config struct { EmailSettings EmailSettings RateLimitSettings RateLimitSettings PrivacySettings PrivacySettings + ClientSettings ClientSettings TeamSettings TeamSettings SSOSettings map[string]SSOSetting } @@ -147,6 +151,8 @@ func (o *Config) ToJson() string { } var Cfg *Config = &Config{} +var CfgLastModified int64 = 0 +var ClientProperties map[string]string = map[string]string{} var SanitizeOptions map[string]bool = map[string]bool{} func FindConfigFile(fileName string) string { @@ -242,22 +248,46 @@ func LoadConfig(fileName string) { panic("Error decoding config file=" + fileName + ", err=" + err.Error()) } + if info, err := file.Stat(); err != nil { + panic("Error getting config info file=" + fileName + ", err=" + err.Error()) + } else { + CfgLastModified = info.ModTime().Unix() + } + configureLog(&config.LogSettings) Cfg = &config - SanitizeOptions = getSanitizeOptions() + SanitizeOptions = getSanitizeOptions(Cfg) + ClientProperties = getClientProperties(Cfg) } -func getSanitizeOptions() map[string]bool { +func getSanitizeOptions(c *Config) map[string]bool { options := map[string]bool{} - options["fullname"] = Cfg.PrivacySettings.ShowFullName - options["email"] = Cfg.PrivacySettings.ShowEmailAddress - options["skypeid"] = Cfg.PrivacySettings.ShowSkypeId - options["phonenumber"] = Cfg.PrivacySettings.ShowPhoneNumber + options["fullname"] = c.PrivacySettings.ShowFullName + options["email"] = c.PrivacySettings.ShowEmailAddress + options["skypeid"] = c.PrivacySettings.ShowSkypeId + options["phonenumber"] = c.PrivacySettings.ShowPhoneNumber return options } +func getClientProperties(c *Config) map[string]string { + props := make(map[string]string) + + props["Version"] = c.ServiceSettings.Version + props["SiteName"] = c.ServiceSettings.SiteName + props["ByPassEmail"] = strconv.FormatBool(c.EmailSettings.ByPassEmail) + props["ShowEmailAddress"] = strconv.FormatBool(c.PrivacySettings.ShowEmailAddress) + props["AllowPublicLink"] = strconv.FormatBool(c.TeamSettings.AllowPublicLink) + props["SegmentDeveloperKey"] = c.ClientSettings.SegmentDeveloperKey + props["GoogleDeveloperKey"] = c.ClientSettings.GoogleDeveloperKey + props["AnalyticsUrl"] = c.ServiceSettings.AnalyticsUrl + props["ProfileHeight"] = fmt.Sprintf("%v", c.ImageSettings.ProfileHeight) + props["ProfileWidth"] = fmt.Sprintf("%v", c.ImageSettings.ProfileWidth) + + return props +} + func IsS3Configured() bool { if Cfg.AWSSettings.S3AccessKeyId == "" || Cfg.AWSSettings.S3SecretAccessKey == "" || Cfg.AWSSettings.S3Region == "" || Cfg.AWSSettings.S3Bucket == "" { return false diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index 95948c8dd..92123956f 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -1,8 +1,6 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. -import {config} from '../utils/config.js'; - export default class EmailVerify extends React.Component { constructor(props) { super(props); @@ -19,10 +17,10 @@ export default class EmailVerify extends React.Component { var body = ''; var resend = ''; if (this.props.isVerified === 'true') { - title = config.SiteName + ' Email Verified'; + title = global.window.config.SiteName + ' Email Verified'; body =

Your email has been verified! Click Please verify your email address. Check your inbox for an email.

; resend = (