tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

file_user_gesture.sjs (999B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2  * License, v. 2.0. If a copy of the MPL was not distributed with this
      3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 function handleRequest(request, response) {
      6   response.setHeader("Cache-Control", "no-cache", false);
      7 
      8   if (request.queryString === "redirect") {
      9     response.setStatusLine(request.httpVersion, 302, "Moved");
     10     response.setHeader(
     11       "Location",
     12       // eslint-disable-next-line @microsoft/sdl/no-insecure-url
     13       `http://${request.host}${request.path}`,
     14       false
     15     );
     16     return;
     17   }
     18 
     19   response.setStatusLine(request.httpVersion, 200, "OK");
     20   response.setHeader("Content-Type", "text/html", false);
     21   response.write(`<button id="directButton" onclick="location.href='http://${request.host}${request.path}'" type="button">direct</button>
     22 <button id="redirectButton" onclick="location.href='http://${request.host}${request.path}?redirect'" type="button">redirect</button> `);
     23 }