mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
parent
76f6f8caa4
commit
3d45c9610f
2 changed files with 33 additions and 33 deletions
|
|
@ -15,17 +15,17 @@ Template.boardMenuPopup.events({
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Template.boardMenuPopup.helpers({
|
Template.boardMenuPopup.helpers({
|
||||||
// exportUrl() {
|
exportUrl() {
|
||||||
// const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
// const loginToken = Accounts._storedLoginToken();
|
const loginToken = Accounts._storedLoginToken();
|
||||||
// return FlowRouter.url(`api/boards/${boardId}?authToken=${loginToken}`);
|
return FlowRouter.url(`api/boards/${boardId}/export?authToken=${loginToken}`);
|
||||||
// },
|
},
|
||||||
// exportFilename() {
|
exportFilename() {
|
||||||
// const boardId = Session.get('currentBoard');
|
const boardId = Session.get('currentBoard');
|
||||||
// return `wekan-export-board-${boardId}.json`;
|
return `wekan-export-board-${boardId}.json`;
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
|
|
||||||
Template.boardChangeTitlePopup.events({
|
Template.boardChangeTitlePopup.events({
|
||||||
submit(evt, tpl) {
|
submit(evt, tpl) {
|
||||||
|
|
|
||||||
|
|
@ -9,33 +9,33 @@ if (Meteor.isServer) {
|
||||||
/*
|
/*
|
||||||
* This route is used to export the board FROM THE APPLICATION.
|
* This route is used to export the board FROM THE APPLICATION.
|
||||||
* If user is already logged-in, pass loginToken as param "authToken":
|
* If user is already logged-in, pass loginToken as param "authToken":
|
||||||
* '/api/boards/:boardId?authToken=:token'
|
* '/api/boards/:boardId/export?authToken=:token'
|
||||||
*
|
*
|
||||||
* See https://blog.kayla.com.au/server-side-route-authentication-in-meteor/
|
* See https://blog.kayla.com.au/server-side-route-authentication-in-meteor/
|
||||||
* for detailed explanations
|
* for detailed explanations
|
||||||
*/
|
*/
|
||||||
// JsonRoutes.add('get', '/api/boards/:boardId', function (req, res) {
|
JsonRoutes.add('get', '/api/boards/:boardId/export', function (req, res) {
|
||||||
// const boardId = req.params.boardId;
|
const boardId = req.params.boardId;
|
||||||
// let user = null;
|
let user = null;
|
||||||
// // todo XXX for real API, first look for token in Authentication: header
|
// todo XXX for real API, first look for token in Authentication: header
|
||||||
// // then fallback to parameter
|
// then fallback to parameter
|
||||||
// const loginToken = req.query.authToken;
|
const loginToken = req.query.authToken;
|
||||||
// if (loginToken) {
|
if (loginToken) {
|
||||||
// const hashToken = Accounts._hashLoginToken(loginToken);
|
const hashToken = Accounts._hashLoginToken(loginToken);
|
||||||
// user = Meteor.users.findOne({
|
user = Meteor.users.findOne({
|
||||||
// 'services.resume.loginTokens.hashedToken': hashToken,
|
'services.resume.loginTokens.hashedToken': hashToken,
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const exporter = new Exporter(boardId);
|
const exporter = new Exporter(boardId);
|
||||||
// if(exporter.canExport(user)) {
|
if(exporter.canExport(user)) {
|
||||||
// JsonRoutes.sendResult(res, 200, exporter.build());
|
JsonRoutes.sendResult(res, { code: 200, data: exporter.build() });
|
||||||
// } else {
|
} else {
|
||||||
// // we could send an explicit error message, but on the other hand the only
|
// we could send an explicit error message, but on the other hand the only
|
||||||
// // way to get there is by hacking the UI so let's keep it raw.
|
// way to get there is by hacking the UI so let's keep it raw.
|
||||||
// JsonRoutes.sendResult(res, 403);
|
JsonRoutes.sendResult(res, 403);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class Exporter {
|
class Exporter {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue