Skip to content

Commit 5f0c4e9

Browse files
authored
Merge branch 'next' into sdk-exp-section
2 parents 0054f93 + cf0725a commit 5f0c4e9

File tree

36 files changed

+1796
-465
lines changed

36 files changed

+1796
-465
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v3
44+
uses: github/codeql-action/init@v4
4545
with:
4646
languages: ${{ matrix.language }}
4747
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,7 +52,7 @@ jobs:
5252
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5353
# If this step fails, then you should remove it and run the build manually (see below)
5454
- name: Autobuild
55-
uses: github/codeql-action/autobuild@v3
55+
uses: github/codeql-action/autobuild@v4
5656

5757
# ℹ️ Command-line programs to run using the OS shell.
5858
# 📚 https://git.io/JvXDl
@@ -66,4 +66,4 @@ jobs:
6666
# make release
6767

6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v3
69+
uses: github/codeql-action/analyze@v4

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,3 +410,13 @@ jobs:
410410
npm install
411411
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
412412
npm run cy:run:sdk
413+
414+
- name: Upload UI tests artifacts
415+
if: ${{ failure() }}
416+
shell: bash
417+
working-directory: /opt/countly/ui-tests/cypress
418+
run: |
419+
ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}_ui_test_sdk.tar.gz"
420+
mkdir -p screenshots videos
421+
tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos
422+
curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,46 @@
22
Dependencies:
33
- Remove SQLite
44

5+
## Version 25.03.25
6+
Fixes:
7+
- [crashes] Fixed resolving audit log recording
8+
- [location] Fixed updating none gps coordinate location after gps location was used
9+
-
10+
Enterprise Fixes:
11+
- [ab-testing] Add script for fixing variant cohort
12+
- [groups] Fix user permission update after updating user group permission
13+
14+
## Version 25.03.24
15+
Fixes:
16+
- [jobs] Fix condition for scheduling alert job
17+
18+
Enterprise Fixes:
19+
- [compliance-hub] Fixed query patterns
20+
- [data-manager] Fixed bug preventing transformation of events ending in a dot
21+
- [data-manager] Fixed segment data deletion
22+
- [license] Stop sending metric after license expired
23+
- [users] Fix add/remove user to profile group
24+
- [users] Remove link to profile group page after removing user from group
25+
26+
Dependencies
27+
- Bump @faker-js/faker from 10.0.0 to 10.1.0 in /ui-tests
28+
- Bump countly-sdk-nodejs from 24.10.2 to 24.10.3
29+
- Bump lint-staged from 16.2.3 to 16.2.4
30+
- Bump puppeteer from 24.23.0 to 24.24.1
31+
32+
## Version 25.03.23
33+
Fixes:
34+
- [events] Entries in the event list are now sorted alphabetically
35+
- [mail] Add smtp debug option for mail module
36+
37+
Enterprise Fixes:
38+
- [block] Fixed filter for consent events
39+
- [drill] [survey] Fix survey answer in drill
40+
- [funnels] Show notification if funnel results are from cache/task manager
41+
- [revenue] Card in revenue page are now correctly indentified
42+
- [users] Add survey section to user feedback page
43+
- [users] Fixed uploading user profile pictures
44+
545
## Version 25.03.22
646
Fixes:
747
- [alerts] Fix: Migrate alerts to the new events model

Dockerfile-core

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM phusion/baseimage:focal-1.2.0
1+
FROM phusion/baseimage:jammy-1.0.4
22

33
ARG COUNTLY_PLUGINS=mobile,web,desktop,plugins,density,locale,browser,sources,views,logger,systemlogs,populator,reports,crashes,push,star-rating,slipping-away-users,compare,server-stats,dbviewer,times-of-day,compliance-hub,alerts,onboarding,consolidate,remote-config,hooks,dashboards,sdk,data-manager,guides
44
# Countly Enterprise:
@@ -38,7 +38,7 @@ RUN useradd -r -M -U -d /opt/countly -s /bin/false countly && \
3838
libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils \
3939
# push / nghttp2
4040
gcc g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev \
41-
libevent-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools && \
41+
libevent-dev libjansson-dev libjemalloc-dev python3-dev python-setuptools && \
4242
# node
4343
wget -qO- https://deb.nodesource.com/setup_20.x | bash - && \
4444
# data_migration (mongo clients)
@@ -77,7 +77,7 @@ RUN useradd -r -M -U -d /opt/countly -s /bin/false countly && \
7777
# cleanup
7878
npm remove -y --no-save mocha nyc should supertest && \
7979
apt-get remove -y build-essential libkrb5-dev wget \
80-
gcc g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools && \
80+
gcc g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev libjemalloc-dev python3-dev python-setuptools && \
8181
apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils && \
8282
apt-get clean && \
8383
rm -rf /var/lib/apt/lists/* /tmp/* /tmp/.??* /var/tmp/* /var/tmp/.??* ~/.npm ~/.cache && \

api/parts/data/usage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ plugins.register("/sdk/user_properties", async function(ob) {
10301030

10311031
if (plugins.getConfig('api', params.app && params.app.plugins, true).city_data === true && !userProps.loc && typeof data.lat !== "undefined" && typeof data.lon !== "undefined") {
10321032
// only override lat/lon if no recent gps location exists in user document
1033-
if (!params.app_user.loc || (params.app_user.loc.gps && params.time.mstimestamp - params.app_user.loc.date > 7 * 24 * 3600)) {
1033+
if (!params.app_user.loc || !params.app_user.loc.gps || params.time.mstimestamp - params.app_user.loc.date > 7 * 24 * 3600) {
10341034
userProps.loc = {
10351035
gps: false,
10361036
geo: {
@@ -1061,7 +1061,7 @@ plugins.register("/sdk/user_properties", async function(ob) {
10611061

10621062
if (plugins.getConfig('api', params.app && params.app.plugins, true).city_data === true && !userProps.loc && data.ll && typeof data.ll[0] !== "undefined" && typeof data.ll[1] !== "undefined") {
10631063
// only override lat/lon if no recent gps location exists in user document
1064-
if (!params.app_user.loc || (params.app_user.loc.gps && params.time.mstimestamp - params.app_user.loc.date > 7 * 24 * 3600)) {
1064+
if (!params.app_user.loc || !params.app_user.loc.gps || params.time.mstimestamp - params.app_user.loc.date > 7 * 24 * 3600) {
10651065
userProps.loc = {
10661066
gps: false,
10671067
geo: {
@@ -1125,7 +1125,7 @@ plugins.register("/sdk/user_properties", async function(ob) {
11251125
userProps.av_major = null;
11261126
userProps.av_minor = null;
11271127
userProps.av_patch = null;
1128-
userProps.av_rel = null;
1128+
userProps.av_prerel = null;
11291129
userProps.av_build = null;
11301130
}
11311131
}

api/parts/jobs/job.js

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -254,32 +254,33 @@ class Job extends EventEmitter {
254254

255255
this._json.next = next.getTime();
256256
}
257-
if (this.name !== "alerts:monitor") {
258-
//check if any job already scheduled or running
259-
let query = {
260-
status: {"$in": [STATUS.SCHEDULED, STATUS.RUNNING]},
261-
name: this.name,
262-
};
263-
if (this._id) {
264-
query._id = {$ne: this._id};
265-
}
266-
var self = this;
267-
return new Promise((resolve, reject) => {
268-
Job.findMany(this.db(), query).then(existing => {
269-
if (existing && existing.length) {
270-
log.d('Job already scheduled or running: %j', existing);
271-
this._json.status = STATUS.CANCELLED; //set this as cancelled now as we have other scheduled
272-
}
273-
else {
274-
self._save().then(resolve, reject);
275-
}
276257

277-
});
278-
});
258+
//check if any job already scheduled or running
259+
let query = {
260+
status: {"$in": [STATUS.SCHEDULED, STATUS.RUNNING]},
261+
name: this.name,
262+
};
263+
264+
if (this.name === 'alerts:monitor' && this.data && Object.keys(this.data).length) {
265+
query.data = this.data;
279266
}
280-
else {
281-
return this._save();
267+
268+
if (this._id) {
269+
query._id = {$ne: this._id};
282270
}
271+
272+
var self = this;
273+
return new Promise((resolve, reject) => {
274+
Job.findMany(this.db(), query).then(existing => {
275+
if (existing && existing.length) {
276+
log.d('Job already scheduled or running: %j', existing);
277+
this._json.status = STATUS.CANCELLED; //set this as cancelled now as we have other scheduled
278+
}
279+
else {
280+
self._save().then(resolve, reject);
281+
}
282+
});
283+
});
283284
}
284285

285286
/**
@@ -1142,4 +1143,4 @@ module.exports = {
11421143
STATUS: STATUS,
11431144
STATUS_MAP: STATUS_MAP,
11441145
debounce: debounce
1145-
};
1146+
};

api/parts/mgmt/mail.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,38 @@ var mail = {},
1111
versionInfo = require('../../../frontend/express/version.info'),
1212
authorize = require('../../utils/authorizer'),
1313
config = require('../../config'),
14+
log = require('../../utils/log.js')('mail'),
15+
util = require('node:util'),
1416
ip = require('./ip.js');
1517

18+
const smtpLogger = {};
19+
20+
// Set up logger wrapper
21+
for (let level of ['trace', 'debug', 'info', 'warn', 'error', 'fatal']) {
22+
smtpLogger[level] = (data, message, ...args) => {
23+
if (args && args.length) {
24+
message = util.format(message, ...args);
25+
}
26+
if (level === 'error' || level === 'fatal') {
27+
log.e(message, data || '');
28+
}
29+
else if (level === 'warn') {
30+
log.w(message, data || '');
31+
}
32+
else if (level === 'info') {
33+
log.i(message, data || '');
34+
}
35+
else {
36+
log.d(message, data || '');
37+
}
38+
};
39+
}
40+
41+
if (config.mail && config.mail.config) {
42+
config.mail.config.logger = smtpLogger;
43+
config.mail.config.debug = true;
44+
}
45+
1646
if (config.mail && config.mail.transport && config.mail.transport !== "nodemailer-smtp-transport") {
1747
mail.smtpTransport = nodemailer.createTransport(require(config.mail.transport)(config.mail.config));
1848
}
@@ -23,7 +53,8 @@ else {
2353
mail.smtpTransport = nodemailer.createTransport({
2454
sendmail: true,
2555
newline: 'unix',
26-
path: '/usr/sbin/sendmail'
56+
path: '/usr/sbin/sendmail',
57+
logger: smtpLogger
2758
});
2859
}
2960

api/utils/pdf.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ exports.renderPDF = async function(html, callback, options = null, puppeteerArgs
4242
}
4343
const updatedTimeout = 240000;
4444
const page = await browser.newPage();
45-
45+
await page.setBypassCSP(true);
4646
page.on('console', (msg) => {
4747
log.d("Headless chrome page log", msg.text());
4848
});
@@ -74,6 +74,16 @@ exports.renderPDF = async function(html, callback, options = null, puppeteerArgs
7474
await page.setContent(html);
7575
}
7676

77+
const contentHeight = await page.evaluate(() => {
78+
/*global document*/
79+
return document.body.scrollHeight;
80+
});
81+
82+
options.width = '210mm'; // A4 width, for example
83+
options.height = `${contentHeight}px`; // full content height
84+
options.printBackground = true;
85+
options.preferCSSPageSize = true;
86+
7787
await page.pdf(options).then(callback, function(error) {
7888
log.d('pdf generation error', error);
7989
});

api/utils/render.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ exports.renderView = function(options, cb) {
6868
XDG_CONFIG_HOME: pathModule.resolve(__dirname, "../../.cache/chrome/tmp/.chromium"),
6969
XDG_CACHE_HOME: pathModule.resolve(__dirname, "../../.cache/chrome/tmp/.chromium")
7070
},
71-
args: ['--no-sandbox', '--disable-setuid-sandbox', '--ignore-certificate-errors'],
71+
args: ['--no-sandbox', '--disable-setuid-sandbox', '--ignore-certificate-errors', '--disable-web-security'],
7272
ignoreHTTPSErrors: true,
7373
userDataDir: pathModule.resolve(__dirname, "../../dump/chrome/" + Date.now())
7474
};
@@ -82,6 +82,7 @@ exports.renderView = function(options, cb) {
8282
try {
8383
log.d('Started rendering images');
8484
var page = await browser.newPage();
85+
await page.setBypassCSP(true);
8586

8687
page.on('console', (msg) => {
8788
log.d("Headless chrome page log", msg.text());

bin/docker/modify.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,26 @@ if [ "${COUNTLY_CONTAINER}" != "frontend" ]; then
1717
# Run ab-testing models compilation if it's there
1818
if [ -d /opt/countly/plugins/ab-testing ]; then
1919
if [ "${ID}" == "debian" ] || [ "${ID}" == "ubuntu" ]; then
20-
apt-get install -y python3-pip
20+
echo "Debian noninteractive"
21+
export DEBIAN_FRONTEND=noninteractive
22+
export TZ=Etc/UTC
23+
24+
apt-get -y update
25+
apt-get install -y software-properties-common build-essential python3-dev libncurses*-dev libsqlite3-dev libreadline6-dev libgdbm-dev zlib1g-dev libbz2-dev sqlite3 tk-dev zip libssl-dev libncurses5-dev liblzma-dev lsb-core lsb-release
26+
27+
export LC_ALL="en_US.UTF-8"
28+
export LC_CTYPE="en_US.UTF-8"
29+
export -n CC
30+
export -n CXX
31+
add-apt-repository -y ppa:deadsnakes/ppa
32+
apt -y install python3.12 python3.12-dev
33+
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
34+
python3.12 get-pip.py
2135
else
2236
yum install -y python36 python36-libs python36-devel python36-pip
2337
fi
38+
ln -s /usr/bin/python3 /usr/bin/python
2439
# shellcheck disable=SC1091
25-
python3.8 -m pip install -r /opt/countly/plugins/ab-testing/api/bayesian/requirements.txt
26-
cd /opt/countly/plugins/ab-testing/api/bayesian && python3.8 model.py
40+
python3.12 -m pip install -r "/opt/countly/plugins/ab-testing/api/bayesian/requirements_docker.txt" && sudo python3.12 "/opt/countly/plugins/ab-testing/api/bayesian/models/cmdstanpy_model.py"
2741
fi
2842
fi

0 commit comments

Comments
 (0)