NodeJS API for contact forms
 
 
Go to file
Keith Irwin 285e2b2345
Replaced msg with alerts on clientside
2021-12-26 16:24:55 -07:00
.dockerignore Added docker-compose.yml to ignorefiles 2021-11-24 13:52:28 -07:00
.gitignore Added docker-compose.yml to ignorefiles 2021-11-24 13:52:28 -07:00
Dockerfile Added docker 2021-11-24 13:12:48 -07:00
LICENSE Added documentation and clientside code 2021-11-26 09:36:06 -07:00
README.md Added documentation and clientside code 2021-11-26 09:36:06 -07:00
docker-compose.yml.sample Moved env vars to docker-compose.yml 2021-11-26 16:58:39 -07:00
index.html.sample Replaced msg with alerts on clientside 2021-12-26 16:24:55 -07:00
index.js Removed token logging 2021-12-26 16:21:42 -07:00
package-lock.json Added code to send email 2021-11-24 12:37:26 -07:00
package.json Switched to body-parser 2021-11-24 18:09:22 -07:00

README.md

mailapi

This is a PGP-enabled contact form that you can use. It has two parts:

  • A static web form that uses javascript to encrypt a message and send it to an api endpoint
  • An API which checks the captcha and sends the message by email

Setting up a server

Download the source; it's not on docker hub.

git clone https://gitea.gf4.pw/ki9/mailapi.git
cd mailapi

Copy the sample environment files and edit them to suit your needs.

cp .env.sample .env
cp docker-compose.yml.sample docker-compose.yml

Start the service with docker:

docker-compose up -d

...or start the service directly, or with a daemon manager:

npm run start

The API should now be listening on port 8080 or whatever you set in the docker-compose.yml. You may choose to run this through a proxy server or whatever.

Serving the clientside app

You can use the contact form in index.html.sample. Tweak it to your needs and put it in your clientside code. I'm not offering support for your particular set up, but the code in both index.html.sample and index.js is short and easy to modify to your use case.

MIT License

Copyright © 2021 Keith Irwin

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.