Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DudeAint/brownbear

Open more actions menu

Repository files navigation

BrownBear — Userscripts & Power Browser for iOS

The first iOS browser to bring ScriptCat-class power to userscripts — background execution, @crontab scheduling, and a sandboxed GM API — and run real Chrome Web Store extensions, all wrapped in a Chromium-inspired interface.


Platform Swift WebKit License

Conventional Commits Code Style: SwiftLint PRs Welcome Status


Features · Why BrownBear · How It Compares · Architecture · Contributing


🐻 Why BrownBear

iOS has never had a true power userscript runtime. Safari extensions like Userscripts and Stay brought Greasemonkey-style injection to mobile, and Gear Browser proved a dedicated userscript browser can ship on the App Store. But none of them deliver the one thing ScriptCat gives desktop users:

Scripts that keep working in the background — on a schedule — without a tab open.

BrownBear is that missing piece. A standalone browser that pairs a clean, Chromium-style interface with a sandboxed engine that runs @background userscripts driven by @crontab, all within the constraints Apple's WebKit and background-execution model allow — honestly and transparently, with every scheduled job visible and stoppable.


✨ Features

🌐 Chromium-style Browser

  • Multi-tab architecture on WKWebView
  • Square tab grid with live snapshots
  • Custom rounded omnibox — URL/search detection, TLS indicator
  • Quick-search bangs!yt cats, swift docs !gh jump straight to YouTube, GitHub, Wikipedia, …
  • Browser proxy (iOS 17+) — one HTTP/HTTPS/SOCKS5 proxy for all tabs; paste any format, test the exit IP, rotate it, or pick a free proxy by country
  • Full back / forward / refresh / stop
  • Precise lifecycle via WKNavigationDelegate

📜 Userscript Engine

  • Tampermonkey / Greasemonkey / Violentmonkey-compatible headers
  • @name · @match · @include · @exclude · @run-at · @grant · @connect · @crontab
  • Glob → regex URL matcher (WebKit-tuned)
  • Inject at document-start / end / idle

🧪 Sandbox & GM API

  • Hostile-page-resistant runtime (clean refs captured at injection)
  • GM_xmlhttpRequest via native URLSession (CORS-free, @connect-gated)
  • GM_setValue / getValue — per-script namespaced store
  • GM_addStyle, GM_setClipboard, GM_openInTab, GM_log

⏰ Background & @crontab

  • BGTaskScheduler (app-refresh + processing)
  • Persisted schedule store (Core Data)
  • 5-field crontab evaluator + @every
  • Headless JSContext runs scripts while the app is closed

📊 Manager Dashboard & Editor

A polished SwiftUI dashboard to install, toggle, and inspect scripts · live execution logs · background-task monitor · an in-app code editor with line numbers, JS syntax highlighting, and save-time metadata validation.

🧩 Browser Extensions (Chrome · Edge · Firefox)

Install and run real browser extensions (MV2 and MV3) from the Chrome Web Store, Edge Add-ons, or Firefox AMO. Browse any of the three stores in-app and their install button becomes Add to BrownBear (it survives the store's single-page navigation), or use a curated one-tap recommended list, paste a link, or open a .crx/.zip/.xpi. A broad native-backed chrome.* / browser.* surface: service workers (classic and ES-module, e.g. uBlock Origin Lite) in a headless JSContext, content scripts, popup / options / side-panel pages over a chrome-extension:// scheme, storage · tabs · windows · webNavigation · scripting · cookies · notifications · contextMenus · identity · alarms · idle · downloads · sidePanel · i18n · runtime messaging + long-lived ports, declarativeNetRequest ad-blocking via WKContentRuleList plus webRequest frame-navigation blocking, an extension New Tab page (chrome_url_overrides), a polyfilled IndexedDB, and web platform APIs JavaScriptCore lacks (fetch/Headers/Request/Response/AbortController/FormData/Blob/File/XMLHttpRequest/ Web Crypto/structuredClone). Userscript-manager extensions (e.g. ScriptCat) are first-class — a .user.js link can be handed off to them. Constrained, partial, and unsupported APIs are documented honestly.


🆚 How It Compares

Capability 🐻 BrownBear Gear Browser Userscripts (Safari) Stay (Safari) ScriptCat (desktop)
Standalone iOS browser ❌ (extension) ❌ (extension) ❌ (desktop)
Tampermonkey-style metadata
GM_xmlhttpRequest (CORS-free)
Per-script value store
Background scripts (no tab) ⚠️ limited
@crontab scheduling
Built-in code editor
Chrome Web Store extensions ✅ MV2/MV3
Open source ✅ MIT ✅ GPL ✅ GPL

⚠️ iOS background execution is budgeted and best-effort by design — @crontab is a target schedule, not a hard real-time guarantee. BrownBear surfaces this honestly in the UI.


🧱 Architecture

BrownBear is one app composed of four runtime planes — a foreground browser, a pure-logic engine, a security bridge, and a background scheduler:

            ┌────────────────────────── Foreground ──────────────────────────┐
 user ──▶ Omnibox ──▶ BrowserVC ──▶ WKWebView(tab) ──▶ injected runtime ──┐   │
            ▲              │                                               │   │
         TabGrid ◀─────────┘                                          GM calls │
            └─────────────────────── Bridge (WKScriptMessageHandler) ─────┘   │
                                            │                                  │
   Engine: ScriptMetadata · URLMatcher · InjectionPlanner  ◀── decides injection
                                            │                                  │
   Native GM services: Network(URLSession) · GMValueStore · Clipboard · Tabs   │
                                            │                                  │
            ┌──────────────────────── Background ─────────────────────────────┘
            BGTaskScheduler ──▶ CrontabEvaluator ──▶ headless JSContext ──▶ Logs
                                            │
   Storage: Core Data (Script, Schedule, LogEntry) + UserDefaults (GM values, namespaced)

📐 Full technical blueprint: ARCHITECTURE.md


🚀 Project Status

🚧 Pre-alpha — actively being built. All six modules have landed — the Chromium-style browser, the userscript engine + sandbox, the @crontab background runner, the dashboard/editor, and the Chrome Web Store extension runtime (Module 6) — and the focus now is real-world hardening against shipping extensions (ScriptCat, uBlock Origin Lite, Violentmonkey, Grammarly, …). The engineering bar is App-Store-shippable code: no stubs, no mocks, no truncation (see CLAUDE.md and AGENTS.md). Where WebKit's extension-less model forces a limit, we degrade honestly and document it.


🛠️ Getting Started

Requirements: Xcode 15+ · iOS/iPadOS 16.4+ deployment target · an Apple Developer account for on-device background-task testing.

Recommended: let GitHub Actions build it. CI on free macOS runners is the canonical build path — open a PR and it's built + tested automatically. To build locally, the Xcode project is generated from project.yml with XcodeGen:

git clone https://github.com/DudeAint/brownbear.git
cd brownbear
brew install xcodegen          # one-time
xcodegen generate              # creates BrownBear.xcodeproj from project.yml
open BrownBear.xcodeproj

Full instructions (CI, local, tests, lint): docs/BUILDING.md.

Reference repositories are documented in References/REFERENCES.md. We study their architecture; we never vendor their (GPL/AGPL) source.


🤝 Contributing

We use Conventional Commits, feature branches, and green-main discipline. AI agents working in this repo must follow CLAUDE.md and AGENTS.md. Start with CONTRIBUTING.md.

🔒 Security

This app executes untrusted JavaScript. Found a vulnerability? Follow the responsible-disclosure process in SECURITY.md — please don't open a public issue.


💛 Contributors

Every PR, script, and bug report makes BrownBear better. Thank you.

BrownBear contributors

Avatar wall auto-generated by contrib.rocks — new contributors appear here after their first merged PR.

⭐ Star History

If BrownBear is useful to you, a star helps others find it.

Star History Chart

📄 License

MIT © BrownBear contributors. BrownBear is an independent implementation; it learns architectural patterns from the projects in References/REFERENCES.md but contains no copied source from GPL/AGPL-licensed projects.

🙏 Acknowledgements

Inspired by ScriptCat · Userscripts · Stay · Gear Browser · and the iOS layer of Chromium.


Built with 🐻 and an intolerance for stubbed code.

About

An iOS power browser that runs real Chrome & Firefox extensions and userscripts — a Tampermonkey/ScriptCat-class script manager with background @crontab scripts, uBlock-style ad-blocking, a sandboxed GM API, and a clean light/dark UI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.