Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #19 from Automattic/update/make-it-work
Browse files Browse the repository at this point in the history
Update some outdated dependecies and make the console work again
  • Loading branch information
youknowriad committed Oct 24, 2016
2 parents a439b21 + 8009b6a commit 7a5e579
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/app.js
Expand Up @@ -246,4 +246,4 @@ referencePanel.load();

window.send = sendRequest;

}); // $();
}); // $();
9 changes: 5 additions & 4 deletions lib/auth/oauth.js
Expand Up @@ -3,7 +3,7 @@ var querystring = require('querystring'),
client_id = null,
$ = require('zepto-browserify').$,
authParams = null;


function findToken(cb) {

Expand Down Expand Up @@ -55,10 +55,11 @@ function sendRequest(req, callback) {
// TODO: format the request correctly before sending
// check the version
// clean up the path in case it's an absolute URI
const version = req.version || '1';

$.ajax({
type: req.method,
url: 'https://public-api.wordpress.com/rest/v1' + req.path + (req.query ? "?" + req.query : '' ),
url: 'https://public-api.wordpress.com/rest/v' + version + req.path + (req.query ? "?" + req.query : '' ),
data: req.method == 'GET' ? null : req.body,
headers: $.extend({'accept':'application/json'}, authHeaders()),
success: function(data, status, xhr) {
Expand Down Expand Up @@ -95,7 +96,7 @@ function OAuth(panel) {
'response_type': 'token'
});
});

panel.on('signout', function() {
delete localStorage.auth;
panel.setValue(null);
Expand All @@ -119,4 +120,4 @@ module.exports = function(config) {

return buildAuth;

};
};
14 changes: 8 additions & 6 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "console2",
"version": "1.0.3",
"description": "A better REST console for WordPress.com.",
"homepage": "https://github.com/beaucollins/wpcom-console2",
"homepage": "https://github.com/Automattic/rest-api-console2",
"main": "lib/index.js",
"scripts": {
"start": "node server.js",
Expand All @@ -14,7 +14,9 @@
"email": "beaucollins@gmail.com"
},
"license": "MIT",
"engines": { "node" : ">=6.0.0" },
"devDependencies": {
"babel-runtime": "^6.11.6",
"browserify": "*",
"browserify-middleware": "*",
"del": "^1.1.0",
Expand All @@ -25,22 +27,22 @@
"gulp-gzip": "0.0.8",
"gulp-jade": "^0.6.1",
"gulp-rename": "^1.2.0",
"gulp-sass": "^0.7.3",
"gulp-sass": "^2.3.2",
"gulp-tar": "^0.5.0",
"jade": "^1.3.0",
"mocha": "*",
"node-sass": "^0.9",
"node-sass-middleware": "^0.9.8",
"uglifyify": "^2.5.0",
"vinyl-source-stream": "^0.1.1",
"wpcom-proxy-request": "*",
"zepto-browserify": "^1.1.3-0"
},
"dependencies": {
"liquidmetal": "rmm5t/liquidmetal",
"fn": "beaucollins/node-fn"
"fn": "beaucollins/node-fn",
"liquidmetal": "rmm5t/liquidmetal"
},
"repository": {
"type": "git",
"url": "https://github.com/beaucollins/wpcom-console2.git"
"url": "https://github.com/Automattic/rest-api-console2.git"
}
}
6 changes: 3 additions & 3 deletions server.js
@@ -1,6 +1,6 @@
var express = require('express'),
browserify = require('browserify-middleware'),
sass = require('node-sass'),
sassMiddleware = require('node-sass-middleware'),
app = express(),
port = process.env.PORT || 4000,
package = require('./package.json'),
Expand All @@ -25,7 +25,7 @@ app.get('/app.js', browserify('./lib/app.js'));
app.get('/search.js', browserify('./lib/search.js'));

// compile sass files
app.use(sass.middleware({
app.use(sassMiddleware({
src:process.cwd() + '/templates/sass',
debug:true,
response:true
Expand All @@ -45,4 +45,4 @@ app.use(express.static(__dirname + '/public'));

app.listen(port);

console.log("Running console on port %d", port);
console.log("Running console on port %d", port);

0 comments on commit 7a5e579

Please sign in to comment.