Main#14
Open
NagarjunDP wants to merge 6 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new React/Vite frontend for BlockVerify and refactors the existing Flask “client” app into a JSON API with a risk-scoring pipeline and a miner voting (“arena”) workflow.
Changes:
- Added a Vite + React SPA with auth, user dashboard (add/verify), and miner dashboard (arena voting + leaderboard).
- Replaced server-rendered Flask routes with JSON API endpoints for auth, file add/verify, and arena voting/leaderboard.
- Updated DB schema/migrations for roles, staking/voting, and arena transactions; adjusted runtime ports and dependency specs.
Reviewed changes
Copilot reviewed 29 out of 37 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/vite.config.js | Adds Vite dev server proxy to backend /api/v1 endpoints. |
| src/frontend/src/main.jsx | Boots the React app into #root. |
| src/frontend/src/index.css | Adds global UI theme/styles for the SPA. |
| src/frontend/src/components/MinerDashboard.jsx | Implements miner arena UI, voting UX, polling, and leaderboard rendering. |
| src/frontend/src/components/FileUploader.jsx | Implements add/verify upload flows and displays risk analysis results. |
| src/frontend/src/components/Dashboard.jsx | Adds user-facing dashboard tabbing between add/verify. |
| src/frontend/src/components/Auth.jsx | Adds SPA login/register UI with role selection. |
| src/frontend/src/assets/vite.svg | Adds asset (likely template-derived). |
| src/frontend/src/assets/react.svg | Adds asset (likely template-derived). |
| src/frontend/src/assets/hero.png | Adds image asset. |
| src/frontend/src/App.jsx | Adds routing and role-based dashboard selection, plus navbar/logout. |
| src/frontend/src/App.css | Adds CSS file (template-derived). |
| src/frontend/public/icons.svg | Adds icon sprite sheet. |
| src/frontend/public/favicon.svg | Adds favicon. |
| src/frontend/package.json | Defines frontend dependencies and scripts for Vite/React. |
| src/frontend/index.html | Adds Vite entry HTML for the SPA. |
| src/frontend/eslint.config.js | Adds ESLint flat config for frontend. |
| src/frontend/README.md | Adds template README for the frontend. |
| src/frontend/.gitignore | Adds frontend ignores (node_modules/dist/etc.). |
| src/client/run.sh | Changes Flask client port to 3000 to match frontend proxy target. |
| src/client/requirements.txt | Switches to unpinned Python dependencies and adds email-validator. |
| src/client/migrations/versions/cc610bff9b63_users_table.py | Removes legacy migration. |
| src/client/migrations/versions/508d5be06df2_arena_changes.py | Adds new migration including user role/stake fields + arena/vote tables. |
| src/client/migrations/script.py.mako | Updates Alembic migration template (Flask-Migrate style). |
| src/client/migrations/env.py | Updates Alembic env to work with newer Flask-SQLAlchemy/Flask-Migrate patterns. |
| src/client/migrations/alembic.ini | Adds Flask-Migrate logger entry. |
| src/client/migrations/README | Updates migrations README text. |
| src/client/config.py | Changes default GPG binary path and retains env overrides. |
| src/client/app/routes.py | Replaces HTML routes with JSON API endpoints + risk engine + arena logic. |
| src/client/app/models.py | Adds role, staking/voting stats, and new arena/vote models. |
| src/client/app/file_handler.py | Updates signing call signature. |
| src/client/app/block_api.py | Auto-mines a block when a transaction is successfully created. |
| src/client/app/init.py | Updates gnupg init parameters for newer python-gnupg. |
| src/api/run.sh | No functional change (still runs API on 6000). |
| src/api/requirements.txt | Switches API deps to unpinned versions. |
| README.md | Adds an extra heading at the end. |
Files not reviewed (1)
- src/frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
14
to
16
| login = LoginManager(app) | ||
| login.login_view = 'login' | ||
|
|
| GPG_KEY_STORE = os.environ.get('GPG_KEY_STORE') or os.path.join( | ||
| basedir, 'keys') | ||
| GPG_BINARY = os.environ.get('GPG_BINARY') or '/usr/bin/gpg1' | ||
| GPG_BINARY = os.environ.get('GPG_BINARY') or '/opt/homebrew/bin/gpg' |
Comment on lines
+1
to
+14
| alembic | ||
| click | ||
| Flask | ||
| Flask-Migrate | ||
| Flask-SQLAlchemy | ||
| itsdangerous | ||
| Jinja2 | ||
| Mako | ||
| MarkupSafe | ||
| python-dateutil | ||
| python-editor | ||
| six | ||
| SQLAlchemy | ||
| Werkzeug |
Comment on lines
+15
to
19
|
|
||
| # Auto-mine block if transaction was successfully added | ||
| if response.status_code == 201: | ||
| requests.get(f'{BASE_URL}/mine') | ||
|
|
Comment on lines
+67
to
+70
| <div className={`file-dropzone ${file ? 'active' : ''}`} | ||
| onDragOver={(e) => e.preventDefault()} onDrop={handleDrop} | ||
| onClick={() => fileInputRef.current.click()}> | ||
| <input type="file" ref={fileInputRef} onChange={handleFileChange} style={{ display: 'none' }} /> |
Comment on lines
+158
to
+165
| file_name = secure_filename(file.filename) | ||
| file_path = os.path.join(app.config['UPLOAD_FOLDER'], file_name) | ||
| file.save(file_path) | ||
|
|
||
| try: | ||
| file_size = os.path.getsize(file_path) | ||
| file_hash_str = file_hash(file_name) # also deletes temp file | ||
| risk_score, risk_level, checks = calculate_risk_score(file_name, file_size, file_hash_str) |
Comment on lines
+1
to
+25
| alembic | ||
| certifi | ||
| chardet | ||
| click | ||
| email-validator | ||
| Flask | ||
| Flask-Login | ||
| Flask-Migrate | ||
| Flask-SQLAlchemy | ||
| Flask-WTF | ||
| gnupg | ||
| idna | ||
| itsdangerous | ||
| Jinja2 | ||
| Mako | ||
| MarkupSafe | ||
| psutil | ||
| python-dateutil | ||
| python-editor | ||
| requests | ||
| six | ||
| SQLAlchemy | ||
| urllib3 | ||
| Werkzeug | ||
| WTForms |
Comment on lines
+16
to
+24
| const useTimer = (endTime) => { | ||
| const [remaining, setRemaining] = useState(0); | ||
| useEffect(() => { | ||
| if (!endTime) return; | ||
| const tick = () => setRemaining(Math.max(0, Math.round(endTime - Date.now() / 1000))); | ||
| tick(); | ||
| const id = setInterval(tick, 500); | ||
| return () => clearInterval(id); | ||
| }, [endTime]); |
Comment on lines
+232
to
+237
| useEffect(() => { | ||
| fetchArena(); | ||
| fetchLeaderboard(); | ||
| const id = setInterval(() => { fetchArena(); fetchLeaderboard(); fetchMe(); }, 2000); | ||
| return () => clearInterval(id); | ||
| }, [fetchArena, fetchLeaderboard, fetchMe]); |
| ## API Reference | ||
|
|
||
| https://documenter.getpostman.com/view/3186515/RW1aJfNe | ||
| # miniprojectt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.