Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] Federation routes #14972

Merged
merged 5 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/federation/server/PeerServer/routes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { API } from '../../../../api';
import { FederationKeys } from '../../../../models';
import { Federation } from '../..';

API.v1.addRoute('federation.events', { authRequired: false }, {
const routeMethods = {
post() {
if (!Federation.peerServer.enabled) {
return API.v1.failure('Not found');
Expand Down Expand Up @@ -112,4 +112,8 @@ API.v1.addRoute('federation.events', { authRequired: false }, {
return API.v1.failure(`Error handling event:${ e.t } - ${ err.toString() }`, err.error || 'unknown-error');
}
},
};

Meteor.startup(() => {
API.v1.addRoute('federation.events', { authRequired: false }, routeMethods);
});
6 changes: 5 additions & 1 deletion app/federation/server/PeerServer/routes/uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Uploads } from '../../../../models';
import { FileUpload } from '../../../../file-upload';
import { Federation } from '../..';

API.v1.addRoute('federation.uploads', { authRequired: false }, {
const routeMethods = {
get() {
if (!Federation.peerServer.enabled) {
return API.v1.failure('Not found');
Expand All @@ -25,4 +25,8 @@ API.v1.addRoute('federation.uploads', { authRequired: false }, {

return API.v1.success({ upload, buffer });
},
};

Meteor.startup(() => {
API.v1.addRoute('federation.uploads', { authRequired: false }, routeMethods);
});
8 changes: 7 additions & 1 deletion app/federation/server/PeerServer/routes/users.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Meteor } from 'meteor/meteor';

import { API } from '../../../../api';
import { Users } from '../../../../models';
import { FederatedUser } from '../../federatedResources';
import { Federation } from '../..';

API.v1.addRoute('federation.users', { authRequired: false }, {
const routeMethods = {
get() {
if (!Federation.peerServer.enabled) {
return API.v1.failure('Not found');
Expand Down Expand Up @@ -45,4 +47,8 @@ API.v1.addRoute('federation.users', { authRequired: false }, {

return API.v1.success({ federatedUsers });
},
};

Meteor.startup(() => {
API.v1.addRoute('federation.users', { authRequired: false }, routeMethods);
});