From c14948a102f819a1f14985613db0c2f7969518ab Mon Sep 17 00:00:00 2001 From: Robin Boutros Date: Wed, 18 Nov 2015 23:16:40 -0500 Subject: [PATCH] change clipboard lib --- app/lib/api.js | 39 ++++++++++++++++++------------------- app/package.json | 2 +- config/env_development.json | 3 +-- config/env_production.json | 3 +-- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/app/lib/api.js b/app/lib/api.js index fee1654..453fa55 100644 --- a/app/lib/api.js +++ b/app/lib/api.js @@ -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" @@ -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() { diff --git a/app/package.json b/app/package.json index 65dc7c7..f0677b8 100644 --- a/app/package.json +++ b/app/package.json @@ -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", diff --git a/config/env_development.json b/config/env_development.json index 6845d61..2f0b3bd 100644 --- a/config/env_development.json +++ b/config/env_development.json @@ -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" } diff --git a/config/env_production.json b/config/env_production.json index ce84ba3..4179a32 100644 --- a/config/env_production.json +++ b/config/env_production.json @@ -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" }