summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md9
-rw-r--r--docker-compose.yml25
-rw-r--r--models/export.js18
-rw-r--r--packages/wekan-oidc/oidc_server.js1
4 files changed, 46 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf37bfb9..ee0e5683 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,16 @@
# Upcoming Wekan release
-This release fixes the following bugs:
+This release adds the following new features:
+
+- [Login to Wekan with Nextcloud](https://github.com/wekan/wekan/pull/2897).
+ Thanks to bogie.
+
+and fixes the following bugs:
- [Show System Wide Announcement in one line](https://github.com/wekan/wekan/pull/2891).
Thanks to tsia.
+- [Fixed board export with attachment in Wekan Meteor 1.9.x version](https://github.com/wekan/wekan/pull/2898).
+ Thanks to izadpoor.
Thanks to above GitHub users for their contributions and translators for their translations.
diff --git a/docker-compose.yml b/docker-compose.yml
index 6f52a2fb..57ccaeea 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -342,6 +342,31 @@ services:
# Tthe claim name you want to map to the email field:
#- OAUTH2_EMAIL_MAP=email
#-----------------------------------------------------------------
+ # ==== OAUTH2 Nextcloud ====
+ # 1) Register the application with Nextcloud: https://your.nextcloud/settings/admin/security
+ # Make sure you capture the application ID as well as generate a secret key.
+ # 2) Configure the environment variables. This differs slightly
+ # by installation type, but make sure you have the following:
+ #- OAUTH2_ENABLED=true
+ # OAuth2 login style: popup or redirect.
+ #- OAUTH2_LOGIN_STYLE=redirect
+ # Application GUID captured during app registration:
+ #- OAUTH2_CLIENT_ID=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
+ # Secret key generated during app registration:
+ #- OAUTH2_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ #- OAUTH2_SERVER_URL=https://your-nextcloud.tld
+ #- OAUTH2_AUTH_ENDPOINT=/index.php/apps/oauth2/authorize
+ #- OAUTH2_USERINFO_ENDPOINT=/ocs/v2.php/cloud/user?format=json
+ #- OAUTH2_TOKEN_ENDPOINT=/index.php/apps/oauth2/api/v1/token
+ # The claim name you want to map to the unique ID field:
+ #- OAUTH2_ID_MAP=id
+ # The claim name you want to map to the username field:
+ #- OAUTH2_USERNAME_MAP=id
+ # The claim name you want to map to the full name field:
+ #- OAUTH2_FULLNAME_MAP=display-name
+ # Tthe claim name you want to map to the email field:
+ #- OAUTH2_EMAIL_MAP=email
+ #-----------------------------------------------------------------
# ==== OAUTH2 KEYCLOAK ====
# https://github.com/wekan/wekan/wiki/Keycloak <== MAPPING INFO, REQUIRED
#- OAUTH2_ENABLED=true
diff --git a/models/export.js b/models/export.js
index cd72a6a4..339123c8 100644
--- a/models/export.js
+++ b/models/export.js
@@ -24,7 +24,6 @@ if (Meteor.isServer) {
JsonRoutes.add('get', '/api/boards/:boardId/export', function(req, res) {
const boardId = req.params.boardId;
let user = null;
-
const loginToken = req.query.authToken;
if (loginToken) {
const hashToken = Accounts._hashLoginToken(loginToken);
@@ -35,7 +34,6 @@ if (Meteor.isServer) {
Authentication.checkUserId(req.userId);
user = Users.findOne({ _id: req.userId, isAdmin: true });
}
-
const exporter = new Exporter(boardId);
if (exporter.canExport(user)) {
JsonRoutes.sendResult(res, {
@@ -137,8 +135,11 @@ export class Exporter {
// [Old] for attachments we only export IDs and absolute url to original doc
// [New] Encode attachment to base64
+
const getBase64Data = function(doc, callback) {
- let buffer = Buffer.from(0);
+ let buffer = Buffer.allocUnsafe(0);
+ buffer.fill(0);
+
// callback has the form function (err, res) {}
const tmpFile = path.join(
os.tmpdir(),
@@ -149,14 +150,16 @@ export class Exporter {
readStream.on('data', function(chunk) {
buffer = Buffer.concat([buffer, chunk]);
});
+
readStream.on('error', function(err) {
- callback(err, null);
+ callback(null, null);
});
readStream.on('end', function() {
// done
fs.unlink(tmpFile, () => {
//ignored
});
+
callback(null, buffer.toString('base64'));
});
readStream.pipe(tmpWriteable);
@@ -165,11 +168,14 @@ export class Exporter {
result.attachments = Attachments.find(byBoard)
.fetch()
.map(attachment => {
+ let filebase64 = null;
+ filebase64 = getBase64DataSync(attachment);
+
return {
_id: attachment._id,
cardId: attachment.cardId,
- // url: FlowRouter.url(attachment.url()),
- file: getBase64DataSync(attachment),
+ //url: FlowRouter.url(attachment.url()),
+ file: filebase64,
name: attachment.original.name,
type: attachment.original.type,
};
diff --git a/packages/wekan-oidc/oidc_server.js b/packages/wekan-oidc/oidc_server.js
index ee60a490..f6e23a15 100644
--- a/packages/wekan-oidc/oidc_server.js
+++ b/packages/wekan-oidc/oidc_server.js
@@ -10,6 +10,7 @@ OAuth.registerService('oidc', 2, null, function (query) {
var expiresAt = (+new Date) + (1000 * parseInt(token.expires_in, 10));
var userinfo = getUserInfo(accessToken);
+ if (userinfo.ocs) userinfo = userinfo.ocs.data; // Nextcloud hack
if (debug) console.log('XXX: userinfo:', userinfo);
var serviceData = {};