Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Changed UI and Add Docs (Documentation) support#84

Open
safiya2610 wants to merge 39 commits intoKathiraveluLab:devfrom
safiya2610:changed-ui
Open

Changed UI and Add Docs (Documentation) support#84
safiya2610 wants to merge 39 commits intoKathiraveluLab:devfrom
safiya2610:changed-ui

Conversation

@safiya2610
Copy link

@safiya2610 safiya2610 commented Feb 15, 2026

Screen Recording:

sc.mp4

How to run

py -3.11 -m venv venv
venv\Scripts\activate
pip install --upgrade pip
pip install -r requirements/lock.txt
uvicorn main:app --reload
pytest -v

safiya2610 and others added 28 commits January 4, 2026 02:42
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Add admin router with user management endpoints
- Create admin service for role-based access control
- Add admin dashboard and user gallery templates
- Implement admin authentication checks
- Add unauthorized access template
- Fix JWT configuration and improve token validation
- Update gallery to show metadata JSON properly
- Add admin navigation and styling
- Update tests for new admin functionality
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @safiya2610, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a major architectural and feature upgrade to the application. It establishes a containerized development and deployment workflow using Docker, enhances user authentication with Google OAuth and JWT, and provides a powerful admin dashboard for managing users and content. Key additions include a dynamic documentation system, advanced image processing with fuzzy emotion detection, and robust security measures like rate limiting and security headers. The user interface has also been significantly improved for a more engaging and secure experience.

Highlights

  • Comprehensive Docker Integration: Introduced a complete Docker setup including a Dockerfile, .dockerignore, and docker-compose.yml for streamlined development and deployment, ensuring consistent environments.
  • Enhanced Authentication System: Implemented Google OAuth for secure user login, alongside a new JWT-based authentication service, providing robust access control and user management.
  • New Admin Dashboard and Tools: Developed a dedicated admin dashboard with functionalities for user management, content review, and data export (CSV for users and images), significantly improving administrative oversight.
  • Dynamic Documentation Platform: Added a documentation system allowing for the creation, management, and display of project documentation, including support for file attachments and search capabilities.
  • Advanced Image Processing and Metadata: Integrated fuzzy emotion detection for uploaded images, generating rich metadata that provides deeper insights into visual content, and updated image handling services.
  • Robust Security and Performance Middleware: Introduced middleware for rate limiting to prevent abuse and security headers to enhance application protection, along with global exception handlers for consistent error responses.
  • Significant UI/UX Overhaul: Refreshed the application's user interface with new CSS styles and updated Jinja2 templates across home, gallery, authentication, and admin pages for a modern and intuitive experience.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .dockerignore
    • Added a new file to specify patterns for files and directories to be ignored by Docker builds.
  • .gitignore
    • Updated the file to include new entries for uploaded static files and the users database.
  • CONTRIBUTING.md
    • Adjusted formatting by adding a blank line.
  • Dockerfile
    • Added a new Dockerfile to define the application's build environment and runtime configuration.
  • app/dependencies/auth.py
    • Added a new module to define authentication dependencies for protected routes.
  • app/middleware/ratelimit.py
    • Added a new module implementing an in-memory rate limiting middleware.
  • app/middleware/security.py
    • Added a new module for security headers middleware and global exception handlers.
  • app/routers/admin.py
    • Added a new router for admin-specific functionalities, including user and image management, and data export.
  • app/routers/auth.py
    • Added a new router to handle user authentication, including Google OAuth login and logout processes.
  • app/routers/export.py
    • Added a new router to provide CSV and JSON export functionalities for user data.
  • app/routers/gallery.py
    • Added a new router for gallery-related operations, such as image upload, deletion, and searching public images.
  • app/routers/images.py
    • Added a new router for a protected API endpoint related to images.
  • app/routers/narrative.py
    • Added a new router to handle updating image narratives.
  • app/routers/pages.py
    • Added a new router for general web pages, including home, login, signup, and documentation pages, with documentation upload functionality.
  • app/services/admin_service.py
    • Added a new service module to encapsulate admin-related logic, such as checking admin status.
  • app/services/auth_service.py
    • Added a new service module to handle Google OAuth authentication flow and user upsertion.
  • app/services/image_service.py
    • Added a new service module for saving and deleting images, including metadata generation.
  • app/services/jwt_service.py
    • Added a new service module for creating and decoding JSON Web Tokens.
  • auth_google.py
    • Added a new module to configure Google OAuth client using Authlib.
  • cleaned_data.json
    • Added a new JSON file containing color-to-emotion mappings for fuzzy emotion detection.
  • config.py
    • Added a new configuration file to manage environment variables, secrets, and JWT settings.
  • db.py
    • Added a new module for database connection and initialization, including schema creation for users, images, admins, and docs entries.
  • docker-compose.yml
    • Added a new Docker Compose file to define and run the multi-container application.
  • fuzzy_emotion.py
    • Added a new module implementing fuzzy logic for emotion detection based on image colors.
  • main.py
    • Added a new main application file, integrating all routers, middleware, and database initialization.
  • make_admin.py
    • Added a new script to programmatically create an admin user in the database.
  • requirements/base.in
    • Added a new file listing base Python dependencies for the project.
  • requirements/dev.in
    • Added a new file listing development Python dependencies.
  • requirements/lock.txt
    • Added a new file containing locked versions of all Python dependencies.
  • requirements/test.in
    • Added a new file listing test-specific Python dependencies.
  • static/css/admin_dashboard.css
    • Added new CSS styles for the admin dashboard page.
  • static/css/auth.css
    • Added new CSS styles for authentication-related pages.
  • static/css/cards.css
    • Added new CSS styles for card components.
  • static/css/docs.css
    • Added new CSS styles for the documentation pages.
  • static/css/gallery.css
    • Added new CSS styles for the image gallery page.
  • static/css/gallery_pg.css
    • Added new CSS styles for gallery page-specific elements.
  • static/css/home.css
    • Added new CSS styles for the home page.
  • static/css/login.css
    • Added new CSS styles for the login page.
  • static/css/navbar.css
    • Added new CSS styles for the navigation bar component.
  • static/js/home.js
    • Added new JavaScript for interactive elements and animations on the home page.
  • static/js/navbar.js
    • Added new JavaScript for navigation bar interactivity.
  • static/style.css
    • Added a basic global stylesheet.
  • templates/admin_dashboard.html
    • Added a new Jinja2 template for the admin dashboard interface.
  • templates/admin_user_gallery.html
    • Added a new Jinja2 template for viewing and managing a specific user's gallery from the admin panel.
  • templates/base.html
    • Added a new base Jinja2 template for common HTML structure and includes.
  • templates/components/cards.html
    • Added a new Jinja2 component for displaying image cards.
  • templates/components/gallery_pg.html
    • Added a new Jinja2 component for a gallery page section.
  • templates/components/navbar.html
    • Added a new Jinja2 component for the application's navigation bar.
  • templates/components/parallax.html
    • Added a new Jinja2 component for a parallax scrolling effect.
  • templates/docs.html
    • Added a new Jinja2 template for the documentation pages.
  • templates/gallery.html
    • Added a new Jinja2 template for the user image gallery.
  • templates/home.html
    • Added a new Jinja2 template for the application's home page.
  • templates/login.html
    • Added a new Jinja2 template for the user login page.
  • templates/signup.html
    • Added a new Jinja2 template for the user signup page.
  • templates/unauthorized.html
    • Added a new Jinja2 template for displaying unauthorized access messages.
  • tests/conftest.py
    • Added a new Pytest configuration file for shared fixtures.
  • tests/test_basic_routes.py
    • Added new tests to verify basic route functionality and authentication redirects.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/ci-cd.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant number of features, effectively setting up a full-stack FastAPI application with a database, authentication, Docker support, and a new UI. The overall structure is good, with a clear separation of concerns into services and routers. However, there are several critical issues that need to be addressed, including runtime errors due to missing imports and incorrect template syntax, security risks from broad exception handling, and inconsistencies in dependency management and application configuration. I've provided specific comments and suggestions to resolve these issues and improve the robustness and maintainability of the new codebase.

Comment on lines +23 to +25
RUN pip install --no-cache-dir --retries 10 --timeout 300 pip-tools && \
pip-compile base.in --output-file requirements.txt && \
pip install --no-cache-dir --retries 10 --timeout 300 -r requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The current method of installing dependencies by compiling base.in inside the Docker container is not ideal. It includes pip-tools in the final image, increasing its size, and may lead to non-reproducible builds. A better practice is to use the requirements/lock.txt file, which is already present in the repository, to ensure builds are deterministic and to keep the production image lean. This can be achieved with a multi-stage build or by directly using the lock file.

COPY requirements/lock.txt requirements.txt
RUN pip install --no-cache-dir --retries 10 --timeout 300 -r requirements.txt

COPY . .

# Change ownership to non-root user
RUN chown -R app:app /app || true
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Using || true can mask important errors during the build process. If chown fails for a legitimate reason, the build should fail to prevent potential runtime issues with file permissions. It's safer to remove || true.

RUN chown -R app:app /app

Comment on lines +145 to +165
print(f"DEBUG: Search query: {q}, Current user: {current_user_email}, Matching users: {matching_users}")

user_emails = [user[0] for user in matching_users]
if not user_emails:
images = []
print("DEBUG: No matching users found")
else:
placeholders = ','.join('?' * len(user_emails))
query = f"""
SELECT filename, metadata, narrative, user_name
FROM images
WHERE user_name IN ({placeholders}) AND visibility = 'public'
ORDER BY upload_date DESC
"""
cur.execute(query, user_emails)

images = [
(fn, json.loads(meta) if meta else {}, narrative, user_name)
for fn, meta, narrative, user_name in cur.fetchall()
]
print(f"DEBUG: Found {len(images)} public images from users: {user_emails}")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There are leftover print statements from debugging. These should be removed before merging into the main branch. Consider using a proper logger if you need to output information during development.

- ./cleaned_data.json:/app/cleaned_data.json
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/docs"]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The health check in docker-compose.yml uses the /docs endpoint, while the Dockerfile defines a HEALTHCHECK using the /health endpoint. It's better to be consistent and use the dedicated, lightweight /health endpoint in both places for more reliable health checks.

      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]

assert res.status_code in (302, 303)


#my code
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This comment seems to be a leftover and should be removed.

safiya2610 and others added 3 commits February 16, 2026 03:29
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@mdxabu mdxabu added the on hold Not merging this PR now. label Feb 16, 2026
Copy link
Member

@mdxabu mdxabu left a comment

Choose a reason for hiding this comment

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

@safiya2610, Please don't use any external copyrighted images like home4.jpg. and use some icon packs for the logout and login!

@safiya2610
Copy link
Author

@mdxabu surely I will make changes.
Thankyou for reviewing !!

safiya2610 and others added 8 commits February 17, 2026 14:02
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Removed unnecessary closing img tag in cards.html.
@safiya2610 safiya2610 requested a review from mdxabu February 20, 2026 23:49
@safiya2610
Copy link
Author

@mdxabu I’ve made the requested changes. Removed the external copyrighted image and replaced the login/logout with icon pack icons.

@mdxabu
Copy link
Member

mdxabu commented Feb 28, 2026

@safiya2610, I reviewed some of your code and added my review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on hold Not merging this PR now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants