todos-contra-el-fuego-web/imports/startup/server/api.js
vjrj 6b6f02d92d quality: web debt batch (tests runner, FireContainer, rate-limit, maps, i18n)
Independent-of-prod quality debt from PENDIENTE.md §2:

- test: migrate broken Jest -> meteortesting:mocha. Tests rewritten to chai +
  Meteor 3 async APIs, moved to test/server/ (server-only). test/server/
  00-setup.test.js re-runs the collection2/accounts init that `meteor test`
  skips (no server/main.js). New comments method + mediaAnalyzers coverage.
  Dropped rest.test.js (removed meteor/http; covered by smoke/). 36 passing.
- fix: scope FireContainer read by the URL _id on the archive route instead of
  a selector-less FiresCollection.findOne() (imports/ui/pages/Fires/Fires.js).
- feat: rate-limit abusable publications via rateLimitSubscriptions (fireFrom*
  and comments.forReference 5/1000ms; geo subs 10/1000ms).
- perf: append loading=async to the Google Maps loader URL (Gkeys.js).
- deps: meteor-accounts-t9n 2.0 -> 2.6 (no gl build -> keep gl->es fallback,
  documented); add 3 missing gl/common.json keys (0 missing now).
- deps: drop jest/babel/enzyme, add chai.
2026-07-21 22:59:06 +02:00

51 lines
1.5 KiB
JavaScript

import '../../api/Documents/methods';
import '../../api/Documents/server/publications';
import '../../api/OAuth/server/methods';
import '../../api/Users/server/methods';
import '../../api/Users/server/publications';
import '../../api/Utility/server/methods';
import '../../api/ActiveFires/server/publications';
import '../../api/ActiveFiresUnion/server/publications';
import '../../api/FireAlerts/server/publications';
import '../../api/Subscriptions/methods';
import '../../api/Subscriptions/server/publications';
import '../../api/Notifications/methods';
import '../../api/Notifications/server/publications';
import '../../api/Fires/methods';
import '../../api/Fires/server/publications';
import '../../api/SiteSettings/methods';
import '../../api/SiteSettings/server/publications';
import '../../api/FalsePositives/methods';
import '../../api/FalsePositives/server/publications';
import { rateLimitSubscriptions } from '../../modules/rate-limit';
// Rate-limit the abusable publications (the old TODO above). Single-fire
// lookups and the comments feed are cheap but brute-forceable, so keep them
// tight; the geo subs fire on every map pan/zoom, so give them more headroom.
rateLimitSubscriptions({
subscriptions: [
'fireFromHash', 'fireFromAlertId', 'fireFromActiveId', 'fireFromId',
'comments.forReference'
],
limit: 5,
timeRange: 1000
});
rateLimitSubscriptions({
subscriptions: [
'activefiresmyloc', 'activefiresunionmyloc', 'fireAlerts',
'falsePositivesMyloc', 'industriesMyloc'
],
limit: 10,
timeRange: 1000
});