Browse Source

added csp and fixed fix.

Keanu Poeschko 2 years ago
parent
commit
1349cecbc7
6 changed files with 24 additions and 7 deletions
  1. 2 2
      engines/bittorrent/merge.php
  2. 2 2
      engines/special/wikipedia.php
  3. 2 2
      index.php
  4. 1 0
      misc/header.php
  5. 1 1
      search.php
  6. 16 0
      static/css/styles.css

+ 2 - 2
engines/bittorrent/merge.php

@@ -86,8 +86,8 @@
                 echo "$source";
                 echo "<h2>$name</h2>";
                 echo "</a>";
-                echo "<span>SE: <span style=\"color:#50fa7b\">$seeders</span> - ";
-                echo "LE: <span style=\"color:#ff79c6\">$leechers</span> - ";
+                echo "<span>SE: <span class=\"seeders\">$seeders</span> - ";
+                echo "LE: <span class=\"leechers\">$leechers</span> - ";
                 echo "$size</span>";
                 echo "</div>";
             }

+ 2 - 2
engines/special/wikipedia.php

@@ -11,11 +11,11 @@
         {
             $description = substr($first_page["extract"], 0, 250) . "...";
 
-            $source = check_for_privacy_frontend("https://wikipedia.org/wiki/$query");
+            $source = check_for_privacy_frontend("https://wikipedia.org/wiki/$query_encoded");
             $response = array(
                 "special_response" => array(
                     "response" => htmlspecialchars($description),
-                    "source" => urlencode($source)
+                    "source" => $source
                 )
             );
 

+ 2 - 2
index.php

@@ -4,11 +4,11 @@
     </head>
     <body>
         <form class="search-container" action="search.php" method="post" enctype="multipart/form-data" autocomplete="off">
-                <h1>Libre<span style="color:#bd93f9;">X</span></h1>
+                <h1>Libre<span class="X">X</span></h1>
                 <input type="text" name="q"/>
                 <input type="hidden" name="p" value="0"/>
                 <input type="hidden" name="type" value="0"/>
-                <input type="submit" style="display:none"/>
+                <input type="submit" class="hide"/>
                 <div class="search-button-wrapper">
                     <button name="type" value="0" type="submit">Search with LibreX</button>
                     <button name="type" value="3" type="submit">Search torrents with LibreX</button>

+ 1 - 0
misc/header.php

@@ -1,6 +1,7 @@
 <!DOCTYPE html >
 <html lang="en">
     <head>
+        <?php header("Content-Security-Policy: sandbox allow-forms allow-top-navigation; default-src 'self'; img-src 'self' data:;"); ?>
         <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
         <meta charset="UTF-8"/>
         <meta name="description" content="A privacy respecting meta search engine."/>

+ 1 - 1
search.php

@@ -24,7 +24,7 @@
                 $type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
                 echo "<input type=\"hidden\" name=\"type\" value=\"$type\"/>";
             ?>
-            <button type="submit" style="display:none;"></button>
+            <button type="submit" class="hide"></button>
             <input type="hidden" name="p" value="0">
             <div class="sub-search-button-wrapper">
                 <button name="type" value="0"><img src="static/images/text_result.png" alt="text result" />Text</button>

+ 16 - 0
static/css/styles.css

@@ -346,3 +346,19 @@ a:hover, .text-result-wrapper h2:hover {
       font-size: 55px;
     }
 }
+
+.hide {
+    display: none;
+}
+
+.X {
+    color: #bd93f9;
+}
+
+.seeders {
+    color: #50fa7b;
+}
+
+.leechers {
+    color: #ff79c6;
+}