From 8b54dfc4687392db830c3fd0d083507720335c38 Mon Sep 17 00:00:00 2001 From: jankapunkt Date: Tue, 4 Oct 2022 10:51:30 +0200 Subject: [PATCH 01/14] build(deps): update Meteor, packages and paths to local deps --- .meteor/packages | 18 +++++----- .meteor/release | 2 +- .meteor/versions | 85 ++++++++++++++++++++++++------------------------ run.sh | 4 ++- 4 files changed, 56 insertions(+), 53 deletions(-) diff --git a/.meteor/packages b/.meteor/packages index 5f0c49a8..b33b9bca 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -6,15 +6,15 @@ meteor-base@1.5.1 # Packages every Meteor app needs to have mobile-experience@1.1.0 # Packages for a great mobile UX -mongo@1.13.0 # The database Meteor supports right now -blaze-html-templates # Compile .html files into Meteor Blaze views +mongo@1.15.0 # The database Meteor supports right now +blaze-html-templates@2.0.0 # Compile .html files into Meteor Blaze views reactive-var@1.0.11 # Reactive variable for tracker tracker@1.2.0 # Meteor's client-side reactive programming library # standard-minifier-css@1.5.3 # CSS minifier run for production mode -standard-minifier-js@2.7.1 # JS minifier run for production mode +standard-minifier-js@2.8.0 # JS minifier run for production mode es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers -ecmascript@0.16.0 # Enable ECMAScript2015+ syntax in app code +ecmascript@0.16.2 # Enable ECMAScript2015+ syntax in app code # shell-server@0.5.0 # Server-side component of the `meteor shell` command @@ -44,7 +44,7 @@ leaonline:publication-factory leaonline:ratelimit-factory # Collections -aldeed:collection2 +aldeed:collection2@4.0.0! dburles:mongo-collection-instances@0.3.6 # files @@ -55,15 +55,15 @@ dburles:mongo-collection-instances@0.3.6 mdg:validated-method # Accounts -accounts-base@2.2.0 -accounts-password@2.2.0 +accounts-base@2.2.3 +accounts-password@2.3.1 leaonline:ddp-login leaonline:ddp-login-handler service-configuration@1.3.0 # UI reactive-dict@1.3.0 -hot-module-replacement@0.4.0 +hot-module-replacement@0.5.1 blaze-hot fourseven:scss@4.15.0 @@ -82,7 +82,7 @@ jkuester:template-loader ccorcos:subs-cache # reporting -email@2.2.0 +email@2.2.1 #======================================== # SECURITY diff --git a/.meteor/release b/.meteor/release index 55995295..66dd7b66 100644 --- a/.meteor/release +++ b/.meteor/release @@ -1 +1 @@ -METEOR@2.5 +METEOR@2.7.3 diff --git a/.meteor/versions b/.meteor/versions index b3ab0f71..87954276 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -1,18 +1,18 @@ -accounts-base@2.2.0 -accounts-password@2.2.0 +accounts-base@2.2.4 +accounts-password@2.3.1 aldeed:autoform@7.0.0 -aldeed:collection2@3.4.0 -allow-deny@1.1.0 +aldeed:collection2@4.0.0 +allow-deny@1.1.1 audit-argument-checks@1.0.7 autoupdate@1.8.0 -babel-compiler@7.7.0 -babel-runtime@1.5.0 +babel-compiler@7.9.2 +babel-runtime@1.5.1 base64@1.0.12 binary-heap@1.0.11 -blaze@2.5.0 -blaze-hot@1.1.0 -blaze-html-templates@1.2.1 -blaze-tools@1.1.2 +blaze@2.6.1 +blaze-hot@1.1.1 +blaze-html-templates@2.0.0 +blaze-tools@1.1.3 boilerplate-generator@1.7.1 caching-compiler@1.2.2 caching-html-compiler@1.2.1 @@ -28,12 +28,12 @@ ddp-server@2.5.0 deps@1.0.12 diff-sequence@1.1.1 dynamic-import@0.7.2 -ecmascript@0.16.0 +ecmascript@0.16.2 ecmascript-runtime@0.8.0 ecmascript-runtime-client@0.12.1 ecmascript-runtime-server@0.11.0 -ejson@1.1.1 -email@2.2.0 +ejson@1.1.2 +email@2.2.1 es5-shim@4.8.0 fetch@0.1.1 force-ssl@1.1.0 @@ -41,8 +41,8 @@ force-ssl-common@1.1.0 fourseven:scss@4.15.0 geojson-utils@1.0.10 hot-code-push@1.0.4 -hot-module-replacement@0.4.0 -html-tools@1.1.2 +hot-module-replacement@0.5.1 +html-tools@1.1.3 htmljs@1.1.1 http@2.0.0 id-map@1.1.1 @@ -58,10 +58,10 @@ leaonline:corelib@1.0.0 leaonline:ddp-login@2.0.2 leaonline:ddp-login-handler@2.0.0 leaonline:method-factory@1.1.0 -leaonline:publication-factory@1.0.0 +leaonline:publication-factory@1.1.1 leaonline:ratelimit-factory@1.0.0 leaonline:service-registry@1.0.0 -leaonline:theme@1.0.0 +leaonline:theme@1.1.0 leaonline:ui@1.0.0 livedata@1.0.18 lmieulet:meteor-coverage@3.2.0 @@ -70,34 +70,34 @@ logging@1.3.1 mdg:validated-method@1.2.0 meteor@1.10.0 meteor-base@1.5.1 -meteortesting:browser-tests@1.3.4 +meteortesting:browser-tests@1.3.5 meteortesting:mocha@2.0.3 meteortesting:mocha-core@8.0.1 -minifier-css@1.6.0 -minifier-js@2.7.1 -minimongo@1.7.0 +minifier-css@1.6.1 +minifier-js@2.7.5 +minimongo@1.8.0 mobile-experience@1.1.0 mobile-status-bar@1.1.0 -modern-browsers@0.1.7 -modules@0.17.0 -modules-runtime@0.12.0 +modern-browsers@0.1.8 +modules@0.18.0 +modules-runtime@0.13.0 modules-runtime-hot@0.14.0 -momentjs:moment@2.29.1 -mongo@1.13.0 -mongo-decimal@0.1.2 +momentjs:moment@2.29.3 +mongo@1.15.0 +mongo-decimal@0.1.3 mongo-dev-server@1.1.0 mongo-id@1.0.8 -npm-mongo@3.9.1 -observe-sequence@1.0.19 +npm-mongo@4.3.1 +observe-sequence@1.0.20 ordered-dict@1.1.0 -ostrio:cstorage@2.2.2 -ostrio:flow-router-extra@3.7.5 -ostrio:i18n@3.1.0 +ostrio:cstorage@4.0.1 +ostrio:flow-router-extra@3.9.0 +ostrio:i18n@3.2.0 promise@0.12.0 raix:eventemitter@1.0.0 random@1.2.0 rate-limit@1.0.9 -react-fast-refresh@0.2.0 +react-fast-refresh@0.2.3 reactive-dict@1.3.0 reactive-var@1.0.11 reload@1.3.1 @@ -106,19 +106,20 @@ routepolicy@1.1.1 seba:minifiers-autoprefixer@2.0.1 service-configuration@1.3.0 sha@1.0.9 -socket-stream-client@0.4.0 -spacebars@1.2.0 -spacebars-compiler@1.3.0 -standard-minifier-js@2.7.1 -templating@1.4.1 +socket-stream-client@0.5.0 +spacebars@1.3.0 +spacebars-compiler@1.3.1 +standard-minifier-js@2.8.1 +templating@1.4.2 templating-compiler@1.4.1 -templating-runtime@1.5.0 -templating-tools@1.2.1 +templating-runtime@1.6.1 +templating-tools@1.2.2 tmeasday:check-npm-versions@1.0.2 tracker@1.2.0 -typescript@4.4.0 +typescript@4.5.4 ui@1.0.13 underscore@1.0.10 url@1.3.2 -webapp@1.13.0 +webapp@1.13.1 webapp-hashing@1.1.0 +zodern:types@1.0.9 diff --git a/run.sh b/run.sh index ab153011..d676d7c5 100755 --- a/run.sh +++ b/run.sh @@ -19,7 +19,9 @@ while getopts "pr" opt; do esac done -PACKAGE_DIRS="../lib:../liboauth:../libext:../meteor-collection2/package" +PACKAGE_DIRS="../blaze/packages:../lib:../liboauth:../libext:../meteor-collection2/package" + +# final command to run DEBUG="app" METEOR_PACKAGE_DIRS=${PACKAGE_DIRS} meteor \ --exclude-archs=web.cordova \ --settings=settings.json \ From f7b8c438fd11d31502b1804f5468f19e9d4c33c6 Mon Sep 17 00:00:00 2001 From: jankapunkt Date: Tue, 4 Oct 2022 10:52:12 +0200 Subject: [PATCH 02/14] feature(client): improved logs for client events (csp;fonts;window) --- client/main.html | 20 +++--- client/main.js | 3 +- client/main.scss | 0 imports/api/notify/notifyUsersAboutError.js | 4 +- imports/startup/client/errors.js | 77 +++++++++++++++++++++ imports/startup/server/collection2.js | 3 + imports/ui/routing/Routes.js | 2 +- 7 files changed, 94 insertions(+), 15 deletions(-) delete mode 100644 client/main.scss create mode 100644 imports/startup/client/errors.js diff --git a/client/main.html b/client/main.html index 5fe3c31c..69a74d97 100644 --- a/client/main.html +++ b/client/main.html @@ -28,11 +28,7 @@ - - + diff --git a/client/main.js b/client/main.js index 03a72773..e950d37c 100644 --- a/client/main.js +++ b/client/main.js @@ -1,11 +1,10 @@ import '../imports/startup/client/serviceWorker' +import '../imports/startup/client/errors' import '../imports/startup/client/testDebug' import '../imports/startup/client/templates' import '../imports/startup/client/bootstrap' import '../imports/startup/client/fontawesome' import '../imports/startup/client/routes' import '../imports/startup/client/routeHelpers' -// import '../imports/startup/client/videos' // TODO import '../imports/ui/layout/footer/footer' -import './main.scss' import './main.html' diff --git a/client/main.scss b/client/main.scss deleted file mode 100644 index e69de29b..00000000 diff --git a/imports/api/notify/notifyUsersAboutError.js b/imports/api/notify/notifyUsersAboutError.js index c58e02b7..1ff3546d 100644 --- a/imports/api/notify/notifyUsersAboutError.js +++ b/imports/api/notify/notifyUsersAboutError.js @@ -1,7 +1,7 @@ import { Meteor } from 'meteor/meteor' import { Email } from 'meteor/email' -const appName = Meteor.settings.public.app.label +const appName = Meteor.settings.public.app.name const { notify, replyTo, from } = Meteor.settings.email export const notifyUsersAboutError = error => { @@ -10,7 +10,7 @@ export const notifyUsersAboutError = error => { notify.forEach(address => { Email.send({ to: address, - subject: `${appName} [error]: ${error.type} - ${error.name}`, + subject: `${appName} [error]: ${error.message}`, replyTo: replyTo, from: from, text: JSON.stringify(error, null, 2) diff --git a/imports/startup/client/errors.js b/imports/startup/client/errors.js new file mode 100644 index 00000000..ff9a0247 --- /dev/null +++ b/imports/startup/client/errors.js @@ -0,0 +1,77 @@ +import { Meteor } from 'meteor/meteor' +import { Blaze } from 'meteor/blaze' +import { Template } from 'meteor/templating' +import { sendError } from '../../contexts/errors/api/sendError' + +const parseAndSendError = ({ error }) => { + const instance = Template.instance() + const templateName = instance + ? instance.viewName ?? instance.view?.name ?? 'unknown' + : 'unknown' + sendError({ + userId: Meteor.userId(), + template: templateName, + error + }) +} + +// to log internal blaze errors we setup this exception handler +// and transform their internal error into something we can use +if (Blaze.setExceptionHandler) { + console.debug('[Blaze]: set exception handler') + Blaze.setExceptionHandler(function (message, blazeRuntimeError) { + blazeRuntimeError.details = Object.assign({}, blazeRuntimeError.details, { blazeMessage: message }) + parseAndSendError({ error: blazeRuntimeError }) + }) +} + +// we also want to log any error that occurs on the window level +window.onerror = function (event, source, lineno, colno, error) { + if (!event.isTrusted) { + return console.error('untrusted event raised', event) + } + const message = typeof event === 'object' + ? event.message + : event + const details = { message, source, lineno, colno } + error.details = Object.assign({}, error.details, details) + parseAndSendError({ error }) +} + +// CSP errors need to be logged as well +Template.body.onCreated(function () { + document.addEventListener('securitypolicyviolation', (securityViolationEvent) => { + if (!securityViolationEvent.isTrusted) { + return console.error('untrusted event raised', securityViolationEvent) + } + + const error = new Error('securitypolicyviolation') + error.details = { + blockedURI: securityViolationEvent.blockedURI, + violatedDirective: securityViolationEvent.violatedDirective, + columnNumber: securityViolationEvent.columnNumber, + documentURI: securityViolationEvent.documentURI, + effectiveDirective: securityViolationEvent.effectiveDirective, + lineNumber: securityViolationEvent.lineNumber, + referrer: securityViolationEvent.referrer, + sample: securityViolationEvent.sample, + sourceFile: securityViolationEvent.sourceFile, + statusCode: securityViolationEvent.statusCode + } + parseAndSendError({ error }) + }) + + document.fonts.addEventListener('loadingerror', (event) => { + if (!event.isTrusted) { + return console.error('untrusted event raised', event) + } + const error = new Error('loadingerror') + error.details = { + fonts: event.fontfaces.map(font => ({ + family: font.family, + reason: font.loaded?.reason?.message + })) + } + parseAndSendError({ error }) + }) +}) diff --git a/imports/startup/server/collection2.js b/imports/startup/server/collection2.js index 77d7ba6d..585d56ad 100644 --- a/imports/startup/server/collection2.js +++ b/imports/startup/server/collection2.js @@ -4,3 +4,6 @@ import Collection2 from 'meteor/aldeed:collection2' if (Collection2 && typeof Collection2.load === 'function') { Collection2.load() } +else { + console.warn('Skip Collection2.load as it\'s not present!') +} diff --git a/imports/ui/routing/Routes.js b/imports/ui/routing/Routes.js index 941d4c95..0730408e 100644 --- a/imports/ui/routing/Routes.js +++ b/imports/ui/routing/Routes.js @@ -10,7 +10,7 @@ const go = (...args) => { const settings = () => { // TODO load dynamically using i18n locale - import settingsFile from '../../../resources/i18n/de/routes' + import settingsFile from '../../../resources/i18n/de/routes.json' return settingsFile } From fea20fee09665c288a67fe49da94bd32020e6eec Mon Sep 17 00:00:00 2001 From: jankapunkt Date: Wed, 5 Oct 2022 22:19:33 +0200 Subject: [PATCH 03/14] tts: add default rate --- imports/api/tts/initializeTTS.js | 1 + 1 file changed, 1 insertion(+) diff --git a/imports/api/tts/initializeTTS.js b/imports/api/tts/initializeTTS.js index f7de10ec..644f5a9c 100644 --- a/imports/api/tts/initializeTTS.js +++ b/imports/api/tts/initializeTTS.js @@ -34,6 +34,7 @@ export const initializeTTS = async () => { }, onComplete () { console.debug('[initializeTTS]: configure complete') + TTSEngine.defaults({ rate: 0.8 }) resolve(TTSEngine) } }) From cb497636124254b21d45e0e41aa87823ea0a9a8a Mon Sep 17 00:00:00 2001 From: jankapunkt Date: Tue, 11 Oct 2022 20:45:06 +0200 Subject: [PATCH 04/14] build(core): update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4d1966fb..2f9b61a6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ public/fonts/ public/logos/ .deploy +.production # Logs logs From 3c97fa8afd08b8b2b7d8adf72fa32858487b5c46 Mon Sep 17 00:00:00 2001 From: jankapunkt Date: Tue, 11 Oct 2022 20:45:36 +0200 Subject: [PATCH 05/14] ui: use only ttf front for font loading --- client/main.html | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/client/main.html b/client/main.html index 69a74d97..a92bd58c 100644 --- a/client/main.html +++ b/client/main.html @@ -31,11 +31,7 @@