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

This PR fixes issue #1300 #1601

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

This PR fixes issue #1300 #1601

wants to merge 3 commits into from

Conversation

Farreeda
Copy link

@Farreeda Farreeda commented Jan 30, 2025

Add URL Shortening for Cheat Sheets

Description

This PR adds automatic URL shortening functionality to make cheat sheets more accessible through memorable shortcuts. Instead of typing long URLs, users can now access cheat sheets using abbreviated paths.

For example:

  • /XSS.htmlcheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
  • /SSRF.htmlcheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
  • /SQLi.htmlcheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html

Changes

  • Added URL shortening logic to Generate_Site_mkDocs.sh
  • Automatically generates shortcuts based on first letters of each word in filenames
  • Creates clean URL .html version (/XSS.html)
  • Adds HTML redirects with proper meta refresh tags
  • Includes verification steps to ensure shortcuts are created correctly

Testing

After running
Test shortcuts:

curl -L http://localhost:8000//CCS.html
curl -L http://localhost:8000/CCSP.html
curl -L http://localhost:8000/DOS.html

Benefits

  • Easier to remember and share URLs
  • Faster access to frequently used cheat sheets
  • Maintains compatibility with existing full URLs
  • Works with both clean URLs and .html extensions

Related Issues

Closes #1300

A Contribution for URL shortcut, now, Abbreviation .html directs to the exact page!
jmanico
jmanico previously approved these changes Jan 31, 2025
Copy link
Member

@jmanico jmanico left a comment

Choose a reason for hiding this comment

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

I am approving just to move this along but can other folks take a closer look at this before we merge?

@szh
Copy link
Collaborator

szh commented Feb 3, 2025

This is fantastic. I'm going to do a full review on it hopefully in the next day or two but I'm really excited about this. Thank you!

@jmanico
Copy link
Member

jmanico commented Feb 5, 2025

This is fantastic - thank you very very much!

@mackowski
Copy link
Collaborator

Build is failing here @Farreeda

echo " - /${shortcut}.html"
else
#echo "❌ Failed to create shortcuts for ${shortcut}"
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

The script fails here, I assume because there's nothing in the else clause except for the comment. Uncommenting the line fixes this.
However, when I run this locally and run make serve the shortcuts don't seem to work. I also don't see where the script reads redirects.yml - it looks like the script is automatically generating the shortcuts which makes me wonder how it will handle possible duplicates. Can you please clarify the process?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your feedback, @szh! I appreciate your insights and apologize for not testing every case @mackowski. The redirects.yml file now includes abbreviations for each path, and it can be easily modified and updated as needed. The XSS and auth issues should be resolved now, but please note that abbreviations should be followed by .html
Thank you, @jmanico, for bringing attention to my PR!

@mackowski
Copy link
Collaborator

@szh can you review it again?

@Farreeda Farreeda requested a review from szh February 12, 2025 20:12
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.

Shortlinks for cheatsheets
4 participants