todos-contra-el-fuego-web/imports/api/OAuth/server/methods.js
vjrj eb3aec82ae meteor3: purge dead client packages — web UI renders on 3.1
alanning:roles removed (client crashed the whole bundle; plain user.roles
checks instead), selaias:cookie-consent replaced by in-repo React banner,
publish-performant-counts vendored with countAsync, Meteor.autorun dropped
(App)/Tracker.autorun (FiresMap), and the map publications not covered by
the REST smoke (activefiresmyloc, activefiresunionmyloc, fireAlerts,
oauth.verifyConfiguration) converted to async APIs.

Verified in browser: / and /fires render with map + cookie banner, zero
uncaught exceptions. REST smoke byte-identical (12/12).
2026-07-14 11:32:19 +02:00

30 lines
784 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { ServiceConfiguration } from 'meteor/service-configuration';
import rateLimit from '../../../modules/rate-limit';
Meteor.methods({
'oauth.verifyConfiguration': async function oauthVerifyConfiguration(services) {
check(services, Array);
try {
const verifiedServices = [];
for (const service of services) {
if (await ServiceConfiguration.configurations.findOneAsync({ service })) {
verifiedServices.push(service);
}
}
return verifiedServices.sort();
} catch (exception) {
throw new Meteor.Error('500', exception);
}
},
});
rateLimit({
methods: [
'oauth.verifyConfiguration',
],
limit: 5,
timeRange: 1000,
});