Skip to content
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

Reworked webui reader #156

Closed
wants to merge 4 commits into from
Closed

Conversation

matthew73210
Copy link

@matthew73210 matthew73210 commented May 9, 2024

Reworked the webui.log reader. Placed the functions it what seems the right folders. #153 & #138
Couldn't for the life of me get the templating working like settings, just created a work around in logs.html. Pretty much just index.html copied and removed some parts.
Need to work on making it dynamic as it depends on refreshing the browser.
Being a gitnoob i commited my changes to config, can ignore them.

Might need to be carefull about CSS attacks cus the function reads the webui log and posts as is, if someones puts some code in there ? I think code rabbit will flag it up again.

Copy link
Contributor

coderabbitai bot commented May 9, 2024

Walkthrough

The changes made enhance debugging capabilities and improve the user interface for log management. Key updates include enabling debug mode, adjusting RTSP settings for better network streaming, adding log file reading functionality, creating a new endpoint for log display, optimizing routes, and enhancing the log viewing page.

Changes

Files Change Summary
.gitignore,
internal/conf/config.yaml
Added conf/config.yaml to ignore list. Enabled debug mode; updated RTSP settings.
internal/.../fileserver.go Imported new libraries; added file reading function.
internal/.../handlers.go,
internal/.../routes.go
Added new handler for log file display. Updated routing, optimized endpoint registrations.
views/logs.html Enhanced HTML with new structure and JavaScript for log display.

🐰✨
In the burrows of code, deep and wide,
A rabbit hops with a joyful stride.
Logs in place, and debugs alight,
Through tunnels of data, into the night.
Celebrate the craft, with every byte! 🌟
🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Out of diff range and nitpick comments (2)
views/logs.html (2)

33-33: Consider providing a more informative error message than "It didn't work" to enhance user understanding in case logs cannot be displayed.


47-49: Consider using a more universally understood method for date formatting or add a comment explaining why the 'sv' locale is used here for toLocaleString.

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6471084 and 0abd886.
Files selected for processing (6)
  • .gitignore (1 hunks)
  • internal/conf/config.yaml (2 hunks)
  • internal/httpcontroller/fileserver.go (2 hunks)
  • internal/httpcontroller/handlers.go (1 hunks)
  • internal/httpcontroller/routes.go (2 hunks)
  • views/logs.html (1 hunks)
Files skipped from review due to trivial changes (2)
  • .gitignore
  • internal/conf/config.yaml
Additional comments not posted (3)
internal/httpcontroller/fileserver.go (1)

Line range hint 10-37: The custom file server setup is correctly implemented and effectively uses Echo's capabilities to serve files with appropriate MIME types.

internal/httpcontroller/routes.go (1)

69-69: The addition of the /logs route is correctly implemented and aligns with the PR's objectives to enhance log reading functionality.

internal/httpcontroller/handlers.go (1)

391-405: The implementation of getLogsHandler is robust, correctly handling the reading of log files and rendering the logs view appropriately.

// It returns an error if there is an issue opening or reading the file.
func readWebLog() (string, error) {
// Open the web.log file
file, err := os.Open("webui.log")
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider making the file path for webui.log configurable to enhance flexibility and maintainability.

@matthew73210
Copy link
Author

The webui doesn't have much going on, but the basis is there to read the other logfile too. Might add two links under logs. Or just paste all logs to webui.log and have a single one?

.gitignore Outdated
Copy link
Owner

Choose a reason for hiding this comment

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

Please do not include this in in pull request, this is unnecessary change

Copy link
Author

Choose a reason for hiding this comment

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

Sorry my bad.

Removed forgotten parts
removed forgotten modifications
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0abd886 and e0bbb8f.
Files selected for processing (1)
  • internal/conf/config.yaml (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • internal/conf/config.yaml

reverted to base
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e0bbb8f and 71b0de5.
Files selected for processing (1)
  • internal/conf/config.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • internal/conf/config.yaml

Copy link
Author

Choose a reason for hiding this comment

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

Not sure what's going on here.

@tphakala
Copy link
Owner

abdandoning this for now

@tphakala tphakala closed this Oct 13, 2024
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