Skip to content

Commit

Permalink
restore decoder and add home.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
DMontgomery40 committed Feb 11, 2025
1 parent 28940e2 commit f05d098
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 7 deletions.
11 changes: 11 additions & 0 deletions netlify/functions/progress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export async function handler(event, context) {
// ... your scanning logic which determines the total and scanned items
// For demonstration, here's a static response:
return {
statusCode: 200,
body: JSON.stringify({
scanned: 20, // update dynamically
total: 100, // update dynamically
}),
};
}
68 changes: 68 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"rate-limiter-flexible": "^4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "^7.1.5",
"semver": "^7.6.3",
"simple-git": "^3.27.0",
"tailwind-merge": "1.14.0",
Expand Down
15 changes: 9 additions & 6 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useEffect } from 'react';
import ScannerUI from './components/ScannerUI';
import Decoder from './components/Decoder';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Home from './components/Home';

function App() {
useEffect(() => {
Expand All @@ -8,11 +10,12 @@ function App() {
}, []);

return (
<div className="min-h-screen bg-gray-900 transition-colors duration-200">
<div className="container mx-auto px-4">
<ScannerUI />
</div>
</div>
<Router>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/secret" element={<Decoder />} />
</Routes>
</Router>
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/components/Decoder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const Decoder = () => {
<div className="mt-4 text-green-300">
&gt;{' '}
<a
href="https://github.com/ghostsecurity/reaper/blob/main/docs/how-to-hack-ghostbank.md"
href="https://securitylens.io/secret?message="
target="_blank"
rel="noopener noreferrer"
className="hover:underline"
Expand All @@ -114,3 +114,5 @@ const Decoder = () => {
);
};

export default Decoder;

14 changes: 14 additions & 0 deletions src/components/Home.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import ScannerUI from './ScannerUI';

const Home = () => {
return (
<div className="min-h-screen bg-gray-900 transition-colors duration-200">
<div className="container mx-auto px-4">
<ScannerUI />
</div>
</div>
);
};

export default Home;
39 changes: 39 additions & 0 deletions src/components/ProgressBar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { useState, useEffect } from 'react';

function ProgressBar() {
// Initialize with 0. Ensure your API returns non-zero total when scanning starts.
const [progress, setProgress] = useState({ scanned: 0, total: 0 });

useEffect(() => {
async function fetchProgress() {
try {
// Assuming your Netlify function or API endpoint is at /api/progress
const response = await fetch('/api/progress');
const data = await response.json();
console.log('Progress API response:', data);
// Make sure data.scanned and data.total are valid numbers
setProgress({
scanned: typeof data.scanned === 'number' ? data.scanned : 0,
total: typeof data.total === 'number' ? data.total : 0,
});
} catch (error) {
console.error('Error fetching progress:', error);
}
}

// Poll every 2 seconds (adjust as needed)
const intervalId = setInterval(fetchProgress, 2000);

// Clean up on unmount
return () => clearInterval(intervalId);
}, []);

return (
<div>
<p>{`fetching: ${progress.scanned} of ${progress.total}`}</p>
{/* Add any additional UI, like a visual progress bar */}
</div>
);
}

export default ProgressBar;

0 comments on commit f05d098

Please sign in to comment.