diff --git a/.gitignore b/.gitignore index 4f697dab..b48b6dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ debug *.crt Dockerfile container.sh +make.sh diff --git a/app/app/components/folder/documents-list.js b/app/app/components/folder/documents-list.js index ebc4cba3..05932992 100644 --- a/app/app/components/folder/documents-list.js +++ b/app/app/components/folder/documents-list.js @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com @@ -16,6 +16,7 @@ export default Ember.Component.extend({ didReceiveAttrs() { this.set('selectedDocuments', []); + this.audit.record('viewed-space'); }, actions: { @@ -38,4 +39,4 @@ export default Ember.Component.extend({ this.get('onDocumentsChecked')(list); } } -}); \ No newline at end of file +}); diff --git a/app/app/index.html b/app/app/index.html index b8d00835..9ef9630b 100644 --- a/app/app/index.html +++ b/app/app/index.html @@ -1,6 +1,5 @@ - {{content-for 'head'}} @@ -14,43 +13,9 @@ - {{content-for 'head-footer'}} - + + {{content-for 'head-footer'}} - {{content-for 'body'}} @@ -62,5 +27,4 @@ {{content-for 'body-footer'}} - - \ No newline at end of file + diff --git a/app/app/services/audit.js b/app/app/services/audit.js index 7bb98016..8bc5d2cc 100644 --- a/app/app/services/audit.js +++ b/app/app/services/audit.js @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com @@ -17,6 +17,7 @@ export default Ember.Service.extend({ sessionService: Ember.inject.service('session'), ready: false, enabled: config.APP.auditEnabled, + appId: config.APP.intercomKey, init() { this.start(); @@ -42,16 +43,14 @@ export default Ember.Service.extend({ start() { let session = this.get('sessionService'); - if (!this.get('enabled') || !session.authenticated || this.get('ready')) { + if (this.get('appId') === "" || !this.get('enabled') || !session.authenticated || this.get('ready')) { return; } this.set('ready', true); - let appId = config.environment === 'production' ? 'c6cocn4z' : 'itgvb1vo'; - window.intercomSettings = { - app_id: appId, + app_id: this.get('appId'), name: session.user.firstname + " " + session.user.lastname, email: session.user.email, user_id: session.user.id, @@ -72,4 +71,4 @@ export default Ember.Service.extend({ window.Intercom('boot', window.intercomSettings); }, -}); \ No newline at end of file +}); diff --git a/app/app/styles/view/page-documents.scss b/app/app/styles/view/page-documents.scss index 60f57640..6d238821 100644 --- a/app/app/styles/view/page-documents.scss +++ b/app/app/styles/view/page-documents.scss @@ -48,27 +48,28 @@ } .documents-list { - // @extend .cards-list; - margin-top: 35px; + margin: 35px 0; > .document { - margin: 10px 10px; - padding: 10px 20px; + margin: 0; + padding: 20px 20px 25px 20px; width: 100%; position: relative; - border: 1px solid transparent; + border-bottom: 1px solid $color-gray2; + transition: .3s; &:hover { > .link { > .title { color: $color-link; } - + > .snippet { - color: $color-off-black; + // color: $color-off-black; + color: $color-gray; } } - + > .checkbox { display: block; } @@ -77,7 +78,7 @@ > .checkbox { position: absolute; display: none; - top: 2px; + top: 5px; right: 12px; cursor: pointer; @@ -98,13 +99,13 @@ text-decoration: none; color: $color-off-black; } - + > .title { font-size: 16px; font-weight: bold; margin-bottom: 8px; } - + > .snippet { color: $color-gray; font-size: 13px; @@ -136,8 +137,7 @@ > .selected-card { background-color: $color-card-active !important; - border: 1px solid $color-link !important; - transition: 0.2s all ease; + border-bottom: 1px solid $color-link !important; > .checkbox { display: block; @@ -178,19 +178,19 @@ margin-top: 100px; text-align: center; opacity: 0.4; - + > .box { padding: 35px; - width: 300px; + width: 300px; display: inline-block; margin: 0 20px; - + > .message { font-size: 14px; color: $color-off-black; margin-top: 20px; } - + > .regular-button { cursor: default !important; } diff --git a/app/config/environment.js b/app/config/environment.js index 564eeea7..d39cbe3c 100644 --- a/app/config/environment.js +++ b/app/config/environment.js @@ -30,10 +30,18 @@ module.exports = function(environment) { }, APP: { // Allows to disable audit service in tests - auditEnabled: true + auditEnabled: true, + intercomKey: "" } }; + process.argv.forEach(function(element){ + if (element.startsWith("intercom=")) { + element = element.replace("intercom=", ""); + ENV.APP.intercomKey = element; + } + }); + if (environment === 'development') { ENV.APP.LOG_TRANSITIONS = true; ENV.APP.LOG_TRANSITIONS_INTERNAL = true; @@ -42,7 +50,7 @@ module.exports = function(environment) { }; ENV.apiHost = "https://localhost:5001"; - // ENV.apiHost = "https://demo1.dev:5001"; + ENV.apiHost = "https://demo1.dev:5001"; } if (environment === 'test') { @@ -76,23 +84,5 @@ module.exports = function(environment) { ENV.apiNamespace = "api"; ENV.contentSecurityPolicy = null; - // ENV.contentSecurityPolicy = { - // 'img-src': "'self' data: self https://js.intercomcdn.com", - // 'font-src': "'self' data: fonts.gstatic.com", - // 'style-src': "'self' 'unsafe-inline' fonts.googleapis.com", - // 'script-src': "'self' https://widget.intercom.io https://js.intercomcdn.com " + ENV.apiHost, - // 'connect-src': "'self' " + ENV.apiHost + " https://api-ping.intercom.io https://nexus-websocket-a.intercom.io https://nexus-websocket-b.intercom.io wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io https://api-iam.intercom.io", - // 'default-src': "none" - // }; - - // ENV.contentSecurityPolicy = { - // 'img-src': "'self' data: self", - // 'font-src': "'self' *", - // 'style-src': "'self' *", - // 'script-src': "'self' *", - // 'connect-src': "'self' *", - // 'default-src': "*" - // }; - return ENV; -}; \ No newline at end of file +}; diff --git a/app/lib/.jshintrc b/app/lib/.jshintrc new file mode 100644 index 00000000..839c191f --- /dev/null +++ b/app/lib/.jshintrc @@ -0,0 +1,4 @@ +{ + "node": true, + "browser": false +} diff --git a/app/lib/intercom/index.js b/app/lib/intercom/index.js new file mode 100644 index 00000000..5bec580d --- /dev/null +++ b/app/lib/intercom/index.js @@ -0,0 +1,56 @@ +/*jshint node:true*/ +module.exports = { + name: 'intercom', + + contentFor: function(type, config) { + // Not using Intercom for app activity logging? + if (!config.APP.auditEnabled) { + return ''; + } + + var appId = config.APP.intercomKey; + + if ('head-footer' === type && appId.length > 0) { + return ` + + `; + } + }, + + isDevelopingAddon: function() { + return true; + } +}; diff --git a/app/lib/intercom/package.json b/app/lib/intercom/package.json new file mode 100644 index 00000000..cdf12d87 --- /dev/null +++ b/app/lib/intercom/package.json @@ -0,0 +1,6 @@ +{ + "name": "intercom", + "keywords": [ + "ember-addon" + ] +} diff --git a/app/package.json b/app/package.json index afab26ad..901027f9 100644 --- a/app/package.json +++ b/app/package.json @@ -40,5 +40,10 @@ "ember-load-initializers": "^0.5.1", "ember-resolver": "^2.0.3", "loader.js": "^4.0.1" + }, + "ember-addon": { + "paths": [ + "lib/intercom" + ] } -} +} \ No newline at end of file diff --git a/app/tests/helpers/stub-audit.js b/app/tests/helpers/stub-audit.js index 2ec9137b..94639cf7 100644 --- a/app/tests/helpers/stub-audit.js +++ b/app/tests/helpers/stub-audit.js @@ -21,12 +21,9 @@ const Audit = Ember.Service.extend({ return id; - // Intercom('trackEvent', id); //jshint ignore: line - // Intercom('update'); //jshint ignore: line }, stop() { - // Intercom('shutdown'); //jshint ignore: line }, start() { @@ -37,31 +34,6 @@ const Audit = Ember.Service.extend({ } this.set('ready', true); - - // let appId = config.environment === 'production' ? 'c6cocn4z' : 'itgvb1vo'; - - // window.intercomSettings = { - // app_id: appId, - // name: session.user.firstname + " " + session.user.lastname, - // email: session.user.email, - // user_id: session.user.id, - // "administrator": session.user.admin, - // company: - // { - // id: session.get('appMeta.orgId'), - // name: session.get('appMeta.title').string, - // "domain": netUtil.getSubdomain(), - // "version": session.get('appMeta.version') - // } - // }; - // - // if (!session.get('isMobile')) { - // window.intercomSettings.widget = { - // activator: "#IntercomDefaultWidget" - // }; - // } - // - // window.Intercom('boot', window.intercomSettings); }, }); diff --git a/build.sh b/build.sh index 17ab229f..138c8062 100755 --- a/build.sh +++ b/build.sh @@ -3,9 +3,13 @@ NOW=$(date) echo "Build process started $NOW" +# First parameter to this script is the Intercom.io key for audit logging. +# This is optional and we use Intercom to record user activity and provider in-app support via messaging. +intercomKey="$1" + echo "Building Ember assets..." cd app -ember b -o dist-prod/ --environment=production +ember b -o dist-prod/ --environment=production intercom=$intercomKey echo "Copying Ember assets..." cd .. @@ -33,8 +37,8 @@ go generate echo "Compiling app..." cd ../.. -for arch in amd64 386 ; do - for os in darwin linux windows ; do +for arch in amd64 386 ; do + for os in darwin linux windows ; do if [ "$os" == "windows" ] ; then echo "Compiling documize-$os-$arch.exe" env GOOS=$os GOARCH=$arch go build -o bin/documize-$os-$arch.exe ./documize diff --git a/documize/api/endpoint/label_endpoint.go b/documize/api/endpoint/label_endpoint.go index 877fd05e..b92cc0d5 100644 --- a/documize/api/endpoint/label_endpoint.go +++ b/documize/api/endpoint/label_endpoint.go @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com @@ -687,11 +687,11 @@ func InviteToFolder(w http.ResponseWriter, r *http.Request) { if len(user.RefID) > 0 { // Ensure they have access to this organization - accounts, err := p.GetUserAccounts(user.RefID) + accounts, err2 := p.GetUserAccounts(user.RefID) - if err != nil { + if err2 != nil { log.IfErr(tx.Rollback()) - writeGeneralSQLError(w, method, err) + writeGeneralSQLError(w, method, err2) return } diff --git a/documize/api/endpoint/router.go b/documize/api/endpoint/router.go index cff57989..75dbff99 100644 --- a/documize/api/endpoint/router.go +++ b/documize/api/endpoint/router.go @@ -30,7 +30,7 @@ const ( // AppVersion does what it says // Versioning scheme major.minor where "minor" is optional // e.g. 1, 2, 3, 4.1, 4.2, 5, 6, 7, 7.1, 8, 9, 10, ..... 127, 127.1, 128 - AppVersion = "12.5" + AppVersion = "12.6" ) var port, certFile, keyFile, forcePort2SSL string diff --git a/documize/api/endpoint/sections_endpoint.go b/documize/api/endpoint/sections_endpoint.go index 7da018e8..bdd163f5 100644 --- a/documize/api/endpoint/sections_endpoint.go +++ b/documize/api/endpoint/sections_endpoint.go @@ -117,10 +117,10 @@ func RefreshSections(w http.ResponseWriter, r *http.Request) { for _, pm := range meta { // Grab the page because we need content type and - page, err := p.GetPage(pm.PageID) + page, err2 := p.GetPage(pm.PageID) - if err != nil { - writeGeneralSQLError(w, method, err) + if err2 != nil { + writeGeneralSQLError(w, method, err2) log.IfErr(tx.Rollback()) return }