Skip to content

jordanblakey/url-redirector

Repository files navigation

URL Redirector Chrome Extension

CI

Reclaim your focus and master your digital habits with URL Redirector. This simple yet powerful extension acts as your personal internet traffic controller, gently nudging you away from distracting websites and towards your goals. Whether you're trying to break a social media loop or simply want to streamline your workflow, URL Redirector provides an unobtrusive way to modify your browsing patterns. Define your own rules, deflect distractions, and take back your time—one redirect at a time.

Links

Core Features

  • Universal Redirection: Redirect any URL (and its subpages) to a target URL.
  • Shuffle Mode: Randomize redirection targets (great for A/B testing or auditing).
  • Snooze: Temporarily pause specific rules without deleting them.
  • Rules Storage: Rules are stored locally using chrome.storage.local.
  • Privacy First: Built on the declarativeNetRequest API. This extension does not read your browsing history and cannot see the content of your pages.

Installation (Local Development)

  1. Clone the repository.
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Open Chrome and navigate to chrome://extensions
  5. Enable Developer mode.
  6. Click Load unpacked and select the dist/ directory created by the build.

Usage

  1. Right-click the extension icon and select Options, or click the extension icon in the toolbar.
  2. Enter a Source URL (e.g., reddit.com)
  3. Enter a Target URL (e.g., google.com)
  4. Click Add Rule

The extension will now redirect reddit.com and all its subpages (e.g., reddit.com/r/linux) to google.com.

Development

Prerequisites

  • Node.js and npm
  • Python 3 (optional, for serving files if needed)

Key Commands

Command Description
npm run build Compiles TypeScript and copies assets to dist/
npm run build:watch Rebuilds automatically on file changes
npm test Runs the full test suite (E2E and Build validation)
npm run bundle Creates extension.zip for Chrome Web Store publication

Project Structure

url-redirector/
├── src/                   # TypeScript source files
├── dist/                  # Compiled extension (gitignored)
├── test/                  # Test suites (E2E, Unit, Mocks)
├── scripts/               # Build and maintenance scripts
├── assets/                # Static assets (HTML, CSS, icons)
├── manifest.json          # Extension configuration
└── playwright.config.ts   # Testing configuration

Testing

The project uses Playwright for comprehensive testing.

# Run all tests
npm test

# Run specifically the build validation tests
npm run test:build

# Run tests with visual UI
npm run test:ui

For more details on the build validation tests, see docs/build-tests.md.

  • Build System: Understand how the build and bundle scripts work.
  • Build Tests: Details on the build validation test suite.
  • Pre-commit Hook: Setup for automated testing before commits.
  • Releasing: Instructions on how to version and submit the extension to the Chrome Web Store.
  • Source Maps: How to use the bundled sourcemaps for production debugging.
  • Store Assets: How to generate high-fidelity assets for the Chrome Web Store.
  • Troubleshooting: Solutions for common issues.
  • SPA Redirection: How the extension handles Single Page Application redirects.

Contributing

  1. Create a branch for your feature or fix.
  2. Make changes and run npm test to ensure everything passes.
  3. Commit your changes (the pre-commit hook will run tests automatically).
  4. Push to GitHub and create a Pull Request.

License

MIT

About

A simple, privacy-focused Chrome Extension to redirect URLs and improve focus.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •