Skip to content

(extension) improve extension debug page [DA-405]#330

Merged
Mr-Quin merged 4 commits intomasterfrom
DA-405_Better-debugging-page
Mar 18, 2026
Merged

(extension) improve extension debug page [DA-405]#330
Mr-Quin merged 4 commits intomasterfrom
DA-405_Better-debugging-page

Conversation

@Mr-Quin
Copy link
Owner

@Mr-Quin Mr-Quin commented Mar 18, 2026

No description provided.

@Mr-Quin Mr-Quin self-assigned this Mar 18, 2026
Copilot AI review requested due to automatic review settings March 18, 2026 03:57
@Mr-Quin
Copy link
Owner Author

Mr-Quin commented Mar 18, 2026

Task linked: DA-405 Better debugging page

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 upgrades the debugging capabilities of the extension by introducing a new interactive 'Playground' for testing different web content types and a refactored, more informative internal debug panel. These changes aim to streamline the development and troubleshooting process, providing developers with better tools to understand and interact with the extension's state and behavior across various scenarios.

Highlights

  • Enhanced Debugging Experience: The previous basic iframe debug page has been replaced with a comprehensive 'Playground' page, offering interactive panels for same-origin iframes, cross-origin iframes, and native video testing. This significantly improves the ability to test and debug various media scenarios within the extension.
  • Refactored Extension Debug Panel: The internal debug panel accessible via the extension's floating UI has been completely overhauled. It now features a tabbed interface to display detailed information about detected frames, the extension's internal state, and current extension options, making debugging more organized and informative.
  • New Debug RPC Command: A new RPC command, debugSkipButton, has been introduced, allowing developers to programmatically trigger a skip button on a video. This is a valuable tool for testing skip functionality without needing specific content.
  • Enriched Video Change Event Data: The videoChange event now includes more detailed information about the video element, specifically its src, width, and height. This provides more context for debugging and potential future features that rely on video metadata.
  • Improved File Tree Management: The local player's file tree now correctly updates its view after expand and collapse operations, ensuring the UI accurately reflects the tree's state.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 18, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
danmaku-anywhere-web 92c3a4e Commit Preview URL

Branch Preview URL
Mar 18 2026, 04:36 AM

Copy link
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 "Playground" page for debugging, replacing the old iframe debug page. This is a significant improvement, offering a more powerful and flexible environment for testing different scenarios like same-origin iframes, cross-origin iframes, and native videos. The code is well-structured, with new reusable components for panels. The extension's debugging capabilities are also enhanced by adding more information to events and providing new debug commands. The refactoring in file-tree.ts to use immutable patterns is a great improvement for stability and predictability. I've found one issue with signal binding in the new playground page that should be addressed.

Comment on lines +38 to +44
<p-select
[options]="panelTypeOptions"
optionLabel="label"
optionValue="value"
[(ngModel)]="$selectedType"
size="small"
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The two-way binding [(ngModel)] does not work directly with Angular signals. You should use separate property binding [ngModel] to read the signal's value and event binding (ngModelChange) to update it.

Suggested change
<p-select
[options]="panelTypeOptions"
optionLabel="label"
optionValue="value"
[(ngModel)]="$selectedType"
size="small"
/>
<p-select
[options]="panelTypeOptions"
optionLabel="label"
optionValue="value"
[ngModel]="$selectedType()"
(ngModelChange)="$selectedType.set($event)"
size="small"
/>

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves developer/debug tooling across the browser extension and the web app by expanding the extension’s debug page (frames/state/options + frame commands) and replacing the web app’s iframe debug route with a more flexible “Playground” for embedding same-/cross-origin iframes and native video.

Changes:

  • Extension: enhance Debug page UI (tabs + copy-to-clipboard snapshot), show detected frames/video info, and add a debug RPC to trigger the skip button.
  • Controller/player: enrich relay:event:videoChange payload with video metadata and store it per frame.
  • Web app: replace /debug/iframe with /debug/playground, and adjust local file-tree expand/collapse behavior to trigger UI updates.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/danmaku-anywhere/src/content/player/videoSkip/VideoSkip.service.ts Adds a debug method to force-show the skip button.
packages/danmaku-anywhere/src/content/player/PlayerCommandHandler.service.ts Sends video metadata on video changes; adds debug RPC command handler.
packages/danmaku-anywhere/src/content/controller/ui/router/routes.tsx Updates DebugPage import to the new debug module path.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/debug/index.ts Adds a barrel export for the new DebugPage location.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/debug/components/StatePanel.tsx New panel to render controller state in a readable form.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/debug/components/OptionsPanel.tsx New panel to render extension options JSON.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/debug/components/FramesPanel.tsx New panel listing frames, video info, and debug actions.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/debug/components/DebugShared.tsx Shared UI helpers for the debug panels.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/debug/DebugPage.tsx New tabbed Debug page with copy-state toolbar action.
packages/danmaku-anywhere/src/content/controller/ui/floatingPanel/pages/DebugPage.tsx Removes the previous monolithic DebugPage implementation.
packages/danmaku-anywhere/src/content/controller/store/store.ts Extends frame state with videoInfo; adds debugShowSkipButton action.
packages/danmaku-anywhere/src/content/controller/danmaku/frame/FrameManager.tsx Stores video metadata per frame and handles updated videoChange payload.
packages/danmaku-anywhere/src/common/standalone/standaloneHandlers.ts Adds a no-op handler for the new debug skip-button command in standalone mode.
packages/danmaku-anywhere/src/common/rpcClient/background/types.ts Updates RPC types: new debug command + videoChange event payload type.
packages/danmaku-anywhere/src/background/rpc/RpcManager.ts Pass-through wiring for the new debug skip-button command.
app/web/src/app/layout/components/sidebar/sidebar.component.ts Renames debug nav entry from iframe debug to Playground.
app/web/src/app/features/local/util/file-tree.ts Changes expand/collapse to clone tree nodes and rebuild indexes.
app/web/src/app/features/local/services/local-player.service.ts Forces UI refresh after expand/collapse via bumpTree().
app/web/src/app/features/debug/playground/playground-page.component.ts New Playground page supporting multiple debug panels.
app/web/src/app/features/debug/playground/panels/same-origin-iframe-panel.component.ts Adds same-origin iframe debug panel.
app/web/src/app/features/debug/playground/panels/native-video-panel.component.ts Adds native video debug panel with selectable sample URLs.
app/web/src/app/features/debug/playground/panels/debug-panel.component.ts Shared panel chrome (title + remove button + content slots).
app/web/src/app/features/debug/playground/panels/cross-origin-iframe-panel.component.ts Adds cross-origin iframe panel with presets and editable URL.
app/web/src/app/features/debug/iframe-debug-page.component.ts Removes the old iframe debug page.
app/web/src/app/app.routes.ts Replaces /debug/iframe route with /debug/playground.
Comments suppressed due to low confidence (1)

packages/danmaku-anywhere/src/content/controller/danmaku/frame/FrameManager.tsx:72

  • When a video is removed you set hasVideo: false but leave videoInfo intact. The debug Frames panel renders frame.videoInfo even when hasVideo is false, so it can display stale src/size after a removal. Clear videoInfo in the videoRemovedHandler update (or conditionally render it based on hasVideo).
  const videoRemovedHandler = useEventCallback((frameId: number) => {
    if (activeFrame?.frameId === frameId) {
      setVideoId(undefined)
      if (activeFrame.mounted) {
        unmountDanmaku.mutate(frameId)
      }
    }
    updateFrame(frameId, { hasVideo: false, mounted: false })
  })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +100 to 112
function cloneWithExpanded(nodes: TreeNode[], expanded: boolean): TreeNode[] {
return nodes.map((n) => {
if (n.type === 'directory' || n.type === 'removableDirectory') {
n.expanded = expanded
if (n.children)
n.children.forEach((c) => {
setExpanded([c], expanded)
})
return {
...n,
expanded,
children: n.children
? cloneWithExpanded(n.children, expanded)
: undefined,
}
}
return { ...n }
})
Comment on lines +26 to +45
const handleCopyState = () => {
// biome-ignore lint/suspicious/noExplicitAny: debug page serialization
const snapshot = produce(state, (draft: any) => {
delete draft.danmaku.comments
if (draft.danmaku.episodes) {
for (const item of draft.danmaku.episodes) {
if ('comments' in item) {
delete item.comments
}
}
}
draft.frame.allFrames = Object.fromEntries(
draft.frame.allFrames.entries()
)
draft.options = options
})
void navigator.clipboard.writeText(JSON.stringify(snapshot, null, 2))
setCopied(true)
setTimeout(() => setCopied(false), 1500)
}
Comment on lines +75 to +78
protected readonly $sanitizedUrl = computed(() =>
this.domSanitizer.bypassSecurityTrustResourceUrl(this.$url())
)

Comment on lines +67 to +75
debugShowSkipButton() {
this.logger.debug('Showing debug skip button')
const time = this.currentVideo?.currentTime ?? 120
const target = new SkipTarget({
startTime: time,
endTime: time + 90,
})
this.showSkipButton(target)
}
@Mr-Quin Mr-Quin merged commit 9f7eb9e into master Mar 18, 2026
12 checks passed
@Mr-Quin Mr-Quin deleted the DA-405_Better-debugging-page branch March 18, 2026 04:37
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