-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit eeca225
Showing
60 changed files
with
10,618 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
_build/ | ||
deps/ | ||
.git/ | ||
.gitignore | ||
Dockerfile | ||
Makefile | ||
README* | ||
test/ | ||
priv/static/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
import_deps: [:phoenix, :surface], | ||
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Elixir CI | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
build: | ||
|
||
name: Build and test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12' | ||
- name: Set up Elixir | ||
uses: actions/setup-elixir@v1 | ||
with: | ||
elixir-version: '1.11' | ||
otp-version: '23' | ||
- name: Restore dependencies cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: ${{ runner.os }}-mix- | ||
- name: Install dependencies | ||
run: mix deps.get | ||
- name: Build assets | ||
run: npm ci --prefix assets && npm run deploy --prefix assets && mix phx.digest | ||
- name: Run tests | ||
run: mix test | ||
- name: Build Release | ||
run: mix release | ||
env: | ||
MIX_ENV: prod | ||
- name: Create a Release | ||
id: create_release | ||
uses: actions/create-release@v1.1.4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./_build/prod/rel/bakeware/mail_sniffex | ||
asset_name: MailSniffex_amd64 | ||
asset_content_type: application/octet-stream | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: adrid/mailsniffex:latest | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# The directory Mix will write compiled artifacts to. | ||
/_build/ | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover/ | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps/ | ||
|
||
# Where 3rd-party dependencies like ExDoc output generated docs. | ||
/doc/ | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump | ||
|
||
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
|
||
# Ignore package tarball (built via "mix hex.build"). | ||
mail_sniffex-*.tar | ||
|
||
# If NPM crashes, it generates a log, let's ignore it too. | ||
npm-debug.log | ||
|
||
# The directory NPM downloads your dependencies sources to. | ||
/assets/node_modules/ | ||
|
||
# Since we are building assets from assets/, | ||
# we ignore priv/static. You may want to comment | ||
# this depending on your deployment strategy. | ||
/priv/static/ | ||
/data | ||
|
||
launch.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# The version of Alpine to use for the final image | ||
ARG ALPINE_VERSION=3.13 | ||
|
||
FROM elixir:1.11-alpine AS builder | ||
|
||
# The following are build arguments used to change variable parts of the image. | ||
# The name of your application/release (required) | ||
ARG APP_NAME=mail_sniffex | ||
# The version of the application we are building (required) | ||
ARG APP_VSN=0.1.0 | ||
# The environment to build with | ||
ARG MIX_ENV=prod | ||
# Set this to true if this release is not a Phoenix app | ||
ARG SKIP_PHOENIX=false | ||
# If you are using an umbrella project, you can change this | ||
# argument to the directory the Phoenix app is in so that the assets | ||
# can be built | ||
ARG PHOENIX_SUBDIR=. | ||
|
||
ENV SKIP_PHOENIX=${SKIP_PHOENIX} \ | ||
APP_NAME=${APP_NAME} \ | ||
APP_VSN=${APP_VSN} \ | ||
MIX_ENV=${MIX_ENV} | ||
|
||
# By convention, /opt is typically used for applications | ||
WORKDIR /opt/app | ||
|
||
# This step installs all the build tools we'll need | ||
RUN apk update && \ | ||
apk upgrade --no-cache && \ | ||
apk add --no-cache \ | ||
nodejs \ | ||
npm \ | ||
git \ | ||
build-base && \ | ||
mix local.rebar --force && \ | ||
mix local.hex --force | ||
|
||
# This copies our app source code into the build container | ||
COPY . . | ||
|
||
RUN mix do deps.get, deps.compile, compile | ||
|
||
# This step builds assets for the Phoenix app (if there is one) | ||
# If you aren't building a Phoenix app, pass `--build-arg SKIP_PHOENIX=true` | ||
# This is mostly here for demonstration purposes | ||
RUN if [ ! "$SKIP_PHOENIX" = "true" ]; then \ | ||
cd ${PHOENIX_SUBDIR}/assets && \ | ||
npm ci && \ | ||
npm run deploy && \ | ||
cd - && \ | ||
mix phx.digest; \ | ||
fi | ||
|
||
RUN \ | ||
mkdir -p /opt/built && \ | ||
mix release && \ | ||
cp -R _build/${MIX_ENV}/rel/${APP_NAME} /opt/built | ||
|
||
# From this line onwards, we're in a new image, which will be the image used in production | ||
FROM alpine:${ALPINE_VERSION} | ||
|
||
EXPOSE 4000 2525 | ||
|
||
# The name of your application/release (required) | ||
ARG APP_NAME=mail_sniffex | ||
|
||
RUN apk update && \ | ||
apk add --no-cache \ | ||
bash \ | ||
openssl-dev | ||
|
||
RUN apk add --upgrade gnu-libiconv | ||
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so | ||
|
||
ENV REPLACE_OS_VARS=true \ | ||
APP_NAME=${APP_NAME} | ||
|
||
WORKDIR /opt/app | ||
|
||
COPY --from=builder /opt/built . | ||
|
||
|
||
CMD trap 'exit' INT; /opt/app/${APP_NAME}/start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 https://github.com/adrid | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# MailSniffex | ||
![Preview](preview.png) | ||
|
||
Email testing tool for developers. Works as a SMTP server to catch sent mails and provides a web interface to browse them. Saves a mail data into local `data` directory. Inspired by MailHog and MailCatcher. | ||
|
||
## Dependencies | ||
* iconv | ||
* OpenSSL | ||
|
||
## ENV options | ||
* PORT - default 4000 - web ui port | ||
* SMTP_PORT - default 2525 - SMPT server port | ||
* SIZE_LIMIT - default 1GB - limits the size of the storage for mails. After passing this limit the app will start removing oldest mails until the size will be under the limit again. Accepts MB and GB postfix (for example 4GB, 100MB). | ||
|
||
## Docker | ||
Available on [Docker Hub](https://hub.docker.com/r/adrid/mailsniffex) | ||
|
||
|
||
## TODO | ||
* Downloading an original email | ||
* Handle displaying of embeded images | ||
* Removal of a single mail | ||
* Show CC, BCC, Reply To and priority fields | ||
* JSON API | ||
* More tests | ||
* Optional sending of messages to a real SMTP server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* This file is for your main application css. */ | ||
@charset "utf-8"; | ||
@import "../node_modules/nprogress/nprogress.css"; | ||
@import "bulma.scss"; | ||
|
||
/* LiveView specific classes for your customizations */ | ||
.phx-no-feedback.invalid-feedback, | ||
.phx-no-feedback .invalid-feedback { | ||
display: none; | ||
} | ||
|
||
.phx-click-loading { | ||
opacity: 0.5; | ||
transition: opacity 1s ease-out; | ||
} | ||
|
||
.phx-disconnected{ | ||
cursor: wait; | ||
} | ||
.phx-disconnected *{ | ||
pointer-events: none; | ||
} | ||
|
||
.phx-modal { | ||
opacity: 1!important; | ||
position: fixed; | ||
z-index: 1; | ||
left: 0; | ||
top: 0; | ||
width: 100%; | ||
height: 100%; | ||
overflow: auto; | ||
background-color: rgb(0,0,0); | ||
background-color: rgba(0,0,0,0.4); | ||
} | ||
|
||
.phx-modal-content { | ||
background-color: #fefefe; | ||
margin: 15% auto; | ||
padding: 20px; | ||
border: 1px solid #888; | ||
width: 80%; | ||
} | ||
|
||
.phx-modal-close { | ||
color: #aaa; | ||
float: right; | ||
font-size: 28px; | ||
font-weight: bold; | ||
} | ||
|
||
.phx-modal-close:hover, | ||
.phx-modal-close:focus { | ||
color: black; | ||
text-decoration: none; | ||
cursor: pointer; | ||
} | ||
|
||
|
||
/* Alerts and form errors */ | ||
.alert { | ||
padding: 15px; | ||
margin-bottom: 20px; | ||
border: 1px solid transparent; | ||
border-radius: 4px; | ||
} | ||
.alert-info { | ||
color: #31708f; | ||
background-color: #d9edf7; | ||
border-color: #bce8f1; | ||
} | ||
.alert-warning { | ||
color: #8a6d3b; | ||
background-color: #fcf8e3; | ||
border-color: #faebcc; | ||
} | ||
.alert-danger { | ||
color: #a94442; | ||
background-color: #f2dede; | ||
border-color: #ebccd1; | ||
} | ||
.alert p { | ||
margin-bottom: 0; | ||
} | ||
.alert:empty { | ||
display: none; | ||
} | ||
.invalid-feedback { | ||
color: #a94442; | ||
display: block; | ||
margin: -1rem 0 2rem; | ||
} | ||
|
||
html, body { | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.main-header { | ||
height: 52px; | ||
} | ||
|
||
.main-content { | ||
height: calc(100% - 52px); | ||
overflow: auto; | ||
} | ||
|
||
.inside-content { | ||
height: 100%; | ||
} |
Oops, something went wrong.