Compare commits

..

17 commits

Author SHA1 Message Date
39415808bf Fase 1a: flag de cutover notifDisabledChannels en processNotif
Guard reversible al inicio de processNotif: los canales listados en
settings.private.notifDisabledChannels (p.ej. ['mobile','web']) los gestiona el
microservicio tcef-notifications, y el observer/cron viejos los ignoran.
Exclusion mutua por canal sin desplegar codigo (solo editar settings).
ES5-compatible (Meteor 1.6 / Node 8).
2026-07-13 00:10:39 +02:00
9d92ec4f88 deps: regenera package-lock.json y actualiza puntero de meteor-comments-ui 2026-07-12 23:26:17 +02:00
2a31435135 Refactor server startup: elimina segfaults, añade leaflet-workaround
Retira import './segfaults' (workaround de crash obsoleto) y añade
leaflet-workaround.js (shims global window/document/navigator para
render de Leaflet en servidor). Ajustes menores en publications de
FalsePositives y subsUnion.
2026-07-12 23:26:16 +02:00
8281fa3427 chore: ignorar settings-production-*.json y settings-tests.json (secretos) 2026-07-12 23:26:16 +02:00
vjrj
ee7af168d6 Update meteor dev user/pass 2022-08-14 21:53:41 +02:00
vjrj
4cbbe65fa3 Fix wrong grey tiles 2022-08-13 19:37:56 +02:00
vjrj
b9457fe141 Minor changes in fires union 2018-12-23 13:31:41 +01:00
vjrj
c4cb52abaf Improved chimp command in README 2018-11-18 18:01:38 +01:00
vjrj
423dbc5ed9 Added optional chimp configuration 2018-11-18 18:01:17 +01:00
vjrj
1fdf86dd47 Union of subs 'null' when app is initialized 2018-11-18 16:24:49 +01:00
vjrj
5f9a84dfd7 Unify don't calc boundaries of empty union 2018-11-18 15:45:14 +01:00
vjrj
564b9e8ead Trying to fix race condition in i18n load 2018-11-18 15:43:48 +01:00
vjrj
df51368d50 Better log in error 2018-11-18 15:05:04 +01:00
vjrj
0f6dd21541 Removed watch to test 2018-11-18 15:04:46 +01:00
vjrj
8903c765e3 Minor refactor 2018-11-18 14:27:51 +01:00
vjrj
266707052c Better error message 2018-11-18 14:27:34 +01:00
vjrj
3f8bc3666b Fixed index DOM warning. Google Play btn height 2018-11-18 13:08:36 +01:00
24 changed files with 600 additions and 686 deletions

5
.gitignore vendored
View file

@ -12,3 +12,8 @@ public/locales/undefined/
.screenshots
.vscode
output.json
# fase-0 higiene: variantes de settings con secretos (no versionar)
settings-production-*.json
settings-tests.json
*.json~

View file

@ -33,11 +33,11 @@ TEST_PORT=3000 TEST_WATCH=1 TEST_CLIENT=0 MONGO_URL=mongodb://localhost:27017/fu
# and
chimp --watch --ddp=http://localhost:3000 --path=cucumber
node_modules/.bin/chimp --watch --ddp=http://localhost:3000 --path=cucumber
# and
chimp --ddp=http://localhost:3000 --path=cucumber
node_modules/.bin/chimp --ddp=http://localhost:3000 --path=cucumber
```

29
cucumber/chimp-config.js Normal file
View file

@ -0,0 +1,29 @@
module.exports = {
// - - - - CHIMP - - - -
/* watch: false,
* watchTags: '@watch',
* offline: false,
*/
// - - - - CUCUMBER - - - -
/* path: './features',
* jsonOutput: 'output.json', */
// '- - - - DEBUGGING - - - -
log: 'info',
debug: false,
seleniumDebug: false,
webdriverLogLevel: false,
// debugBrkCucumber: 5858,
// - - - - WEBDRIVER-IO - - - -
webdriverio: {
waitforTimeout: 10000,
waitforInterval: 250, // KEEP SMALL (!!!) this is the INTERVAL in which waitFor* is looped fo
desiredCapabilities: {
chromeOptions: {
// args: ["headless", "disable-gpu"]
args: ['--disable-gpu', '--no-sandbox', '--headless']
},
isHeadless: true
}
}
};

View file

@ -40,7 +40,6 @@ Feature: Test all secundary pages
| fire/Fe26.2**1a0361ed0384f741403682e26b4bbc3850bee24e775da13c9782b22365ea895f*r_3gmVad5vzkeyqPpo6UcA*1s5fFz3iDGKTYP2RCvXMshof00QCHf4ErDl9K2dxoX0u-J-t6scyOWG8pGp3ehg_FfEtyR_kYcEKU3rE0jaSlZbD09TIvhiIJeS3C6Uc8YD-rit0XBrgsVKfYSxKzTRoOYiYFJ8JYd298hMtfiASePjS05Z58hhicyCcJYYRlarqDScG3LiVY3lL5y2nfcdIMNuSjCiKOJWuMkxwd9nR1UHMudLl0hEoy56mPdnHpDYtP9IYUlIOk1LlWBxcmHKifbXeqHu94p8j13Kk20dh2R49Hw3KsSoE9UbWmGQA9wAZXT82301i3rGF5GPAKjlTlRYcWisQurnPwHSVmx3DhUdiYwKGxt4KeaM5QVI4BE9octvE41OOprB_-Il105diQEh2Y9vdvX51ZVWIRfCboICPM6rJb0Oin7U7F1iM-oD_5s3DGnelfM5LGBcKwiB5paMo5M5vdBMaO-zR216cW9yGVXw9IZqHx8xDQWnoHAZjt8NLHeiGF2QOmIGtEUH7qnwhGpkcvszajmAZzR8saZgoH1qfBfvpVA41YfV14gU**4d030f05e23ad75409cebc609107467fc60be5077d52cf041087cd024fc4dc45*GY97aGFc1MyAsoO3Qxqtgwk9j-MbAPdEGBmEHq6r8VU | Additional information | false |
Then I check that all page urls works properly
@watch
Scenario: Check that other non visible pages work well
Given I logout if logged
And a list of non visible pages ids and contents

View file

@ -67,12 +67,14 @@ Meteor.publish('activefiresunionmyloc', function activeInMyLoc(northEastLng, nor
check(northEastLat, NumberBetween(-90, 90));
check(withMarks, Boolean);
if (!Meteor.isDevelopment) return this.ready(); // empty
// I use this for fire stats
// if (!Meteor.isDevelopment) return this.ready(); // empty
return activeFiresUnion(northEastLng, northEastLat, southWestLng, southWestLat, withMarks);
});
// Warning: this increase always by one the fire stats
Meteor.publish('lastFireUnionDetected', function lastFireDetected() {
if (!Meteor.isDevelopment) return this.ready(); // empty
// I use this for fire stats
// if (!Meteor.isDevelopment) return this.ready(); // empty
return ActiveFiresUnion.find({}, { limit: 1, sort: { when: -1 } });
});

View file

@ -5,7 +5,8 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { NumberBetween } from '/imports/modules/server/other-checks';
import L from 'leaflet-headless';
import '/imports/startup/server/leaflet-workaround.js';
import L from 'leaflet';
import calcUnion from '/imports/ui/components/Maps/SubsUnion/Unify';
import Industries from '/imports/api/Industries/Industries';
import FalsePositives from '../FalsePositives';

View file

@ -147,7 +147,7 @@ export function fireFromHash(fireEnc, params) {
// const unsealed = Promise.await(urlEnc.decrypt(fireEnc));
const unsealed = Promise.await(unsealW(fireEnc));
if (unsealed === undefined) {
throw Error('Undefined unsealed');
throw Error(`Fail to unseal '${fireEnc}'`);
}
const w = unsealed.when;
unsealed.when = new Date(w);

View file

@ -43,7 +43,18 @@ function imgUrl(lat, lng) {
return `<img src="${imgUrl(lat, lng)}" width="640" height="480"/>`;
} */
// Cutover flag (fase 1a): channels listed in
// Meteor.settings.private.notifDisabledChannels (e.g. ['mobile','web']) are
// handled by the tcef-notifications microservice, so the old observer/cron must
// NOT send them. Mutual exclusion per channel — reversible by editing settings,
// no code deploy needed. ES5-compatible on purpose (Meteor 1.6 / Node 8).
const notifDisabledChannels = (Meteor.settings.private && Meteor.settings.private.notifDisabledChannels) || [];
const processNotif = (notif) => {
if (notifDisabledChannels.indexOf(notif.type) !== -1) {
// This channel was migrated to tcef-notifications; do nothing here.
return;
}
if (isMailServerMaster && validFcmSender && notif.type === 'mobile' && notif.notified !== true) {
const fcmSender = new gcm.Sender(Meteor.settings.private.fcmApiToken);
const user = Meteor.users.findOne({ _id: notif.userId });

View file

@ -17,5 +17,4 @@ import './prerender';
import './feedback';
import './cron';
import './isMaster';
import './segfaults';
import './rest';

View file

@ -0,0 +1,19 @@
// imports/startup/server/leaflet-workaround.js
global.window = {
screen: {
deviceXDPI: 1,
logicalXDPI: 1
}
};
global.document = {
documentElement: {
style: {}
},
createElement: () => {
return {};
}
};
global.navigator = {
userAgent: 'foo',
platform: 'bar'
};

View file

@ -1,25 +0,0 @@
import SegfaultHandler from 'segfault-handler';
import moment from 'moment';
// import ravenLogger from './ravenLogger';
// https://github.com/ddopson/node-segfault-handler
const dateFileFormat = moment().format('YYYYMMDD_HH:mm:ss');
SegfaultHandler.registerHandler(`/var/tmp/tcef-stacktrace-${dateFileFormat}.log`);
// This callaback does not work:
// https://github.com/ddopson/node-segfault-handler/issues/49
/* SegfaultHandler.registerHandler('/var/tmp/tcef-crash.log', (signal, address, stack) => {
* // Do what you want with the signal, address, or stack (array)
* // This callback will execute before the signal is forwarded on.
* ravenLogger.log(stack, signal);
* }); */
// Only uncomment for segv tests
// SegfaultHandler.causeSegfault();
// Or this for normal error (should go to raven in configured)
// throw new Error('This is just a test of error in server');

View file

@ -4,7 +4,8 @@ import { Meteor } from 'meteor/meteor';
import Subscriptions from '/imports/api/Subscriptions/Subscriptions';
import SiteSettings from '/imports/api/SiteSettings/SiteSettings';
import Perlin from 'loms.perlin';
import L from 'leaflet-headless';
import './leaflet-workaround';
import L from 'leaflet';
import calcUnion from '/imports/ui/components/Maps/SubsUnion/Unify';
import { isMailServerMaster } from '/imports/startup/server/email';

View file

@ -35,7 +35,8 @@ class DefMapLayers extends Component {
<TileLayer
opacity={defOpacity}
attribution="&copy; <a href=&quot;http://osm.org/copyright&quot;>OpenStreetMap</a> contributors"
url="https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png"
// url="https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png"
url="https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"
/>
</BaseLayer>);
const osmlayer = (

View file

@ -31,7 +31,7 @@ class FireCircleMark extends Component {
} = this.props;
const rect = rectangleAround({ lat, lon }, track, track);
return (
<GeoJSON data={rect} color="red" stroke width="1" opacity=".4" fillOpacity=".3">
<GeoJSON data={rect} color="red" stroke width="1" opacity=".4" fillOpacity="1">
<FirePopup t={t} history={history} id={id} nasa={nasa} lat={lat} lon={lon} when={when} />
</GeoJSON>
);

View file

@ -2,7 +2,8 @@ import { calcUnion as calcUnionWoBounds } from 'map-common-utils';
const calcUnion = (L, subs, decorated, typeCircle) => {
const unionJson = calcUnionWoBounds(subs, decorated, typeCircle);
return [unionJson, L.geoJSON(unionJson).getBounds()];
// return [unionJson, L.geoJSON(unionJson).getBounds()];
return [unionJson, unionJson === null ? null : L.geoJSON(unionJson).getBounds()];
};
export default calcUnion;

View file

@ -98,66 +98,66 @@ const App = props => (
/* https://react.i18next.com/components/i18nextprovider.html */
<div>
{props.i18nReady.get() &&
<ErrorBoundary>
<I18nextProvider i18n={i18n}>
<ErrorBoundary appName={i18n.t('AppNameFull')} title={i18n.t('general-error-title')} subTitle={i18n.t('general-error-description')}>
<Router history={history}>
<LocationListener>
{ !props.loading &&
<div className="App">
<Helmet>
<meta charSet="utf-8" />
<title>{i18n.t('AppName')}</title>
<meta name="description" content={`${i18n.t('AppDescrip')}: ${i18n.t('AppDescripLong')}`} />
<link rel="alternate" href={`https://fires.comunes.org${history.location.pathname}`} hrefLang="en" />
<link rel="alternate" href={`https://fuegos.comunes.org${history.location.pathname}`} hrefLang="es" />
</Helmet>
<Navigation {...props} />
<ReSendEmail {...props} />
<ErrorBoundary>
<I18nextProvider i18n={i18n}>
<ErrorBoundary appName={i18n.t('AppNameFull')} title={i18n.t('general-error-title')} subTitle={i18n.t('general-error-description')}>
<Router history={history}>
<LocationListener>
{ !props.loading &&
<div className="App">
<Helmet>
<meta charSet="utf-8" />
<title>{i18n.t('AppName')}</title>
<meta name="description" content={`${i18n.t('AppDescrip')}: ${i18n.t('AppDescripLong')}`} />
<link rel="alternate" href={`https://fires.comunes.org${history.location.pathname}`} hrefLang="en" />
<link rel="alternate" href={`https://fuegos.comunes.org${history.location.pathname}`} hrefLang="es" />
</Helmet>
<Navigation {...props} />
<ReSendEmail {...props} />
<Grid>
<Switch>
<Route exact name="index" path="/" component={Index} />
<Authenticated exact path="/subscriptions" component={Subscriptions} {...props} />
<Authenticated exact path="/subscriptions/new" component={NewSubscription} {...props} />
<Authenticated exact path="/subscriptions/:_id" component={ViewSubscription} {...props} />
<Authenticated exact path="/subscriptions/:_id/edit" component={EditSubscription} {...props} />
<Authenticated exact path="/profile" component={Profile} {...props} />
<Authenticated exact path="/status" component={Status} {...props} />
<Route path="/fires" component={FiresMap} industries={false} {...props} />
<Route path="/zones" component={ZonesMap} {...props} />
<Grid>
<Switch>
<Route exact name="index" path="/" component={Index} />
<Authenticated exact path="/subscriptions" component={Subscriptions} {...props} />
<Authenticated exact path="/subscriptions/new" component={NewSubscription} {...props} />
<Authenticated exact path="/subscriptions/:_id" component={ViewSubscription} {...props} />
<Authenticated exact path="/subscriptions/:_id/edit" component={EditSubscription} {...props} />
<Authenticated exact path="/profile" component={Profile} {...props} />
<Authenticated exact path="/status" component={Status} {...props} />
<Route path="/fires" component={FiresMap} industries={false} {...props} />
<Route path="/zones" component={ZonesMap} {...props} />
<Route path="/fire/:type(active|archive|alert)/:id" component={Fires} {...props} />
<Route path="/fire/:id" component={Fires} {...props} />
<Public path="/auth/:token" component={Auth} {...props} />
<Public path="/signup" component={Signup} {...props} />
<Public path="/login" component={Login} {...props} />
<Route path="/logout" component={Logout} {...props} />
<Route path="/sandbox" component={Sandbox} {...props} />
<Route path="/error" component={TestError} {...props} />
<Route path="/fire/:type(active|archive|alert)/:id" component={Fires} {...props} />
<Route path="/fire/:id" component={Fires} {...props} />
<Public path="/auth/:token" component={Auth} {...props} />
<Public path="/signup" component={Signup} {...props} />
<Public path="/login" component={Login} {...props} />
<Route path="/logout" component={Logout} {...props} />
<Route path="/sandbox" component={Sandbox} {...props} />
<Route path="/error" component={TestError} {...props} />
<Route name="verify-email" path="/verify-email/:token" component={VerifyEmail} />
<Route name="recover-password" path="/recover-password" component={RecoverPassword} />
<Route name="reset-password" path="/reset-password/:token" component={ResetPassword} />
<Route name="terms" path="/terms" component={Terms} />
<Route name="privacy" path="/privacy" component={Privacy} />
<Route name="license" path="/license" component={License} />
<Route name="credits" path="/credits" component={Credits} />
<Route name="about" path="/about" component={About} />
<Route name="verify-email" path="/verify-email/:token" component={VerifyEmail} />
<Route name="recover-password" path="/recover-password" component={RecoverPassword} />
<Route name="reset-password" path="/reset-password/:token" component={ResetPassword} />
<Route name="terms" path="/terms" component={Terms} />
<Route name="privacy" path="/privacy" component={Privacy} />
<Route name="license" path="/license" component={License} />
<Route name="credits" path="/credits" component={Credits} />
<Route name="about" path="/about" component={About} />
<Route component={NotFound} />
</Switch>
</Grid>
<Footer />
<Reconnect {...props} />
<Feedback {...props} />
{props.i18nReady.get() && <Blaze template="cookieConsent" /> }
</div>}
</LocationListener>
</Router>
</ErrorBoundary>
</I18nextProvider>
</ErrorBoundary> }
<Route component={NotFound} />
</Switch>
</Grid>
<Footer />
<Reconnect {...props} />
<Feedback {...props} />
{props.i18nReady.get() && <Blaze template="cookieConsent" /> }
</div>}
</LocationListener>
</Router>
</ErrorBoundary>
</I18nextProvider>
</ErrorBoundary> }
</div>
);
@ -186,7 +186,9 @@ export default withTracker(() => {
const loading = !Roles.subscription.ready() || !i18nReady.get();
const name = user && user.profile && user.profile.name && getUserName(user.profile.name);
const emailAddress = user && user.emails && user.emails[0].address;
// console.log(`i18n ready?: ${i18nReady.get()}`);
Meteor.autorun(() => {
console.log(`i18n ready?: ${i18nReady.get()}`);
});
return {
loading,
loggingIn,

View file

@ -140,13 +140,12 @@ class Fire extends React.Component {
>
<Fragment>
<GeoJSON
ref={(circle) => { this.circle = circle; this.handleLeafletCircleLoad(circle); }}
data={rect}
color="red"
stroke
width="1"
fillOpacity="0.0"
ref={(circle) => { this.circle = circle; this.handleLeafletCircleLoad(circle); }}
/>
</Fragment>
<FireList

View file

@ -84,19 +84,6 @@ class FiresMap extends React.Component {
});
}
/* shouldComponentUpdate(nextProps, nextState) {
* const notMoving = !nextState.moving;
* const markersChanged = this.state.useMarkers !== nextState.useMarkers;
* const unionChanged = this.state.showSubsUnion !== nextState.showSubsUnion;
* const otherViewport = this.state.viewport !== nextState.viewport;
* // const init = nextState.viewport.center === [0, 0];
* // console.log(notMoving ? 'Not moving map' : 'Moving map');
* // console.log(otherViewport ? 'Other viewport' : 'Not other viewport');
* console.log(`${otherViewport ? 'OTHER' : 'Not other'} viewport ${nextState.viewport.center} zoom: ${nextState.viewport.zoom}`);
* return this.state.init || (notMoving && otherViewport && this.state.moved) || unionChanged || markersChanged;
* }
*/
shouldComponentUpdate(nextProps, nextState) {
const notMoving = !nextState.moving;
return notMoving;
@ -249,7 +236,7 @@ class FiresMap extends React.Component {
<p className="firesmap-legend">
{ (this.props.activefires.length + this.props.firealerts.length) === 0 ?
<Fragment><Trans parent="span" i18nKey="noActiveFireInMapCount">No hay fuegos activos en esta zona del mapa. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> <FireStats loadingAll={loading} {... this.props} /></Fragment> :
<Fragment><Trans parent="span" i18nKey="activeFireInMapCount">En rojo, <strong>{{ count: this.props.activefires.length + this.props.firealerts.length }}</strong> fuegos activos. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> <FireStats loadingAll={loading} {... this.props} /></Fragment>
<Fragment><Trans parent="span" i18nKey="activeFireInMapCount">En rojo, <strong>{{ count: this.props.activefiresunion.length + this.props.firealerts.length }}</strong> fuegos activos. <strong>{{ countTotal: this.props.activefirestotal }}</strong> fuegos activos en el mundo.</Trans> <FireStats loadingAll={loading} {... this.props} /></Fragment>
}
</p>
{isNotHomeAndMobile() && this.props.firealerts.length > 0 &&

View file

@ -182,9 +182,9 @@ class Index extends Component {
</div>
<p className="moto"><Trans>Siempre alerta a los fuegos en nuestro vecindario</Trans></p>
{/* <Link className="participe-btn btn btn-lg btn-warning" role="button" to="/#platforms">{this.props.t('Participa')}</Link> */}
<p>
<div className="android-btn">
<MobileStoreButton store="android" url={androidUrl} />
</p>
</div>
</div>
</section>
</section>

View file

@ -77,3 +77,7 @@
}
}
}
.android-btn > div {
height: 50px !important;
}

View file

@ -63,8 +63,8 @@ class SubscriptionsMap extends React.Component {
handleLeafletLoad(map) {
// console.log('Map loading');
// console.log(map);
if (map) {
if (map && this.props.userSubs !== 'null') {
// console.log(`Union of ${this.props.userSubs}`);
this.state.union = subsUnion(this.state.union, {
map,
subs: this.props.userSubs,

1017
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
"name": "tcef",
"private": true,
"scripts": {
"start": "QT_QPA_PLATFORM='' MONGO_URL=mongodb://localhost:27017/fuegos meteor --settings settings-development.json",
"start": "QT_QPA_PLATFORM='' MONGO_URL=mongodb://fuegos:fuegos@localhost:27017/fuegos meteor --settings settings-development.json",
"test": "jest"
},
"dependencies": {
@ -39,7 +39,6 @@
"juice": "^4.2.2",
"leaflet": "^1.3.1",
"leaflet-graphicscale": "0.0.2",
"leaflet-headless": "^0.2.6",
"leaflet-sleep": "^0.5.1",
"lodash": "^4.17.4",
"loms.perlin": "^1.0.1",
@ -83,7 +82,6 @@
"react-router-hash-link": "^1.1.1",
"react-share": "^2.0.0",
"reactstrap": "^5.0.0-alpha.3",
"segfault-handler": "^1.0.0",
"simpl-schema": "^1.5.0",
"simple-line-icons": "^2.4.1",
"store": "^2.0.12",

@ -1 +1 @@
Subproject commit 3346b6db70c153b1dd66e6a16a0ad28f10ebf740
Subproject commit 4761da921f467838a2c01b34e84a7703ee49b12c