Code Monkey home page Code Monkey logo

filesutra's Introduction

Filesutra

Filesutra is an easy way to implement imports and uploads from all popular cloud storage. Supports google drive, onedrive, box, dropbox.

Demo and usage - visheshsinghal.com/blog/filesutra

Filesutra backend is written using grails framework and frontend is written using angularjs.

To use Filesutra in a web application, include filesutra.js from the server where Filesutra app is running. A demo application is hosted at filesutra.com, so you can quickly use the Filesutra in your application.

Add following script to your html page -

<script src="http://filesutra.com/js/filesutra.js"></script>

Then add following code to click handler of import button(assuming jquery is already included in the page) -

$("#importBtn").click(function() {
  filesutra.importFiles(function(data) {
  // File import response is available in 'data' variable
  /** sample response
  {
    "fileName": "sample.pdf",
    "downloadUrl": "http://filesutra.com/download/teGhzSfIp4zJLW9",
    "size": 12345
  }
  **/
  console.log(data);
  });
});

To use Filesutra in your production web apps, please host Filesutra on your own server by following instructions below. Then add filesutra.js from your own running instance of Filesutra.

How to run Filesutra -

Clone this repository. Install postgreSQL database. Create a user in postgres and a blank database using following commands in a terminal -

psql -U postgres

CREATE ROLE <user_name>;
ALTER ROLE <user_name> WITH LOGIN PASSWORD '<password>' NOSUPERUSER NOCREATEDB NOCREATEROLE;
CREATE DATABASE filesutradb OWNER <user_name>;
REVOKE ALL ON DATABASE filesutradb FROM PUBLIC;
GRANT CONNECT ON DATABASE filesutradb TO <user_name>;
GRANT ALL ON DATABASE filesutradb TO <user_name>;

Configuration -

cd to Filesutra repo. Copy the file filesutra-config.groovy from docs/ to any place where you want to keep the configuration file, just keep is outside the cloned repo. Edit the config file and insert the appropriate values for parameters. You will need to create API projects for Google, OneDrive, Box and OneDrive. Use the following links:

Google - https://console.developers.google.com/project Redirect URI - <serverurl>/auth/googleCallback

Box - https://app.box.com/developers/services/edit/ Type - Box Content Redirect URI - <server url>/auth/boxCallback

Dropbox - https://www.dropbox.com/developers/apps/create Type - Dropbox API app Redirect URI - <server url>/auth/dropboxCallback

OneDrive - https://account.live.com/developers/applications/create Redirect URI - <server url>/auth/onedriveCallback

After creating these projects, copy the CLIENT_ID, CLIENT_SECRET and REDIRECT_URI to filesutra-config.groovy at appropriate places

Once the configuration is in place, set the following Environment variable - FILESUTRA_CONFIG to the location where you copied the configuration file. Then run the grails app -

On *.nix system, execute ./grailsw

On windows system, run grailsw.bat

How to contribute -

Fork this repository, make your changes and send a pull request.

filesutra's People

Contributors

vishesheltropy avatar

Watchers

mntz avatar  avatar

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.