Commit graph

116 commits

Author SHA1 Message Date
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
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
76df9c8d76 Refactor and simply function name. 2022-08-26 16:49:58 +05:30
Kailash Nadh
13068ccce2 Fix broken bulk subscriber query. Closes #897. 2022-08-26 16:49:58 +05:30
Kailash Nadh
bbbf28c5ce Create default tx template on upgrade. 2022-07-30 22:37:05 +05:30
Kailash Nadh
bfc27def57 Fix regression of public subscriber page behaviour. 2022-07-30 20:11:59 +05:30
Kailash Nadh
c84837f8cb Fix '&amp' encoding in tracked URLs before saving in the DB. Closes #844. 2022-07-11 23:18:08 +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
4de5d53fe4 Refactor upgrade schema to remove column default. 2022-07-09 10:36:12 +05:30
Kailash Nadh
2dcac57cba Fix tx template delete query. 2022-07-09 10:36:12 +05:30
Kailash Nadh
d3774d606a Make tx DB upgrade schema consistent with install schema. 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
Joe Paul
175770d8b8 fix: Use list append instead of indexing 2022-06-27 16:14:46 +05:30
Joe Paul
a1df02b41c feat(postback): Add attachment, from email to postback body 2022-06-27 15:47:38 +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
fe5466dfda Remove test files committed accidentaly. 2022-05-10 11:00:45 +05:30
Kailash Nadh
959541f8ee Rename unsub query to match the core method name. 2022-05-08 14:45:45 +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
Kailash Nadh
89eca5f14b Changed email subject template from HTML to text. Fixes #785. 2022-05-03 10:41:46 +05:30
Kailash Nadh
7ea523db37
Merge pull request #727 from yatish27/fix_typos_in_comments
Fix typos
2022-04-03 11:39:07 +05:30
Kailash Nadh
73e4c1cf28 Fix POP mail parsing in multipart bounce e-mails.
This was originally authored by @stevesavanna in #707. This commit
contains changes and refactors that could not be pushed to the original PR.

Changes from #707

- Don't ignore bounce mails missing campaign / subscriber UUIDs. The
  original behaviour falls back to looking up subscribers by e-mail.
- Refactor repetetive header.get + regexp conditions per header into
  a simpler lookup map.
- Trim e-mail header values of `\r`.

Closes #707, #763

Co-authored-by: stevesavanna <steven@savannacorp.com>
2022-04-03 11:37:11 +05:30
Yatish Mehta
26483334c5 Fix typos 2022-03-20 11:17:29 -07:00
Gokul Menon
04c4552a9c Fixed typos 2022-02-28 14:19:50 +01:00
Kailash Nadh
caa27f30cf
Merge pull request #699 from yatish27/fix_typos
Fix typos
2022-02-16 20:04:03 +05:30
Yatish Mehta
6c903239dd Fix typos 2022-02-13 08:54:39 -08:00
Yatish Mehta
dc4e3a6780
Fix typo in manager.go 2022-02-12 23:03:41 -08:00
Kailash Nadh
0f6a0376da Add accurate realtime message rate counter.
The `rate` field `/api/campaigns/running/stats` returned was computed
based on the total time spent from the start of the campaign to the
current time. This meant that for large campaigns, if there were
pauses or slowdowns in between, the rate would be skewed heavily
making it useless to figure out the current send rate.

This commit introduces a realtime running rate counter in the campaign
manager that returns accurate (running) send rates for the last minute.

The `rate` field in the API now shows the live running rate and a
new `net_rate` field shows the rate from the beginning of the campaign.
2022-02-06 11:38:02 +05:30
Kailash Nadh
64d2c5aeb9 Add support for custom public S3 URLs. Closes #505. 2022-01-15 21:20:32 +05:30
Kailash Nadh
7955a4fa27 Fix media upload S3 IAM init blocking outside non-AWS environments.
- Update `simples3` to a version that supports IAM timeout.
- On IAM error, fall back to key/secret mode (although with empty creds)
  so that the app still starts.
2022-01-15 20:45:17 +05:30
Kailash Nadh
e200ab0dab Add support for additional POP3 mail charsets. Closes #644. 2022-01-04 22:46:42 +05:30
Kailash Nadh
e1d3dd4a65 Merge branch 'master' of github.com:knadh/listmonk 2022-01-04 22:33:58 +05:30
Kailash Nadh
d8ed40422e Make tls_enabled key migratin idempotent. 2022-01-04 22:30:43 +05:30
Kailash Nadh
583dab4bc6 Add support for per-campaign custom headers.
- Add new `headers[]` column to the campain table.
- Add new headers box to the campaign UI that takes a JSON array of
  custom headers like the headers on the SMTP settings UI.
- Headers are added to e-mails and messenger postback webhooks.
- Add cypress tests.

Closes #514.
2022-01-04 22:27:40 +05:30
Kailash Nadh
dd061f56d4 Add support for direct SSL/TLS (non-STARTTLS) SMTP connections.
- Add support for TLS in `smtppool` (v0.4.0) and upgrade the lib.
- Change `tls_enabled: bool` in the settings table to string
  `tls_type: STARTTLS|TLS|none` and on the settings UI.
- Add DB migrations and schema changes to apply the field change.

Closes #504.
2022-01-03 19:28:36 +05:30
Rohan
c003aec9c9 feat: switch from s3 POST to s3 put
This commit switches simples3 from issuing a POST to a PUT.

Ref #617
2021-12-29 15:13:23 +05:30
Kailash Nadh
fabe06e339 Add support for custom CSS/JS in settings for admin and public pages.
This feature was originally authored by @sweetppro in PR #438.
However, since the PR ended up in an unclean state with
multiple master merges (instead of rebase) from the upstream, there are
several commits that are out of order and can can no longer be be
squashed for a clean feature merge.

This commit aggregates the changes from the original PR and applies the
following fixes on top of it.

- Add custom admin JS box to appearance UI.
- Refactor i18n language strings.
- Add handlers and migrations for the new `appearance.admin.custom_js`
  field.
- Fix migration version to `v2.1.0`
- Load custom appearance CSS/JS bytes into global constants during boot
  instead of making a DB call on every request.
- Fix and canonicalize URIs from `/api/custom*` to `/public/*.css`
  and `/admin/*.css`. Add proxy paths to yarn proxy config.
- Remove redundant HTTP handlers for different custom appearance files
  and refactor into a single handler `serveCustomApperance()`
- Fix content-type and UTF8 encoding headers for different file types.
- Fix incorrect registration of public facing custom CSS/JS handlers
  in the authenticated admin URI group.
- Fix merge conflicts in `Settings.vue`.
- Minor HTML and style fixes.
- Remove the `AppearanceEditor` component and use the existing
  `HTMLEditor` component instead.
- Add `language` prop to the `HTMLEditor` component.

Co-authored-by: SweetPPro <sweetppro@users.noreply.github.com>
2021-12-18 15:38:42 +05:30
Kailash Nadh
4cb5eb782f Fix settings form input validation.
- Fix settings UI form submit button.
- Validate upload URI. Closes #621.
2021-12-09 19:30:15 +05:30
Kailash Nadh
a7fa97a214 Add scanning of full bounce email body for bounce headers. Closes #492. 2021-11-10 20:47:55 +05:30
Kailash Nadh
11010393d8 Add "passive" mode with --passive flag.
Every listmonk instance scans the DB periodically to look for
running campaigns to process. This made running multiple instances of
listmonk impractical as they would all pick up the same running
campaign and process them, resulting in duplicate e-mails.

This commit adds a `--passive` flag to the binary that runs listmonk
in a "passive" mode where campaign processing is disabled. This allows
multiple instances of listmonk to be run to handle different kinds of
requests if there is a requirement (scale/traffic?). It is important
to note that there should only be one non-passive instance running at
any given time. If distributed campaign processing is ever considered,
this will change.
2021-10-29 14:40:22 +05:30
Kailash Nadh
b46ab6d3a9 Fallback to default S3 URL on empty media upload URL in settings. 2021-10-04 22:20:24 +05:30
Kailash Nadh
7aa850824c Add explicit public-read ACL to public S3 uploads. Closes #496. 2021-10-02 17:12:31 +05:30
Kailash Nadh
3ffd88f0df Remove obsolete bounce routines from manager package. 2021-09-26 18:57:25 +05:30
Kailash Nadh
7aee36eab1 Add support for blocklisting e-mail domains.
E-mails in the domain blocklist are disallowed on the admin UI, public
subscription forms, API, and in the bulk importer.

- Add blocklist setting that takes a list of multi-line domains on the
  Settings -> Privacy UI.
- Refactor e-mail validation in subimporter to add blocklist checking
  centrally.
- Add Cypress testr testing domain blocklist behaviour on admin
  and non-admin views.

Closes #336.
2021-09-25 15:39:09 +05:30
Kailash Nadh
e71115db26 Add option to toggle sending opt-in confirmation. Closes #363. 2021-09-25 10:38:13 +05:30