diff --git a/content.js b/content.js index 74a346c..9dd7b40 100644 --- a/content.js +++ b/content.js @@ -80,3 +80,14 @@ fetch("http://127.0.0.1:7657/themes/console/light/images/i2plogo.png") var consoleLinks = document.querySelectorAll(".application-info"); hide(consoleLinks); }); + +fetch("http://127.0.0.1:7657/jsonrpc/") + .then((myJson) => { + var toopieLinks = document.querySelectorAll(".window-visit-toopie"); + unhide(toopieLinks); + }) + .catch((error) => { + var toopieLinks = document.querySelectorAll(".window-visit-toopie"); + hide(toopieLinks); + }); + diff --git a/home.html b/home.html index ec90c62..3e27098 100644 --- a/home.html +++ b/home.html @@ -86,8 +86,8 @@ --> -
  • - Toopie For information about your I2P router status, go here: +
  • + Toopie For information about your I2P router status, go here:
  • @@ -147,5 +147,6 @@ + diff --git a/i2pcontrol/README.md b/i2pcontrol/README.md index 786d9e5..3297a55 100644 --- a/i2pcontrol/README.md +++ b/i2pcontrol/README.md @@ -1,5 +1,8 @@ -i2pcontrol.js -============= +toopie.html/i2pcontrol.js +========================= -This is inside of the webextension for now, but it's actually a fully-fledged, -standalone library for talking to i2pcontrol. +To enable toopie.html, the built in I2P monitoring system in this webextension, +go to the [Web App Configuration page in the I2P Router and start I2PControl](http://127.0.0.1:7657/configwebapps). +Click the "Start" button next to the menu item that says `jsonrpc`. + +- ![i2pcontrol.png](i2pcontrol.png) diff --git a/i2pcontrol/i2pcontrol.js b/i2pcontrol/i2pcontrol.js index f7d1a62..703410a 100644 --- a/i2pcontrol/i2pcontrol.js +++ b/i2pcontrol/i2pcontrol.js @@ -383,9 +383,30 @@ function UpdateContents() { } var done = Echo(hello); -done.then(Done); +done.then(Done).catch(Done); function Done(output) { + function hide(elements) { + elements = elements.length ? elements : [elements]; + for (var index = 0; index < elements.length; index++) { + elements[index].style.display = "none"; + } + } + + function unhide(elements) { + elements = elements.length ? elements : [elements]; + for (var index = 0; index < elements.length; index++) { + elements[index].style.display = "inline-block"; + } + } + console.log("(i2pcontrol) I2PControl connection tested,", output); + if (output == hello) { + var toopieLinks = document.querySelectorAll(".window-visit-toopie"); + unhide(toopieLinks); + }else{ + var toopieLinks = document.querySelectorAll(".window-visit-toopie"); + hide(toopieLinks); + } return output; } diff --git a/i2pcontrol/i2pcontrol.png b/i2pcontrol/i2pcontrol.png new file mode 100644 index 0000000..da53c44 Binary files /dev/null and b/i2pcontrol/i2pcontrol.png differ diff --git a/i2pcontrol/index.html b/i2pcontrol/index.html new file mode 100644 index 0000000..57a38ca --- /dev/null +++ b/i2pcontrol/index.html @@ -0,0 +1,17 @@ + + + + I2P in Private Browsing Mode + + + + + +

    toopie.html/i2pcontrol.js

    +

    To enable toopie.html, the built in I2P monitoring system in this webextension, go to the Web App Configuration page in the I2P Router and start I2PControl. Click the “Start” button next to the menu item that says jsonrpc.

    + + + + \ No newline at end of file diff --git a/info.js b/info.js index 0fa4c5b..f59b70f 100644 --- a/info.js +++ b/info.js @@ -123,6 +123,12 @@ document.addEventListener("click", (clickEvent) => { } else if (clickEvent.target.id === "window-visit-index") { console.log("attempting to create index tab"); goIndex(); + } else if (clickEvent.target.id === "window-visit-torrent") { + console.log("attempting to create torrent tab"); + goTorrent(); + } else if (clickEvent.target.id === "window-visit-help") { + console.log("attempting to create torrent tab"); + goHelp(); } else if (clickEvent.target.id === "window-visit-homepage") { console.log("attempting to create homepage tab"); goHome(); @@ -226,7 +232,7 @@ function goHome() { function goIndex() { function onTabError() { - console.log("Help tab created"); + console.log("Help tab not created"); } let createData = { url: "index.html", @@ -236,6 +242,30 @@ function goIndex() { creating.then(onTabCreated, onTabError); } +function goTorrent() { + function onTabError() { + console.log("Torrent Help tab not created"); + } + let createData = { + url: "torrent/index.html", + }; + console.log("visiting torrent help"); + let creating = browser.tabs.create(createData); + creating.then(onTabCreated, onTabError); +} + +function goHelp() { + function onTabError() { + console.log("Torrent Help tab not created"); + } + let createData = { + url: "i2pcontrol/index.html", + }; + console.log("visiting torrent help"); + let creating = browser.tabs.create(createData); + creating.then(onTabCreated, onTabError); +} + function goToopie() { function onTabError() { console.log("Toopie tab created"); diff --git a/torrent/README.md b/torrent/README.md index 23b6090..d514513 100644 --- a/torrent/README.md +++ b/torrent/README.md @@ -1,4 +1,4 @@ -Acknowledgement +Acknowledgementindex =============== **Many, many thanks to the [Transmitter](https://github.com/myfreeweb/transmitter) @@ -33,7 +33,7 @@ To install the plugin, go to [http://127.0.0.1:7657/configplugins](http://127.0. and scroll down to the section of the page where it says "Installation from URL" and paste the following URL: -```http://stats.i2p/i2p/plugins/i2psnark-rpc.su3``` +`http://stats.i2p/i2p/plugins/i2psnark-rpc.su3` Click the "Install Plugin" button and you'll be ready to go. Now, open the extension options menu, and just click "Save." The defaults are correct for use diff --git a/window.html b/window.html index 50929b3..866f2a3 100644 --- a/window.html +++ b/window.html @@ -84,9 +84,9 @@

    These applications use I2P to provide them with security and privacy.