From 13de1a213707f59830348b83dcb0447eaf05730b Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sat, 29 Aug 2020 22:56:03 +0200 Subject: [PATCH 01/10] feat: add sentry --- package.json | 3 ++ src/main.ts | 15 +++++++++ yarn.lock | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a563db7..67a76ac 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,9 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "@sentry/browser": "^5.22.3", + "@sentry/integrations": "^5.22.3", + "@sentry/tracing": "^5.22.3", "@types/vue-moment": "^4.0.0", "changed-lines": "^1.0.0", "core-js": "^3.6.5", diff --git a/src/main.ts b/src/main.ts index 521a524..eafe1bc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,21 @@ import apitator from 'vue-apitator' // @ts-ignore import { TiptapVuetifyPlugin } from 'tiptap-vuetify' +import * as Sentry from '@sentry/browser' +import { Vue as VueIntegration } from '@sentry/integrations' +import { Integrations } from '@sentry/tracing' + +if (process.env.VUE_APP_DISABLE_SENTRY == undefined) { + Sentry.init({ + dsn: 'https://e69f240d55414b0ca7763773c2fe3a24@o315435.ingest.sentry.io/5410664', + integrations: [ + new VueIntegration({ Vue, tracing: true }), + new Integrations.BrowserTracing() + ], + tracesSampleRate: 1 + }) +} + Vue.config.productionTip = false Vue.use(apitator, { baseUrl: process.env.VUE_APP_BASE_URL diff --git a/yarn.lock b/yarn.lock index 4819075..bf3226b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -904,6 +904,79 @@ dependencies: any-observable "^0.3.0" +"@sentry/browser@^5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.22.3.tgz#7a64bd1cf01bf393741a3e4bf35f82aa927f5b4e" + integrity sha512-2TzE/CoBa5ZkvxJizDdi1Iz1ldmXSJpFQ1mL07PIXBjCt0Wxf+WOuFSj5IP4L40XHfJE5gU8wEvSH0VDR8nXtA== + dependencies: + "@sentry/core" "5.22.3" + "@sentry/types" "5.22.3" + "@sentry/utils" "5.22.3" + tslib "^1.9.3" + +"@sentry/core@5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.22.3.tgz#030f435f2b518f282ba8bd954dac90cd70888bd7" + integrity sha512-eGL5uUarw3o4i9QUb9JoFHnhriPpWCaqeaIBB06HUpdcvhrjoowcKZj1+WPec5lFg5XusE35vez7z/FPzmJUDw== + dependencies: + "@sentry/hub" "5.22.3" + "@sentry/minimal" "5.22.3" + "@sentry/types" "5.22.3" + "@sentry/utils" "5.22.3" + tslib "^1.9.3" + +"@sentry/hub@5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.22.3.tgz#08309a70d2ea8d5e313d05840c1711f34f2fffe5" + integrity sha512-INo47m6N5HFEs/7GMP9cqxOIt7rmRxdERunA3H2L37owjcr77MwHVeeJ9yawRS6FMtbWXplgWTyTIWIYOuqVbw== + dependencies: + "@sentry/types" "5.22.3" + "@sentry/utils" "5.22.3" + tslib "^1.9.3" + +"@sentry/integrations@^5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.22.3.tgz#ecec954d1d8802930baf824cac4cd2a51c8691cb" + integrity sha512-Fx6h8DTDvUpEOymx8Wi49LBdVcNYHwaI6NqApm1qVU9qn/I50Q29KWoZTCGBjBwmkJud+DOAHWYWoU2qRrIvcQ== + dependencies: + "@sentry/types" "5.22.3" + "@sentry/utils" "5.22.3" + localforage "1.8.1" + tslib "^1.9.3" + +"@sentry/minimal@5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.22.3.tgz#706e4029ae5494123d3875c658ba8911aa5cc440" + integrity sha512-HoINpYnVYCpNjn2XIPIlqH5o4BAITpTljXjtAftOx6Hzj+Opjg8tR8PWliyKDvkXPpc4kXK9D6TpEDw8MO0wZA== + dependencies: + "@sentry/hub" "5.22.3" + "@sentry/types" "5.22.3" + tslib "^1.9.3" + +"@sentry/tracing@^5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-5.22.3.tgz#9b5a376e3164c007a22e8642ec094104468cac0c" + integrity sha512-Zp59kMCk5v56ZAyErqjv/QvGOWOQ5fRltzeVQVp8unIDTk6gEFXfhwPsYHOokJe1mfkmrgPDV6xAkYgtL3KCDQ== + dependencies: + "@sentry/hub" "5.22.3" + "@sentry/minimal" "5.22.3" + "@sentry/types" "5.22.3" + "@sentry/utils" "5.22.3" + tslib "^1.9.3" + +"@sentry/types@5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.22.3.tgz#d1d547b30ee8bd7771fa893af74c4f3d71f0fd18" + integrity sha512-cv+VWK0YFgCVDvD1/HrrBWOWYG3MLuCUJRBTkV/Opdy7nkdNjhCAJQrEyMM9zX0sac8FKWKOHT0sykNh8KgmYw== + +"@sentry/utils@5.22.3": + version "5.22.3" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.22.3.tgz#e3bda3e789239eb16d436f768daa12829f33d18f" + integrity sha512-AHNryXMBvIkIE+GQxTlmhBXD0Ksh+5w1SwM5qi6AttH+1qjWLvV6WB4+4pvVvEoS8t5F+WaVUZPQLmCCWp6zKw== + dependencies: + "@sentry/types" "5.22.3" + tslib "^1.9.3" + "@soda/friendly-errors-webpack-plugin@^1.7.1": version "1.7.1" resolved "https://registry.yarnpkg.com/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.1.tgz#706f64bcb4a8b9642b48ae3ace444c70334d615d" @@ -4781,6 +4854,11 @@ ignore@^5.1.1: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== +immediate@~3.0.5: + version "3.0.6" + resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps= + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -5463,6 +5541,13 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lie@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" + integrity sha1-mkNrLMd0bKWd56QfpGmz77dr2H4= + dependencies: + immediate "~3.0.5" + lines-and-columns@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" @@ -5574,6 +5659,13 @@ loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.0, loader-utils@^1.2 emojis-list "^3.0.0" json5 "^1.0.1" +localforage@1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433" + integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ== + dependencies: + lie "3.1.1" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -8775,7 +8867,7 @@ tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.13.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== From 2d456c8937c2df751250ea4b5896b33660f76196 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sat, 29 Aug 2020 23:10:20 +0200 Subject: [PATCH 02/10] wow fix --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index eafe1bc..66ad59d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,7 +17,7 @@ import * as Sentry from '@sentry/browser' import { Vue as VueIntegration } from '@sentry/integrations' import { Integrations } from '@sentry/tracing' -if (process.env.VUE_APP_DISABLE_SENTRY == undefined) { +if (process.env.VUE_APP_DISABLE_SENTRY === undefined) { Sentry.init({ dsn: 'https://e69f240d55414b0ca7763773c2fe3a24@o315435.ingest.sentry.io/5410664', integrations: [ From 8691ca0453613c5c948a9491829d91fafd65cccb Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sun, 30 Aug 2020 10:47:38 +0200 Subject: [PATCH 03/10] fix(OrganizationList): external open --- src/views/Admin/OrganizationList.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/Admin/OrganizationList.vue b/src/views/Admin/OrganizationList.vue index 83d085d..fb96384 100644 --- a/src/views/Admin/OrganizationList.vue +++ b/src/views/Admin/OrganizationList.vue @@ -688,7 +688,10 @@ export default { openExternal (item) { let queryStr = '' - if (item.validationState === 'pending') { + if ( + item.lastPublished == null || + item.validationState === 'pending' + ) { queryStr = '?version=proposed' } From b02a05122331a9aa266307b98e44da902e9c5b9c Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Wed, 2 Sep 2020 22:10:57 +0200 Subject: [PATCH 04/10] feat: add user context to sentry.io reports --- .env.example | 3 ++- src/layouts/Admin.vue | 6 ++++++ src/layouts/Delegate.vue | 37 +++++++++++++++++++++++++------------ src/main.ts | 6 +++--- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.env.example b/.env.example index 0996c28..b942a72 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -VUE_APP_BASE_URL=https://associations.espacecondorcet.org \ No newline at end of file +VUE_APP_BASE_URL=https://associations.espacecondorcet.org +VUE_APP_SENTRY_URL=https://wow.com \ No newline at end of file diff --git a/src/layouts/Admin.vue b/src/layouts/Admin.vue index 439ee56..fa469c3 100644 --- a/src/layouts/Admin.vue +++ b/src/layouts/Admin.vue @@ -77,6 +77,8 @@ diff --git a/src/router/index.ts b/src/router/index.ts index 78eeb20..ac631dd 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -13,12 +13,8 @@ const routes: Array = [ { path: '/about', name: 'About', - // route level code-splitting - // this generates a separate chunk (about.[hash].js) for this route - // which is lazy-loaded when the route is visited. component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') }, - { path: '/admin', component: () => import(/* webpackChunkName: "adminLayout" */ '../layouts/Admin.vue'), diff --git a/src/store/index.ts b/src/store/index.ts index 5d9ea03..59ba3ed 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -68,12 +68,12 @@ const defaultState: State = { validateMainCallback: (d = false) => d, mainRules: { name: [ - (v: any) => v.length >= 3 || 'Au minimum 3 caractères', - (v: any) => v.length <= 50 || 'Au maximum 50 caractères' + (v: any) => (v != null && v.length >= 3) || 'Au minimum 3 caractères', + (v: any) => (v != null && v.length <= 50) || 'Au maximum 50 caractères' ], descriptionShort: [ - (v: any) => v.length >= 20 || 'Au minimum 20 caractères', - (v: any) => v.length <= 200 || 'Au maximum 200 caractères' + (v: any) => (v != null && v.length) >= 20 || 'Au minimum 20 caractères', + (v: any) => (v != null && v.length) <= 200 || 'Au maximum 200 caractères' ], tags: [(v: any) => (Array.isArray(v) && v.length > 0) || 'Vous devez choisir au minimum une catégorie'], 'contacts.email': [(v: any) => /.+@.+\..+/.test(v) || "L'email est requis et doit être valide"], From 2020e79cabf5057c0500e6e8c4c91fce64f97647 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Wed, 2 Sep 2020 22:58:57 +0200 Subject: [PATCH 06/10] fix(Gallery): send substring to API when it's a video --- src/views/Delegate/Gallery.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/Delegate/Gallery.vue b/src/views/Delegate/Gallery.vue index 4d7c956..e0ce671 100644 --- a/src/views/Delegate/Gallery.vue +++ b/src/views/Delegate/Gallery.vue @@ -262,7 +262,11 @@ export default { const reader = new FileReader() reader.readAsArrayBuffer(file) reader.onloadend = (event) => { - resolve(['file', event.target.result, file.name]) + let name = file.name + if (file.type.indexOf('video') !== -1) { + name += '||%_FORMAT_VIDEO_%||' // it's a dirty way to say to the back end : 'hey this is a video file !' + } + resolve(['file', event.target.result, name]) } reader.onerror = () => { console.log(reader.error) @@ -275,7 +279,11 @@ export default { const promises = this.files.map(file => this.loadFile(file)) Promise.all(promises).then(results => { const formData = new FormData() - results.forEach(r => formData.append(r[0], new Blob([new Uint8Array(r[1])]), r[2])) + results.forEach(r => formData.append( + r[0], // field name + new Blob([new Uint8Array(r[1])]), // the file + r[2] // file name + )) this.$apitator.post('/delegate/medias', formData, { withAuth: true, From d9f09065b46c710f991718ed9dd85fe2b191e3b6 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Wed, 2 Sep 2020 23:05:10 +0200 Subject: [PATCH 07/10] fix(Admin): lint error --- src/layouts/Admin.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/Admin.vue b/src/layouts/Admin.vue index fa469c3..8c44295 100644 --- a/src/layouts/Admin.vue +++ b/src/layouts/Admin.vue @@ -113,10 +113,9 @@ export default { window.localStorage.setItem('adminToken', adminToken) this.loading = false this.enabled = true - // set sentry meta data to debug Sentry.setTag('user.type', 'admin') - Sentry.setUser({type: "admin"}) + Sentry.setUser({ type: 'admin' }) // this.$store.commit('ADD_ALERT', { // color: 'success', // text: 'Vous voilà connecté !' From 32d30be94312b6e2dd2fd283988a794667ae2691 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Thu, 3 Sep 2020 18:58:20 +0200 Subject: [PATCH 08/10] fix(Contact): fix issue with address parsing sentry #1866716154 --- src/views/Delegate/Contact.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/Delegate/Contact.vue b/src/views/Delegate/Contact.vue index 0f599d7..1ef9ce2 100644 --- a/src/views/Delegate/Contact.vue +++ b/src/views/Delegate/Contact.vue @@ -203,11 +203,15 @@ export default { if (raw.length === 3) { this.secondLine = raw[1] raw = raw[2].split('%postalsep%') + this.postalCode = raw[0] + this.city = raw[1] } else { - raw = raw[1].split('%postalsep%') + if (raw.length > 0) { + raw = raw[1].split('%postalsep%') + this.postalCode = raw[0] + this.city = raw[1] + } } - this.postalCode = raw[0] - this.city = raw[1] } else { // encode address let encoded = '' From c1d3e80e79ffb6676323c2c550ef5f0c9334477f Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Thu, 3 Sep 2020 18:58:55 +0200 Subject: [PATCH 09/10] fix(Schedule): initial when.day to [] sentry issue #1874850840 --- src/views/Delegate/Schedule.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Delegate/Schedule.vue b/src/views/Delegate/Schedule.vue index b9ddfac..3954e8f 100644 --- a/src/views/Delegate/Schedule.vue +++ b/src/views/Delegate/Schedule.vue @@ -347,7 +347,7 @@ export default { toDeleteCategory: {}, oldEditCategory: {}, whenModal: false, - when: { day: '', from: '', to: '' }, + when: { day: [], from: '', to: '' }, deleteWhenModal: false, toDeleteWhen: {}, oldEditWhen: {}, From f119bca2905188d8833706ca3606623f08080cf7 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Fri, 5 Mar 2021 23:25:18 +0100 Subject: [PATCH 10/10] feat: change title of the website --- public/index.html | 2 +- src/store/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 87a7ab6..cbd6978 100644 --- a/public/index.html +++ b/public/index.html @@ -11,7 +11,7 @@ Github: https://github.com/lefuturiste - Forum virtuel des associations + Annuaire des associations diff --git a/src/store/index.ts b/src/store/index.ts index 59ba3ed..665172d 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -89,7 +89,7 @@ export default new Vuex.Store({ }, SET_TITLE (state: State, payload) { state.title = payload - window.document.title = state.title + ' | Panel forum des associations' + window.document.title = state.title + ' | Panel annuaire des associations' }, ADD_ALERT (state: State, payload) { state.alert = {