Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156<!DOCTYPE html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Reroute — rules</title> <link rel="stylesheet" href="options.css"></head><body> <header class="masthead"> <div class="masthead-inner"> <div class="wordmark"> <svg width="22" height="22" viewBox="0 0 24 24" aria-hidden="true"> <path d="M3 8h13l-3.2-3.2L14.2 3 20 8.8 14.2 14.6l-1.4-1.8L16 9.6H3z" fill="currentColor"/> <path d="M21 16H8l3.2 3.2L9.8 21 4 15.2 9.8 9.4l1.4 1.8L8 14.4h13z" fill="currentColor" opacity="0.45"/> </svg> <h1>Reroute</h1> </div> <label class="switch" title="Turn all rewriting on or off"> <input type="checkbox" id="global-enabled"> <span class="track"></span> <span class="switch-label" id="global-label">On</span> </label> </div> <p class="tagline">Rewrites happen in the browser's network layer — no page ever loads from the original URL first, and nothing leaves your machine.</p> </header>
<main> <section class="panel" aria-labelledby="rules-heading"> <div class="panel-head"> <h2 id="rules-heading">Rules</h2> <div class="panel-actions"> <button id="btn-export" class="ghost">Export</button> <button id="btn-import" class="ghost">Import</button> <input type="file" id="import-file" accept="application/json" hidden> <button id="btn-add" class="primary">Add rule</button> </div> </div> <p class="hint">First matching rule wins, top to bottom.</p> <ul id="rule-list" class="rule-list"></ul> <p id="empty-state" class="empty" hidden>No rules yet. Add one, or import a JSON file.</p> </section>
<section class="panel editor" id="editor" hidden aria-labelledby="editor-heading"> <h2 id="editor-heading">New rule</h2>
<div class="field"> <label for="f-name">Name</label> <input id="f-name" type="text" placeholder="Twitter → xcancel" autocomplete="off"> </div>
<div class="field"> <span class="label">Kind</span> <div class="segmented" role="radiogroup" aria-label="Rule kind"> <label><input type="radio" name="f-type" value="host" checked><span>Domain swap</span></label> <label><input type="radio" name="f-type" value="regex"><span>Regex rewrite</span></label> <label><input type="radio" name="f-type" value="accept"><span>Header fix</span></label> <label><input type="radio" name="f-type" value="param-redirect"><span>?url= redirect</span></label> </div> </div>
<div id="fields-host"> <div class="field"> <label for="f-from">From domains <span class="sub">(comma-separated; subdomains included automatically)</span></label> <input id="f-from" type="text" class="mono" placeholder="twitter.com, x.com" autocomplete="off"> </div> <div class="field"> <label for="f-to">To host(s) <span class="sub">(comma-separated — more than one makes a round-robin pool: each visit uses the next host)</span></label> <input id="f-to" type="text" class="mono" placeholder="xcancel.com, nitter.net, nitter.poast.org" autocomplete="off" spellcheck="false"> </div> <div id="pool-options" hidden> <div class="field checkline"> <label><input type="checkbox" id="f-health-check"> Health-check instances before redirecting <span class="sub">(pools of 2+ hosts only; a single destination ignores this flag)</span></label> </div> <div class="field"> <button type="button" id="btn-test-instances" class="ghost">Test instances</button> <div id="f-test-results" class="probe-results" hidden aria-live="polite"></div> </div> </div> <p class="hint">Path, query and fragment are kept; only the host changes (and the scheme becomes https). Round-robin pools apply to page navigations only.</p> </div>
<div id="fields-regex" hidden> <div class="field"> <label for="f-pattern">Pattern <span class="sub">(matched against the full URL, case-insensitive, RE2 syntax)</span></label> <input id="f-pattern" type="text" class="mono" placeholder="^https?://example\.com/watch\?v=([\w-]+)" autocomplete="off" spellcheck="false"> </div> <div class="field"> <label for="f-substitution">Rewrite to <span class="sub">(\1–\9 insert capture groups, \0 the whole match)</span></label> <input id="f-substitution" type="text" class="mono" placeholder="https://other.example/v/\1" autocomplete="off" spellcheck="false"> </div> </div>
<div id="fields-accept" hidden> <div class="field"> <label for="f-accept-hosts">Hosts to fix <span class="sub">(comma-separated; subdomains included automatically — e.g. i.redd.it)</span></label> <input id="f-accept-hosts" type="text" class="mono" placeholder="i.redd.it, preview.redd.it" autocomplete="off"> </div> <div class="field"> <label for="f-accept-header">Header</label> <input id="f-accept-header" type="text" class="mono" value="Accept" autocomplete="off"> </div> <div class="field"> <label for="f-accept-value">Value <span class="sub">(e.g. an image Accept header so the server serves the raw file)</span></label> <input id="f-accept-value" type="text" class="mono" value="image/avif,image/webp,*/*;q=0.8" autocomplete="off" spellcheck="false"> </div> <p class="hint">Sets the request header on navigations to these hosts. The URL is unchanged; the server just answers with the content you asked for. Defaults to page navigations only.</p> </div>
<div id="fields-param" hidden> <div class="field"> <label for="f-param-match">Match <span class="sub">(content-script match pattern, e.g. *://*.reddit.com/media*)</span></label> <input id="f-param-match" type="text" class="mono" placeholder="*://*.reddit.com/media*" autocomplete="off" spellcheck="false"> </div> <div class="field"> <label for="f-param-name">Query parameter</label> <input id="f-param-name" type="text" class="mono" value="url" autocomplete="off"> </div> <div class="field"> <label for="f-param-hosts">Allowed destination hosts <span class="sub">(comma-separated; *.redd.it matches i.redd.it but not evilredd.it — only these are ever redirected to)</span></label> <input id="f-param-hosts" type="text" class="mono" placeholder="*.redd.it, *.redditmedia.com" autocomplete="off"> </div> <p class="hint">Decodes the query parameter and goes straight to it, but only if it's an http/https URL on an allowed host. Anything else is left alone.</p> </div>
<div class="field checkline"> <label><input type="checkbox" id="f-all-requests"> Also rewrite embedded requests (iframes, images, scripts) — default is page navigations only <span class="sub">(not available for ?url= redirects, which follow the page's own links)</span></label> </div>
<p id="editor-error" class="error" hidden></p>
<div class="editor-actions"> <button id="btn-save" class="primary">Save rule</button> <button id="btn-cancel" class="ghost">Cancel</button> </div> </section>
<section class="panel" aria-labelledby="test-heading"> <h2 id="test-heading">Try a URL</h2> <div class="test-row"> <input id="test-url" type="url" class="mono" placeholder="https://x.com/user/status/123…" autocomplete="off" spellcheck="false"> </div> <div id="test-result" class="test-result" hidden></div> </section> </main>
<footer> <p>Rules live in local extension storage. Export a backup before uninstalling.</p> </footer>
<script src="common.js"></script> <script src="probe.js"></script> <script src="options.js"></script></body></html>