Browse Source

Merge pull request #3244 from nocodb/feat/gui-v2-smtp-rejectUnauthorized

feat(gui-v2): add smtp rejectUnauthorized
pull/3298/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
94554dffb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue
  2. 12
      packages/nocodb/src/lib/plugins/smtp/SMTP.ts
  3. 13
      packages/nocodb/src/lib/plugins/smtp/index.ts
  4. 2
      packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql
  5. 3
      scripts/cypress/support/page_objects/mainPage.js

7
packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue

@ -103,6 +103,13 @@ const readPluginDetails = async () => {
const emptyParsedInput = formDetails.array ? [{}] : {}
const parsedInput = res.input ? JSON.parse(res.input) : emptyParsedInput
// the type of 'secure' was XcType.SingleLineText in 0.0.1
// and it has been changed to XcType.Checkbox, since 0.0.2
// hence, change the text value to boolean here
if ('secure' in parsedInput && typeof parsedInput.secure === 'string') {
parsedInput.secure = !!parsedInput.secure
}
plugin = { ...res, formDetails, parsedInput }
pluginFormData = plugin.parsedInput
} catch (e) {

12
packages/nocodb/src/lib/plugins/smtp/SMTP.ts

@ -14,11 +14,12 @@ export default class SMTP implements IEmailAdapter {
public async init(): Promise<any> {
const config = {
// from: this.input.from,
// options: {
host: this.input?.host,
port: parseInt(this.input?.port, 10),
secure: this.input?.secure === 'true',
secure:
typeof this.input?.secure === 'boolean'
? this.input?.secure
: this.input?.secure === 'true',
ignoreTLS:
typeof this.input?.ignoreTLS === 'boolean'
? this.input?.ignoreTLS
@ -27,8 +28,11 @@ export default class SMTP implements IEmailAdapter {
user: this.input?.username,
pass: this.input?.password,
},
// }
tls: {
rejectUnauthorized: this.input?.rejectUnauthorized,
},
};
this.transporter = nodemailer.createTransport(config);
}

13
packages/nocodb/src/lib/plugins/smtp/index.ts

@ -8,7 +8,7 @@ import SMTPPlugin from './SMTPPlugin';
const config: XcPluginConfig = {
builder: SMTPPlugin,
title: 'SMTP',
version: '0.0.1',
version: '0.0.2',
// icon: 'mdi-email-outline',
description: 'SMTP email client',
price: 'Free',
@ -42,8 +42,8 @@ const config: XcPluginConfig = {
key: 'secure',
label: 'Secure',
placeholder: 'Secure',
type: XcType.SingleLineText,
required: true,
type: XcType.Checkbox,
required: false,
},
{
key: 'ignoreTLS',
@ -52,6 +52,13 @@ const config: XcPluginConfig = {
type: XcType.Checkbox,
required: false,
},
{
key: 'rejectUnauthorized',
label: 'Reject Unauthorized',
placeholder: 'Reject Unauthorized',
type: XcType.Checkbox,
required: false,
},
{
key: 'username',
label: 'Username',

2
packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql

@ -3308,7 +3308,7 @@ nc_iyhlectialukbv Vultr Object Storage Using Vultr Object Storage can give flexi
nc_lr8pcvg64g5bho OvhCloud Object Storage Upload your files to a space that you can access via HTTPS using the OpenStack Swift API, or the S3 API. f \N 0.0.1 \N install \N plugins/ovhCloud.png \N Storage Storage {"title":"Configure OvhCloud Object Storage","items":[{"key":"bucket","label":"Bucket Name","placeholder":"Bucket Name","type":"SingleLineText","required":true},{"key":"region","label":"Region","placeholder":"Region","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and attachment will be stored in OvhCloud Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.60416+00 2022-06-13 07:00:02.60416+00
nc_3f19m6v5iyudty Linode Object Storage S3-compatible Linode Object Storage makes it easy and more affordable to manage unstructured data such as content assets, as well as sophisticated and data-intensive storage challenges around artificial intelligence and machine learning. f \N 0.0.1 \N install \N plugins/linode.svg \N Storage Storage {"title":"Configure Linode Object Storage","items":[{"key":"bucket","label":"Bucket Name","placeholder":"Bucket Name","type":"SingleLineText","required":true},{"key":"region","label":"Region","placeholder":"Region","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and attachment will be stored in Linode Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.606391+00 2022-06-13 07:00:02.606391+00
nc_ikemr7ajwzfcr3 UpCloud Object Storage The perfect home for your data. Thanks to the S3-compatible programmable interface,\nyou have a host of options for existing tools and code implementations.\n f \N 0.0.1 \N install \N plugins/upcloud.png \N Storage Storage {"title":"Configure UpCloud Object Storage","items":[{"key":"bucket","label":"Bucket Name","placeholder":"Bucket Name","type":"SingleLineText","required":true},{"key":"endpoint","label":"Endpoint","placeholder":"Endpoint","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and attachment will be stored in UpCloud Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.6085+00 2022-06-13 07:00:02.6085+00
nc_tv5fgn17fgvcwh SMTP SMTP email client f \N 0.0.1 \N install \N \N \N Email Email {"title":"Configure Email SMTP","items":[{"key":"from","label":"From","placeholder":"eg: admin@run.com","type":"SingleLineText","required":true},{"key":"host","label":"Host","placeholder":"eg: smtp.run.com","type":"SingleLineText","required":true},{"key":"port","label":"Port","placeholder":"Port","type":"SingleLineText","required":true},{"key":"secure","label":"Secure","placeholder":"Secure","type":"SingleLineText","required":true},{"key":"ignoreTLS","label":"Ignore TLS","placeholder":"Ignore TLS","type":"Checkbox","required":false},{"key":"username","label":"Username","placeholder":"Username","type":"SingleLineText","required":false},{"key":"password","label":"Password","placeholder":"Password","type":"Password","required":false}],"actions":[{"label":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use SMTP configuration","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.61079+00 2022-06-13 07:00:02.61079+00
nc_tv5fgn17fgvcwh SMTP SMTP email client f \N 0.0.1 \N install \N \N \N Email Email {"title":"Configure Email SMTP","items":[{"key":"from","label":"From","placeholder":"eg: admin@run.com","type":"SingleLineText","required":true},{"key":"host","label":"Host","placeholder":"eg: smtp.run.com","type":"SingleLineText","required":true},{"key":"port","label":"Port","placeholder":"Port","type":"SingleLineText","required":true},{"key":"secure","label":"Secure","placeholder":"Secure","type":"Checkbox","required":false},{"key":"ignoreTLS","label":"Ignore TLS","placeholder":"Ignore TLS","type":"Checkbox","required":false},{"key":"username","label":"Username","placeholder":"Username","type":"SingleLineText","required":false},{"key":"password","label":"Password","placeholder":"Password","type":"Password","required":false}],"actions":[{"label":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use SMTP configuration","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.61079+00 2022-06-13 07:00:02.61079+00
nc_hcnsq71s0tr8um MailerSend MailerSend email client f \N 0.0.1 \N install \N plugins/mailersend.svg \N Email Email {"title":"Configure MailerSend","items":[{"key":"api_key","label":"API KEy","placeholder":"eg: ***************","type":"Password","required":true},{"key":"from","label":"From","placeholder":"eg: admin@run.com","type":"SingleLineText","required":true},{"key":"from_name","label":"From Name","placeholder":"eg: Adam","type":"SingleLineText","required":true}],"actions":[{"label":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use MailerSend configuration","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.612874+00 2022-06-13 07:00:02.612874+00
nc_z2zas0qdy0cz7e Scaleway Object Storage Scaleway Object Storage is an S3-compatible object store from Scaleway Cloud Platform. f \N 0.0.1 \N install \N plugins/scaleway.png \N Storage Storage {"title":"Setup Scaleway","items":[{"key":"bucket","label":"Bucket name","placeholder":"Bucket name","type":"SingleLineText","required":true},{"key":"region","label":"Region of bucket","placeholder":"Region of bucket","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed Scaleway Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.61482+00 2022-06-13 07:00:02.61482+00
nc_96vkc0jdyw7los SES Amazon Simple Email Service (SES) is a cost-effective, flexible, and scalable email service that enables developers to send mail from within any application. f \N 0.0.1 \N install \N plugins/aws.png \N Email Email {"title":"Configure Amazon Simple Email Service (SES)","items":[{"key":"from","label":"From","placeholder":"From","type":"SingleLineText","required":true},{"key":"region","label":"Region","placeholder":"Region","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use Amazon SES","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.617114+00 2022-06-13 07:00:02.617114+00

3
scripts/cypress/support/page_objects/mainPage.js

@ -222,7 +222,8 @@ export class _mainPage {
.click()
.type(host);
cy.getActiveModal().find('[placeholder="Port"]').click().type(port);
cy.getActiveModal().find('[placeholder="Secure"]').click().type(secure);
// TODO: in v2, it would be a button
// if (secure) cy.getActiveModal().find('[placeholder="Secure"]').click();
cy.getActiveModal().find("button").contains("Save").click();
cy.toastWait(
"Successfully installed and email notification will use SMTP configuration"

Loading…
Cancel
Save