Commit graph

11 commits

Author SHA1 Message Date
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 68512d2dcd Add i18n support to TinyMCE.
- Load bundled TinyMCE i18n language file based on a
  listmonk -> TinyMCE map.
- Refactor editor initialisation to accommodate this change.
- Introduce `constants.js -> uris.static` to make the static URI
  available to TinyMCE for loading language files.
2021-09-23 20:04:48 +05:30
Kailash Nadh bb340b8785 Refactor frontend build and name space all admin URIs behind /admin/.
- Namespace all admin UI URLs behind `/admin/*`.
  This breaks the current admin UI URLs.
- Make Vue output build assets to `frontend/dist/*` instead of
  `frontend/dist/frontend`.
- Namespace Vue static assets to `/admin/static/*`.

This commit reduces the cofusing and convoluted Vue+WebPack build URI
and static path schemes. In addition, it removes ambiguity in URLs
where non-UI URLs like `/public`, `/api`, `/webhooks` etc. were in the
same name space as UI URLs like `/campaigns`, `/lists` etc. Now all UI
URLs are behind `/admin/`, also simplifying security rules for proxies.
2021-09-23 19:21:35 +05:30
Kailash Nadh 4b13f0c74f Add public URIs to yarn dev proxy. 2021-09-19 17:10:40 +05:30
Kailash Nadh edac5a1910 Add bounce tests (Cypress) 2021-08-22 15:48:36 +05:30
Kailash Nadh f5221ab1ee Upgrade JS sass libs.
See issue #369

Upgrade sass libs to work with Node 16.
2021-05-23 17:27:32 +05:30
Kailash Nadh b054ed5adc Fix inconsistent quotes in Vue config 2020-10-18 23:10:48 +05:30
Vivek R 6c234f1b1d fix: use inbuilt frontend dev server to proxy API
Vue's inbuilt dev server can be configured to proxy API for
development instead of directing developers to setup Nginx proxy.
Additionally this commit also adds an option to configure frontend port
on which dev server runs. Sample env config file is under
`frontend/.env.sample`, it can be copied to either `frontend/.env` or `frontend/.env.local`.

Available options are

LISTMONK_FRONTEND_PORT - Configure frontend dev server port (defaults to 8080)
LISTMONK_API_URL - Configure API server URL (defaults to http://127.0.0.1:9000)

Since env variables are sourced to current session we are prefixing it with `LISTMONK_`.
2020-10-03 04:50:07 +05:30
Shivam Mishra ed0d9ee431 chore: remove stray whitesapce 2020-08-25 19:15:32 +05:30
raghavsood ceac96b662
frontend: Enable vue filenameHash
This enables clean updates when listmonk is behind a caching proxy such as cloudflare
2020-07-06 23:54:08 +08:00
Kailash Nadh 97583fe4b4 Rewrite frontend with Vue+Buevy and ditch React+Ant Design.
- antd+react was resulting in extremely clunky and unreadable
  spaghetti frontend code (primarily due to how antd is).
- Buefy is lighter by an order of magnitude, has excellent
  responsive views (especially tables) and usability.
- Vue's templating produces far more readable template code.
2020-07-04 00:12:14 +05:30