Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
added the Launcher as an extension
  • Loading branch information
Ahmad Nassri committed Sep 29, 2011
1 parent e61d54f commit faf1e25
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 99 deletions.
41 changes: 0 additions & 41 deletions README

This file was deleted.

51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
REST Console is an HTTP Request Visualizer and Constructor tool, helps developers build, debug and test RESTful APIs.

# Permissions Breakdown:

* Your tabs and browsing activity: The only access to tabs we need is for launching the oAuth Authorization page to the 3rd party oAuth provider.

* Your data on all websites: This is somewhat misleading, we ask for `*://*/*` access so that developers can make API calls to ANY URL ...

we don't collect any personal data and we don't want access to your data on all websites, we simply have to use that permission so developers can use the App on all urls.


# Features:
* Syntax highlighting (multiple themes)
* Custom headers
* Construct POST or PUT body via raw input
* Auto Complete
* File upload
* Easy query parameters creation
* Add custom headers through intuitive ui
* Authentication support: Plain, Basic, OAuth + Custom
* Keyboard navigation and shortcuts
* Customizable Interface

# Resources

* Follow us on Twitter: http://twitter.com/restconsole
* Get the source code: https://github.com/codeinchaos/rest-console
* Report issues: https://github.com/codeinchaos/rest-console/issues
* Donate: https://flattr.com/thing/156628/REST-Console

# Changelog

* v4.0.1 Corrupted images in the previous build now fixed.
* v4.0.0 Brand New UI
* v3.0.7 Updating links to new github project page
* v3.0.6 UI enhancements + File uploads + "Save Default" Option
* v3.0.5 More keyboard shortcuts
* v3.0.4 Bugfixes
* v3.0.3 Keyboard navigation + Bugfixes
* v3.0.2 Syntax Highlighting themes + Collapsible sections + Options
* v3.0.1 RAW request body + Bugfixes
* v3.0.0 Brand New UI
* v2.1.1 Bugfixes
* v2.1 Added OAuth1.0a support + bug fixes.
* v2.0 Revamped Design.
* v1.0 Released!

# Coming Soon:

* Request history manager
* URL auto complete
56 changes: 4 additions & 52 deletions application/background.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,8 @@
<html>
<body>
<script type="text/javascript" src="js/OAuthSimple.js"></script>
<script type="text/javascript" src="js/chrome_ex_oauth.js"></script>
<script type="text/javascript" src="js/analytics.js"></script>
<script>
chrome.browserAction.onClicked.addListener(function (tab) {
chrome.tabs.create({url: 'index.html'});
});

var oAuth = {
'instance': null,

'hasInstance': function() {
return this.instance ? true : false;
},

'initialize': function(options) {
this.instance = ChromeExOAuth.initBackgroundPage(options);
},

'hasToken': function() {
return this.instance.hasToken();
},

'authorize': function() {
if (this.hasInstance()) {
this.instance.authorize(function() {
chrome.extension.getViews().forEach(function(view) {
dialog = view.document.querySelector('form.authorization.oauth');

if (dialog) {
var token_key = dialog.querySelector('input[name="token_key"]');
var token_secret = dialog.querySelector('input[name="token_secret"]');

token_key.value = oAuth.instance.getToken();
token_key.fireEvent('change');

token_secret.value = oAuth.instance.getTokenSecret();
token_secret.fireEvent('change');
}
});
});
}
},

'clear': function() {
if (this.hasInstance()) {
this.instance.clearTokens();
this.instance = null;
}
}
}
</script>
<script src="js/OAuthSimple.js"></script>
<script src="js/chrome_ex_oauth.js"></script>
<script src="js/analytics.js"></script>
<script src="js/background.js"></script>
</body>
</html>
8 changes: 4 additions & 4 deletions application/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>REST Console v@VERSION@</title>
<title>REST Console</title>
<link rel="stylesheet" type="text/css" media="all" href="css/style.css"/>

<link rel="shortcut icon" href="images/favicon.ico"/>
Expand All @@ -23,7 +23,7 @@
<!--
<div class="container-fluid">
-->
<div class="brand"><img src="images/logo/32.png" align="left"/> REST Console <small>version @VERSION@</small></div>
<div class="brand"><img src="images/logo/32.png" align="left"/> REST Console <small>version 4.0.1</small></div>

<ul class="nav">
<li><a href="#options" scroll><span>O</span>ptions</a></li>
Expand Down Expand Up @@ -1003,7 +1003,7 @@ <h1>Response</h1>

<div class="page" id="donate">
<div class="page-header">
<h1>Donate <small>Your support keeps REST Console!</small></h1>
<h1>Donate <small>Show us you care!</small></h1>
</div>

<p></p>
Expand All @@ -1024,7 +1024,7 @@ <h1>Donate <small>Your support keeps REST Console!</small></h1>
</div>

<div class="page-header">
<h1>Share the love! </h1>
<h1>Share the love! <small>Spread the good news!</small></h1>
</div>

<div class="row">
Expand Down
43 changes: 43 additions & 0 deletions application/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var oAuth = {
'instance': null,

'hasInstance': function() {
return this.instance ? true : false;
},

'initialize': function(options) {
this.instance = ChromeExOAuth.initBackgroundPage(options);
},

'hasToken': function() {
return this.instance.hasToken();
},

'authorize': function() {
if (this.hasInstance()) {
this.instance.authorize(function() {
chrome.extension.getViews().forEach(function(view) {
dialog = view.document.querySelector('form.authorization.oauth');

if (dialog) {
var token_key = dialog.querySelector('input[name="token_key"]');
var token_secret = dialog.querySelector('input[name="token_secret"]');

token_key.value = oAuth.instance.getToken();
token_key.fireEvent('change');

token_secret.value = oAuth.instance.getTokenSecret();
token_secret.fireEvent('change');
}
});
});
}
},

'clear': function() {
if (this.hasInstance()) {
this.instance.clearTokens();
this.instance = null;
}
}
}
4 changes: 2 additions & 2 deletions application/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"version": "4.0.0",
"version": "4.0.1",

"name": "REST Console",
"description": "REST Console is an HTTP Request Visualizer and Constructor tool, helps developers build, debug and test RESTful APIs.",


"options_page": "index.html",
"options_page": "index.html#options",
"background_page": "background.html",

"icons": {
Expand Down
41 changes: 41 additions & 0 deletions extension/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<html>
<body>
<script>
const ID = 'cokgbflfommojglbmbpenpphppikmonn';
const URL = 'https://chrome.google.com/webstore/detail/' + ID;

// add click event listenr
chrome.browserAction.onClicked.addListener(function(tab) {
// get all apps
chrome.management.getAll(function(apps) {
// loop through apps
for (var i in apps) {
var app = apps[i];

// found it!
if (app.id == ID) {
console.log(app)
if (app.enabled) {
// is it enabled?
//launch it
chrome.management.launchApp(app.id);
} else {
// enable it
chrome.management.setEnabled(app.id, true, function() {
// then launch it
chrome.management.launchApp(app.id);
});
}

// we are done here
return;
}
}

// fail! go to store!
chrome.tabs.create({'url': URL});
});
});
</script>
</body>
</html>
Binary file added extension/images/logo/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/logo/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/logo/32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/logo/48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added extension/images/logo/720.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions extension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "4.0.1.1",

"name": "REST Console Launcher",
"description": "This is a toolbar launcher for REST Console. get the REST Console App at http://www.restconsole.com",

"background_page": "background.html",

"icons": {
"16": "images/logo/16.png",
"32": "images/logo/32.png",
"48": "images/logo/48.png",
"128": "images/logo/128.png"
},

"browser_action": {
"default_icon": "images/logo/32.png"
},

"permissions": [
"tabs",
"management"
]
}

0 comments on commit faf1e25

Please sign in to comment.