GithubHelp home page GithubHelp logo

lightning's Introduction

Lightning

Build Status Coverage Status Version Twitter

Lightning is a real-time social media REST API, to be used in conjunction with Thunder. Lightning provides methods to request data from various 3rd party social media and cloud services, including Facebook and Twitter.

Running Locally

  • Requirements
    • Java 1.8
    • Maven 3.3.3

First, fork this repo on GitHub. Then, clone your forked repo onto your machine.

$ git clone YOUR-FORK-URL

Compile and package the source code with Maven.

$ mvn package

Run the packaged jar with the server argument.

$ java -jar application/target/application-*.jar server

Lightning should now be running on localhost port 9000.

Testing

There is a Python testing script available in the scripts directory. To run this script, make sure you are in the base lightning directory and run the following command.

$ python scripts/tester.py

There are multiple optional command line arguments for the testing script. These are described in the table below, along with their default values. Additionally, when running the script from the command line, adding the -h option will display a help message with all optional arguments.

Flag Description Default Value
-h --help Display a help message. ----
-e --endpoint The endpoint to connect to lightning with. http://localhost:9000
-m --email The email to make requests for. [email protected]
-p --password The password of the user that matches the username. Should not be a hashed password. password
-a --auth The basic authentication credentials in the form {app_name}:{app_secret} application:secret
-v --verbose Provide more output information. False

When adding new endpoints to lightning, be sure to include a new TestCase for that endpoint in the tester.py script.

Another testing option is to use HTTPie. See the wiki for each individual command.

lightning's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar imgbotapp avatar nickeckert avatar rohannagar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lightning's Issues

Implement Text-Only Publishing for Facebook

Currently we can publish photos or videos, but we also should be able to post only text. The publish method in FacebookResource should have the ability to do any type of publishing based on what it receives.

Handle error responses from Thunder

When making network calls to Thunder e.g. thunderClient.getUser(username), we should handle the cases where Thunder is down or we are unauthorized. Currently an uncaught exception is thrown.

Create Client Library

A Java client library would add the feature to easily call each endpoint from another Java application in the future. This would be important if we built another application, such as a scheduler.

Dependency Upgrades and Dependabot Integration

Before turning on the Dependabot integration, we should upgrade known dependencies and fix known problems with upgrading certain dependencies (carried over from experience with Thunder).

Cache Platform Service instances per user

Each time a resource method is called, we create a new service instance using our factories. This is fine, but does add some additional overhead.

As a potential improvement, we can cache these instances for re-use.

This is currently low priority because there is not enough traffic that this would cause a heavy slow-down.

Write cURL Testing Script

We should have a script that we run to test each endpoint so that we do not have to manually test each endpoint. This will become even more necessary as we add more platforms and endpoints.

Lightning Email Validation

Lightning needs to validate an email by sending an email to a newly registered user or newly registered email for an existing user. Once Lightning can validate that a user has access to the registered email the registration process can finish or an email can be added as a valid address for the account.

The process will go something like this:

  1. Start the validation process by creating a new user and denoting the associated email as unverified. If the user already exists then just add a new email as unverified.
  2. Generate a unique hash and store it along side the unconfirmed field in the DB.
  3. Append the hash as a query param to a url that points to a validation endpoint on Lightning and send the url to the address you want to validate.
  4. When lightning receives an email with a hash, parse the hash and confirm the user is associated with the given hash.
  5. Mark the email as valid in thunder.

Note that a user account can be viewed as unverified if there exists only one email and it's not verified. This can be useful for tracking down accounts that are registered but never verified.

The end goal is to allow account recovery and general contact with our user base.

  • Add email validation field associated with each unique address in the DB
  • Add email random hash associated with each unique address in the DB
  • Ability to generate a random hash to store in the DB
  • Ability to create a URL containing an emails associated hash value as a query param
  • Ability to parse the URL containing a hash value and verify it belongs to a certain users email
  • Ability to mark individual user emails as invalid/valid
  • Ability to store an associated hash value along with each unique email on a user account

Twitter Upload is Limited

Currently Twitter upload is limited to a small filesize. We can fix this by using chunked upload, but Twitter4J does not support it, as development has stopped on it.

Our end goal should be to build our own Twitter Java SDK and use that moving forward. For a short-term workaround, we can fork Twitter4J and pull in some changes that people have made in PRs. Then we can pull in the new jar using Jitpack.

Remove Dropbox-Related Code

Dropbox is no longer going to be used. In order to maintain a clean code base, we should remove it. It can always be added back in if necessary.

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.