Commit graph

161 commits

Author SHA1 Message Date
Kailash Nadh
5aedc3a4f6 Make media upload file extension validation case insensitive. Closes #1256. 2023-03-25 11:46:23 +05:30
Kailash Nadh
55f7eca2e8
Add support for file attachments in the transactional (tx) API. (#1243)
The original PR accepts files to the `/tx` endpoints as Base64 encoded
strings in the JSON payload. This isn't ideal as the payload size
increase caused by Base64 for larger files can be significant,
in addition to the added clientside API complexity.

This PR adds supports for multipart form posts to `/tx` where the
JSON data (name: `data`) and multiple files can be posted simultaenously
(one or more `file` fields).

--- PR: #1166
* Attachment model for TxMessage
* Don't reassign values, just pass the manager.Messgage
* Read attachment info from API; create attachment Header
* Refactor tx attachments to use multipart form files. Closes #1166.
---

Co-authored-by: MatiSSL <matiss.lidaka@nic.lv>
2023-03-19 15:50:44 +05:30
Kailash Nadh
6cf82347bf Add support for SVG files to media. Closes #1217.
- Add support for SVG in media uploader.
- Add provision to exclude vector formats from thumbnail creation.
- Increase default thumb size to 120px from 90px.

Co-authored-by: Ronan <ronan.le_meillat@sctg.eu.org>
2023-03-19 13:58:41 +05:30
Kailash Nadh
dda7d44601 Hide private lists from prefs manage page. Closes #1200. 2023-02-26 12:36:46 +05:30
Ronan LE MEILLAT
80592f60c6
Translate the subject of the email sent with personnal datas (#1193) 2023-02-20 20:33:44 +05:30
Kailash Nadh
8985e5c24a
Add hCaptcha.com support to public subscription form. (#1152)
Bots easily bypass the simple `nonce` hack. This commit adds support
for the hcaptcha.com widget.

- New `Security` tab in the admin settings UI.
- Enable/disable CAPTCHA.
- Render CAPTCHA on the public subscription form.

Closes #1116.
2023-01-23 21:50:10 +05:30
Kailash Nadh
62d3782d04 Use send_at date for scheduled campaigns in RSS feed. Closes #1149. 2023-01-21 12:43:30 +05:30
Kailash Nadh
3cfbc646e3 Add support for multiple subscribers in a single transactional message call.
This patch adds new array fields on `POST /tx`: `subscriber_emails[]`, `subscriber_ids[]`.
Either of these array fields can be sent with multiple subscribers.

The individual non-array fields `subscriber_id` and `subscriber_email` are deprecated.

Closes #994.
2022-12-25 17:32:01 +05:30
Kailash Nadh
5d4f1ea0ad Add optional params in DB config to accept arbitrary Postgres params. Closes #1016. 2022-12-25 16:28:19 +05:30
Kailash Nadh
1f693b80f7 Add a default public archive template. 2022-12-25 16:07:12 +05:30
Kailash Nadh
4dee2e9a1b Fix per_page=all in API calls in the paginator lib.
Closes #1098.
2022-12-25 00:43:58 +05:30
Kailash Nadh
8d4a5751d8 Fix broken single list fetch API. 2022-11-22 23:11:20 +05:30
Kailash Nadh
1e90feecaf Show send_at on archive page for scheduled campaigns. Closes #1036. 2022-11-18 23:12:53 +05:30
Kailash Nadh
818f2c9d8e Add public archive on/off toggle to settings. 2022-11-10 23:30:53 +05:30
Kailash Nadh
f958f3d24b Add RSS feed to the public mailing list archive. 2022-11-10 23:30:53 +05:30
Kailash Nadh
438568eeb0 Add global site name setting to render name on public pages. 2022-11-10 23:30:53 +05:30
Kailash Nadh
eac1240437 Exclude opt-in campaign from public archive. 2022-11-10 23:30:53 +05:30
Kailash Nadh
23fb178ec4 Add subscription/archive links to public pages. 2022-11-10 23:30:53 +05:30
Kailash Nadh
56a9836e86 Integrate paginator library in place of custom pagination function. 2022-11-10 23:30:50 +05:30
Kailash Nadh
9add728b08 WIP: Add support for publishing campaigns to publish archives. 2022-11-10 23:30:11 +05:30
Kailash Nadh
ef1f84ee7c Add new description field to lists. Closes #925. 2022-11-01 21:04:35 +05:30
Kailash Nadh
3b0083190e Add ability for subscribers to manage preferences on the unsub form.
- Ability to change name.
- Ability to unsubscribe from individual lists.
- Toggle option to enable this in Admin Settings -> Privacy.

Closes #455.
2022-10-29 15:23:28 +05:30
Kailash Nadh
281c47198c Fix go-for-loop reference bug in template caching. 2022-10-21 17:59:56 +05:30
Kailash Nadh
c38100427d Add arbitrary meta field to media. Closes #938.
- Add new `meta` JSONB field to `media` table.
- Start storing image width and height as meta with media uploads.
2022-10-02 23:04:51 +05:30
Kailash Nadh
c3d04a5490 Refactor models.SubscriberAttribs JSON wrapper to generic name JSON. 2022-10-02 22:53:38 +05:30
Kailash Nadh
edb4c9168d Improve HTML check in notif template loading. Closes #903. 2022-09-10 12:21:53 +05:30
Kailash Nadh
f266f93cc8 Add Safe() template function to notif templates. 2022-09-10 12:20:27 +05:30
Kailash Nadh
5a9e9209c8 Fix missing list names on optin page. Closes #940. 2022-09-10 12:17:01 +05:30
Kailash Nadh
6d820f4f6e Add maintenance options.
- Add new maintenance UI with options to garbage collect (delete)
  orphan subscriber and analytics records.
2022-09-03 14:58:25 +05:30
Kailash Nadh
8ace25849e Add /api/public/* endpoints.
- Add `/api/public/lists` that returns the list of public lists, same
  information revealed on the `/subscription/form` page.

- Add `/api/public/subscription` that accepts a JSON POST for a
  subscription signup same as `/subscription/form`.

Closes #910.
2022-08-28 15:12:20 +05:30
Kailash Nadh
b497f52ae7 Merge branch 'fix-analytics' 2022-07-30 20:12:11 +05:30
Kailash Nadh
bfc27def57 Fix regression of public subscriber page behaviour. 2022-07-30 20:11:59 +05:30
Kailash Nadh
3550d5453d Fix incorrect analytics count. Closes #712. 2022-07-30 19:01:20 +05:30
Kailash Nadh
77bc8a7745 Send full media object in upload API response. Closes #770. 2022-07-13 19:48:09 +05:30
Kailash Nadh
278d5bf74e Merge branch 'test-smtp' 2022-07-11 19:46:03 +05:30
Kailash Nadh
ee448170ef Add support for testing SMTP connections in the settings UI. 2022-07-11 19:44:44 +05:30
Kailash Nadh
e99c8ed86b Disable template type updation after creation to prevent breaking of campaign relations. 2022-07-09 10:36:12 +05:30
Kailash Nadh
5a5caca256 Refactor campaign/template preview functions and component. 2022-07-09 10:36:12 +05:30
Kailash Nadh
0574a1b820 Fix template compilation check on CRUD. 2022-07-09 10:36:12 +05:30
Kailash Nadh
3f5a50fc0d Fix header processing in tx send. 2022-07-09 10:36:12 +05:30
Kailash Nadh
68da86aadc Fix redundant echo/http error wrapping. 2022-07-09 10:36:12 +05:30
Kailash Nadh
4a6e041ca8 Don't break boot on tx template compilation errors. 2022-07-09 10:36:12 +05:30
Kailash Nadh
463e92d1e1 Add transactional (tx) messaging capability.
This commit adds a new API `POST /api/tx` that sends an ad-hoc message
to a subscriber based on a pre-defined transactional template. This is
a large commit that adds the following:

- New campaign / tx template types on the UI. tx templates have an
  additional subject field.
- New fields `type` and `subject` to the templates table.
- Refactor template CRUD operations and models.
- Refactor template func assignment in manager.
- Add pre-compiled template caching to manager runtime.
- Pre-compile all tx templates into memory on program boot to avoid
  expensive template compilation on ad-hoc tx messages.
2022-07-09 10:36:12 +05:30
Kailash Nadh
59c9441b3b Fix subscriber create query to not ignore duplicate e-mail error.
Trying to insert a pre-existing e-mail on POST /api/subscribers
now return a 409 Conflict error.

Closes #718
2022-05-11 21:40:31 +05:30
Kailash Nadh
b94da621d7 Fix broken public link redirect. 2022-05-05 18:05:13 +05:30
Kailash Nadh
5fd4d7b44b Refactor paginated bounce query function to return DB total. 2022-05-03 10:50:33 +05:30
Kailash Nadh
d2ef23d3fa Refactor paginated campaign query function to return DB total. 2022-05-03 10:50:33 +05:30
Kailash Nadh
e303850584 Refactor paginated list query function to return DB total. 2022-05-03 10:50:33 +05:30
Kailash Nadh
aa19771307 Refactor bounces package to remove db/queries dependency.
Instead of passing a DB/SQL statement references, instead pass a
callback that inserts a bounce into the DB via the `core` package.
2022-05-03 10:50:33 +05:30
Kailash Nadh
b5cd9498b1 Refactore all CRUD functions to a new core package.
This is a long pending refactor. All the DB, query, CRUD, and related
logic scattered across HTTP handlers are now moved into a central
`core` package with clean, abstracted methods, decoupling HTTP
handlers from executing direct DB queries and other business logic.

eg: `core.CreateList()`, `core.GetLists()` etc.

- Remove obsolete subscriber methods.
- Move optin hook queries to core.
- Move campaign methods to `core`.
- Move all campaign methods to `core`.
- Move public page functions to `core`.
- Move all template functions to `core`.
- Move media and settings function to `core`.
- Move handler middleware functions to `core`.
- Move all bounce functions to `core`.
- Move all dashboard functions to `core`.
- Fix GetLists() not honouring type
- Fix unwrapped JSON responses.
- Clean up obsolete pre-core util function.
- Replace SQL array null check with cardinality check.
- Fix missing validations in `core` queries.
- Remove superfluous deps on internal `subimporter`.
- Add dashboard functions to `core`.
- Fix broken domain ban check.
- Fix broken subscriber check middleware.
- Remove redundant error handling.
- Remove obsolete functions.
- Remove obsolete structs.
- Remove obsolete queries and DB functions.
- Document the `core` package.
2022-05-03 10:50:29 +05:30