diff --git a/peertube-plugin-matomo/.gitignore b/peertube-plugin-matomo/.gitignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/peertube-plugin-matomo/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/peertube-plugin-matomo/CHANGELOG.md b/peertube-plugin-matomo/CHANGELOG.md new file mode 100644 index 0000000..360228f --- /dev/null +++ b/peertube-plugin-matomo/CHANGELOG.md @@ -0,0 +1,7 @@ +# 1.0.0 + + * Support [Matomo Media Analytics] for embed page + +# 0.0.4 + + * Support [Matomo Media Analytics] for watch page diff --git a/peertube-plugin-matomo/client/common-client-plugin.js b/peertube-plugin-matomo/client/common-client-plugin.js index c78e173..93004b6 100644 --- a/peertube-plugin-matomo/client/common-client-plugin.js +++ b/peertube-plugin-matomo/client/common-client-plugin.js @@ -1,53 +1,32 @@ +import { initMatomo } from './utils' + function register ({ registerHook, peertubeHelpers }) { - initMatomo(registerHook, peertubeHelpers) - .catch(err => console.error('Cannot initialize Matomo', err)) + init(registerHook, peertubeHelpers) + .catch(err => console.error('Cannot initialize Matomo plugin', err)) } export { register } -function initMatomo (registerHook, peertubeHelpers) { - return peertubeHelpers.getSettings() - .then(s => { - if (!s || !s['site-id'] || !s['url']) { - console.error('Matomo settings are not set.') - return - } - - const matomoUrl = s['url'] - const siteId = s['site-id'] - - window._paq = window._paq || []; - window._paq.push(['trackPageView']); - window._paq.push(['enableLinkTracking']); - (function() { - var u = matomoUrl + '/'; - window._paq.push(['setTrackerUrl', u+'matomo.php']); - window._paq.push(['setSiteId', siteId]); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); - })(); +async function init (registerHook, peertubeHelpers) { + const success = await initMatomo(peertubeHelpers) + if (!success) return + registerHook({ + target: 'action:router.navigation-end', + handler: function (params) { window._paq.push(['setDocumentTitle', window.document.title]); - window._paq.push(['setCustomUrl', '/' + window.location.hash.substr(1)]); + window._paq.push(['setCustomUrl', params.path]); window._paq.push(['trackPageView']); + } + }) - registerHook({ - target: 'action:router.navigation-end', - handler: function (params) { - window._paq.push(['setDocumentTitle', window.document.title]); - window._paq.push(['setCustomUrl', params.path]); - window._paq.push(['trackPageView']); - } - }) - - registerHook({ - target: 'action:video-watch.player.loaded', - handler: function () { - window._paq.push(['MediaAnalytics::scanForMedia', window.document]); - } - }) - }) - + registerHook({ + target: 'action:video-watch.player.loaded', + handler: function () { + window._paq.push(['MediaAnalytics::scanForMedia', window.document]); + } + }) } + diff --git a/peertube-plugin-matomo/client/embed-client-plugin.js b/peertube-plugin-matomo/client/embed-client-plugin.js new file mode 100644 index 0000000..e5cd76c --- /dev/null +++ b/peertube-plugin-matomo/client/embed-client-plugin.js @@ -0,0 +1,22 @@ +import { initMatomo } from './utils' + +function register ({ registerHook, peertubeHelpers }) { + init(registerHook, peertubeHelpers) + .catch(err => console.error('Cannot initialize Matomo plugin', err)) +} + +export { + register +} + +async function init (registerHook, peertubeHelpers) { + const success = await initMatomo(peertubeHelpers) + if (!success) return + + registerHook({ + target: 'action:embed.player.loaded', + handler: function () { + window._paq.push(['MediaAnalytics::scanForMedia', window.document]); + } + }) +} diff --git a/peertube-plugin-matomo/client/utils.js b/peertube-plugin-matomo/client/utils.js new file mode 100644 index 0000000..5f45473 --- /dev/null +++ b/peertube-plugin-matomo/client/utils.js @@ -0,0 +1,33 @@ +function initMatomo(peertubeHelpers) { + return peertubeHelpers.getSettings() + .then(s => { + if (!s || !s['site-id'] || !s['url']) { + console.error('Matomo settings are not set.') + return false + } + + const matomoUrl = s['url'] + const siteId = s['site-id'] + + window._paq = window._paq || [] + window._paq.push(['trackPageView']) + window._paq.push(['enableLinkTracking']); + (function () { + var u = matomoUrl + '/' + window._paq.push(['setTrackerUrl', u + 'matomo.php']) + window._paq.push(['setSiteId', siteId]) + var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0] + g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s) + })() + + window._paq.push(['setDocumentTitle', window.document.title]) + window._paq.push(['setCustomUrl', '/' + window.location.hash.substr(1)]) + window._paq.push(['trackPageView']) + + return true + }) +} + +export { + initMatomo +} diff --git a/peertube-plugin-matomo/package-lock.json b/peertube-plugin-matomo/package-lock.json new file mode 100644 index 0000000..6a45bf8 --- /dev/null +++ b/peertube-plugin-matomo/package-lock.json @@ -0,0 +1,540 @@ +{ + "name": "peertube-plugin-matomo", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "peertube-plugin-matomo", + "version": "1.0.0", + "devDependencies": { + "esbuild": "^0.14.27" + } + }, + "node_modules/esbuild": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.27.tgz", + "integrity": "sha512-MZQt5SywZS3hA9fXnMhR22dv0oPGh6QtjJRIYbgL1AeqAoQZE+Qn5ppGYQAoHv/vq827flj4tIJ79Mrdiwk46Q==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "esbuild-android-64": "0.14.27", + "esbuild-android-arm64": "0.14.27", + "esbuild-darwin-64": "0.14.27", + "esbuild-darwin-arm64": "0.14.27", + "esbuild-freebsd-64": "0.14.27", + "esbuild-freebsd-arm64": "0.14.27", + "esbuild-linux-32": "0.14.27", + "esbuild-linux-64": "0.14.27", + "esbuild-linux-arm": "0.14.27", + "esbuild-linux-arm64": "0.14.27", + "esbuild-linux-mips64le": "0.14.27", + "esbuild-linux-ppc64le": "0.14.27", + "esbuild-linux-riscv64": "0.14.27", + "esbuild-linux-s390x": "0.14.27", + "esbuild-netbsd-64": "0.14.27", + "esbuild-openbsd-64": "0.14.27", + "esbuild-sunos-64": "0.14.27", + "esbuild-windows-32": "0.14.27", + "esbuild-windows-64": "0.14.27", + "esbuild-windows-arm64": "0.14.27" + } + }, + "node_modules/esbuild-android-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.27.tgz", + "integrity": "sha512-LuEd4uPuj/16Y8j6kqy3Z2E9vNY9logfq8Tq+oTE2PZVuNs3M1kj5Qd4O95ee66yDGb3isaOCV7sOLDwtMfGaQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.27.tgz", + "integrity": "sha512-E8Ktwwa6vX8q7QeJmg8yepBYXaee50OdQS3BFtEHKrzbV45H4foMOeEE7uqdjGQZFBap5VAqo7pvjlyA92wznQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.27.tgz", + "integrity": "sha512-czw/kXl/1ZdenPWfw9jDc5iuIYxqUxgQ/Q+hRd4/3udyGGVI31r29LCViN2bAJgGvQkqyLGVcG03PJPEXQ5i2g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.27.tgz", + "integrity": "sha512-BEsv2U2U4o672oV8+xpXNxN9bgqRCtddQC6WBh4YhXKDcSZcdNh7+6nS+DM2vu7qWIWNA4JbRG24LUUYXysimQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.27.tgz", + "integrity": "sha512-7FeiFPGBo+ga+kOkDxtPmdPZdayrSzsV9pmfHxcyLKxu+3oTcajeZlOO1y9HW+t5aFZPiv7czOHM4KNd0tNwCA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.27.tgz", + "integrity": "sha512-8CK3++foRZJluOWXpllG5zwAVlxtv36NpHfsbWS7TYlD8S+QruXltKlXToc/5ZNzBK++l6rvRKELu/puCLc7jA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.27.tgz", + "integrity": "sha512-qhNYIcT+EsYSBClZ5QhLzFzV5iVsP1YsITqblSaztr3+ZJUI+GoK8aXHyzKd7/CKKuK93cxEMJPpfi1dfsOfdw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.27.tgz", + "integrity": "sha512-ESjck9+EsHoTaKWlFKJpPZRN26uiav5gkI16RuI8WBxUdLrrAlYuYSndxxKgEn1csd968BX/8yQZATYf/9+/qg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.27.tgz", + "integrity": "sha512-JnnmgUBdqLQO9hoNZQqNHFWlNpSX82vzB3rYuCJMhtkuaWQEmQz6Lec1UIxJdC38ifEghNTBsF9bbe8dFilnCw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.27.tgz", + "integrity": "sha512-no6Mi17eV2tHlJnqBHRLekpZ2/VYx+NfGxKcBE/2xOMYwctsanCaXxw4zapvNrGE9X38vefVXLz6YCF8b1EHiQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.27.tgz", + "integrity": "sha512-NolWP2uOvIJpbwpsDbwfeExZOY1bZNlWE/kVfkzLMsSgqeVcl5YMen/cedRe9mKnpfLli+i0uSp7N+fkKNU27A==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.27.tgz", + "integrity": "sha512-/7dTjDvXMdRKmsSxKXeWyonuGgblnYDn0MI1xDC7J1VQXny8k1qgNp6VmrlsawwnsymSUUiThhkJsI+rx0taNA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.27.tgz", + "integrity": "sha512-D+aFiUzOJG13RhrSmZgrcFaF4UUHpqj7XSKrIiCXIj1dkIkFqdrmqMSOtSs78dOtObWiOrFCDDzB24UyeEiNGg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.27.tgz", + "integrity": "sha512-CD/D4tj0U4UQjELkdNlZhQ8nDHU5rBn6NGp47Hiz0Y7/akAY5i0oGadhEIg0WCY/HYVXFb3CsSPPwaKcTOW3bg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.27.tgz", + "integrity": "sha512-h3mAld69SrO1VoaMpYl3a5FNdGRE/Nqc+E8VtHOag4tyBwhCQXxtvDDOAKOUQexBGca0IuR6UayQ4ntSX5ij1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.27.tgz", + "integrity": "sha512-xwSje6qIZaDHXWoPpIgvL+7fC6WeubHHv18tusLYMwL+Z6bEa4Pbfs5IWDtQdHkArtfxEkIZz77944z8MgDxGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.27.tgz", + "integrity": "sha512-/nBVpWIDjYiyMhuqIqbXXsxBc58cBVH9uztAOIfWShStxq9BNBik92oPQPJ57nzWXRNKQUEFWr4Q98utDWz7jg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.27.tgz", + "integrity": "sha512-Q9/zEjhZJ4trtWhFWIZvS/7RUzzi8rvkoaS9oiizkHTTKd8UxFwn/Mm2OywsAfYymgUYm8+y2b+BKTNEFxUekw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.27.tgz", + "integrity": "sha512-b3y3vTSl5aEhWHK66ngtiS/c6byLf6y/ZBvODH1YkBM+MGtVL6jN38FdHUsZasCz9gFwYs/lJMVY9u7GL6wfYg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.27.tgz", + "integrity": "sha512-I/reTxr6TFMcR5qbIkwRGvldMIaiBu2+MP0LlD7sOlNXrfqIl9uNjsuxFPGEG4IRomjfQ5q8WT+xlF/ySVkqKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + } + }, + "dependencies": { + "esbuild": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.27.tgz", + "integrity": "sha512-MZQt5SywZS3hA9fXnMhR22dv0oPGh6QtjJRIYbgL1AeqAoQZE+Qn5ppGYQAoHv/vq827flj4tIJ79Mrdiwk46Q==", + "dev": true, + "requires": { + "esbuild-android-64": "0.14.27", + "esbuild-android-arm64": "0.14.27", + "esbuild-darwin-64": "0.14.27", + "esbuild-darwin-arm64": "0.14.27", + "esbuild-freebsd-64": "0.14.27", + "esbuild-freebsd-arm64": "0.14.27", + "esbuild-linux-32": "0.14.27", + "esbuild-linux-64": "0.14.27", + "esbuild-linux-arm": "0.14.27", + "esbuild-linux-arm64": "0.14.27", + "esbuild-linux-mips64le": "0.14.27", + "esbuild-linux-ppc64le": "0.14.27", + "esbuild-linux-riscv64": "0.14.27", + "esbuild-linux-s390x": "0.14.27", + "esbuild-netbsd-64": "0.14.27", + "esbuild-openbsd-64": "0.14.27", + "esbuild-sunos-64": "0.14.27", + "esbuild-windows-32": "0.14.27", + "esbuild-windows-64": "0.14.27", + "esbuild-windows-arm64": "0.14.27" + } + }, + "esbuild-android-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.14.27.tgz", + "integrity": "sha512-LuEd4uPuj/16Y8j6kqy3Z2E9vNY9logfq8Tq+oTE2PZVuNs3M1kj5Qd4O95ee66yDGb3isaOCV7sOLDwtMfGaQ==", + "dev": true, + "optional": true + }, + "esbuild-android-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.14.27.tgz", + "integrity": "sha512-E8Ktwwa6vX8q7QeJmg8yepBYXaee50OdQS3BFtEHKrzbV45H4foMOeEE7uqdjGQZFBap5VAqo7pvjlyA92wznQ==", + "dev": true, + "optional": true + }, + "esbuild-darwin-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.14.27.tgz", + "integrity": "sha512-czw/kXl/1ZdenPWfw9jDc5iuIYxqUxgQ/Q+hRd4/3udyGGVI31r29LCViN2bAJgGvQkqyLGVcG03PJPEXQ5i2g==", + "dev": true, + "optional": true + }, + "esbuild-darwin-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.27.tgz", + "integrity": "sha512-BEsv2U2U4o672oV8+xpXNxN9bgqRCtddQC6WBh4YhXKDcSZcdNh7+6nS+DM2vu7qWIWNA4JbRG24LUUYXysimQ==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.27.tgz", + "integrity": "sha512-7FeiFPGBo+ga+kOkDxtPmdPZdayrSzsV9pmfHxcyLKxu+3oTcajeZlOO1y9HW+t5aFZPiv7czOHM4KNd0tNwCA==", + "dev": true, + "optional": true + }, + "esbuild-freebsd-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.27.tgz", + "integrity": "sha512-8CK3++foRZJluOWXpllG5zwAVlxtv36NpHfsbWS7TYlD8S+QruXltKlXToc/5ZNzBK++l6rvRKELu/puCLc7jA==", + "dev": true, + "optional": true + }, + "esbuild-linux-32": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.14.27.tgz", + "integrity": "sha512-qhNYIcT+EsYSBClZ5QhLzFzV5iVsP1YsITqblSaztr3+ZJUI+GoK8aXHyzKd7/CKKuK93cxEMJPpfi1dfsOfdw==", + "dev": true, + "optional": true + }, + "esbuild-linux-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.27.tgz", + "integrity": "sha512-ESjck9+EsHoTaKWlFKJpPZRN26uiav5gkI16RuI8WBxUdLrrAlYuYSndxxKgEn1csd968BX/8yQZATYf/9+/qg==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.14.27.tgz", + "integrity": "sha512-JnnmgUBdqLQO9hoNZQqNHFWlNpSX82vzB3rYuCJMhtkuaWQEmQz6Lec1UIxJdC38ifEghNTBsF9bbe8dFilnCw==", + "dev": true, + "optional": true + }, + "esbuild-linux-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.27.tgz", + "integrity": "sha512-no6Mi17eV2tHlJnqBHRLekpZ2/VYx+NfGxKcBE/2xOMYwctsanCaXxw4zapvNrGE9X38vefVXLz6YCF8b1EHiQ==", + "dev": true, + "optional": true + }, + "esbuild-linux-mips64le": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.27.tgz", + "integrity": "sha512-NolWP2uOvIJpbwpsDbwfeExZOY1bZNlWE/kVfkzLMsSgqeVcl5YMen/cedRe9mKnpfLli+i0uSp7N+fkKNU27A==", + "dev": true, + "optional": true + }, + "esbuild-linux-ppc64le": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.27.tgz", + "integrity": "sha512-/7dTjDvXMdRKmsSxKXeWyonuGgblnYDn0MI1xDC7J1VQXny8k1qgNp6VmrlsawwnsymSUUiThhkJsI+rx0taNA==", + "dev": true, + "optional": true + }, + "esbuild-linux-riscv64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.27.tgz", + "integrity": "sha512-D+aFiUzOJG13RhrSmZgrcFaF4UUHpqj7XSKrIiCXIj1dkIkFqdrmqMSOtSs78dOtObWiOrFCDDzB24UyeEiNGg==", + "dev": true, + "optional": true + }, + "esbuild-linux-s390x": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.27.tgz", + "integrity": "sha512-CD/D4tj0U4UQjELkdNlZhQ8nDHU5rBn6NGp47Hiz0Y7/akAY5i0oGadhEIg0WCY/HYVXFb3CsSPPwaKcTOW3bg==", + "dev": true, + "optional": true + }, + "esbuild-netbsd-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.27.tgz", + "integrity": "sha512-h3mAld69SrO1VoaMpYl3a5FNdGRE/Nqc+E8VtHOag4tyBwhCQXxtvDDOAKOUQexBGca0IuR6UayQ4ntSX5ij1Q==", + "dev": true, + "optional": true + }, + "esbuild-openbsd-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.27.tgz", + "integrity": "sha512-xwSje6qIZaDHXWoPpIgvL+7fC6WeubHHv18tusLYMwL+Z6bEa4Pbfs5IWDtQdHkArtfxEkIZz77944z8MgDxGw==", + "dev": true, + "optional": true + }, + "esbuild-sunos-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.14.27.tgz", + "integrity": "sha512-/nBVpWIDjYiyMhuqIqbXXsxBc58cBVH9uztAOIfWShStxq9BNBik92oPQPJ57nzWXRNKQUEFWr4Q98utDWz7jg==", + "dev": true, + "optional": true + }, + "esbuild-windows-32": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.14.27.tgz", + "integrity": "sha512-Q9/zEjhZJ4trtWhFWIZvS/7RUzzi8rvkoaS9oiizkHTTKd8UxFwn/Mm2OywsAfYymgUYm8+y2b+BKTNEFxUekw==", + "dev": true, + "optional": true + }, + "esbuild-windows-64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.27.tgz", + "integrity": "sha512-b3y3vTSl5aEhWHK66ngtiS/c6byLf6y/ZBvODH1YkBM+MGtVL6jN38FdHUsZasCz9gFwYs/lJMVY9u7GL6wfYg==", + "dev": true, + "optional": true + }, + "esbuild-windows-arm64": { + "version": "0.14.27", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.27.tgz", + "integrity": "sha512-I/reTxr6TFMcR5qbIkwRGvldMIaiBu2+MP0LlD7sOlNXrfqIl9uNjsuxFPGEG4IRomjfQ5q8WT+xlF/ySVkqKg==", + "dev": true, + "optional": true + } + } +} diff --git a/peertube-plugin-matomo/package.json b/peertube-plugin-matomo/package.json index dbb9263..b73b1c7 100644 --- a/peertube-plugin-matomo/package.json +++ b/peertube-plugin-matomo/package.json @@ -1,14 +1,17 @@ { "name": "peertube-plugin-matomo", - "version": "0.0.4", + "version": "1.0.0", "description": "Matomo plugin that tracks page views on a PeerTube instance.", "engine": { - "peertube": ">=1.3.0" + "peertube": ">=4.2.0" }, "keywords": [ "peertube", "plugin" ], + "scripts": { + "build": "esbuild client/common-client-plugin.js --minify --bundle --format=esm --outfile=dist/common-client-plugin.js --target=safari11 && esbuild client/embed-client-plugin.js --minify --bundle --format=esm --outfile=dist/embed-client-plugin.js --target=safari11" + }, "homepage": "https://framagit.org/framasoft/peertube/official-plugins/tree/master/peertube-plugin-matomo", "author": "Chocobozzz", "bugs": "https://framagit.org/framasoft/peertube/official-plugins/issues", @@ -17,11 +20,20 @@ "css": [], "clientScripts": [ { - "script": "client/common-client-plugin.js", + "script": "dist/common-client-plugin.js", "scopes": [ "common" ] + }, + { + "script": "dist/embed-client-plugin.js", + "scopes": [ + "embed" + ] } ], - "translations": {} + "translations": {}, + "devDependencies": { + "esbuild": "^0.14.27" + } }