Skip to content

Element Zapper#74

Merged
0xCUB3 merged 19 commits intomainfrom
zapper
Jul 10, 2025
Merged

Element Zapper#74
0xCUB3 merged 19 commits intomainfrom
zapper

Conversation

@0xCUB3
Copy link
Copy Markdown
Owner

@0xCUB3 0xCUB3 commented Jul 10, 2025

No description provided.

0xCUB3 added 9 commits July 10, 2025 08:29
- Implemented WBlockZapperInjector class to manage the injection of the zapper interface into web pages.
- Added message handling for communication between the main script and the zapper interface.
- Created an iframe to host the zapper UI and handle user interactions for hiding elements.
- Developed CSS and JavaScript for the zapper interface, including element selection, rule saving, and application.
- Integrated localStorage for persistent rule management across sessions.
- Enabled keyboard shortcuts for quick activation of the zapper.
Removed redundant or legacy security entitlements from all .entitlements files, consolidating permissions. Updated project.pbxproj to set sandbox, network, and file access via build settings instead of entitlements, and enabled dead code stripping. Also updated Xcode scheme and workspace files to reflect the latest Xcode version.
Replaces unnecessary MainActor.run calls with direct property access for currentPlatform and filterLists, improving clarity and thread safety. Refactors variable naming for clarity in FilterListUpdater and fixes an actor method call in ConcurrentLogManager. Also updates UI logic to remove unnecessary async/await in ContentView and UpdatePopupView.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @0xCUB3, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the application's content filtering capabilities by introducing an interactive 'Element Zapper' feature. Users can now directly hide specific elements on web pages, and these custom rules are saved per-site for persistent application. The feature is seamlessly integrated into the existing UI and relies on a robust communication architecture between the Safari extension and the web page's content. Additionally, the project's build configurations have been updated for improved performance and compatibility.

Highlights

  • New Feature: Element Zapper: This pull request introduces an interactive 'Element Zapper' tool, allowing users to select and hide unwanted elements directly on web pages. This provides a highly customizable content filtering experience.
  • Persistent Custom Rules: User-defined element hiding rules are now persistently stored for each website, ensuring that unwanted elements remain hidden across browsing sessions without manual re-application.
  • Integrated User Interface: A new 'Element Zapper' button and a 'Zapper Rules' management section have been added to the application's popover, providing a clear and accessible way for users to activate and manage their custom rules.
  • Enhanced Cross-Process Communication: The implementation includes a sophisticated communication bridge between the Safari extension's Swift code, the main content script, and an injected iframe, enabling seamless interaction and data persistence for the zapper functionality.
  • Build System Modernization: Various Xcode project settings, including entitlements and build configurations, have been updated to align with newer Xcode versions, optimize builds (e.g., dead code stripping), and explicitly configure sandbox permissions within the project file.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new 'Element Zapper' feature, allowing users to visually select and hide elements on web pages. The implementation includes UI changes in SwiftUI, view model logic, a Safari extension handler, and significant JavaScript for the in-page tool. While the feature is comprehensive, the review identified several critical and high-severity issues. These include a potential crash in the UI due to unsafe collection handling, a critical concurrency bug in the logging mechanism, insecure use of localStorage for storing rules, and significant maintainability problems due to large blocks of code being embedded as strings. Several medium-severity issues related to performance, modern API usage, and code cleanliness were also noted.

0xCUB3 and others added 9 commits July 10, 2025 11:21
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@0xCUB3
Copy link
Copy Markdown
Owner Author

0xCUB3 commented Jul 10, 2025

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the "Element Zapper" feature. The Swift-side changes, especially the refactoring to use modern concurrency with async/await, are well done.

However, the JavaScript implementation of the zapper has some architectural issues. There appear to be multiple, conflicting implementations of the zapper logic across different files (element-zapper.js, element-zapper-complete.js, and a large embedded string in script.js). This makes the code confusing and hard to maintain.

My main concerns are:

  • The embedding of a very large JavaScript class as a string literal in script.js.
  • The presence of extensive debugging code in script.js that should be conditionally compiled.
  • The use of the deprecated synchronize() method for UserDefaults.

I recommend unifying the zapper implementation into a single, clean approach and addressing the other points to improve code quality and maintainability.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@0xCUB3 0xCUB3 merged commit 643953d into main Jul 10, 2025
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.

1 participant