Skip to content

Conversation

@mrubens
Copy link
Collaborator

@mrubens mrubens commented Apr 11, 2025

Reverts #2494

#2494 (comment)


Important

Reverts HTML generation refactor by removing WebviewHTMLManager and restoring HTML methods in ClineProvider.

  • Revert Refactor:
    • Reverts moving HTML generation to WebviewHTMLManager by removing WebviewHTMLManager.ts.
    • Restores HTML generation methods getHMRHtmlContent() and getHtmlContent() directly in ClineProvider.
  • Imports and Dependencies:
    • Removes import of WebviewHTMLManager from ClineProvider.ts.
    • Adds imports for getNonce and getUri in ClineProvider.ts.
  • Class Changes:
    • Removes webviewHTMLManager property from ClineProvider.
    • Updates resolveWebviewView() to use restored HTML methods in ClineProvider.

This description was created by Ellipsis for d93d7a7. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 11, 2025

⚠️ No Changeset found

Latest commit: d93d7a7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 11, 2025
@mrubens mrubens merged commit ba307f8 into main Apr 11, 2025
15 of 16 checks passed
@mrubens mrubens deleted the revert-2494-bramburn/refactor/clineProvider.ts/002 branch April 11, 2025 21:32
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Apr 11, 2025
// Try to read the port from the file
let localPort = "5173" // Default fallback
try {
const fs = require("fs")
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid mixing import statements with inline require. You already import fs/promises at the top; consider using the imported module to maintain consistency.

// Try to read the port from the file
let localPort = "5173" // Default fallback
try {
const fs = require("fs")
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider replacing the synchronous fs operations (fs.existsSync and fs.readFileSync) with the asynchronous ones from 'fs/promises'. Note that 'fs/promises' is already imported at the top, so using the synchronous API here may block the event loop.

const portFilePath = path.resolve(__dirname, "../.vite-port")

if (fs.existsSync(portFilePath)) {
localPort = fs.readFileSync(portFilePath, "utf8").trim()
Copy link
Contributor

Choose a reason for hiding this comment

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

Validate and sanitize the value read from the .vite-port file before using it in URL and CSP string constructions to avoid potential injection issues.

Suggested change
localPort = fs.readFileSync(portFilePath, "utf8").trim()
localPort = /^[0-9]+$/.test(fs.readFileSync(portFilePath, "utf8").trim()) ? fs.readFileSync(portFilePath, "utf8").trim() : "5173"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants