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: support cdn url #140

Merged
merged 7 commits into from
Jan 10, 2023
Merged

feat: support cdn url #140

merged 7 commits into from
Jan 10, 2023

Conversation

l1ch40
Copy link
Collaborator

@l1ch40 l1ch40 commented Jan 8, 2023

Resolve #71

src/html.rs Outdated Show resolved Hide resolved
Copy link
Member

@Folyd Folyd left a comment

Choose a reason for hiding this comment

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

Thanks for working on this.

Copy link
Member

@Folyd Folyd left a comment

Choose a reason for hiding this comment

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

I mean we can rewrite base_url and cdn_url in a single rewriting, no need to call rewrite_html_url multiple times.

pub fn rewrite_html_url(
    raw_html: &[u8],
    base_url: Option<&str>,
    cdn_url: Option<&str>,
) -> Result<Vec<u8>> {
}

Similar to this:

if matches!(current_mode(), Mode::Build) {
    rewrite_html_url(&buf, site.get("url"), site.get("cdn"))?;
}

@l1ch40
Copy link
Collaborator Author

l1ch40 commented Jan 9, 2023

I mean we can rewrite base_url and cdn_url in a single rewriting, no need to call rewrite_html_url multiple times.

pub fn rewrite_html_url(
    raw_html: &[u8],
    base_url: Option<&str>,
    cdn_url: Option<&str>,
) -> Result<Vec<u8>> {
}

Similar to this:

if matches!(current_mode(), Mode::Build) {
    rewrite_html_url(&buf, site.get("url"), site.get("cdn"))?;
}

Get

Copy link
Member

@Folyd Folyd left a comment

Choose a reason for hiding this comment

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

LGTM overall. However, I believe we should remove /static part from the cdn URL. For example, /static/test.png should be https://cdn-example.net/test.png.

@l1ch40
Copy link
Collaborator Author

l1ch40 commented Jan 9, 2023

LGTM overall. However, I believe we should remove /static part from the cdn URL. For example, /static/test.png should be https://cdn-example.net/test.png.

Please, Review the commit ad67036

src/html.rs Outdated Show resolved Hide resolved
@Folyd Folyd merged commit e041fcb into zineland:master Jan 10, 2023
@Folyd Folyd mentioned this pull request Jan 10, 2023
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.

Support cdn domain
2 participants