Giter VIP home page Giter VIP logo

api's Introduction

Lavaboom API

Code Climate

Lavaboom's main API written in Golang.

Contains the core Lavaboom's functionality. Currently a monolith, which later will be split and transformed into a set of microservices.

Requirements

  • Redis
  • RethinkDB
  • NSQ

Installation

Inside a Docker container

This image will be soon uploaded to Docker Hub.

git clone https://github.com/lavab/api.git
cd api
docker build -t "lavab/api" .
docker run \
	-p 127.0.0.1:5000:5000 \
	--name api \
	lavab/api \
	-redis_address=172.8.0.1:6379 \
	-lookupd_address=172.8.0.1:4161 \
	-nsqd_address=172.8.0.1:4150 \
	-rethinkdb_address=172.8.0.1:28015 \
	-api_host=api.lavaboom.com \
	-email_domain=lavaboom.com

Directly running the parts

go get github.com/lavab/api

api \
	-redis_address=172.8.0.1:6379 \
	-lookupd_address=172.8.0.1:4161 \
	-nsqd_address=172.8.0.1:4150 \
	-rethinkdb_address=172.8.0.1:28015 \
	-api_host=api.lavaboom.com \
	-email_domain=lavaboom.com

Passing configuration

You can use either commandline flags:

{ api } master » ./api -help
Usage of api:
  -api_version="v0": Shown API version
  -bind=":5000": Network address used to bind
  -config="": config file to load
  -email_domain="lavaboom.io": Domain of the default email service
  -etcd_address="": etcd peer addresses split by commas
  -etcd_ca_file="": etcd path to server cert's ca
  -etcd_cert_file="": etcd path to client cert file
  -etcd_key_file="": etcd path to client key file
  -etcd_path="settings/": Path of the keys
  -force_colors=false: Force colored prompt?
  -log="text": Log formatter type. Either "json" or "text"
  -lookupd_address="127.0.0.1:4160": Address of the lookupd server
  -nsqd_address="127.0.0.1:4150": Address of the nsqd server
  -redis_address="127.0.0.1:6379": Address of the redis server
  -redis_db=0: Index of redis database to use
  -redis_password="": Password of the redis server
  -rethinkdb_address="127.0.0.1:28015": Address of the RethinkDB database
  -rethinkdb_db="dev": Database name on the RethinkDB server
  -rethinkdb_key="": Authentication key of the RethinkDB database
  -session_duration=72: Session duration expressed in hours
  -slack_channel="#notif-api-logs": channel to which Slack bot will send messages
  -slack_icon=":ghost:": emoji icon of the Slack bot
  -slack_level="warning": minimal level required to have messages sent to slack
  -slack_url="": URL of the Slack Incoming webhook
  -slack_username="API": username of the Slack bot
  -yubicloud_id="": YubiCloud API id
  -yubicloud_key="": YubiCloud API key

Or environment variables:

{ api } master » BIND=127.0.0.1:6000 VERSION=v1 ./api

Or configuration files:

{ api } master » cat api.conf
# lines beggining with a "#" character are treated as comments
bind :5000
force_colors false
log text

rethinkdb_db dev
# configuration values can be empty
rethinkdb_key
# Keys and values can be also seperated by the "=" character
rethinkdb_url=localhost:28015

session_duration=72
version=v0
{ api } master » ./api -config api.conf

License

This project is licensed under the MIT license. Check license for more information.

api's People

Contributors

andreis avatar flixi avatar gitter-badger avatar golint-fixer avatar makkalot avatar pzduniak avatar vviikk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

api's Issues

The wonders of duplicated labels

@piggyslasher somehow managed to create an account with duplicated primary labels...
So he now has multiple Inbox, Sent, Starred, Spam etc labels...

Where? Takes place on .com
When? first noticed 1 day before, confirmed now
His owner id is: ytut9R6fngoXCmeicW51
example of label ids(Inbox): GW6V8NXNMzoYlCMDz8Ci, TGg7nZhU7PADQCMHlZ7m

Need to fix this as soon as possible

P.S. my code does not create labels with one exception - drafts
https://github.com/lavab/web/blob/develop/src/js/apps/AppLavaboom/services/inbox.js#L108-108

Remove loggly

Change

-log="text": Log formatter type. Either "json" or "text"
-loggly_token="": Loggly token

to log-type and log-token (to be provider agnostic)

thread.secure has wrong value

I have forwarded an email from gmail to my lavaboom.com account - it came from unsecure source and was encrypted on our server.
Thread id: XTuxuCBsZsdJXbn3GfW0

what I got? thread.secure: all
what I expected? thread.secure: none
where? .com
when? just now

API exposes&&store subject of raw emails in clear-text

How to reproduce:

  1. send email to gmail
  2. reply to this email from gmail
  3. email.name contains subject in clear text while it should be "Encrypted message (xxx)" and subject should be in the manifest only

Email is getting encrypted as soon as it hits out servers, no reason to expose neither store subject in clear text.

emails.create thread_id is ignored

I've tried to reply to a thread, sent valid thread_id, server accepted the email but it does not appear in the same thread in my Inbox label

Threads.list labels filter

Filter out threads with labels Spam/Trash when we request a list of threads outside of Spam/Trash

I'm going to mark threads as Spam just by adding Spam label and preserve all original labels so later thread could be easily restored from spam

Add Thread.kind to threads.list, threads.get calls

thread.kind = thread.emails[0].kind
I need this to determine is thread secure or not(fast check without pulling the actual email),

I can't use thread.manifest as all threads have manifest because we have on-the-fly encryption of emails as soon as they hit Lavaboom servers
also see: #85

Labels.list unread_threads_count

Where? .com/.co
When? now

What?
This field should have positive value only for Inbox label

For example:
When I send email I get unread_threads_count > 0 for Sent, if I star this thread I will get the same for Starred label

Clean up API results from unused fields

As we use manifests now it would be nice to get rid of Email.list/get from and to fields - required data is in manifest and we have manifests for all emails

Raw emails have wrong format

Part of data from threads.list
body: "111"
kind: "raw"
manifest: "long-manifest-data-goes-here"
pgp_fingerprints: Array[0]

Please note kind is raw and pgp_fingerprints is empty, while it should be manifest + pgp_fingerprints should contain fingerprints of user default public key

Probably it was caused by a hack I have to use, see #81
Need this fixed as soon as possible

Thread matching bug

  1. Send email to yourself with subject "hi"(thread_1)
  2. Send email from gmail to lavaboom with subject "hi"
    Email from gmail ends up to be in the thread_1 and members field does not contain any information about this "merge"

Expected: email should go to another thread
where? .com

Make sure API does NOT expose unencrypted emails

Email can be received from gmail for example,

There's a small time window after queueing the email and sending it
During which the email can be unencrypted
And all inbound raw emails are encrypted

We need to make sure API exposes only encrypted emails

Threads are identified by subject line if no references exist

This sometimes creates problems.
Steps to reproduce:

  1. Write email from first external account ([email protected]) with subject "Invoice" to lavaboom account
  2. Write email from second external account ([email protected]) with subject "Invoice" to lavaboom account

What happens:
Emails from Alice and Bob are shown in one thread, even though they don't have anything to do with each other.

This also happens in practice, for example all "Undelivered emails returned to sender" messages are aggregated into one thread.

Appears to be duplicate of #127, sorry.

Moving thread to trash/spam and thread.is_read flag

Currently we mark thread as read after a certain timeout(4 sec)
if user moves the thread faster to his trash/spam thread stays unread

we do not show it in the Inbox, but labels.list has no idea about new labels filtering Inbox -Trash -Spam...

No notification event about email delivery

I've replied to a email from my gmail account, server received email but did not notify me about it via sockjs event, tho after I refreshed page email was here.
thread id: ex1MSUrqCsuSCXwjnXz8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.