Skip to content

Commit 333a129

Browse files
authored
Merge pull request #24 from ngageoint/matomo
Adding Matomo
2 parents bd564f1 + 2aabc87 commit 333a129

File tree

28 files changed

+690
-428
lines changed

28 files changed

+690
-428
lines changed

BUILD.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Windows
44
* Install Visual Studio 19 w/ Desktop development with C++ workload
55
* Install Python 2.7
6-
* Install Node 18.13.0
6+
* Install Node 18.17.0
77
* Install Git for windows
88
* Install GTK+ (version 2.22.1, do NOT get version 3)
99
* Install libjpeg-turbo64
@@ -184,8 +184,10 @@ Software source code previously released under an open source license and then m
184184
# Releasing a New Version
185185
1. Update package.json version
186186
2. Add a changelog file for the version describing new features added and bugs fixed
187-
3. Commit changes
188-
4. Tag version
189-
5. Build windows, linux and mac installers
190-
6. Notarize mac installers
191-
7. Create release on github for the new version and upload all the installer files
187+
3. Enable Matomo in env
188+
4. Commit changes
189+
5. Tag version
190+
6. Build windows, linux and mac installers
191+
7. Notarize mac installers
192+
8. Create release on github for the new version and upload all the installer files
193+
9. You'll need to generate builds for all different environments in order to have the correct matomo urls

changelog/v1.6.2.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# MapCache Desktop - v1.6.2
2+
3+
Patch release 1.6.2
4+
5+
## New Features
6+
* Matomo user metrics logging added'
7+
* Consent banner added
8+
9+
10+
## Bug Fixes
11+
* Fixed shp file import'
12+
13+
## Previous Versions
14+
* [v1.6.1](https://github.com/ngageoint/mapcache-electron/blob/v1.6.1/changelog/v1.6.1.md)
15+
* [v1.6.0](https://github.com/ngageoint/mapcache-electron/blob/v1.6.0/changelog/v1.6.0.md)
16+
* [v1.5.1](https://github.com/ngageoint/mapcache-electron/blob/v1.5.1/changelog/v1.5.1.md)
17+
* [v1.5.0](https://github.com/ngageoint/mapcache-electron/blob/v1.5.0/changelog/v1.5.0.md)
18+
* [v1.4.0](https://github.com/ngageoint/mapcache-electron/blob/v1.4.0/changelog/v1.4.0.md)
19+
* [v1.3.1](https://github.com/ngageoint/mapcache-electron/blob/v1.3.1/changelog/v1.3.1.md)
20+
* [v1.3.0](https://github.com/ngageoint/mapcache-electron/blob/v1.3.0/changelog/v1.3.0.md)
21+
* [v1.2.0](https://github.com/ngageoint/mapcache-electron/blob/v1.2.0/changelog/v1.2.0.md)
22+
* [v1.1.1](https://github.com/ngageoint/mapcache-electron/blob/v1.1.1/changelog/v1.1.1.md)
23+
* [v1.1.0](https://github.com/ngageoint/mapcache-electron/blob/v1.1.0/changelog/v1.1.0.md)
24+
* [v1.0.9](https://github.com/ngageoint/mapcache-electron/blob/v1.0.9/changelog/v1.0.9.md)
25+
* [v1.0.8](https://github.com/ngageoint/mapcache-electron/blob/v1.0.8/changelog/v1.0.8.md)
26+
* [v1.0.7](https://github.com/ngageoint/mapcache-electron/blob/v1.0.7/changelog/v1.0.7.md)
27+
* [v1.0.6](https://github.com/ngageoint/mapcache-electron/blob/v1.0.6/changelog/v1.0.6.md)
28+
* [v1.0.5](https://github.com/ngageoint/mapcache-electron/blob/v1.0.5/changelog/v1.0.5.md)
29+
* [v1.0.4](https://github.com/ngageoint/mapcache-electron/blob/v1.0.5/changelog/v1.0.4.md)
30+
* [v1.0.3](https://github.com/ngageoint/mapcache-electron/blob/v1.0.5/changelog/v1.0.3.md)

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mapcache",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"description": "Desktop Electron app to create GeoPackages from geospatial data sources.",
55
"author": "Christopher Caldwell <c.caldwell90@gmail.com> (https://github.com/caldwellc)",
66
"scripts": {
@@ -67,6 +67,7 @@
6767
"sanitize-html": "^2.7.0",
6868
"sax": "^1.2.4",
6969
"sharp": "0.32.6",
70+
"shpjs": "4.0.4",
7071
"sortablejs": "^1.15.0",
7172
"stream-chain": "^2.2.5",
7273
"stream-json": "^1.8.0",
@@ -75,6 +76,7 @@
7576
"uuid": "^9.0.0",
7677
"vector-tile": "^1.3.0",
7778
"vue": "^3.3.4",
79+
"vue-matomo": "^4.2.0",
7880
"vue-observe-visibility": "^1.0.0",
7981
"vue-router": "^4.2.2",
8082
"vuetify": "3.5.12",
@@ -97,7 +99,8 @@
9799
"better-sqlite3": "8.4.0",
98100
"bindings": "git://github.com/caldwellc/node-bindings.git#master",
99101
"canvas": "git://github.com/jclark118/empty-module.git#main",
100-
"minimatch": "9.0.5"
102+
"minimatch": "9.0.5",
103+
"rollup": "^3.29.5"
101104
},
102105
"contributors": [
103106
{

src/lib/env/env.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const environment = {
2929
geopackageLibrariesUrl: 'https://ngageoint.github.io/GeoPackage',
3030
eventkitUrl: 'https://eventkit.gs.mil',
3131
surveyUrl: 'https://portal.geo.nga.mil/survey123/share/93444389134845e79d79f18a11ab17d3',
32+
matomoUrl: 'https://webanalytics.nga.mil/',
33+
matomoJsUrl: 'https://webanalytics.nga.mil//matomo.js',
34+
matomoSiteId: '',
35+
matomoEnabled: false,
3236
preloadedDataSources: []
3337
}
3438

src/lib/source/shapefile/ShapeFileSource.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
33
import AdmZip from 'adm-zip'
4-
// import shp from 'shpjs'
4+
import shpjs from 'shpjs'
55

66
import Source from '../Source'
77
import GeoTIFFSource from '../geotiff/GeoTIFFSource'
@@ -86,16 +86,18 @@ export default class ShapeFileSource extends Source {
8686
await sleep(250)
8787

8888
if (isZip) {
89-
const result = await shp.parseZip(fs.readFileSync(this.filePath))
89+
let fileBuffer = Buffer.from(fs.readFileSync(this.filePath))
90+
const result = await shpjs.parseZip(fileBuffer)
9091
if (result.length == null) {
9192
featureCollections.push(result)
9293
} else {
9394
featureCollections = result
9495
}
9596
} else {
97+
const result = await shpjs.parseShp(fs.readFileSync(this.filePath))
9698
featureCollections.push({
9799
type: 'FeatureCollection',
98-
features: shp.parseShp(fs.readFileSync(this.filePath)),
100+
features: result,
99101
fileName: name
100102
})
101103
}

src/lib/vue/vuex/ProjectActions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,10 @@ function setActiveGeoPackageFeatureLayer (projectId, geopackageId, tableName) {
553553
}
554554
}
555555

556+
function setConsent (consent) {
557+
return store.dispatch('UIState/setConsent', {consent})
558+
}
559+
556560
function setDarkTheme (projectId, enabled) {
557561
return store.dispatch('UIState/setDarkTheme', { projectId, enabled })
558562
}
@@ -724,6 +728,7 @@ export {
724728
setActiveGeoPackage,
725729
setActiveGeoPackageFeatureLayer,
726730
updateStyleKey,
731+
setConsent,
727732
setDarkTheme,
728733
notifyTab,
729734
clearNotification,

src/main/lib/MapCacheWindowManager.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ import {
7171
UNDO,
7272
REQUEST_TILE_COMPILATION,
7373
REQUEST_TILE_COMPILATION_COMPLETED,
74-
CANCEL_TILE_COMPILATION_REQUEST, WEB_VIEW_AUTH_REQUEST, WEB_VIEW_AUTH_CANCEL
74+
CANCEL_TILE_COMPILATION_REQUEST, WEB_VIEW_AUTH_REQUEST, WEB_VIEW_AUTH_CANCEL,
75+
CLOSE_APP
7576
} from './ipc/MapCacheIPC'
7677
import windowStateKeeper from 'electron-window-state'
7778
import WebViewAuth from './auth/WebViewAuth'
@@ -541,6 +542,10 @@ class MapCacheWindowManager {
541542
const taskId = payload.id
542543
await this.mapcacheThreadHelper.cancelTask(taskId, false)
543544
})
545+
546+
ipcMain.on(CLOSE_APP, () => {
547+
app.quit()
548+
})
544549
}
545550
}
546551

src/main/lib/ipc/MapCacheIPC.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const SHOW_PROJECT = 'show-project'
1111
const CLOSE_PROJECT = 'close-project'
1212
const CLOSING_PROJECT_WINDOW = 'closing-project-window'
1313
const PROCESS_SOURCE = 'process-source'
14+
const CLOSE_APP = 'close-app'
15+
1416

1517
function PROCESS_SOURCE_COMPLETED (id) {
1618
return 'process-source-completed-' + id
@@ -169,7 +171,8 @@ const MAIN_CHANNELS = [
169171
BUILD_TILE_LAYER,
170172
CANCEL_BUILD_TILE_LAYER,
171173
WORKER_READY,
172-
LAUNCH_USER_GUIDE
174+
LAUNCH_USER_GUIDE,
175+
CLOSE_APP
173176
]
174177

175178
const WORKER_CHANNELS = [
@@ -267,5 +270,6 @@ export {
267270
REDO,
268271
WEB_VIEW_AUTH_REQUEST,
269272
WEB_VIEW_AUTH_RESPONSE,
270-
WEB_VIEW_AUTH_CANCEL
273+
WEB_VIEW_AUTH_CANCEL,
274+
CLOSE_APP
271275
}

src/preload/mainPreload.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'path'
44
import { deleteProjectFolder } from '../lib/vue/vuex/CommonPreloadFunctions'
55
import { createNextAvailableLayerDirectory, createNextAvailableProjectDirectory, createNextAvailableSourceDirectory } from '../lib/util/file/FileUtilities'
66
import { createUniqueID } from '../lib/util/UniqueIDUtilities'
7-
import { GET_APP_VERSION, GET_USER_DATA_DIRECTORY, LAUNCH_WITH_GEOPACKAGE_FILES, OPEN_EXTERNAL, SHOW_PROJECT } from '../main/lib/ipc/MapCacheIPC'
7+
import { GET_APP_VERSION, GET_USER_DATA_DIRECTORY, LAUNCH_WITH_GEOPACKAGE_FILES, OPEN_EXTERNAL, SHOW_PROJECT, CLOSE_APP } from '../main/lib/ipc/MapCacheIPC'
88
import { Context, HtmlCanvasAdapter, SqliteAdapter } from '@ngageoint/geopackage'
99
import { environment } from '../lib/env/env'
1010
import { vuexElectronAPI } from './vuexPreload'
@@ -45,6 +45,9 @@ contextBridge.exposeInMainWorld('mapcache', {
4545
ipcRenderer.send(OPEN_EXTERNAL, link)
4646
}
4747
},
48+
closeApp: () => {
49+
ipcRenderer.send(CLOSE_APP)
50+
},
4851
setupGeoPackageContext: () => {
4952
Context.setupCustomContext(SqliteAdapter, HtmlCanvasAdapter)
5053
},

src/renderer/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="/favicon.ico">
88
<title>MapCache</title>
9-
<meta http-equiv="Content-Security-Policy" content="default-src * blob: 'unsafe-inline'; frame-src blob: 'unsafe-inline'; script-src 'self' 'unsafe-inline'; style-src * 'unsafe-inline'; img-src * http: https: data: file: mapcache: blob:">
9+
<meta http-equiv="Content-Security-Policy" content="default-src * blob: 'unsafe-inline'; frame-src blob: 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://webanalytics.nga.mil/; style-src * 'unsafe-inline'; img-src * http: https: data: file: mapcache: blob:">
1010
</head>
1111
<body class="noselect">
1212
<noscript>

0 commit comments

Comments
 (0)