Commit graph

60 commits

Author SHA1 Message Date
Kailash Nadh 5e2c24b662 Make --new-config accept path from --config. Closes #410. 2021-06-29 20:10:59 +05:30
Kailash Nadh 5988ea36cb Sanitize media upload filenames. Closes #397. 2021-06-19 17:11:27 +05:30
Kailash Nadh b3612927c8 Display app version the settings UI 2021-06-09 20:11:45 +05:30
Kailash Nadh 868fae6ac2 Refactor subsbscription status option on the import page.
- Refactor subimporter New*() funcs to take opt structs.
- Refactor and simplify Vue code.
- Remove redundant i18n entries and use existing ones.
- Remove redundant subimporter constants and use existing ones.

- Consider 'overwrite' option for subscription status as well.
- Write Cypress integration tests for the new feature.
2021-06-06 17:33:23 +05:30
Russ Smith 7ca08f0a36 Adding a subscription status option to the import.
Ref #168
2021-06-06 17:33:23 +05:30
Kailash Nadh c37a7690d6 Add robots noindex header to public user specific subscription pages 2021-06-05 12:45:10 +05:30
Kailash Nadh 8859911c73 Remove hardcoded limit for per_page in pagination 2021-06-05 12:01:33 +05:30
Karan Sharma 50dc9fca16 feat: add a public healthcheck endpoint
- Adds `/health` as a public facing healthcheck endpoint.
- `/api/health` is meant for internal healthchecks. This endpoint in
  future can serve sensitive information about Listmonk *or* can be
deprecated if there's not enough usecase.

Closes https://github.com/knadh/listmonk/issues/380
2021-06-03 11:19:03 +05:30
Kailash Nadh 44adcd44de Stop checking for updates on boot.
This commit disables the automatic upe check thappens immediately
on boot, giving users an opportunity disable it from the settings UI
before any remote requests are initiated. Tupdate checks happen
every 24 houfter boot.

Ref: #326
2021-05-23 21:08:32 +05:30
Kailash Nadh dba47bca28 Add file extsnsion check to media uploads.
While file content (MIME) check already existed, the lack of file
extension check allowed arbitrary extensions to be uploaded and
then accessed via the static file server. For instance, a .html file
with JPG content intersperesed with Javascript.

This commit adds a file extension check on top of the MIME type check.
2021-05-23 20:17:42 +05:30
Kailash Nadh 931e467b25 Fixes campaign test messages not including unsub headers.
Campaign messages are handled by `manager` whereas test messages
were being pushed directly into a messenger skipping some campaign
related routines such as the addition of list unsub headers.

This commit exposes a new function `manager.PushCampaignMessage()`
that accepts arbitrary campaign messages that then pass through
the standard campaign message workers, thus getting the missing unsub
headers. This closes #360.

In addition, this removes the superfluous `CampaignMessage.Render()`
function which had to be mandatorily called always and makes it
implicit in `manager.NewCampaignMessage()`.
2021-05-21 23:35:08 +05:30
Kailash Nadh 95a81d17ce Add option on UI to toggle update checks.
Closes #326
2021-05-16 16:54:55 +05:30
Kailash Nadh d695bb34cc Prioritise --static-dir on init when no assets are embedded.
When no static assets are found on init, i.e., when a binary without
stuffbin assets are loaded, the app looks for all necessary static
files in the working dir, including the `./static/*` path which renders
the `--static-dir` flag irrelevant.

This patch gives `--static-dir`, if set, precedence over `./static/*`
when loading assets from the working dir when a binary is not stuffed
with static files.

Closes #340.
2021-05-16 15:53:30 +05:30
Kailash Nadh aa5eff915d Fix incorre check on template deletion. 2021-05-16 15:26:38 +05:30
Kailash Nadh 65d25fc3f9 Improve campaign content format conversion.
Previously, converting between formats simply copied over raw content.
This update does actual conversion between different formats. While
lossy, this seems to a good enough approximation for even reasonbly
rich HTML content. Closes #348.

- richtext, html => plain
  Strips HTML and converts content to plain text.

- richtext, html => markdown
  Uses turndown (JS) lib to convert HTML to Markdown.

- plain => richtext, html
  Converts line breaks in plain text to HTML breaks.

- richtext => html
  "Beautifies" the HTML generated by the WYSIWYG editor unlike the
  earlier behaviour of dumping one long line of HTML.

- markdown => richtext, html
  Makes an API call to the backend to use the Goldmark lib to convert
  Markdown to HTML.
2021-05-09 15:36:31 +05:30
Kailash Nadh 5868db0124 Sort i18n language list on the settings UI 2021-04-21 19:04:04 +05:30
Kailash Nadh 37824136c0 Refactor campaign preview to use dummy campaign and subscriber.
Use a dummy subscriber instead of fetching a random one from the
DB. In addition, replace the preview campaign UUID with a dummy
one to prevent clicks and views being registered against the
campaign when previewing.
2021-04-21 15:32:05 +05:30
Kailash Nadh fe61e898a3 Add hidden nonce (honeypot) field to filter bot autofills on subs page 2021-04-21 14:01:32 +05:30
Kailash Nadh c479a90c42 Add support for loading external i18n language files.
The new `--i18n-dir` directory allows the loading of an external
directory of i18n JSON files, milar to have `--static-dir`
works. New languages can be added and existing language files
can be customized this way.

This commit changes file loading behaviour so that invalid or
non-existent don't halt the execution of the app completely but
merely throw a warning and continue with the default (en) lang.
2021-04-17 14:26:56 +05:30
Kailash Nadh ad0a0e0841 Add preconfirm_subscriptions=true/falsenew subs API.
Sending th optional flag as `trunue` in the POST /api/subscrirs
body will skip sending opt-iconfirmation e-mails to subscribers
and mark list subscriptions in the request a`confirmed`.
2021-04-17 13:34:37 +05:30
Kailash Nadh 1e59d53135 Add markdown support to campaign content. 2021-04-14 12:26:09 +05:30
Kailash Nadh 570a81f966 WIP: Add tests 2021-04-10 12:26:33 +05:30
Kailash Nadh e8ad7a9adc Fix subscriber attribs update API.
Change the behaviour where not passing attribs to the update API
overwrites the attribs with empty values. This commit changes the
behaviour so that in the absence of the attribs field in the
subscriber API, the existing value in the DB is retained.
2021-03-10 21:20:26 +05:30
Kailash Nadh f8e555dac5 Fix incorrect ID handling in update handlers 2021-03-09 17:54:07 +05:30
Kailash Nadh 97b78aa695 Fix incorrect 'get subscriber' calls 2021-02-15 18:27:14 +05:30
Kailash Nadh 2f6bd05ca0 Fix the optin-in, form re-subscribe behaviour.
If a user is already subscribed to an optin list but hasn't
confirmed, subscribing using the same e-mail id from the public
form now re-sends the optin e-mail while also showing an
appropriate message on the frontend rather than just saying
"subscribed successfully".

https://github.com/knadh/listmonk/issues/266
https://github.com/knadh/listmonk/issues/264
2021-02-13 17:55:10 +05:30
Kailash Nadh b950d2f4ff Refactor fetching of server config and settings.
The earlier approach of loading `/api/config.js` as a script on
initial page load with the necessary variables to init the UI is
ditched. Instead, it's now `/api/config` and `/api/settings` like
all other API calls. On load of the frontend, these two resources
are fetched and the frontend is initialised.
2021-02-13 12:34:36 +05:30
Kailash Nadh b6dcf2c841 Merge branch 'i18n' 2021-02-07 12:06:06 +05:30
Kailash Nadh 2235d30063 Add a new public page for end users to subscribe to public lists.
In addition to generating HTML forms for selected public lists,
the form page now shows a URL (/subscription/form) that can be
publicly shared to solicit subscriptions. The page lists all
public lists in the database. This page can be disabled on the
Settings UI.
2021-01-31 16:19:39 +05:30
Kailash Nadh a7b72a6b7c Fix broken i18n language keys 2021-01-31 13:38:35 +05:30
Kailash Nadh dd0c124b0e Stop throwing "exists" error on public forms 2021-01-31 13:38:02 +05:30
Kailash Nadh 62bce6902e Remove "normalization" of non-Latin characters in tags 2021-01-31 13:06:52 +05:30
Kailash Nadh 68afd61024 Add support for alternate plaintext body for e-mails.
This commit removes the Go html2text lib that would automatically
convert all HTML messages to plaintext and add them as the alt
text body to outgoing e-mails. This lib also had memory leak
issues with certain kinds of HTML templates.

A new UI field for optionally adding an alt plaintext body to
a campaign is added. On enabling, it converts the HTML message in
the campaign editor into plaintext (using the textversionjs lib).

This introduces breaking changes in the campaigns table schema,
model, and template compilation.
2021-01-30 18:49:47 +05:30
Kailash Nadh b420c31d33 Log test message error 2021-01-28 23:30:39 +05:30
Joe Paul 8867f771d4 fix: Stop tickers 2021-01-27 12:58:17 +05:30
Kailash Nadh 4bfdda9b91 Load a default (en) language underneath the selected language.
The default language (en) is loaded first and the selected
language is loaded on top of it so that missing translation keys
in the selected language will have the original English strings
available on the UI.
2021-01-26 21:59:27 +05:30
Kailash Nadh 05928d57b1 Fix default campaign template not being setup on first install.
This was a ridiculous miss, where on first time installation, the
well designed default e-mail template was never installed in the
DB! I never spotted this because my local dev setup, and
surprisingly, nobody ever complained that the default campaign
template was a blank slate with no styles.
2021-01-24 12:49:52 +05:30
Kailash Nadh 027261793f Add support for rate limiting messages with a sliding window.
Certain SMTP hosts limit the total number of messages that can be
sent within a window, for instance, X / 24 hours. The concurrency
and message rate controls can only limit that to a max of
1 messages / second, without a global cap.

This commit introduces a simple sliding window rate limit feature
that counts the number of messages sent in a specific window, and
upon reaching that limit, waits for the window to reset before
any more messages are pushed out globally across any number of
campaigns.

Context: https://github.com/knadh/listmonk/issues/119
2021-01-24 12:19:26 +05:30
Kailash Nadh ee4fb7182f Refactor i18n name and fix the L() function in public HTML templates 2021-01-23 19:34:30 +05:30
Kailash Nadh 4cd5e6ebeb Refactor and remove placeholder i18n func 2021-01-23 18:54:33 +05:30
Kailash Nadh 810607e547 Fix incorrect i18n keys in message strings 2021-01-23 18:48:10 +05:30
Kailash Nadh ec1c4f30ed Add subscriber export feature 2021-01-23 18:23:29 +05:30
Kailash Nadh 3498a727f5 WIP: Add i18n support 2021-01-17 20:59:01 +05:30
Karan Sharma ad8f290dad feat: Set default values for DB connection parameters
- Configures `max_open` and `max_idle` in default configs to `25`.
  This changes the previous behaviour of connection pooling where both the
  values were unset (from default config) and causes unbounded connection
  limit and no connection reuse.
- Configures `db.SetConnMaxLifetime` which sets the maximum time the
  connection can be reused in a pool.
- Sets `max_conn_lifetime` in default config as `5 minutes`.

Closes https://github.com/knadh/listmonk/issues/225
2020-11-17 14:34:35 +05:30
Kailash Nadh cde0b4b42a Add a DB setup check on boot 2020-11-10 22:21:25 +05:30
Kailash Nadh 1e8b533d45 Fix echo's URI routing race condition that caused random 404s. 2020-11-08 18:36:25 +05:30
Kailash Nadh 1aecd6f2e1 Add serverside sort to tables.
Lists, campaigns, and subscribers tables now support server-side
sorting from the UI. This significantly changes the internal
queries from prepared to string interpolated to support dynamic
sort params.
2020-10-24 20:00:29 +05:30
Kailash Nadh a1aeba22bb Fix invalid link click registrations
The link_clicks.link_id table was NULLable incorrectly. Links that
do not exist should not register a tracking entry. Fix the query
and also update the schema + migration (breaking table change).
2020-10-24 14:03:37 +05:30
Kailash Nadh 7cecbbba34 Register missing settings/logs URL in the backend 2020-10-24 13:36:22 +05:30
Kailash Nadh e9bf47b006 Fix --version string and duplicate printing 2020-10-18 22:59:22 +05:30