Code Monkey home page Code Monkey logo

af_refspoof's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @alekc
  • ๐Ÿ‘€ Iโ€™m interested in ...
  • ๐ŸŒฑ Iโ€™m currently learning ...
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on ...
  • ๐Ÿ“ซ How to reach me ...

af_refspoof's People

Contributors

alekc avatar alt-grr avatar hpsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

af_refspoof's Issues

Doesn't work with semi-modern TTRSS

Got a bunch of issues trying to use this on ttrss from six months ago (324aef9f6f80e7d1b34f1af2487ab03eebc66f47)

I fixed some of it with this:

diff --git a/init.php b/init.php
index 7f911c1..ae66293 100644
--- a/init.php
+++ b/init.php
@@ -22,7 +22,7 @@ class af_refspoof extends Plugin {
         require_once ("PhCURL.php");
 
         $this->host = $host;
-        $this->dbh = Db::get();
+        $this->dbh = Db::pdo();
         $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this);
         $host->add_hook($host::HOOK_PREFS_TAB, $this);
     }
@@ -54,14 +54,9 @@ EOF;
             <script type="dojo/method" event="onSubmit" args="evt">
                 evt.preventDefault();
                 if (this.validate()) {
-                    new Ajax.Request('backend.php', {
-                        parameters: dojo.objectToQuery(this.getValues()),
-                        onComplete: function(transport) {
-                            if (transport.responseText.indexOf('error')>=0)
-                                notify_error(transport.responseText);
-                            else notify_info(transport.responseText);
-                        }
-                    });
+                    xhr.post("backend.php", this.getValues(), (reply) => {
+                        Notify.info(reply);
+                    })
                 }
                 </script>
             <table>
@@ -118,7 +113,9 @@ EOF;
 
                         $entry->setAttribute("srcset", $srcSet);
                     }
-                    $url = $backendURL . '&url=' . urlencode($origSrc) . '&ref=' . urlencode($article['link']);
+                    //$url = $backendURL . '&url=' . urlencode($origSrc) . '&ref=' . urlencode($article['link']);
+                    //TODO: this might be unnecessary
+                    $url = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . "/" . $backendURL . '&url=' . urlencode($origSrc) . '&ref=' . urlencode($article['link']);
                     $entry->setAttribute("src",$url);
                 }
                 $article["content"] = $doc->saveXML();
@@ -157,11 +154,13 @@ EOF;
     protected function getFeeds()
     {
         $feeds = array();
-        $result = $this->dbh->query("SELECT id, title
+        $stmt = $this->dbh->prepare("SELECT id, title
                 FROM ttrss_feeds
-                WHERE owner_uid = ".$_SESSION["uid"].
-                " ORDER BY order_id, title");
-        while ($line = $this->dbh->fetch_assoc($result)) {
+                WHERE owner_uid = :sessionID
+                ORDER BY order_id, title");
+        $stmt->execute(['sessionID' => $_SESSION["uid"]]);
+        $result = $stmt->fetch();
+        while ($line = $stmt->fetch(PDO::FETCH_ASSOC)) {
             $feeds[] = (object) $line;
         }
         return $feeds;

But now I just get a CSRF error when calling the redirect, and I ran out of time to poke at it today.
I'll keep this issue updated with any progress I may make next time I try to get this working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.