Skip to content

Fix Scramjet proxy, navigation buttons, and optimize service worker loading - #51

Draft
sriail with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-scramjet-functionality
Draft

Fix Scramjet proxy, navigation buttons, and optimize service worker loading#51
sriail with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-scramjet-functionality

Conversation

Copilot AI commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

Scramjet proxy wasn't working because settings were being reset to defaults on every page load. Navigation buttons (forward/back/reload) weren't functioning on proxied content. Service worker was slow due to redundant config loading on every fetch.

Changes

Settings Persistence (src/utils/settings.ts)

  • proxy(), searchEngine(), adBlock() now only set defaults when no value exists in localStorage
  • Previously always overwrote user preferences with defaults when called without arguments
// Before: Always overwrites
proxy(prox?: "uv" | "sj") {
    this.#storageManager.setVal("proxy", prox || "uv");
}

// After: Preserves existing value
proxy(prox?: "uv" | "sj") {
    if (prox) {
        this.#storageManager.setVal("proxy", prox);
    } else if (!this.#storageManager.getVal("proxy")) {
        this.#storageManager.setVal("proxy", "uv");
    }
}

Navigation Buttons (src/pages/index.astro)

  • Use flag-based init to prevent duplicate listeners
  • Get fresh contentWindow reference on each click (was stale)
  • Added fallback reload via iframe src reset for cross-origin scenarios

Service Worker Performance (public/sw.js)

  • Cache Scramjet config loading with promise pattern (was loading on every fetch)
  • Pre-load config during install/activate events
  • Only check CAPTCHA/heavy-cookie handling for proxied requests
let sjConfigLoaded = false;
let sjConfigPromise = null;

async function ensureSjConfigLoaded() {
    if (sjConfigLoaded) return Promise.resolve();
    if (sjConfigPromise) return sjConfigPromise;
    sjConfigPromise = sj.loadConfig().then(() => { sjConfigLoaded = true; });
    return sjConfigPromise;
}

Scramjet Fallback (src/utils/proxy.ts)

  • Added null check for ScramjetController, falls back to UV if not ready
  • Added default search engine template if none provided

Scramjet working - URL shows /~/scramjet/ prefix

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /usr/local/bin/node node server/index.js (dns block)
  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/Radius/Radius/node_modules/.bin/astro build (dns block)
  • www.google.com
    • Triggering command: /usr/local/bin/node node server/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

fix scramjet not working, maek the forward, back and reload arrows work on the proxied content, and make the proxy WAY faster, as loading takes a vary long time


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@codesandbox

codesandbox Bot commented Nov 28, 2025

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copilot AI and others added 3 commits November 28, 2025 16:33
Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
…ition

Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix scramjet functionality for navigation and speed Fix Scramjet proxy, navigation buttons, and optimize service worker loading Nov 28, 2025
Copilot AI requested a review from sriail November 28, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants