diff options
Diffstat (limited to 'shared/utils/server')
-rw-r--r-- | shared/utils/server/config.ts | 3 | ||||
-rw-r--r-- | shared/utils/server/contact-form.ts | 28 |
2 files changed, 31 insertions, 0 deletions
diff --git a/shared/utils/server/config.ts b/shared/utils/server/config.ts index ff5288c82..0c5512bab 100644 --- a/shared/utils/server/config.ts +++ b/shared/utils/server/config.ts | |||
@@ -80,6 +80,9 @@ function updateCustomSubConfig (url: string, token: string, newConfig: any) { | |||
80 | admin: { | 80 | admin: { |
81 | email: 'superadmin1@example.com' | 81 | email: 'superadmin1@example.com' |
82 | }, | 82 | }, |
83 | contactForm: { | ||
84 | enabled: true | ||
85 | }, | ||
83 | user: { | 86 | user: { |
84 | videoQuota: 5242881, | 87 | videoQuota: 5242881, |
85 | videoQuotaDaily: 318742 | 88 | videoQuotaDaily: 318742 |
diff --git a/shared/utils/server/contact-form.ts b/shared/utils/server/contact-form.ts new file mode 100644 index 000000000..80394cf99 --- /dev/null +++ b/shared/utils/server/contact-form.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | import * as request from 'supertest' | ||
2 | import { ContactForm } from '../../models/server' | ||
3 | |||
4 | function sendContactForm (options: { | ||
5 | url: string, | ||
6 | fromEmail: string, | ||
7 | fromName: string, | ||
8 | body: string, | ||
9 | expectedStatus?: number | ||
10 | }) { | ||
11 | const path = '/api/v1/server/contact' | ||
12 | |||
13 | const body: ContactForm = { | ||
14 | fromEmail: options.fromEmail, | ||
15 | fromName: options.fromName, | ||
16 | body: options.body | ||
17 | } | ||
18 | return request(options.url) | ||
19 | .post(path) | ||
20 | .send(body) | ||
21 | .expect(options.expectedStatus || 204) | ||
22 | } | ||
23 | |||
24 | // --------------------------------------------------------------------------- | ||
25 | |||
26 | export { | ||
27 | sendContactForm | ||
28 | } | ||