autoregister by visiting tt-rss preferences v0.2.0
authorChristian Weiske <cweiske@cweiske.de>
Thu, 9 Jul 2015 10:45:59 +0000 (12:45 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 9 Jul 2015 10:45:59 +0000 (12:45 +0200)
README.rst
init.php

index cf9eb05ab9204fd2f683976b919c41f4218ada27..c797952269e018c39e9298acd4843f2825f8e4ee 100644 (file)
@@ -16,11 +16,8 @@ __ http://cweiske.de/tagebuch/tt-rss-subtome.htm
 Usage
 =====
 #. Go to Tiny Tiny RSS preferences.
 Usage
 =====
 #. Go to Tiny Tiny RSS preferences.
-#. You'll see a new panel "SubToMe". Click on it.
-#. Click the "Add TT-RSS to SubToMe.com" button.
-
-   If you want, you can adjust the name before.
 
 
+That's it. Your Tiny Tiny RSS instance is registered at subtome.com now.
 
 ============
 Installation
 
 ============
 Installation
@@ -30,10 +27,15 @@ TT-RSS folder::
 
     $ cd /path/to/tt-rss/
     $ cd plugins.local/
 
     $ cd /path/to/tt-rss/
     $ cd plugins.local/
-    $ git clone git://git.cweiske.de/tt-rss-subtome.git
+    $ git clone git://git.cweiske.de/tt-rss-subtome.git subtome
 
 Then enable the plugin in the preferences.
 
 
 Then enable the plugin in the preferences.
 
+.. note:: To make it easy for everyone, enable the plugin for all
+          users by adding it to the ``PLUGINS`` configuration in
+          ``config.php``::
+
+            define('PLUGINS', 'auth_internal, note, subtome');
 
 =====
 About
 
 =====
 About
index 4f624ff18d894c7246e946504d9bf0ff263b0e57..2ccb4e4c64a7def863a21425dc269750228d1627 100644 (file)
--- a/init.php
+++ b/init.php
@@ -15,10 +15,10 @@ class SubToMe extends Plugin
     public function about()
     {
         return array(
     public function about()
     {
         return array(
-            0.1,
-            'Add TT-RSS to SubToMe.com',
+            0.2,
+            'Add Tiny Tiny RSS to SubToMe.com',
             'cweiske',
             'cweiske',
-            false//not a system plugin
+            false
         );
     }
     
         );
     }
     
@@ -32,55 +32,25 @@ class SubToMe extends Plugin
         if ($args != "prefPrefs") {
             return;
         }
         if ($args != "prefPrefs") {
             return;
         }
+        $name = 'Tiny Tiny RSS @ '
+            . parse_url(get_self_url_prefix(), PHP_URL_HOST);
 
         $ttSubscribeUrl = get_self_url_prefix()
             . '/public.php?op=subscribe&feed_url={url}';
 
         $ttSubscribeUrl = get_self_url_prefix()
             . '/public.php?op=subscribe&feed_url={url}';
-
         $regUrl = 'https://www.subtome.com/register-no-ui.html'
         $regUrl = 'https://www.subtome.com/register-no-ui.html'
-            . '?name=##NAME##'
+            . '?name=' . urlencode($name)
             . '&url=' . urlencode($ttSubscribeUrl);
             . '&url=' . urlencode($ttSubscribeUrl);
+        $hRegUrl = htmlspecialchars($regUrl);
+
         $jRegUrl = json_encode($regUrl);
 
         echo <<<HTM
 <div dojoType="dijit.layout.AccordionPane" title="SubToMe">
         $jRegUrl = json_encode($regUrl);
 
         echo <<<HTM
 <div dojoType="dijit.layout.AccordionPane" title="SubToMe">
- <form dojoType="dijit.form.Form" id="subtome_reg_form">
-  <script type="dojo/method" event="onSubmit" args="evt">
-    evt.preventDefault();
-    if (this.validate()) {
-        var regUrl = $jRegUrl.replace(
-            '##NAME##', document.getElementById("subtome_name").value
-        );
-        var me = document.getElementById('subtome_reg_form');
-        me.insertAdjacentHTML(
-            'afterend',
-            '<iframe style="display:none;" src="' + regUrl + '" />'
-        );
-        document.getElementById("subtome_done").style = "";
-    }
-  </script>
-
-  <table width="100%" class="prefPrefsList">
-   <tr><td colspan="2"><h3>Configure SubToMe</h3></td></tr>
-   <tr>
-    <td width="40%" class="prefName">
-     <label for="subtome_name">Name</label>
-    </td>
-    <td class="prefValue">
-     <input name="subtome_name" id="subtome_name" type="text" size="20" value="Tiny Tiny RSS" dojoType="dijit.form.TextBox"/>
-    </td>
-   </tr>
-  </table>
-  <p>
-   <input type="submit" value="Add TT-RSS to SubToMe.com"/>
-   <span id="subtome_done" style="display: none">
-    <input type="checkbox" checked="checked" value="1"
-           dojoType="dijit.form.CheckBox" />
-    Registration finished!
-   </span>
-  </p>
- </form>
-
- <h3>Testing</h3>
+ <iframe style="display:none;" src="$hRegUrl"></iframe>
+ <p>
+  Tiny Tiny RSS has been added to subtome.com automatically
+  by visiting the Tiny Tiny RSS preferences.
+ </p>
  <p>
   Try the "Subscribe" button on
   <a href="http://blog.superfeedr.com/">blog.superfeedr.com</a>.
  <p>
   Try the "Subscribe" button on
   <a href="http://blog.superfeedr.com/">blog.superfeedr.com</a>.