Skip to content

Commit 4a07807

Browse files
authored
Merge pull request #13 from Countly/next
Next
2 parents 6aadb4c + 4ad1e13 commit 4a07807

File tree

602 files changed

+47656
-10137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

602 files changed

+47656
-10137
lines changed

.eslintignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ frontend/express/public/javascripts/min/**
55
frontend/express/public/javascripts/utils/**
66
frontend/express/public/javascripts/visualization/**
77
frontend/express/public/themes/**
8+
frontend/express/public/sdk/**
89
plugins/*/frontend/public/*
910
plugins/*/frontend/public/javascripts/*
1011
bin/scripts/nghttp2/*
1112
plugins/push/api/parts/apn/*
1213

1314
!plugins/*/frontend/public/javascripts
14-
!plugins/*/frontend/public/javascripts/countly.models.js
15-
!plugins/*/frontend/public/javascripts/countly.views.js
15+
!plugins/*/frontend/public/javascripts/countly.*.js

.eslintrc.json

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "eslint:recommended",
33
"rules": {
4+
"require-atomic-updates": "off",
45
"block-spacing": [
56
"error",
67
"always"
@@ -28,10 +29,7 @@
2829
"error",
2930
"all"
3031
],
31-
"eol-last": [
32-
"error",
33-
"never"
34-
],
32+
"eol-last": "off",
3533
"func-call-spacing": [
3634
"error",
3735
"never"
@@ -126,8 +124,7 @@
126124
{
127125
"files": [
128126
"frontend/express/public/javascripts/countly/*.js",
129-
"plugins/*/frontend/public/javascripts/countly.models.js",
130-
"plugins/*/frontend/public/javascripts/countly.views.js"
127+
"plugins/*/frontend/public/javascripts/countly.*.js"
131128
],
132129
"env": {
133130
"browser": true
@@ -197,14 +194,15 @@
197194
"frontend/express/libs/*.js",
198195
"plugins/pluginManager.js",
199196
"plugins/*/api/**/*.js",
200-
"plugins/*/frontend/*.js"
197+
"plugins/*/frontend/*.js",
198+
"plugins/*/extend/*.js"
201199
],
202200
"env": {
203201
"es6": true,
204202
"node": true
205203
},
206204
"parserOptions": {
207-
"ecmaVersion": 2017
205+
"ecmaVersion": 9
208206
},
209207
"rules": {
210208
"no-console": "off",
@@ -281,7 +279,7 @@
281279
"node": true
282280
},
283281
"parserOptions": {
284-
"ecmaVersion": 2017
282+
"ecmaVersion": 9
285283
},
286284
"rules": {
287285
"no-console": "off"
@@ -299,7 +297,7 @@
299297
"mocha": true
300298
},
301299
"parserOptions": {
302-
"ecmaVersion": 2017
300+
"ecmaVersion": 9
303301
},
304302
"rules": {
305303
"no-console": "off",

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
language: nodejs
2-
node_js: "8"
2+
dist: trusty
3+
node_js: "10"
34
env:
45
global:
5-
- MONGODB=3.6.6
6+
- MONGODB=4.0.12
67
- secure: ZXdUMP+8Nk9Kd5nX31D/DIB1t2xlJd+T4W7umWjwpy+KPA9d1W1OhUG6V2Gpv3PsJf+UtMosgZsywcLFVG4l/WcjAhs3c9pegW5ZRYAEfVjkk7aHhWQGvj5DID8iAAxs91Mm8LwJ43o68x+XN6746zArPqcVzQltDunJ0G3gfh8=
78
branches:
89
except:

CHANGELOG.md

+129
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,132 @@
1+
## Version 19.08
2+
3+
**Fixes**
4+
* [api] fixed error on deleting user with exported data
5+
* [api] improved tops speed with aggregation pipeline
6+
* [app_versions] fixing displaying empty state
7+
* [assistant] handling case, when document could not be read
8+
* [browser] correctly convert metric to collection for correct data
9+
* [configs] display correct values in app configuration after save
10+
* [events] fixed event overview incorrectly formats duration
11+
* [frontend] added configuration element for google maps api key
12+
* [frontend] correct event total calculation for segmented view of aggregated data
13+
* [frontend] fixed Drop throws error when datatable is empty
14+
* [frontend] fixed japanese locale dates
15+
* [frontend] fixed refreshing total user correction for today
16+
* [frontend] reduced session extend calls.
17+
* [loyalty] fix table ordering
18+
* [push] Correct system log on push credentials update error
19+
* [push] Fixing populator creating messages for wrong app
20+
* [slipping-away] fix fetch user list bug
21+
* [source] fixed localization key in configs
22+
* [star-rating] lots of bug and ui fixes
23+
* [ui] Fixing expand row icon switches on refresh
24+
* [ui] changed email reports % colors.
25+
* [ui] disabling annoying chrome autocomplete
26+
* [ui] fix bug with Ubuntu font on Windows
27+
* [ui] prevent double scrolling
28+
* [ui] set app title attribute when switching apps
29+
* [ui] users and new users country sorting problem resolved
30+
* [views] fixes with tokens expiring when viewing heatmaps
31+
32+
**Enterprise fixes**
33+
* [attribution] encode link if it is not a custom scheme
34+
* [attribution] fixed using last campaign urls when creating new campaign
35+
* [block] fixed creating empty users for new blocked users
36+
* [cohorts] fixed editing cohorts with big lists
37+
* [cohorts] handle empy user sets correctly and more efficiently
38+
* [dashboards] block all popups for dashboard image rendering in emails
39+
* [dashboards] fixed sending email reports if creator is deleted
40+
* [dashboards] improve screenshot rendering speed with cache for emails
41+
* [drill] actions button avaialble without query
42+
* [drill] better bucket and value selection for report manager data
43+
* [drill] big list values are not selected when replaying query bugfix
44+
* [drill] cohorts querying fixes
45+
* [drill] correct user count for multi BY queries
46+
* [drill] fixed generating month ticks for more than 1 year
47+
* [drill] query performance improved with new indexes
48+
* [flows] fix flows logic bug about app data clearing
49+
* [flows] fix views event logic bug
50+
* [funnels] allow to create funnels without events but with views
51+
* [funnels] fixed editing funnels with grouping elements
52+
* [funnels] top percentage update bug fixed
53+
* [groups] add uppercase to allowed characters for name and group id
54+
* [revenue] fix updating overview widget on period changes
55+
* [whitelabeling] replacement of word Countly with company name in all localized strings
56+
57+
**New Features**
58+
* [api] allow updating multiple app users
59+
* [applications] application lock mechanism
60+
* [authorization] tokens now support url parameters as limits
61+
* [crashes] multi thread error support
62+
* [crashes] new crash stack processing for android and javascript
63+
* [crashes] new dropdown menu UI in crash groups
64+
* [dbviewer] added custom field support to dbviewer sort
65+
* [events] display top events for event overview
66+
* [frontend] option to delete your own account
67+
* [plugins] asynchronously check plugin enabling/disabling procedure
68+
* [push] Adding push events to user’s timeline
69+
* [push] allow building target audience just before scheduled date
70+
* [push] option to view recipients of a push
71+
* [push] proxy authentication support
72+
* [push] real-time event triggered push notifications
73+
* [report-manager] smarter more often regenerating automatic reports
74+
* [security] added password secret salt support in configuration file
75+
* [slipping-away-users] add flexible periods setting support
76+
* [two-factor-auth] enable two factor authentication through Microsoft or Google authenticator apps
77+
* [ui] added native tab behaivor to cly-select element
78+
* [ui] allow uploading dashboard profile pictures
79+
* [ui] customize graph colors through config file
80+
* [ui] moved some management tools to top menu
81+
* [ui] new graph note system
82+
* [ui] new menu design
83+
* [ui] new prelogin page design
84+
* [views] select columns to display functionality
85+
86+
**New Enterprise Features**
87+
* [ab-testing] new plugin to perform AB testing
88+
* [attribution] allow providing custom domain for campaign links
89+
* [attribution] allow reattribution
90+
* [concurrent_users] new and more performant and detailed version of live plugin
91+
* [crash_symbolication] support for native crashes and symbolication
92+
* [crashes-jira] plugin to tie caught crashes with JIRA issues
93+
* [drill] make Drill configuration on app level
94+
* [formulas] new plugin to perform arithmetical computations on selected metrics
95+
* [funnels] allow sorting steps by drag and drop when editing funnels
96+
* [geo] Allowing float as geo radius
97+
* [users] added region support
98+
* [users] select columns to display functionality
99+
100+
**Development related**
101+
* [api] moved account deletion to backend api.
102+
* [api] provide cancel request on app not exists
103+
* [api] refactored getPeriodObj
104+
* [cmd] added new upgrade subcommands for automatic multiple version upgrades
105+
* [cmd] script to upgrade countly to ee
106+
* [cmd] use password prompt to mask sensitive data
107+
* [common] add email for validation
108+
* [configs] improved config parsing and usage
109+
* [configs] more session and cookie settings in config file
110+
* [core] Increasing default heap size to 2Gb for API
111+
* [crashes] make crash identification model independent
112+
* [db] log incorrect Object ID to info level
113+
* [example] AWS SES - Simple Email Service example
114+
* [example] nginx example config of blocking access outside intranet
115+
* [frontend] redirect rather than render on POST processing
116+
* [frontend] replaced old google library loader with new version
117+
* [frontend] set cookie only when theme is customizable on user level
118+
* [frontend] trust estimation correction more than new users data
119+
* [members] moved all member functions to single separate members utility
120+
* [scripts] allow countly user to enable plugins
121+
* [scripts] correctly backup nginx config on ubuntu
122+
* [scripts] update_translation.js perfs and reliability boost
123+
* [security] HTML escaping in all localized strings
124+
* [security] remove flash cross domain policy
125+
* [taskmanager] no need to decode html (breaks json parsing)
126+
* [tests] additional way to parse CSRF from body in case of minified html
127+
* [ui] new menu management system
128+
* [ui] updated font awesome lib
129+
1130
## Version 19.02.1
2131

3132
**Fixes**

Gruntfile.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ module.exports = function(grunt) {
5555
'frontend/express/public/javascripts/utils/vue.min.js',
5656
'frontend/express/public/javascripts/utils/jquery.xss.js',
5757
'frontend/express/public/javascripts/countly/countly.common.js',
58-
'frontend/express/public/javascripts/utils/simpleUpload.min.js'
58+
'frontend/express/public/javascripts/utils/simpleUpload.min.js',
59+
'frontend/express/public/javascripts/utils/jsoneditor/codemirror.js',
60+
'frontend/express/public/javascripts/utils/jsoneditor/javascript.js',
61+
'frontend/express/public/javascripts/utils/jsoneditor/json2.js',
62+
'frontend/express/public/javascripts/utils/jsoneditor/jsonlint.js',
63+
'frontend/express/public/javascripts/utils/jsoneditor/minify.json.js',
64+
'frontend/express/public/javascripts/utils/jsoneditor/jsoneditor.js',
65+
'frontend/express/public/javascripts/utils/Sortable.min.js',
66+
'frontend/express/public/javascripts/utils/vuedraggable.umd.min.js'
5967
],
6068
dest: 'frontend/express/public/javascripts/min/countly.utils.concat.js'
6169
},
@@ -127,6 +135,7 @@ module.exports = function(grunt) {
127135
'frontend/express/public/stylesheets/main.css',
128136
'frontend/express/public/stylesheets/amaranjs/amaran.min.css',
129137
'frontend/express/public/stylesheets/selectize/selectize.css',
138+
'frontend/express/public/stylesheets/jsoneditor/codemirror.css',
130139
'frontend/express/public/javascripts/dom/tipsy/tipsy.css',
131140
'frontend/express/public/javascripts/visualization/rickshaw/rickshaw.min.css',
132141
'frontend/express/public/javascripts/dom/pace/pace-theme-flash.css',

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<p align="right">
55

6-
[![Build Status](https://api.travis-ci.org/Countly/countly-server.png?branch=master)](https://travis-ci.org/Countly/countly-server) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/98c2726f2d734697a5f1ac0d453f0a06)](https://app.codacy.com/app/ar2rsawseen/countly-server?utm_source=github.com&utm_medium=referral&utm_content=Countly/countly-server&utm_campaign=Badge_Grade_Dashboard) [![Install Countly on DigitalOcean](https://do.count.ly/button.svg?v2)](http://do.count.ly)
6+
[![Build Status](https://api.travis-ci.org/Countly/countly-server.png?branch=master)](https://travis-ci.org/Countly/countly-server) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/98c2726f2d734697a5f1ac0d453f0a06)](https://app.codacy.com/app/ar2rsawseen/countly-server?utm_source=github.com&utm_medium=referral&utm_content=Countly/countly-server&utm_campaign=Badge_Grade_Dashboard) [![Install Countly on DigitalOcean](https://count.ly/github/install-on-digital-ocean.svg)](http://do.count.ly)
77

88
</p>
99

@@ -118,7 +118,7 @@ There are several ways to install Countly:
118118

119119
1. The following command will download and install Countly on your **Ubuntu** or **CentOS** server.
120120

121-
`wget -qO- http://c.ly/install | bash`
121+
`wget -qO- https://c.ly/install | bash`
122122

123123
2. If you have a Digital Ocean account, [click here and install on Digital Ocean](http://do.count.ly) with a single click.
124124

api/api.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const common = require('./utils/common.js');
1111
const {processRequest} = require('./utils/requestProcessor');
1212
const versionInfo = require('../frontend/express/version.info');
1313
const frontendConfig = require('../frontend/express/config.js');
14+
const {CacheMaster, CacheWorker} = require('./parts/data/cache.js');
1415

1516
var t = ["countly:", "api"];
1617

@@ -207,6 +208,12 @@ const passToMaster = (worker) => {
207208
};
208209

209210
if (cluster.isMaster) {
211+
common.cache = new CacheMaster(common.db);
212+
common.cache.start().then(plugins.dispatch.bind(plugins, '/cache/init', {}), e => {
213+
console.log(e);
214+
process.exit(1);
215+
});
216+
210217
const workerCount = (countlyConfig.api.workers)
211218
? countlyConfig.api.workers
212219
: os.cpus().length;
@@ -231,17 +238,22 @@ if (cluster.isMaster) {
231238

232239
// Allow configs to load & scanner to find all jobs classes
233240
setTimeout(() => {
241+
jobs.job('api:topEvents').replace().schedule('every 1 day');
234242
jobs.job('api:ping').replace().schedule('every 1 day');
235243
jobs.job('api:clear').replace().schedule('every 1 day');
236244
jobs.job('api:clearTokens').replace().schedule('every 1 day');
237-
jobs.job('api:task').replace().schedule('every 59 mins starting on the 59 min');
245+
jobs.job('api:task').replace().schedule('every 1 hour on the first min');
238246
jobs.job('api:userMerge').replace().schedule('every 1 hour on the 10th min');
239247
}, 10000);
240248
}
241249
else {
242250
console.log("Starting worker", process.pid, "parent:", process.ppid);
243251
const taskManager = require('./utils/taskmanager.js');
244252
common.db = plugins.dbConnection(countlyConfig);
253+
254+
common.cache = new CacheWorker(common.db);
255+
common.cache.start();
256+
245257
//since process restarted mark running tasks as errored
246258
taskManager.errorResults({db: common.db});
247259

@@ -291,7 +303,7 @@ else {
291303
const headers = {};
292304
headers["Access-Control-Allow-Origin"] = "*";
293305
headers["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS";
294-
headers["Access-Control-Allow-Headers"] = "countly-token";
306+
headers["Access-Control-Allow-Headers"] = "countly-token, Content-Type";
295307
res.writeHead(200, headers);
296308
res.end();
297309
}

api/jobs/ping.js

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class PingJob extends job.Job {
5959
timestamp: Math.floor(date.getTime() / 1000),
6060
hour: date.getHours(),
6161
dow: date.getDay(),
62+
no_meta: true,
6263
events: JSON.stringify([
6364
{
6465
key: "PING",

api/jobs/task.js

+33-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const job = require('../parts/jobs/job.js'),
55
Promise = require("bluebird");
66
const common = require('../utils/common.js');
77
const taskmanager = require('../utils/taskmanager.js');
8-
const moment = require('moment');
98

109
/**
1110
* Task Monitor Job extend from Countly Job
@@ -18,14 +17,44 @@ class MonitorJob extends job.Job {
1817
*/
1918
run(db, done) {
2019
const self = this;
21-
const targetHour = (new moment()).hours();
20+
/**
21+
* Filter tasks to run base on job run time
22+
* @param {object} task object from db
23+
* @return {boolean} return true if can run now
24+
*/
25+
function tasksFilter(task) {
26+
if (task.status === 'running' || task.status === 'rerunning') {
27+
return false;
28+
}
29+
const lastStart = task.start || 0;
30+
const lastEnd = task.end || 0;
31+
const now = Date.now();
32+
const duration = lastEnd - lastStart;
33+
if (duration <= 60 * 1000 && duration >= 0) {
34+
return true;
35+
}
36+
if (duration <= 10 * 60 * 1000 && now - lastEnd >= 2 * 60 * 60 * 1000) {
37+
return true;
38+
}
39+
if (duration <= 30 * 60 * 1000 && now - lastEnd >= 4 * 60 * 60 * 1000) {
40+
return true;
41+
}
42+
if (duration <= 60 * 60 * 1000 && now - lastEnd >= 12 * 60 * 60 * 1000) {
43+
return true;
44+
}
45+
if (duration > 60 * 60 * 1000 && now - lastEnd >= 24 * 60 * 60 * 1000) {
46+
return true;
47+
}
48+
return false;
49+
}
50+
2251
common.db.collection("long_tasks").find({
2352
autoRefresh: true,
24-
r_hour: targetHour
2553
}).toArray(function(err, tasks) {
2654
log.d('Running Task Monitor Job ....');
2755
log.d("job info:", self._json, tasks);
28-
tasks.forEach((task)=>{
56+
const filteredTasks = tasks.filter(tasksFilter);
57+
filteredTasks.forEach((task) => {
2958
return Promise.coroutine(function *() { // eslint-disable-line require-yield
3059
try {
3160
taskmanager.rerunTask({

0 commit comments

Comments
 (0)