aboutsummaryrefslogtreecommitdiffstats
path: root/pino.js
diff options
context:
space:
mode:
authorsnaka2009-05-19 15:39:32 +0000
committersnaka2009-05-19 15:39:32 +0000
commit25844dd69b38358ed8591b6ee5e8c3dcacf071e9 (patch)
tree8a318ed4838db8414287ef9c0c5aeea1e699631a /pino.js
parentbf398ff220d62d2c6cd46f558ec6f3fcf298e761 (diff)
downloadvimperator-plugins-25844dd69b38358ed8591b6ee5e8c3dcacf071e9.tar.bz2
proxy経由だとピンの一覧取得APIへのアクセスが失敗する場合があったので修正。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@33416 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'pino.js')
-rw-r--r--pino.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/pino.js b/pino.js
index f4e1966..0dbf3ec 100644
--- a/pino.js
+++ b/pino.js
@@ -158,7 +158,7 @@ liberator.plugins.pino.api = (function() {
count: true,
completer: function(context) {
var pins = new Pins();
- context.title = ["title", "url"];
+ context.title = ["url", "title"];
context.completions = [
[i.link, i.title] for each (i in pins.items())
];
@@ -234,7 +234,10 @@ liberator.plugins.pino.api = (function() {
var request = new libly.Request(
baseURL() + "/api/pin/all",
null,
- { asynchronous: false }
+ {
+ asynchronous: false,
+ postBody: toQuery({ApiKey: this.apiKey})
+ }
);
request.addEventListener("onSuccess", function(data) {
@@ -255,12 +258,13 @@ liberator.plugins.pino.api = (function() {
var libly = plugins.libly;
function getLDRApiKey() {
- var uri = Cc["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService)
- .newURI(baseURL(), null, null);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ var uri = ioService.newURI(baseURL(), null, null);
+ var channel = ioService.newChannelFromURI(uri);
var cookie = Cc["@mozilla.org/cookieService;1"]
.getService(Ci.nsICookieService)
- .getCookieString(uri, null);
+ .getCookieString(uri, channel);
var apiKey = cookie.match(/reader_sid=([^;]+)/);
return apiKey ? apiKey[1]: null;
}