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

feat(Html2Pdf): add disable web security config #4957

Merged
merged 4 commits into from
Dec 26, 2024
Merged

feat(Html2Pdf): add disable web security config #4957

merged 4 commits into from
Dec 26, 2024

Conversation

ArgoZhang
Copy link
Collaborator

@ArgoZhang ArgoZhang commented Dec 26, 2024

add disable web security config

Summary of the changes (Less than 80 chars)

简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号

Description

fixes #4956

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add support for disabling web security in the HTML to PDF conversion feature.

Bug Fixes:

  • Resolve an issue where PDF exports were missing FontAwesome icons.

Enhancements:

  • Update the styling of PDF exports to include FontAwesome styles.

ArgoZhang and others added 4 commits December 26, 2024 13:14
Co-Authored-By: 王雪飞 <909149916@qq.com>
# Conflicts:
#	src/BootstrapBlazor/BootstrapBlazor.csproj

Co-Authored-By: 王雪飞 <909149916@qq.com>
@bb-auto bb-auto bot added the bug Something isn't working label Dec 26, 2024
Copy link

sourcery-ai bot commented Dec 26, 2024

Reviewer's Guide by Sourcery

This PR adds a configuration option to disable web security in the Html2Pdf component, addressing issue #4956. This is achieved by adding a new parameter to the Html2Pdf component and updating the underlying implementation to use the new parameter. The change also includes updates to the project files and CSS stylesheets.

Sequence diagram for ExportPdfButton click handling with updated styles

sequenceDiagram
    participant User as User
    participant Button as ExportPdfButton
    participant Nav as NavigationManager
    participant Pdf as Html2PdfConverter

    User->>Button: Click Export
    activate Button
    Button->>Nav: Get BaseUri
    Nav-->>Button: Return BaseUri
    Button->>Button: Build style list
    Note over Button: Add FontAwesome CSS
    Note over Button: Add Bootstrap Blazor CSS
    Button->>Button: Add custom StyleTags
    Button->>Pdf: Convert with styles
    Pdf-->>Button: Return PDF
    Button-->>User: Download PDF
    deactivate Button
Loading

Class diagram for ExportPdfButton changes

classDiagram
    class ExportPdfButton {
        -List~string~ styles
        +StyleTags: List~string~
        #Task HandlerClick()
    }
    note for ExportPdfButton "Added FontAwesome CSS to default styles"
Loading

File-Level Changes

Change Details Files
Added disable web security config
  • Added a new parameter to the Html2Pdf component to control web security.
  • Updated the implementation of the Html2Pdf component to use the new parameter.
  • Added new CSS stylesheets for FontAwesome and Bootstrap Blazor bundle to support the updated component.
src/BootstrapBlazor/Components/Button/ExportPdfButton.cs
Updated project files
  • Modified project files to include the updated dependencies and configurations for the Html2Pdf component with the new disable web security feature.
src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
src/BootstrapBlazor/BootstrapBlazor.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#4956 Add support for webfonts (specifically Font Awesome) in PDF exports

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added this to the v9.0.0 milestone Dec 26, 2024
@ArgoZhang ArgoZhang enabled auto-merge (squash) December 26, 2024 07:49
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please update the PR title and description to reflect the actual changes (adding FontAwesome CSS support for PDF exports) rather than referring to web security configuration.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

codecov bot commented Dec 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (bf3d335) to head (1c5bd02).
Report is 517 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #4957     +/-   ##
==========================================
  Coverage   99.99%   100.00%             
==========================================
  Files         584       629     +45     
  Lines       25289     28096   +2807     
  Branches     3678      4035    +357     
==========================================
+ Hits        25288     28096   +2808     
+ Partials        1         0      -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArgoZhang ArgoZhang merged commit 04c56cc into main Dec 26, 2024
5 checks passed
@ArgoZhang ArgoZhang deleted the fix-pdf branch December 26, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(Html2Pdf): add disable web security config
1 participant