Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Fixed Image Selection Command `setImage` and fixed reinjection command ``reinject` to also update the image
  • Loading branch information
hackthedev authored Oct 9, 2024
1 parent 79a7c69 commit 5e65e76
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function updateScriptFiles(base64String) {
let fileContent = fs.readFileSync(filePath, 'utf-8');

// Find and replace `const imageBase64Background = null;`
const searchPattern = /const imageBase64Background = null;/g;
const searchPattern = /const imageBase64Background = /g;
if (searchPattern.test(fileContent)) {
fileContent = fileContent.replace(searchPattern, `const imageBase64Background = "${base64String}";`);
fs.writeFileSync(filePath, fileContent, 'utf-8');
Expand Down Expand Up @@ -306,8 +306,14 @@ rl.on('line', (input) => {
const trimmedInput = input.trim();

if (trimmedInput.startsWith('reinject')) {
// Run the function to update the scripts
console.log("Updating background");
updateScriptFiles(fs.readFileSync("background.txt", 'utf-8').trim());
console.log('Reinjecting scripts...');
injectScriptsIntoAllPages(); // Assuming this function is defined elsewhere

setTimeout(async () => {
await injectScriptsIntoAllPages();
}, 2000); // Delay to ensure pages are fully loaded
} else if (trimmedInput.startsWith('setImage')) {
const filePath = trimmedInput.split(' ')[1]; // Get the file path after the "setImage" command

Expand Down
2 changes: 1 addition & 1 deletion scripts/blu-theme/main.js

Large diffs are not rendered by default.

0 comments on commit 5e65e76

Please sign in to comment.