Skip to content

Commit

Permalink
Tracking cookie will now be set as secure=true and sameSite=none
Browse files Browse the repository at this point in the history
…if env var NODE_ENV is set to 'production'. This will fix issues with embeding Vidi and setting the cookie.
  • Loading branch information
mapcentia committed Mar 10, 2022
1 parent 8d12c6b commit 77d0044
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [CalVer](https://calver.org/).
- Added GC2 Meta option for tiled raster layer: `tiled`. If set to `true` the layer will be fetched in tiles instead of one big single tile, which is default. The layer visibility detection still works, but will be more inaccurate because of the natur of tile loading. But it will always be false visible.
- A new option in embed.js: `data-vidi-no-tracking`, which will disable the Vidi tracking cookie used for advanced functions like state-snapshots and printing.

### CHANGED
- Tracking cookie will now be set as `secure=true` and `sameSite=none` if env var NODE_ENV is set to 'production'. This will fix issues with embeding Vidi and setting the cookie.

## [2022.3.0] - 2022-4-3
### Added
- Added config setting for auto panning the map when pop-up's opens, so they don't stay outside the map: `autoPanPopup: false|true`
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,6 @@ module.exports = function (grunt) {

grunt.registerTask('default', ['prepareAssets', 'browserify:publish', 'browserify:publish_sw_dev', 'extension-css', 'shell:default', 'hogan', 'version']);
grunt.registerTask('production', ['env:prod', 'hogan', 'prepareAssets', 'browserify:publish', 'browserify:publish_sw', 'extension-css', 'shell:default', 'uglify', 'processhtml', 'cssmin:build', 'cacheBust', 'version', 'appendBuildHashToVersion']);
grunt.registerTask('production-test', ['env:prod', 'hogan', 'browserify:publish', 'browserify:publish_sw', 'extension-css', 'shell:default', 'uglify', 'processhtml', 'cssmin:build', 'cacheBust', 'version', 'appendBuildHashToVersion']);
grunt.registerTask('production-test', ['env:prod', 'browserify:publish']);
grunt.registerTask('extension-css', ['less', 'cssmin:extensions']);
};
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ class StateSnapshotsDashboard extends React.Component {

// Setting unique cookie if it have not been set yet
if (!noTracking) {
let options = {
expires: 365
}
if (process.env.NODE_ENV === "production") {
options.secure = true;
options.sameSite = 'none';
}
let trackingCookie = uuidv4();
if (cookie.get('vidi-state-tracker')) {
trackingCookie = cookie.get('vidi-state-tracker');
} else {
cookie.set('vidi-state-tracker', trackingCookie, {expires: 365});
if (!cookie.get('vidi-state-tracker')) {
cookie.set('vidi-state-tracker', trackingCookie, options);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 77d0044

Please sign in to comment.