Skip to content

Enhance random HTML file selection and error handling#155

Draft
prettyleaf wants to merge 2 commits into
eGamesAPI:mainfrom
prettyleaf:main
Draft

Enhance random HTML file selection and error handling#155
prettyleaf wants to merge 2 commits into
eGamesAPI:mainfrom
prettyleaf:main

Conversation

@prettyleaf
Copy link
Copy Markdown
Contributor

This pull request refactors and improves the randomhtml() function in src/modules/selfsteal_templates.sh, enhancing the logic for selecting and preparing random HTML templates, as well as making the HTML modification process more robust. The main changes include a more flexible template selection mechanism, improved error handling, and a more reliable approach to modifying and verifying HTML files.

Template selection and preparation improvements:

  • Updated the selection logic for "nothing-sni" templates to dynamically pick from all available .html files in the current directory, rather than just files named 1-8.html. This makes the function more flexible and future-proof.
  • Added a check to ensure that if no templates are found, the function exits with an error, improving error handling and preventing unexpected behavior.

HTML modification and validation enhancements:

  • Improved the sed command that injects a random class into the <body> tag so it now correctly handles cases where the tag may or may not already have a class attribute.
  • Changed the logic to ensure the /var/www/html directory always exists before copying or extracting templates, and reorganized the directory creation check for clarity and reliability.
  • Replaced the previous method of searching for the injected meta name in HTML files with a more efficient and reliable grep -Rql command, ensuring the modification is validated correctly.

@prettyleaf prettyleaf marked this pull request as draft April 25, 2026 14:42
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.

1 participant