Skip to content

Commit

Permalink
change clipboard lib
Browse files Browse the repository at this point in the history
  • Loading branch information
niuage committed Nov 19, 2015
1 parent 226b3b8 commit c14948a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 25 deletions.
39 changes: 19 additions & 20 deletions app/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var env = window.env;
var $ = require('jquery');
var _ = require('underscore');
var radio = require('backbone.radio');
var clipboard = require("copy-paste");
var clipboard = require("clipboard");

import { Map } from "./map"

Expand All @@ -14,25 +14,24 @@ class API {
send(log) {
if (!this.isAuthorized()) return this.unauthorized();

clipboard.paste(_.bind(function(clipboard, cp_content) {
var map = new Map(cp_content);
var token = this.token();

$.ajax({
url: env.api.logs_url,
type: "POST",
dataType: "json",
data: {
token: token,
log: {
command: log.toS(),
map: map.encode()
}
},
xhrFields: { withCredentials: true },
crossDomain: false
});
}, this));
var cpContent = clipboard.readText();
var map = new Map(cp_content);
var token = this.token();

$.ajax({
url: env.api.logs_url,
type: "POST",
dataType: "json",
data: {
token: token,
log: {
command: log.toS(),
map: map.encode()
}
},
xhrFields: { withCredentials: true },
crossDomain: false
});
}

token() {
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"backbone": "^1.2.3",
"backbone.radio": "^1.0.2",
"copy-paste": "^1.1.3",
"electron": "^0.4.1",
"fs-jetpack": "^0.7.0",
"jquery": "^2.1.4",
"readline": "^1.1.0",
Expand Down
3 changes: 1 addition & 2 deletions config/env_development.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "development",
"title": "Path of Maps - dev",
"description": "Add here any environment specific stuff you like.",
"logs_path": ["resources", "Client.txt"],
"description": "Path of Maps - Dev",
"api": {
"logs_url": "http://localhost:5000/logs"
}
Expand Down
3 changes: 1 addition & 2 deletions config/env_production.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "production",
"title": "Path of Maps",
"description": "Add here any environment specific stuff you like.",
"logs_path": ["C:", "Program Files", "Grinding Gear Games", "Path of Exile", "logs", "Client.txt"],
"description": "Path of Maps",
"api": {
"logs_url": "http://pathofmaps.com/logs"
}
Expand Down

0 comments on commit c14948a

Please sign in to comment.