mirror of
https://github.com/plankanban/planka.git
synced 2025-08-10 07:55:27 +02:00
commit
8d98d7ec61
14 changed files with 4555 additions and 28427 deletions
|
@ -1,57 +0,0 @@
|
||||||
# name: Build and publish release package
|
|
||||||
|
|
||||||
# on:
|
|
||||||
# release:
|
|
||||||
# types: [created]
|
|
||||||
|
|
||||||
|
|
||||||
# jobs:
|
|
||||||
# build-and-publish-release-package:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v4
|
|
||||||
# - uses: actions/setup-node@v3
|
|
||||||
# with:
|
|
||||||
# node-version: '18'
|
|
||||||
# cache: 'npm'
|
|
||||||
|
|
||||||
# - name: Workflow install pnpm
|
|
||||||
# run: npm install pnpm -g
|
|
||||||
|
|
||||||
# - name: Client install dependencies
|
|
||||||
# run: pnpm install
|
|
||||||
|
|
||||||
# - name: Server install dependencies
|
|
||||||
# run: pnpm install
|
|
||||||
|
|
||||||
# - name: Server include into dist
|
|
||||||
# run: mv server/ dist/
|
|
||||||
|
|
||||||
# - name: Client build production
|
|
||||||
# run: |
|
|
||||||
# npm run build
|
|
||||||
# working-directory: ./client
|
|
||||||
|
|
||||||
# - name: Client include into dist
|
|
||||||
# run: |
|
|
||||||
# mv build/index.html ../dist/views/index.ejs
|
|
||||||
# mv build/* ../dist/public/
|
|
||||||
# working-directory: ./client
|
|
||||||
|
|
||||||
# - name: Dist include README.md SECURITY.md LICENSE start.sh
|
|
||||||
# run: mv README.md SECURITY.md LICENSE start.sh dist/
|
|
||||||
|
|
||||||
# - name: Dist Remove node modules
|
|
||||||
# run: rm -R dist/node_modules
|
|
||||||
|
|
||||||
# - name: Dist create .zip file
|
|
||||||
# run: |
|
|
||||||
# mv dist/ planka/
|
|
||||||
# zip -r planka-prebuild-${{ github.event.release.tag_name }}.zip planka
|
|
||||||
|
|
||||||
# - name: Dist upload assets
|
|
||||||
# run: |
|
|
||||||
# gh release upload ${{ github.event.release.tag_name }} planka-prebuild-${{ github.event.release.tag_name }}.zip
|
|
||||||
# env:
|
|
||||||
# GH_TOKEN: ${{ github.token }}
|
|
14
.vscode/launch.json
vendored
Normal file
14
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"command": "npm start",
|
||||||
|
"name": "Run npm start",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
24191
client/package-lock.json
generated
24191
client/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -30,6 +30,9 @@ services:
|
||||||
- DEFAULT_ADMIN_NAME=Demo Demo
|
- DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
- DEFAULT_ADMIN_USERNAME=demo
|
- DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
|
- MAIL_HOST=smtp.gmail.com
|
||||||
|
|
||||||
|
|
||||||
# related: https://github.com/knex/knex/issues/2354
|
# related: https://github.com/knex/knex/issues/2354
|
||||||
# As knex does not pass query parameters from the connection string we
|
# As knex does not pass query parameters from the connection string we
|
||||||
# have to use environment variables in order to pass the desired values, e.g.
|
# have to use environment variables in order to pass the desired values, e.g.
|
||||||
|
|
2313
package-lock.json
generated
2313
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -58,7 +58,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
"husky": "^8.0.2",
|
"husky": "^8.0.2",
|
||||||
"lint-staged": "^13.0.3"
|
"lint-staged": "^13.0.3",
|
||||||
|
"nodemailer": "^6.9.7",
|
||||||
|
"nodemailer-direct-transport": "^3.3.2",
|
||||||
|
"nodemailer-smtp-transport": "^2.7.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.28.0",
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const { sendUserEmails } = require('../../../utils/mail');
|
||||||
|
|
||||||
const Errors = {
|
const Errors = {
|
||||||
NOT_ENOUGH_RIGHTS: {
|
NOT_ENOUGH_RIGHTS: {
|
||||||
notEnoughRights: 'Not enough rights',
|
notEnoughRights: 'Not enough rights',
|
||||||
|
@ -77,7 +79,7 @@ module.exports = {
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER);
|
.intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER);
|
||||||
|
await sendUserEmails({ to: [inputs.userId], subject: 'b', text: 'c' });
|
||||||
return {
|
return {
|
||||||
item: cardMembership,
|
item: cardMembership,
|
||||||
};
|
};
|
||||||
|
|
26
server/api/controllers/mail/index.js
Normal file
26
server/api/controllers/mail/index.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
const { sendEmail } = require('../../../utils/mail');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
inputs: {
|
||||||
|
to: {
|
||||||
|
type: 'json',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
subject: {
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: 'string',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
cc: {
|
||||||
|
type: 'json',
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
async fn({ to = [], subject = '', text = '', cc = [] }) {
|
||||||
|
const mailResult = await sendEmail({ to, subject, text, cc });
|
||||||
|
return mailResult;
|
||||||
|
},
|
||||||
|
};
|
|
@ -42,4 +42,10 @@ module.exports.custom = {
|
||||||
oidcSkipUserInfo: process.env.OIDC_SKIP_USER_INFO === 'true',
|
oidcSkipUserInfo: process.env.OIDC_SKIP_USER_INFO === 'true',
|
||||||
|
|
||||||
defaultAdminEmail: process.env.DEFAULT_ADMIN_EMAIL,
|
defaultAdminEmail: process.env.DEFAULT_ADMIN_EMAIL,
|
||||||
|
|
||||||
|
mailConnectorHost: process.env.MAIL_HOST,
|
||||||
|
mailConnectorPort: process.env.MAIL_PORT || 25,
|
||||||
|
mailConnectorEmail: 'Planka <planka-noreplay@test.com>',
|
||||||
|
mailConnectorUser: process.env.MAIL_USER,
|
||||||
|
mailConnectorPass: process.env.MAIL_PASSWORD,
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,4 +26,5 @@ module.exports.policies = {
|
||||||
'access-tokens/create': true,
|
'access-tokens/create': true,
|
||||||
'access-tokens/exchange': true,
|
'access-tokens/exchange': true,
|
||||||
'appconfig/index': true,
|
'appconfig/index': true,
|
||||||
|
'mail/index': true,
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
module.exports.routes = {
|
module.exports.routes = {
|
||||||
'GET /api/appconfig': 'appconfig/index',
|
'GET /api/appconfig': 'appconfig/index',
|
||||||
|
|
||||||
|
'POST /api/mail': 'mail/index',
|
||||||
|
|
||||||
'POST /api/access-tokens': 'access-tokens/create',
|
'POST /api/access-tokens': 'access-tokens/create',
|
||||||
'POST /api/access-tokens/exchange': 'access-tokens/exchange',
|
'POST /api/access-tokens/exchange': 'access-tokens/exchange',
|
||||||
'DELETE /api/access-tokens/me': 'access-tokens/delete',
|
'DELETE /api/access-tokens/me': 'access-tokens/delete',
|
||||||
|
|
6323
server/package-lock.json
generated
6323
server/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -37,6 +37,7 @@
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"move-file": "^2.1.0",
|
"move-file": "^2.1.0",
|
||||||
|
"nodemailer": "^6.9.7",
|
||||||
"openid-client": "^5.4.3",
|
"openid-client": "^5.4.3",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"sails": "^1.5.3",
|
"sails": "^1.5.3",
|
||||||
|
|
36
server/utils/mail.js
Normal file
36
server/utils/mail.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
const nodemailer = require('nodemailer');
|
||||||
|
|
||||||
|
const mailerConfig = {
|
||||||
|
host: sails.config.custom.mailConnectorHost,
|
||||||
|
port: sails.config.custom.mailConnectorPort,
|
||||||
|
};
|
||||||
|
if (sails.config.custom.mailConnectorUser) {
|
||||||
|
Object.assign(mailerConfig, {
|
||||||
|
auth: {
|
||||||
|
user: sails.config.custom.mailConnectorUser,
|
||||||
|
pass: sails.config.custom.mailConnectorPass,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const transport = nodemailer.createTransport(mailerConfig);
|
||||||
|
|
||||||
|
const sendEmail = async ({ to, subject, text, cc }) => {
|
||||||
|
try {
|
||||||
|
await transport.sendMail({
|
||||||
|
from: sails.config.custom.mailConnectorEmail,
|
||||||
|
to,
|
||||||
|
cc,
|
||||||
|
subject,
|
||||||
|
html: text,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
sails.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const sendUserEmails = async ({ ids, subject, text, cc }) => {
|
||||||
|
const users = await sails.helpers.users.getMany(ids);
|
||||||
|
return sendEmail({ to: users.map((u) => u.email), subject, text, cc });
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { sendEmail, sendUserEmails };
|
Loading…
Add table
Add a link
Reference in a new issue