Skip to content

Instantly share code, notes, and snippets.

@JaHIY
Last active April 9, 2017 20:46
Show Gist options
  • Save JaHIY/4483939 to your computer and use it in GitHub Desktop.
Save JaHIY/4483939 to your computer and use it in GitHub Desktop.
patch: for Echofon(Firefox Add-on) 2.5.2
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/components/nsEchofon.js /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/components/nsEchofon.js
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/components/nsEchofon.js 2012-09-19 06:55:02.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/components/nsEchofon.js 2013-01-27 16:56:49.000000000 +0800
@@ -25,7 +25,7 @@
Components.utils.import("resource://echofon/TwitterClient.jsm");
Components.utils.import("resource://echofon/EchofonHttpRequest.jsm");
Components.utils.import("resource://echofon/Timeline.jsm");
- Components.utils.import("resource://echofon/EchofonGA.jsm");
+ //Components.utils.import("resource://echofon/EchofonGA.jsm");
this._pref = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefService).getBranch("extensions.twitternotifier.");
}
@@ -103,31 +103,8 @@
},
getAd: function(info) {
-
- if (info.force == false && this._ad && this._lastAd) {
- var now = new Date();
- if (now - this._lastAd < AD_INTERVAL_TIME) {
- EchofonUtils.notifyObservers("adDidLoad", this._ad);
- return;
- }
- }
- var acct = EchofonAccountManager.instance().get();
-
- var ad_id;
- if (EchofonUtils.isXULRunner()) {
- ad_id = '92'; // windows
- }
- else {
- ad_id = '36'; // firefox
- }
-
- var url = "http://api.140proof.com/ads/user.json?hb=" + acct.user_id + "&app_id=" + ad_id;
- var r = new EchofonHttpRequest();
- r.setURL(url);
- var target = this;
- r.onload = function (p) {target.onLoadAd(r)};
- r.onerror = function (p) {target.onErrorLoadAd(r);};
- r.asyncOpen();
+ this._pref.setBoolPref("licensed", true);
+ EchofonUtils.notifyObservers("removeAds");
},
onLoadAd: function (r) {
@@ -443,7 +420,7 @@
if (settings.trend_location) {
woeid = settings.trend_location[0].woeid;
}
- tc.get("trends." + woeid, {}, "trends");
+ tc.get("trends.place", {'id': woeid}, "trends");
}
},
@@ -543,20 +520,20 @@
if (arr && arr.length == 3) {
this.post("direct_messages.new", {user: arr[1], text: arr[2], include_entities:'true'}, msg);
- EchofonGA.instance().trackEvent("post", "direct_message");
+ //EchofonGA.instance().trackEvent("post", "direct_message");
}
else if (msg.isDM) {
this.post("direct_messages.new", {user: msg.user, text: msg.status, include_entities:'true'}, msg);
- EchofonGA.instance().trackEvent("post", "direct_message");
+ //EchofonGA.instance().trackEvent("post", "direct_message");
}
else {
var status = {status:msg.status};
if (msg.inReplyTo) {
status["in_reply_to_status_id"] = msg.inReplyTo;
- EchofonGA.instance().trackEvent("post", "mention");
+ //EchofonGA.instance().trackEvent("post", "mention");
}
else {
- EchofonGA.instance().trackEvent("post", "status");
+ //EchofonGA.instance().trackEvent("post", "status");
}
if (msg.place_id) {
status["place_id"] = msg.place_id;
@@ -572,7 +549,7 @@
Cu.import("resource://echofon/PlixiClient.jsm");
var pc = new PlixiClient(account, this, msg);
pc.upload(msg.images[0], msg.status)
- EchofonGA.instance().trackEvent("post", "photo");
+ //EchofonGA.instance().trackEvent("post", "photo");
},
imageUploadDidFinish: function(context, path, url) {
@@ -591,14 +568,14 @@
this._req = new TwitterClient(acct, this);
this._req.message_id = msg.id;
- this._req.post("favorites." + msg.method + "." + msg.id, null, "favorites_" + msg.method);
+ this._req.post("favorites." + msg.method, {'id': msg.id}, "favorites_" + msg.method);
},
retweet: function(msg) {
var account = EchofonAccountManager.instance().get();
var req = new TwitterClient(account, this);
- req.post("statuses.retweet." + msg.id, {}, "statuses_retweet");
- EchofonGA.instance().trackEvent("post", "retweet");
+ req.post("statuses.retweet." + msg.id, {'trim_user': true}, "statuses_retweet");
+ //EchofonGA.instance().trackEvent("post", "retweet");
},
statuses_retweet: function (tweet, req, context) {
@@ -890,7 +867,7 @@
checkFollowing: function(acct) {
var checkFollow = this._pref.getIntPref("checkFollow");
if (checkFollow == 0) {
- EchofonGA.instance().trackEvent("app", "new user");
+ //EchofonGA.instance().trackEvent("app", "new user");
}
if (checkFollow == 2) {
this.get("friendships.exists", {"user_a":acct.screen_name, "user_b":"echofon"});
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/conversation-view.js /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/conversation-view.js
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/conversation-view.js 2012-05-11 07:39:15.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/conversation-view.js 2012-10-29 14:01:12.000000000 +0800
@@ -11,7 +11,7 @@
Components.utils.import("resource://echofon/TwitterClient.jsm");
Components.utils.import("resource://echofon/Models.jsm");
Components.utils.import("resource://echofon/EchofonUtils.jsm");
-Components.utils.import("resource://echofon/EchofonGA.jsm");
+//Components.utils.import("resource://echofon/EchofonGA.jsm");
const {classes:Cc, interfaces:Ci} = Components;
const container = $('echofon-tweets');
@@ -69,7 +69,7 @@
container.appendChild(textbox);
getScrollBoxObject().ensureElementIsVisible(textbox);
}
- EchofonGA.instance().trackPage("/conversation");
+ //EchofonGA.instance().trackPage("/conversation");
}
function onunload()
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/user-view.js /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/user-view.js
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/user-view.js 2012-08-11 02:40:16.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/user-view.js 2012-10-29 14:05:12.000000000 +0800
@@ -12,7 +12,7 @@
Components.utils.import("resource://echofon/Models.jsm");
Components.utils.import("resource://echofon/EchofonUtils.jsm");
Components.utils.import("resource://echofon/EchofonSync.jsm");
-Components.utils.import("resource://echofon/EchofonGA.jsm");
+//Components.utils.import("resource://echofon/EchofonGA.jsm");
const {classes:Cc, interfaces:Ci, utils:Cu} = Components;
@@ -57,7 +57,7 @@
updateUserTimeline(params.screen_name);
- EchofonGA.instance().trackPage("/user");
+ //EchofonGA.instance().trackPage("/user");
$('follow_button').className = "echobutton following";
$('follow_button').label = EchofonCommon.getString("Loading");
}
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/utility.js /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/utility.js
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/utility.js 2012-08-14 06:39:14.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/utility.js 2013-01-23 22:20:32.000000000 +0800
@@ -470,7 +470,7 @@
}
var url = entity['url'];
var expanded_url = entity['expanded_url'];
- a = this.createAnchorText(url, linked_text, "link");
+ a = this.createAnchorText(expanded_url ? expanded_url : url, linked_text, "link");
a.setAttribute('url', url);
a.setAttribute('expanded_url', expanded_url);
this.checkPhotoURL(parent_elem, expanded_url ? expanded_url : url);
@@ -495,7 +495,7 @@
}
var url = entity['url'];
var expanded_url = entity['expanded_url'];
- a = this.createAnchorText(url, linked_text, "link");
+ a = this.createAnchorText(expanded_url ? expanded_url : url, linked_text, "link");
a.setAttribute('url', url);
a.setAttribute('expanded_url', expanded_url);
parent_elem.setAttribute("status-photo", url);
@@ -1066,4 +1066,4 @@
echofonObserver.prototype.remove = function()
{
Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService).removeObserver(this, "echofon-status");
-}
\ No newline at end of file
+}
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/window.js /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/window.js
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/chrome/Echofon/content/window.js 2012-08-29 07:37:18.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/chrome/Echofon/content/window.js 2012-10-29 14:06:12.000000000 +0800
@@ -32,7 +32,7 @@
Cu.import("resource://echofon/Account.jsm");
Cu.import("resource://echofon/EchofonUtils.jsm");
Cu.import("resource://echofon/EchofonSync.jsm");
-Cu.import("resource://echofon/EchofonGA.jsm");
+//Cu.import("resource://echofon/EchofonGA.jsm");
Cu.import("resource://echofon/Models.jsm");
//
@@ -143,7 +143,7 @@
changeTab(tab);
}
else {
- EchofonGA.instance().trackPage("/home");
+ //EchofonGA.instance().trackPage("/home");
getTimeline(user_id, activeTab);
EchofonCommon.notify("restoreSession");
}
@@ -1341,7 +1341,7 @@
return;
}
- EchofonGA.instance().trackPage("/" + tabName);
+ //EchofonGA.instance().trackPage("/" + tabName);
markRead();
var reduced = reduceTweets(contentBox.getContainer(activeTab));
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/modules/EchofonUtils.jsm /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/modules/EchofonUtils.jsm
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/modules/EchofonUtils.jsm 2012-09-19 06:55:29.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/modules/EchofonUtils.jsm 2012-10-27 21:16:02.000000000 +0800
@@ -132,11 +132,16 @@
},
verifyLicense: function(email, key, callback) {
+ /*
var r = new EchofonHttpRequest();
var app = this.isXULRunner() ? "Echofon for Windows" : "Echofon for Firefox";
r.setURL(LICENSE_SERVER + '?key=' + encodeURIComponent(key) + '&email=' + encodeURIComponent(email) + "&app=" + encodeURIComponent(app));
r.onload = function(p) {callback.onVerifyLicense(r);}
r.asyncOpen();
+ */
+ var r = {};
+ r.status = 200;
+ callback.onVerifyLicense(r);
},
log: function(msg) {
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/modules/Timeline.jsm /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/modules/Timeline.jsm
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/modules/Timeline.jsm 2012-07-20 02:18:46.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/modules/Timeline.jsm 2013-01-29 16:45:57.854499000 +0800
@@ -671,8 +671,8 @@
var now = Date.now();
if (!this.blocksLoaded || now - this.blocksLoaded > 60 * 60 * 1000) {
- this.get('blocks.blocking.ids', {});
- this.get('friendships.no_retweet_ids', {});
+ this.get('blocks.ids', {});
+ //this.get('friendships.no_retweet_ids', {});
return true;
}
return false;
@@ -691,7 +691,7 @@
if (since_id) {
since_id =EchofonModel.DBM.calcSnowflakeId(since_id, 5);
}
- var method = type == MENTIONS_TIMELINE ? 'mentions' : 'home_timeline';
+ var method = type == MENTIONS_TIMELINE ? 'mentions_timeline' : 'home_timeline';
var params = {include_entities:true};
if (max_id) {
params['max_id'] = max_id;
@@ -741,7 +741,7 @@
var now = Date.now();
if (!this.listLoaded || now - this.listLoaded > 60 * 60 * 1000) {
- this.get('lists.all', {});
+ this.get('lists.list', {});
}
},
@@ -750,7 +750,7 @@
var now = Date.now();
if (!this.savedSearchesLoaded || now - this.savedSearchesLoaded > 60 * 60 * 1000) {
- this.get('saved_searches', {});
+ this.get('saved_searches.list', {});
}
},
@@ -953,7 +953,7 @@
}
},
- statuses_mentions : function(resp, req, context) {
+ statuses_mentions_timeline : function(resp, req, context) {
if (resp) {
this.retrieveTweets(resp, MENTIONS_TIMELINE, context);
@@ -990,7 +990,7 @@
}
},
- lists_all: function(resp, req, context) {
+ lists_list: function(resp, req, context) {
if (resp) {
var lists = [];
for (var i in resp) {
@@ -1004,7 +1004,7 @@
}
},
- blocks_blocking_ids: function(resp, req, context) {
+ blocks_ids: function(resp, req, context) {
if (resp) {
EchofonModel.Blocking.update(this.token.user_id, resp);
this.blocksLoaded = Date.now();
@@ -1024,7 +1024,7 @@
}
},
- saved_searches: function(resp, req, context) {
+ saved_searches_list: function(resp, req, context) {
if (resp) {
var ss = [];
for (var i in resp) {
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/modules/TwitterClient.jsm /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/modules/TwitterClient.jsm
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/modules/TwitterClient.jsm 2012-09-19 02:44:38.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/twitternotifier@naan.net/modules/TwitterClient.jsm 2013-01-22 21:26:25.000000000 +0800
@@ -6,7 +6,7 @@
Cu.import("resource://echofon/EchofonHttpRequest.jsm");
const OAUTH_CONSUMER_KEY = "yqoymTNrS9ZDGsBnlFhIuw";
-const TWITTER_API_URL = "api.twitter.com/1/";
+const TWITTER_API_URL = "api.twitter.com/1.1/";
function convertToHexString(data)
{
@JaHIY
Copy link
Author

JaHIY commented Jan 8, 2013

直接下载修改好的 xpi -> http://sdrv.ms/TXcF3j <- You can download .xpi files here. The patch is outdated.

@sirald66
Copy link

https://blog.mozilla.org/addons/2015/02/10/extension-signing-safer-experience

IMPORTANT - ACTION NEEDED

Firefox will soon require ALL add-on extensions be reviewed and signed by them for security. It appears forked/private versions can be signed. The add-on ID must be changed to avoid problems.

@rrglomsk
Copy link

With the new Firefox 36 update, a lot of the functionality of the patched Echofon is lost. It would be great to see an update of the patch if there's time 😃

@oilvier
Copy link

oilvier commented Feb 26, 2015

+1

@txipi
Copy link

txipi commented Feb 27, 2015

+1

@BBKing77
Copy link

+1 (and probably a whole lot more... I just created my account to add my +1 here)

Also probably worth noting that official Twitter extension also affected by FF 36 update.

@Jordi-m
Copy link

Jordi-m commented Feb 28, 2015

@AntoineTurmel
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment