diff --git a/.desktop/settings.json b/.desktop/settings.json index eb28927..d5d15b9 100644 --- a/.desktop/settings.json +++ b/.desktop/settings.json @@ -1,6 +1,6 @@ { "name": "communecter", - "version": "0.0.31", + "version": "0.0.33", "projectName": "communecter", "devTools": true, "devtron": true, @@ -21,14 +21,13 @@ "uglify": true, "plugins": { "meteor-desktop-splash-screen": { - "version": "0.3.0", + "version": "0.4.3", "imagePath": "splash.png", "windowSettings": { "width": 800, "height": 600 } }, - "meteor-desktop-localstorage": "0.0.11", "meteor-desktop-system-notifications": { "version": "0.0.2" } @@ -41,8 +40,6 @@ }, "builderOptions": { "win": { - "title": "communecter", - "authors": "Thomas Craipeau", "target": ["squirrel","nsis"] }, "squirrelWindows": { @@ -74,15 +71,15 @@ "_osx": { "icon": ".desktop/assets/icon.icns" }, - "version-string": { + "appVersion": "@version", + "buildVersion": "@version", + "appCopyright": "communecter", + "win32metadata": { "CompanyName": "communecter", - "LegalCopyright": "communecter.org", "FileDescription": "communecter", "OriginalFilename": "communecter.exe", - "FileVersion": "@version", - "ProductVersion": "@version", "ProductName": "communecter", "InternalName": "communecter.exe" } - } + } } diff --git a/.meteor/packages b/.meteor/packages index fa8f26c..610aa3f 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -92,3 +92,5 @@ comerc:autoform-selectize natestrauser:publish-performant-counts mizzao:user-status underscore@1.0.10 +omega:meteor-desktop-watcher@=2.0.0 +omega:meteor-desktop-bundler@=2.0.0 diff --git a/.meteor/versions b/.meteor/versions index be080e0..c9f317e 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -108,6 +108,8 @@ multiply:iron-router-progress@1.0.2 natestrauser:publish-performant-counts@0.1.2 npm-mongo@3.1.2-beta181.17 observe-sequence@1.0.16 +omega:meteor-desktop-bundler@2.0.0 +omega:meteor-desktop-watcher@2.0.0 ordered-dict@1.1.0 outatime:geolib@2.0.15 promise@0.11.2 diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 7cbbe99..6c93969 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -57,6 +57,7 @@ "Name is Too short":"Name is Too short", "Password is Too short":"Password is Too short", "Not the same password":"Not the same password", + "The-username-is-incorrect": "The username is incorrect: Only the characters A-Z, a-z, 0-9 and '-' are accepted.", "are you sure you want to delete":"Are you sure you want to delete ?", "Current":"Current", "Upcoming":"Upcoming", diff --git a/i18n/fr.i18n.json b/i18n/fr.i18n.json index 557d624..790bcfc 100644 --- a/i18n/fr.i18n.json +++ b/i18n/fr.i18n.json @@ -57,6 +57,7 @@ "Name is Too short":"Votre nom est trop court", "Password is Too short":"Votre mot de passe est trop court", "Not the same password":"Vous n'avez pas saisis le même mot de passe", + "The-username-is-incorrect": "Le nom d'utilisateur est incorrect : Seul les caractères A-Z, a-z, 0-9 et '-' sont acceptés.", "are you sure you want to delete":"Etes-vous sûr que vous voulez supprimer ?", "Current":"En cours", "Upcoming":"A venir", diff --git a/imports/api/citoyens.js b/imports/api/citoyens.js index 1ef9a8a..89b10be 100644 --- a/imports/api/citoyens.js +++ b/imports/api/citoyens.js @@ -25,7 +25,7 @@ export const Citoyens = new Mongo.Collection('citoyens', { idGeneration: 'MONGO' const baseSchemaCitoyens = baseSchema.pick(['name', 'shortDescription', 'description', 'url', 'tags', 'tags.$']); const updateSchemaCitoyens = new SimpleSchema({ - username: { + /* username: { type: String, custom () { if (Meteor.isClient && this.isSet) { @@ -37,7 +37,7 @@ const updateSchemaCitoyens = new SimpleSchema({ }); } }, - }, + }, */ email: { type: String, unique: true, @@ -102,21 +102,7 @@ export const SchemasCitoyensRest = new SimpleSchema([baseSchemaCitoyens, updateS export const BlockCitoyensRest = {}; BlockCitoyensRest.descriptions = new SimpleSchema([blockBaseSchema, baseSchema.pick(['shortDescription', 'description', 'tags', 'tags.$'])]); -BlockCitoyensRest.info = new SimpleSchema([blockBaseSchema, baseSchema.pick(['name', 'url']), updateSchemaCitoyens.pick(['email', 'fixe', 'mobile', 'fax', 'birthDate']), { - username: { - type: String, - custom () { - if (Meteor.isClient && this.isSet) { - Meteor.call('checkUsername', this.value, function (error, result) { - // console.log(result); - if (!result) { - BlockCitoyensRest.info.namedContext('editBlockCitoyen').addInvalidKeys([{ name: 'username', type: 'usernameNotUnique' }]); - } - }); - } - }, - }, -}]); +BlockCitoyensRest.info = new SimpleSchema([blockBaseSchema, baseSchema.pick(['name', 'url']), updateSchemaCitoyens.pick(['email', 'fixe', 'mobile', 'fax', 'birthDate'])]); BlockCitoyensRest.network = new SimpleSchema([blockBaseSchema, updateSchemaCitoyens.pick(['github', 'telegram', 'skype', 'gpplus', 'twitter', 'facebook'])]); BlockCitoyensRest.locality = new SimpleSchema([blockBaseSchema, geoSchema]); BlockCitoyensRest.preferences = new SimpleSchema([blockBaseSchema, { diff --git a/imports/api/server/method.js b/imports/api/server/method.js index d08bf00..128e1bf 100644 --- a/imports/api/server/method.js +++ b/imports/api/server/method.js @@ -1747,6 +1747,11 @@ indexMax:20 */ throw new Meteor.Error('Username not unique'); } + const urlRegEx = new RegExp(/^[a-z0-9-]+$/, 'i'); + if (urlRegEx.test(user.username) !== true) { + throw new Meteor.Error('The-username-is-incorrect'); + } + const insee = Cities.findOne({ insee: user.city }); console.log({ diff --git a/imports/startup/client/client.js b/imports/startup/client/client.js index 56633f4..32ae54f 100644 --- a/imports/startup/client/client.js +++ b/imports/startup/client/client.js @@ -69,7 +69,7 @@ Meteor.startup(function () { const m = regex.exec(intent); // alert(`${Meteor.settings.public.endpoint}${m[0]}`); if (m && m[0] && m[1] && m[2]) { - //${Meteor.settings.public.endpoint} + // ${Meteor.settings.public.endpoint} Meteor.call('validateEmail', `${Meteor.settings.public.endpoint}${m[0]}`, (error, result) => { if (error) { // alert(`${error}`); @@ -203,6 +203,14 @@ Meteor.startup(function () { }, ); + Template.registerHelper('calculateAge', (birth) => { + const bday = moment(birth, 'YYYYMMDD HH:mm'); + const today = moment().startOf('day').hour(12); + let age = today.year() - bday.year(); + if (bday > today.subtract(age, 'years')) { age -= 1; } + return age; + }); + Template.registerHelper('i18npref', (prefix, text) => TAPi18n.__(`${prefix}.${text}`)); @@ -287,24 +295,24 @@ Meteor.startup(function () { return count >= 0; } }); - + Template.registerHelper('markdown', new Blaze.Template('markdown', function () { - const view = this; - let content = ''; + const view = this; + let content = ''; + + if (view.templateContentBlock) { + content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING); + // content = view.templateContentBlock; + } + const md = new MarkdownIt('default', { + html: true, + linkify: true, + typographer: true, + }); - if (view.templateContentBlock) { - content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING); - //content = view.templateContentBlock; - } - const md = new MarkdownIt('default',{ - html: true, - linkify: true, - typographer: true - }); - const result = md.render(content); - return HTML.Raw(result); - })); + return HTML.Raw(result); + })); Template.registerHelper('SchemasFollowRest', SchemasFollowRest); Template.registerHelper('SchemasInviteAttendeesEventRest', SchemasInviteAttendeesEventRest); diff --git a/imports/startup/client/routes.js b/imports/startup/client/routes.js index a805213..a7b4099 100644 --- a/imports/startup/client/routes.js +++ b/imports/startup/client/routes.js @@ -37,9 +37,10 @@ Router.map(function() { this.route('detailListHome', { before () { - if (Meteor.loggingIn() && Meteor.user()) { + if (Meteor.userId()) { this.redirect('actusList', { scope: 'citoyens', _id: Meteor.userId() }); } + this.next(); }, template: 'dashboard', path: '/', diff --git a/imports/ui/citoyens/list.html b/imports/ui/citoyens/list.html index 8d53ddd..503a146 100644 --- a/imports/ui/citoyens/list.html +++ b/imports/ui/citoyens/list.html @@ -169,7 +169,6 @@
{{formatBirthDate}} ({{diffInText birthDate}})
+{{formatBirthDate}} ({{calculateAge birthDate}})
{{/if}} {{/if}} {{#unless ../shareVisible}} diff --git a/imports/ui/login/login.js b/imports/ui/login/login.js index 4cbbae5..406c638 100644 --- a/imports/ui/login/login.js +++ b/imports/ui/login/login.js @@ -152,6 +152,15 @@ Template.signin.events({ return false; }; + const isValidUsernameChar = (val) => { + const urlRegEx = new RegExp(/^[a-z0-9-]+$/, 'i'); + if (urlRegEx.test(val) === true) { + return true; + } + pageSession.set('error', 'The-username-is-incorrect'); + return false; + }; + const isValidPassword = (val) => { if (val.length > 7) { return true; @@ -167,6 +176,9 @@ Template.signin.events({ if (!isValidUsername(username)) { return; } + if (!isValidUsernameChar(username)) { + return; + } if (!IsValidEmail(email)) { pageSession.set('error', 'Email not valid'); return; diff --git a/imports/ui/news/news.js b/imports/ui/news/news.js index ea20a37..e0f6f86 100644 --- a/imports/ui/news/news.js +++ b/imports/ui/news/news.js @@ -217,7 +217,7 @@ Template.scopeFilActusTemplate.onRendered(function() { } const threshold = $('.content.overflow-scroll').scrollTop() + - $('.content.overflow-scroll').height() + 130; + $('.content.overflow-scroll').height() + 150; /* console.log(`threshold: ${threshold}`); console.log(`traget top: ${$target.offset().top}`); console.log(`list height: ${$('.content.overflow-scroll .list').height()}`); */ @@ -225,7 +225,7 @@ Template.scopeFilActusTemplate.onRendered(function() { if (heightLimit < threshold) { if (!$target.data('visiblelimitFilActus')) { $target.data('visiblelimitFilActus', true); - pageSession.set('limitFilActus', pageSession.get('limit') + 5); + pageSession.set('limitFilActus', pageSession.get('limitFilActus') + 5); } } else if ($target.data('visiblelimitFilActus')) { $target.data('visiblelimitFilActus', false); diff --git a/mobile-config.js b/mobile-config.js index 5b9956b..66d2e90 100644 --- a/mobile-config.js +++ b/mobile-config.js @@ -4,8 +4,8 @@ App.info({ description: 'communecter mobile', author: 'thomas', email: 'thomas.craipeau@gmail.com', - version: '0.0.31', - buildNumber: '131', + version: '0.0.33', + buildNumber: '133', }); App.setPreference('android-targetSdkVersion', '26'); diff --git a/package.json b/package.json index 5f6f3bf..da1c854 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "communecter", - "version": "0.0.31", + "version": "0.0.33", "description": "communecter", "private": true, "scripts": { @@ -59,12 +59,12 @@ } }, "dependencies": { - "@babel/runtime": "^7.2.0", - "autolinker": "^1.4.3", - "bcrypt": "^0.8.7", + "@babel/runtime": "^7.3.1", + "autolinker": "^3.0.0", + "bcrypt": "^3.0.4", "markdown-it": "^8.4.2", "meteor-node-stubs": "^0.4.1", - "sanitize-html": "^1.14.1" + "sanitize-html": "^1.20.0" }, "repository": { "type": "git", @@ -79,13 +79,17 @@ "devDependencies": { "@meteorjs/eslint-config-meteor": "^1.0.5", "babel-eslint": "^7.2.3", + "electron": "2.0.17", + "electron-builder": "20.38.5", + "electron-builder-squirrel-windows": "20.38.5", "eslint": "^4.3.0", "eslint-config-airbnb": "^15.1.0", "eslint-import-resolver-meteor": "^0.4.0", "eslint-plugin-import": "^2.7.0", "eslint-plugin-jsx-a11y": "^5.0.1", "eslint-plugin-meteor": "^4.1.0", - "eslint-plugin-react": "^7.1.0" + "eslint-plugin-react": "^7.1.0", + "meteor-desktop": "^2.0.0" }, "meteor": { "mainModule": {