Skip to content

Instantly share code, notes, and snippets.

@rolltidehero
Created December 15, 2025 10:48
Show Gist options
  • Select an option

  • Save rolltidehero/4b52ee381c4e79593d878df98611f0c9 to your computer and use it in GitHub Desktop.

Select an option

Save rolltidehero/4b52ee381c4e79593d878df98611f0c9 to your computer and use it in GitHub Desktop.
Control D Chrome Extension

Project Plan: "Control D Bypass Domain Chrome Extension"

1. Core Features

  • Bypass current domain with one click
  • Show notification (success/fail)
  • User Settings UI:
    • Enter and save Profile ID and API Key (stored with chrome.storage)
  • History:
    • List of recently bypassed domains (persistent, stored safely)
  • Basic Error Handling:
    • User-friendly messages for API or network errors

2. Suggested Advanced Features

  • Undo/Remove domain rule from history
  • Auto-detect enforced profile
  • Search-in-history
  • Multi-profile support (user selects profile)
  • Custom notification sounds
  • Domain status check (is it already bypassed/blocked?)
  • Quick access context menu: Right-click to bypass any link or domain
  • Dark mode/light mode
  • Analytics panel: Show stats on usage/unblocks

3. Code Structure Overview

  • manifest.json
  • /icons/
  • popup.html (main UI)
  • popup.js (logic/UI)
  • settings.html (settings page)
  • settings.js
  • background.js (for notifications/rules management)
  • Optionally: history.html for detailed results

4. Security Improvements

  • Do NOT hardcode API keys or profile IDs.
    Save them with chrome.storage.sync
  • Background scripts should handle API calls so secrets aren't exposed in the popup.
  • Validate user inputs before saving.

5. Example: Settings UI for API Key/Profile ID

settings.html

<!DOCTYPE html>
<html>
  <body>
    <label>API Token: <input id="api-token" type="password"/></label><br>
    <label>Profile ID: <input id="profile-id" /></label><br>
    <button id="save">Save</button>
    <script src="settings.js"></script>
  </body>
</html>

settings.js

document.getElementById('save').onclick = () => {
  const apiToken = document.getElementById('api-token').value
  const profileId = document.getElementById('profile-id').value
  chrome.storage.sync.set({ apiToken, profileId }, () => {
    alert('Settings saved!') // Can be improved with nicer UI
  })
}

// You can also add logic to load values when opening the page


6. Example: Secure API Call From Popup

popup.js

document.getElementById('bypass').onclick = function() {
  chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
    const url = new URL(tabs[0].url)
    const currentDomain = url.hostname

    chrome.storage.sync.get(['apiToken', 'profileId'], ({apiToken, profileId}) => {
      if (!apiToken || !profileId) {
        alert('Please set your API Token and Profile ID in settings.')
        return
      }

      fetch(`https://api.controld.com/profiles/${profileId}/rules`, {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${apiToken}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          do: 1,
          status: 1,
          'hostnames[]': [currentDomain]
        })
      })
      .then(res => res.json())
      .then(data => {
        // Record to history
        chrome.storage.local.get({history: []}, ({history}) => {
          history.unshift({domain: currentDomain, time: new Date().toISOString()});
          chrome.storage.local.set({history: history.slice(0, 50)});
        });

        chrome.notifications.create({
          type: 'basic',
          iconUrl: 'icon.png',
          title: 'Control D',
          message: `Bypassed: ${currentDomain}`
        })
      })
      .catch(err => {
        chrome.notifications.create({
          type: 'basic',
          iconUrl: 'icon.png',
          title: 'Control D',
          message: 'Error: Could not bypass domain.'
        })
      })
    })
  })
}


Let me know if you want a starter template, advice on history UI, or any specific feature details!

1:30 AM

You

I want to make this a complete suite of Control D's features into the chrome extension instead of just a bypass tool. I'll work on the UI, but i need you to list all the features in a markdown table. You could split the tables up into specific types of features. And obviously the Settings\Options page will need to be very granular. Maybe have an Advanced Settings... option for experienced users.

1:36 AM

Barry

Absolutely! Here's a detailed breakdown of Control D features you could bring into your Chrome extension, organized in markdown tables by category. This should help you scope out a full-feature extension suite, including both basic and advanced capabilities.


🚦 Core DNS Controls

Feature Description Settings Scope
Apply Profile Assign a profile to the extension/endpoint Basic
Bypass Domain Instantly unblock/bypass a domain Basic
Block Domain Instantly block a domain Basic
Switch Profiles Change active profile from UI Basic
View Active Profile Show current enforced profile Basic
Pause Filtering Temporarily disable all filtering Basic/Advanced

🔍 Rule and Filter Management

Feature Description Settings Scope
Add Custom Rule Create custom block/bypass/spoof/redirect rules Basic
Edit/Delete Rule Manage (edit, remove) custom rules Basic
View Rule List Show all custom rules in enforced profile Basic
Rule Folders Organize rules by groups/folders Advanced
Filter Management Enable/disable native/3rd party filters Basic/Advanced
Service Rules Bypass/block/redirect popular services e.g. YouTube Basic/Advanced

📊 Analytics & Activity

Feature Description Settings Scope
Activity Log View DNS query history Basic
Unblock/Block History See list of past bypassed/blocked domains Basic
Per-Domain Stats Show stats for specific domain (queries, blocks) Advanced
Show Most-Blocked Domains Display most frequently blocked domains Advanced
Graphs/Dashboards Simple visualization of analytics data Advanced

⚙️ Settings & Options

Feature Description Settings Scope
API Key/Profile ID Settings Input & validation, stored securely Basic
Appearance/Theme Light/Dark/Auto mode Basic
Notification Control Enable/disable which events trigger notices Basic/Advanced
Rule History Retention Set User sets retention time/size for history Advanced
Export/Import Settings Easily backup/restore user config Advanced
Advanced Settings Toggle Hide/unhide advanced options Basic
Granular Profile Option Controls Toggle or adjust: Advanced
--- DNSSEC, AI Malware, etc. Direct control of individual profile options Advanced

🛠️ Advanced Controls

Feature Description Settings Scope
Custom Upstream DoH/DoT Server Allow setting a custom upstream DNS server Advanced
IP Learning & Restriction Mgmt Show & manage authorized IPs if needed Advanced
Multi-device Endpoint Mgmt List & control browser endpoints/devices Advanced
Proxy/Redirect Rule Creation Add/modify REDIRECT and SPOOF rules via UI Advanced
Folder-based Bulk Rule Ops Actions on rule folders (pause, delete, clone) Advanced

🧰 Miscellaneous/Convenience

Feature Description Settings Scope
Quick Toggle in Extension Popup or context menu for fast actions Basic
Context Menu Integration Right-click to block/bypass domain/link Basic
Help & Docs Links Quick access to Control D support/docs Basic
Feedback Feature Submit feature/bug reports from UI Basic

Settings Page Recommendations:

  • Basic tab: API Credentials, theme, notifications, quick toggles.

  • History tab: Activity log, unblock/block history, export.

  • Advanced tab: Rule folders, filter controls, profile options, bulk operations.

  • Help/About: Support links, version info.

Let me know if you want specific option breakdowns for any one category, or sample UI layouts!

1:36 AM

You

I want specific option breakdowns for each category, and a couple of sample UI layouts!

1:37 AM

Barry

Absolutely---here are detailed option breakdowns for each feature category, and two sample UI layout sketches in markdown to help you visualize the structure.


🚦 Core DNS Controls: Option Breakdown

Option Description Default/Note
Current Profile Show & switch between profiles Dropdown/List
Switch Profile Change enforced profile Button/Dropdown
Pause Filtering Temporarily disable/freeze all DNS rules Toggle/Timer
Bypass This Domain 1-click bypass for active/current domain Button
Block This Domain 1-click block for active/current domain Button
View Last Action Status See result of last block/bypass Inline/Toast message

🔍 Rule and Filter Management: Option Breakdown

Option Description Default/Note
List All Custom Rules View all user block/bypass/redirect rules Table/list view
Add Rule Add block, bypass, redirect, or spoof rule Modal/input form
Edit/Delete Rule Edit/delete any rule from list Inline control
Organize by Folders Enable organizing custom rules into folders/groups Advanced tab
Add/Edit Rule Folder Create, rename, move, or delete rule folders Nested list, context menu
Enable/Disable Native Filters Toggle categories (ads, malware, adult, etc.) Switches
Native Filter Mode Choose modes (strict/relaxed) for filters if supported Dropdown/switch
Enable/Disable 3rd Party Filters Toggle 3rd party list subscriptions Advanced
Service Rules Toggle service rules (e.g., unblock Netflix, block Facebook) Dropdown/checkbox

📊 Analytics & Activity: Option Breakdown

Option Description Scope/Type
DNS Query Log Show individual queries (domain, time, action) Table/paginated
Unblock/Block History Show last N bypassed or blocked domains List
Per-Domain Stats Block % vs. Allow %, query count, etc. Inline graph/stats
Top Blocked/Bannered Domains List most affected domains with quick actions Leaderboard/List
Download/Export Analytics Export log/history to CSV or JSON Button

⚙️ Settings & Options: Option Breakdown

Option Description Default/Note
API Token Enter and save (mask input in UI) Required
Profile ID Enter and save enforced profile Required
Theme Light, Dark, System Visual setting
Notification Control Per-action toggles (bypass, block, error) Checkboxes
History Retention How many actions/logs to keep Number field/dropdown
Export/Import Settings Download/upload config backup Buttons
Show Advanced Settings Toggle to unhide advanced options Switch
Per-feature/option toggles DNSSEC, malware filter, IPv6 spoof, etc. Switches/checkboxes
About/Version Show extension version and API user Inline/readonly

🛠️ Advanced Controls: Option Breakdown

Option Description Default/Notes
Manage Upstream DoH/DoT Server Show/modify browser upstream DNS Advanced popup/modal
Proxy/Redirect Rule Management Add/edit REDIRECT/SPOOF rules with targets Advanced
IP Learning/Restriction Management List authorized IPs for resolver, edit/delete Advanced
Multi-Endpoint/Device Control Switch browser between multiple endpoints Advanced
Bulk Operations on Rules/Folders Enable/disable/delete all rules in folder Adv. context menu

🧰 Miscellaneous/Convenience: Option Breakdown

Option Description Default/Note
Quick Popup Toggle Core actions (block, bypass, profile) Shortcut/icons
Context Menu Right-click menu block/bypass on page/link Requires permissions
Feedback/Support Link Email or web link to submit feature requests Footer/button
Tips/Info Tooltips Hover text for complex options Info icons/tooltips
Docs/Help Links Direct links to docs Inline/help dialog

🎨 Sample UI Layouts

Layout 1: Tabbed Popup Extension

 ----------------------
|  [ Profile ▼   ⏸️ ]    |
|----------------------|
| [Bypass] [Block]     |
|----------------------|
| [Rules]   | [History] | [Analytics] | [Settings] |
|----------------------------------------------|
| (Default: show rules list, toggle filters)   |
|    - Custom Rules Table/List                 |
|    - Native Filter Controls                  |
|    - Quick Add Rule                         |
|----------------------------------------------|
|    [ Open Settings | Advanced ▼ ]            |
 ----------------------

Settings Tab Example

  • API Key (mask input), Profile ID

  • Theme selection

  • Notification toggles

  • [Advanced ▼] reveals: filter options, retention, upstream config


Layout 2: Collapsible Sections (Single-page Popup)

 ------------------------------
|  [Control D Extension]        |
|------------------------------|
| → Active Profile: [Dropdown]  |
| → [Pause Filtering ⏸️]         |
|------------------------------|
| ▼ Actions                     |
|   [Bypass Domain]  [Block Domain]  |
|------------------------------|
| ▼ Recent Activity             |
|   [table: domain, action, time]   |
|------------------------------|
| ▼ Rules & Filters             |
|   [Add/Edit Rule] [Filters]      |
|------------------------------|
| ▼ Settings & Advanced         |
|   [API Key], [Profile ID], [Theme], etc.  |
|   [Show Advanced ⚙️]               |
|------------------------------|
| [Help] [Docs] [Feedback]      |
 ------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment