Coder Social home page Coder Social logo

diffview's Introduction

DiffView Google Drive Application

This web application allows viewing formatted diff/patch files directly from your Gmail or Google Drive.

A hosted version is available here.

Implementation Details

  • Apps is hosted using Google App Engine. It uses python backend, but there is very little going on on the server side.

  • The user's files are never copied to the server. Patches are sent from Google server to the client browser for rendering.

  • A small JS library does diff color formatting on the data, locally on the browser.

See Google Cloud Platform github repos for sample applications and scaffolding for other python frameworks and use cases.

Also see Google Drive SDK - Open Files for details about the Drive SDK, how to write apps for Drive and how to integrate open files.

Run Locally

  • I could not figure out how to fetch Google Drive files when running a local web server. I do not think it is possible, since the Drive API configuration requires a real URI, and cannot route to localhost.

  • To test the JavaScript code that colors the diff files, you can use a skeleton html file like:

	<html xmlns="http://www.w3.org/1999/xhtml">
	    <head>
	        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	        <title>Test</title>
	        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
	        <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
	        <link rel="stylesheet" type="text/css" href="diff.css" />
	        <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
	        <script src="diff.js"></script>
	        <script type="text/javascript">
	        $.ajax({
	            url: "sample.patch",
	            beforeSend: function( xhr ) {
	                xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
	            }
	        })
	        .done(function( data ) {
	              $("#file").html(toDiff(data));
	        });
	        </script>
	        <style>
	        
	        </style>
	    </head>
	    <body>
	        <div id="file" class="diff"></div>
	    </body>
	</html>

Please place a sample.patch to test rendering.

Deploy

To deploy the application:

Licensing

See LICENSE

Author

Aviv Greenberg

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.