-
Notifications
You must be signed in to change notification settings - Fork 528
feat: add ipfs-check tab to diagnostics screen #2424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lidel
merged 8 commits into
feat/diagnostics-screen
from
feat/diagnostics-screen-check-tab
Sep 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
134cc53
feat: add ipfs-check tab to diagnostics screen
SgtPooki 89bc732
chore: use relative import
SgtPooki 1d7737f
fix: useDebouncedCallback doesnt lose function call on delay change
SgtPooki 6add454
feat: add retrieval check tab with ipfs-check iframe
lidel 3576491
security: add iframe sandboxing
lidel 2530cfb
feat: add loading state and ARIA attributes
lidel 8e8b475
feat: set iframe initial height to 80vh
lidel 27aeb14
feat: make ipfs-check service URL configurable
lidel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import type React from 'react' | ||
|
|
||
| /** | ||
| * src/bundles/routes.js creates a RouteBundle from redux-bundler that provides some objects that are not typed. | ||
| */ | ||
|
|
||
| /** | ||
| * The type for the object provided by `selectRouteInfo` selector. | ||
| * | ||
| * These types are not 100% accurate and only filled out as accurately as possible as needed. | ||
| */ | ||
| export interface RouteInfo { | ||
| /** | ||
| * The value of the currently matched pattern from src/bundles/routes.js | ||
| */ | ||
| page: React.ReactNode | ||
|
|
||
| params: { | ||
| // if you are on #/diagnostics/logs, this will be equal to '/logs' | ||
| path: string | ||
| } | ||
|
|
||
| /** | ||
| * This will match whatever key is set in src/bundles/routes.js for the page that is currently active. | ||
| * For the diagnostics page, this will be equal to '/diagnostics*' | ||
| */ | ||
| pattern: string | ||
|
|
||
| /** | ||
| * The hash of the url, without the hash symbol. | ||
| */ | ||
| url: string | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import React, { useRef, useEffect } from 'react' | ||
| import { useDebouncedCallback } from '../../lib/hooks/use-debounced-callback' | ||
|
|
||
| const CheckScreen: React.FC = () => { | ||
| const ref = useRef<HTMLIFrameElement>(null) | ||
|
|
||
| const requestSize = useDebouncedCallback(() => { | ||
| const iframe = ref.current | ||
| if (!iframe) return | ||
| ref.current?.contentWindow?.postMessage({ type: 'iframe-size:request' }, '*') | ||
| }, 100) | ||
|
|
||
| useEffect(() => { | ||
| const iframe = ref.current | ||
| if (!iframe) return | ||
|
|
||
| const onMsg = (e: MessageEvent<any>) => { | ||
| if (e.data?.type !== 'iframe-size:report') return | ||
| iframe.style.height = `${e.data.height}px` | ||
| } | ||
| const onLoad = () => requestSize() | ||
|
|
||
| window.addEventListener('message', onMsg) | ||
| window.addEventListener('resize', requestSize) | ||
| iframe.addEventListener('load', onLoad) | ||
|
|
||
| // intial size request since the iframe ref is available. | ||
| requestSize() | ||
|
|
||
| return () => { | ||
| window.removeEventListener('message', onMsg) | ||
| window.removeEventListener('resize', requestSize) | ||
| iframe.removeEventListener('load', onLoad) | ||
| } | ||
| }, [requestSize]) | ||
|
|
||
| return ( | ||
| <iframe | ||
| ref={ref} | ||
| className="db bn w-100 overflow-y-hidden overflow-x-hidden" | ||
| title="Check Screen" | ||
| // src="https://check.ipfs.network/" // TODO: uncomment when https://github.com/ipfs/ipfs-check/pull/102 is deployed to check.ipfs.network | ||
|
lidel marked this conversation as resolved.
Outdated
|
||
| src="http://127.0.0.1:3001/" | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| export default CheckScreen | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for selectors created by redux-bundler itself (i.e.
createRouteBundle) i figured this would be a good place to hook into those