diff --git a/CHANGELOG.md b/CHANGELOG.md index 08cf6e1..8f1c0fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Notable changes to Mailpit will be documented in this file. +## 1.1.2 + +### UI +- Allow reverse proxy subdirectories + + ## 1.1.1 ### UI diff --git a/README.md b/README.md index a73dcab..f1a5406 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,13 @@ Mailpit is inspired by [MailHog](#why-rewrite-mailhog), but much, much faster. ## Installation -Download a pre-built binary in the [releases](https://github.com/axllent/mailpit/releases/latest). The `mailpit` can be placed in your `$PATH`, or simply run as `./mailpit`. See `mailpit -h` for options, or see [the wiki](https://github.com/axllent/mailpit/wiki/Runtime-options) for additional information. +Linux & Mac users can install it directly to `/usr/local/bin/mailpit` with: + +```bash +sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh) +``` + +Or download a pre-built binary in the [releases](https://github.com/axllent/mailpit/releases/latest). The `mailpit` can be placed in your `$PATH`, or simply run as `./mailpit`. See `mailpit -h` for options, or see [the wiki](https://github.com/axllent/mailpit/wiki/Runtime-options) for additional information. To build Mailpit from source see [building from source](https://github.com/axllent/mailpit/wiki/Building-from-source). diff --git a/go.mod b/go.mod index 7899ebb..550a04b 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.18 require ( github.com/GuiaBolso/darwin v0.0.0-20191218124601-fd6d2aa3d244 github.com/axllent/semver v0.0.1 + github.com/disintegration/imaging v1.6.2 github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 github.com/jhillyerd/enmime v0.10.0 @@ -27,7 +28,6 @@ require ( github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962 // indirect github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect github.com/cznic/ql v1.2.0 // indirect - github.com/disintegration/imaging v1.6.2 // indirect github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect github.com/google/go-cmp v0.5.8 // indirect github.com/google/uuid v1.3.0 // indirect diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..6dd6dc6 --- /dev/null +++ b/install.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +GH_REPO="axllent/mailpit" +TIMEOUT=90 + +set -e + +VERSION=$(curl --silent --location --max-time "${TIMEOUT}" "https://api.github.com/repos/${GH_REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') +if [ $? -ne 0 ]; then + echo -ne "\nThere was an error trying to check what is the latest version of ssbak.\nPlease try again later.\n" + exit 1 +fi + +# detect the platform +OS="$(uname)" +case $OS in +Linux) + OS='linux' + ;; +FreeBSD) + OS='freebsd' + echo 'OS not supported' + exit 2 + ;; +NetBSD) + OS='netbsd' + echo 'OS not supported' + exit 2 + ;; +OpenBSD) + OS='openbsd' + echo 'OS not supported' + exit 2 + ;; +Darwin) + OS='darwin' + ;; +SunOS) + OS='solaris' + echo 'OS not supported' + exit 2 + ;; +*) + echo 'OS not supported' + exit 2 + ;; +esac + +# detect the arch +OS_type="$(uname -m)" +case "$OS_type" in +x86_64 | amd64) + OS_type='amd64' + ;; +i?86 | x86) + OS_type='386' + ;; +aarch64 | arm64) + OS_type='arm64' + ;; +*) + echo 'OS type not supported' + exit 2 + ;; +esac + +GH_REPO_BIN="mailpit-${OS}-${OS_type}.tar.gz" + +#create tmp directory and move to it with macOS compatibility fallback +tmp_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mailpit-install.XXXXXXXXXX') +cd "$tmp_dir" + +echo "Downloading Mailpit $VERSION" +LINK="https://github.com/${GH_REPO}/releases/download/${VERSION}/${GH_REPO_BIN}" + +curl --silent --location --max-time "${TIMEOUT}" "${LINK}" | tar zxf - || { + echo "Error downloading" + exit 2 +} + +mkdir -p /usr/local/bin || exit 2 +cp mailpit /usr/local/bin/ || exit 2 +chmod 755 /usr/local/bin/mailpit || exit 2 +case "$OS" in +'linux') + chown root:root /usr/local/bin/mailpit || exit 2 + ;; +'freebsd' | 'openbsd' | 'netbsd' | 'darwin') + chown root:wheel /usr/local/bin/mailpit || exit 2 + ;; +*) + echo 'OS not supported' + exit 2 + ;; +esac + +rm -rf "$tmp_dir" +echo "Installed successfully to /usr/local/bin/mailpit" diff --git a/server/ui-src/App.vue b/server/ui-src/App.vue index 1803367..29d97e1 100644 --- a/server/ui-src/App.vue +++ b/server/ui-src/App.vue @@ -275,7 +275,9 @@ export default { // websocket connect connect: function () { let wsproto = location.protocol == 'https:' ? 'wss' : 'ws'; - let ws = new WebSocket(wsproto + "://" + document.location.host + "/api/events"); + let ws = new WebSocket( + wsproto + "://" + document.location.host + document.location.pathname + "api/events" + ); let self = this; ws.onmessage = function (e) { let response = JSON.parse(e.data);