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).
30 lines
784 B
JavaScript
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,
|
|
});
|