Commit graph

1686 commits

Author SHA1 Message Date
Kailash Nadh
110345d659 Refactor and simplify state management in campaign editor.
- Simplify and fix content conversion between formats.
- Fix state management issues.
- Rename `Apply` to `Import` on the visual template UI.
2025-04-20 20:48:51 +05:30
Kailash Nadh
fca5ec5abe Change visual editor UI language. 2025-04-20 20:48:51 +05:30
Kailash Nadh
7786b18473 Add DB migrations for visual editor. 2025-04-20 20:48:51 +05:30
Kailash Nadh
c1f81cfadd Fix compatibility issues with master.
- Fix merge conflicts.
- Simply logic in campaign preview handler.
- Remove redundant `GetCampaignForPreviewWithTemplate()` and switch to the old
  query that optionally takes a template.
- Fix Vue linting issues.
2025-04-20 20:48:51 +05:30
Vivek R
82e2b705bd fix: Move visual-editor to iframe so that CSS styles are isolated. 2025-04-20 20:48:51 +05:30
Vivek R
4a524c9332 feat: Integrate media selector to visual editor and add minor fixes.
- Disable visual templates from being made default.
- Refactor visual template selection flow in campaigns.
- Hide scroll if templates modal is active. This is to make sure it doesn't
  flicker when adding blocks in visual-editor.
2025-04-20 20:48:51 +05:30
Vivek R
e6f08a052c feat: Inject email-builder instead of loading it as ES module
- Add email-builder source
- Update yarn lock
2025-04-20 20:48:51 +05:30
Vivek R
ae98280858 feat: Integrate email-builder on campaign/template editor UI and backend. 2025-04-20 20:48:51 +05:30
Kailash Nadh
5a0980e55e Add on-hover one-click Copy button to subscribers and campaigns tables UI. 2025-04-20 20:48:41 +05:30
Fabian Schneebauer
a85e467cd9
Add missing charset for numbers in TrackLink regex. (#2404)
Co-authored-by: Fabian Schneebauer <fabian@fs-it.org>
2025-04-19 11:15:44 +05:30
Kailash Nadh
fb527008d7 Remove GET /api/settings dependency on the Lists -> Forms UI. 2025-04-18 23:44:08 +05:30
Kailash Nadh
b44ea0c336 Merge branch 'fix-sql-search' 2025-04-18 15:33:41 +05:30
Kailash Nadh
75aad8ec88 Add new search param to paginated API response structure. 2025-04-18 15:33:10 +05:30
Kailash Nadh
29591c188a Add get list permission check to bulk subscriber list management. 2025-04-18 15:30:28 +05:30
dependabot[bot]
fca8d6de25
Bump vite from 5.4.17 to 5.4.18 in /frontend (#2416)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.17 to 5.4.18.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.18/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.18/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.18
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-18 15:19:33 +05:30
Kailash Nadh
4b805f885b Fix broken subscribers:sql_query permission.
This permission was never checked for and had an unintended consequence of
allowing a non-superadmin user to execute arbitrary queries (expected), but
getting a superadmin session by joining the `sessions` table.

This patch:
- Introduces a table allowlist that uses the Postgres query plan (JSON)
  and validate the referenced tables against the allowed ones on arbitrary
  queries issued to the various `/subscribers` APIs.
- Explicitly adds the missing `subscribers:sql_query` permission check to all
  handlers that accept `query`.
- Introduces a new `search` parameter on all handlers that accept `query`.
  This parameter is an interface over the default name/email substring search
  instead of relying on `query`.
2025-04-18 14:15:47 +05:30
dependabot[bot]
375e385666
Bump golang.org/x/net from 0.36.0 to 0.38.0 (#2413)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-18 14:01:03 +05:30
Carson Yang
4d8c8cdedd
Update installation.md (#2405) 2025-04-15 15:18:50 +05:30
Pierre Neillo
5971bc4a5c
Fix Raw CSV example on import UI (#2392)
Signed-off-by: Pierre Neillo <pierre.neillo@free.fr>
2025-04-14 13:08:14 +05:30
Kailash Nadh
562e52cd22 Introduce LISTMONK_ADMIN_API_USER to --install. Closes #2314, #2322.
- During install, listmonk now accepts the env `LISTMONK_ADMIN_API_USER`
  and creates an API user (with username $LISTMONK_ADMIN_API_USER)
  with full superadmin permissions. This requires LISTMONK_ADMIN_USER and
  LISTMONK_ADMIN_API_PASSWORD to be set so that that there's always a superadmin
  user to avoid bad states, mainly: bot superadmin exists, but no admin user
  exists, leaving the installation perpetually open with the superadmin user
  creation UI on the first login.
  The API user's token is printed to stderr in the following format:
  `export LISTMONK_ADMIN_API_TOKEN="7I81VSd90UWhKDj5Kq9c6YopToRduyDF"`
  This can be redirected to a file with ./listmonk 2> /tmp/token or captured
  directly and then source()'d.
- Add new function `core.GetRole(id)`.
- Fix `at least one super admin` query in user deletion.
2025-04-10 13:06:04 +05:30
dependabot[bot]
b3e6b09929
Bump vite from 5.4.15 to 5.4.17 in /frontend (#2391)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.15 to 5.4.17.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.17/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.17/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.17
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-06 15:33:41 +05:30
Kailash Nadh
0826f401b7 Remove repetitive URL param :id validation and simplify handlers.
This patch significantly cleans up clunky, repetitive, and pervasive
validation logic across HTTP handlers.

- Rather than dozens of handlers checking and using strconv to validate ID,
  the handlers with `:id` are now wrapped in a `hasID()` middleware that does
  the validation and sets an int `id` in the handler context that the wrapped
  handlers can now access with `getID()`.

- Handlers that handled both single + multi resource requests
  (eg: GET `/api/lists`) with single/multiple id checking conditions are all now
  split into separate handlers, eg: `getList()`, `getLists()`.
2025-04-06 14:01:21 +05:30
Kailash Nadh
e6d3aad0a1 Add ability to wait and healthcheck for backend app in Cypress settings tests. 2025-04-06 13:40:44 +05:30
Kailash Nadh
78366ab7e4 Clean up main initialization to remove app interdepencies in init.
`App{}` now is used purely as a container for HTTP handlers.
2025-04-06 00:28:35 +05:30
Kailash Nadh
88489223c9 Remove superfluous consts dep in init functions by separating URL consts. 2025-04-05 23:39:08 +05:30
Kailash Nadh
e2f24a140e Turn notifs into a special stateful global singleton package, removing clunky deps. 2025-04-05 22:45:19 +05:30
Kailash Nadh
e327ebbbdf Move all HTTP handlers directly to App and remove the redundant in-between layer. 2025-04-05 19:24:25 +05:30
Kailash Nadh
b3d46a8c85 Refactor system notification callbacks into a new notifs package. 2025-04-05 19:07:06 +05:30
Kailash Nadh
00c858fc49 Refactor all HTTP handlers and attach them to a single struct.
- Attach all HTTP handlers to a new `Handlers{}` struct.
- Remove all `handle*` function prefixes.
- Remove awkward, repetitive `app = c.Get("app").(*App)` from all handlers
  and instead, simply access it from `h.app` from `Handlers{}`

Originally proposed in #2292.
2025-04-05 15:42:35 +05:30
Kailash Nadh
007f4de850 Fix a number of cosmetic inconsistenies across handlers and functions.
- Make the beginning of handlers consistent with uniform variable declaration
  and grouping.
- Add missing comments.
- Fix staticcheck/vet warnings and idiom issues.
2025-04-05 13:41:31 +05:30
Kailash Nadh
fcf2449a70 Replace awkward auth user object access in handlers with an explicit func. 2025-04-05 00:26:05 +05:30
Kailash Nadh
17998fbff5 Refactor user auth models and permission checks.
- Move user models from `/models` to `internal/auth`.
- Move and refactor various permission check functions into `User.()`
- Refactor awkward `get, manage bool` function args into `Get|Manage` bitflags.
2025-04-05 00:19:27 +05:30
Kailash Nadh
5c785064c1 Refactor superfluous list perm check middleware into standalone function. 2025-04-04 23:29:41 +05:30
Kailash Nadh
a271bf54d5 Introduce per-campaign filter permissions. Closes #2325.
This patch introduces new `campaigns:get_all` and `campaigns:manage_all`
permissions which alter the behaviour of the the old `campaigns:get` and
`campaigns:manage` permissions. This is a subtle breaking behavioural change.

Old:

- `campaigns:get` -> View all campaigns irrespective of a user's list
  permissions.
- `campaigns:manage` -> Manage all campaigns irrespective of a user's list
  permissions.

New:

- `campaigns:get_all` -> View all campaigns irrespective of a user's list
  permissions.
- `campaigns:manage_all` -> Manage all campaigns irrespective of a user's list
  permissions.
- `campaigns:get` -> View only the campaigns that have at least one list to
  which which a user has get or manage access.
- `campaigns:manage` -> Manage only the campaigns that have at list one list
  to which a user has get or manage access.

In addition, this patch refactors and cleans up certain permission related
logic and functions.
2025-03-31 16:39:42 +05:30
Kailash Nadh
a5f8b28cb1 Fix inconsistent behaviour in campaign scheduling on the UI.
- Fix status/button state management issues when `Send at` was toggled
  under various scenarios.
- Allow paused campaigns to be edited and turned into scheduled campaigns.
- Add Cypress UI tests for unscheduling.
2025-03-31 13:00:51 +05:30
Kailash Nadh
fbc27ae4b2 Refactor UI time diff display function to prefix '-' on past dates. 2025-03-31 12:56:43 +05:30
Kailash Nadh
92e5d630ca Fix various static-check/idiom warnings. 2025-03-30 11:21:50 +05:30
Kailash Nadh
b18c7ad0fb Fix incorrect loading spinner on the Lists UI. Closes #1822. 2025-03-30 10:53:54 +05:30
dependabot[bot]
d1c964da4f
Bump vite from 5.4.12 to 5.4.15 in /frontend (#2379)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.12 to 5.4.15.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.15/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.15/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-30 00:18:23 +05:30
Kailash Nadh
b8f50eafa3 Add support for domain allowlists in addition to blocklists. Closes #2230.
This patch introduces a new `Domain allowlist` input in Settings -> Privacy UI
as a new tab alongside domain `Domain blocklist`. If any domains are entered
here, then only subscriptions/imports/additions of e-mails from those particular
domains are accepted. blocklist is mutually exclusive with allowlist when there
are values in the allowlist.
2025-03-29 23:31:34 +05:30
Kailash Nadh
6efb6e7600 Upgrade smtppool to v2 and add support for concrete SSL options. 2025-03-29 17:05:03 +05:30
Kailash Nadh
e4a18dabc3 Remove forcing unique filename on all media uploads.
This patch removes the forced suffixing of all media upload filenames with
random strings. The upload handler now checks the `media` table to ensure that
the filename being uploaded doesn't exist before forcing a suffix.

Outright rejecting duplicate filenames cannot be done to maintain backwards
compatibility with the old behaviour.

Closes #2277.
2025-03-29 15:21:32 +05:30
Kailash Nadh
ef8f31919d Remove obsolete language key and refresh i18n files. 2025-03-29 14:08:25 +05:30
Kailash Nadh
9224e344be Update i18n refresh script to remove deleted base keys from all other files. 2025-03-29 14:07:26 +05:30
Kailash Nadh
5f1b676401 Remove ASCII-only restriction on media filenames. Closes #2277. 2025-03-29 14:06:57 +05:30
Kailash Nadh
0be7a79dac Fix broken log rendering on importer UI. 2025-03-29 13:10:46 +05:30
Tamás Halasi
1b43e1a013
Add minor i18n Hungarian language pack fixes (#2375) 2025-03-28 15:45:12 +05:30
Thomerson Roncally
06c2f3b963
Add Nuxt.js module to Supported Libraries Lists (#2371) 2025-03-27 00:18:40 +05:30
Tamás Halasi
473f94272f
Add i18n Hungarian language pack fixes (#2370) 2025-03-26 23:01:03 +05:30
Fabian Schneebauer
7d3e6e615a
Fix too greedy TrackLink regex replacement. (#2355)
Co-authored-by: Fabian Schneebauer <fabian@fs-it.org>
2025-03-25 15:39:35 +05:30