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

fix: exploit md5 hash to solve the limit of label on gitalk #41

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ gitalk:
repo:
owner:
admin:

md5: false
# https://giscus.app/zh-CN
giscus:
enable: false
Expand Down
6 changes: 5 additions & 1 deletion layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@

<% if (theme.gitalk.enable && theme.gitalk.clientID && theme.gitalk.clientSecret) { %>
<%- js({src: vendorCdn(theme.vendor.js.gitalk)[0], 'data-pjax': true}) %>
<% if (theme.gitalk.md5) { %>
<script src="https://fastly.jsdelivr.net/npm/[email protected]/js/md5.min.js"></script>
<% } %>
<script data-pjax>
const id = <%= theme.gitalk.md5 ? 'md5(location.pathname)' : 'location.pathname' %>
const gitalk = new Gitalk({
clientID: '<%= theme.gitalk.clientID %>',
clientSecret: '<%= theme.gitalk.clientSecret %>',
repo: '<%= theme.gitalk.repo %>',
owner: '<%= theme.gitalk.owner %>',
admin: <%- JSON.stringify(theme.gitalk.admin) %>,
id: location.pathname, // Ensure uniqueness and length less than 50
id: id, // Ensure uniqueness and length less than 50
distractionFreeMode: false // Facebook-like distraction free mode
})
gitalk.render('comments')
Expand Down
Loading