Skip to content

D3c3pt1c0nCyber/Vector-Asset-Management

Repository files navigation

Vector Asset Management

A customization and automation layer built on top of Snipe-IT that transforms the default asset tracker into a fully branded Vector Asset Management platform — complete with a dark theme, AI-powered chatbox assistant, admin AI settings panel, Docker orchestration, and automated theming scripts.


Overview

This repository contains all the patch scripts, Docker configuration, and theme files needed to deploy and brand a self-hosted Vector Asset Management instance. Each script is designed to be run inside the running container to apply its changes, making the entire setup reproducible and re-runnable (idempotent).

Base platform: Snipe-IT (open-source IT asset management) Branding: Vector Asset Management / Vector Solutions AI Engine: Claude (Anthropic) Deployment: Docker Compose


Features

Dark Theme

  • Full dark UI applied via custom CSS injected directly into the database settings
  • GitHub-inspired color palette (#0D1117 base, #161B22 sidebar, #21262D cards)
  • CSS custom properties (variables) for consistent theming across all components
  • Covers: navbar, sidebar, tables, cards, forms, modals, buttons, badges, alerts, pagination, dropdowns, date pickers, Select2, and more
  • Dark mode set as the default for all new users (no manual toggle needed on first load)
  • Available in both Python (update_theme.py) and PHP (update_theme.php) variants

AI Chatbox Assistant

  • Floating chat button (fixed, bottom-right) on every page of the application
  • Gradient icon with live connection status dot (green = connected, red = error, amber = busy)
  • Draggable chat panel — reposition anywhere on screen by dragging the header
  • Fetches live data from the asset management API in parallel before each AI response:
    • Always fetched: Hardware (500 items), Users (200), Licenses, Locations, Departments, Categories, Manufacturers, Models, Status Labels, Companies
    • Conditionally fetched based on query keywords: Accessories, Consumables, Components, Suppliers
  • Powered by claude-haiku-4-5-20251001 — fast, cost-efficient responses
  • Streamed to a scrollable message window with markdown rendering (bold, inline code)
  • Quick-action chips on the welcome message: "Summarize all assets", "Show unassigned hardware", "List licenses & usage", etc.
  • Settings drawer within the panel to enter/update the Anthropic API key (stored in localStorage)
  • API key auth status shown inside the panel (green checkmark when configured)

Admin AI Settings Panel

  • New section injected into the Snipe-IT Admin Settings page (/settings)
  • Configure Anthropic API key from within the app — no file editing required
  • Test Connection button — live-tests the key against the Anthropic API and shows result
  • Clear button to revoke a stored key
  • Connection status badge (Connected / Auth failed / Not configured) with color-coded indicator
  • API key stored in browser localStorage — never logged or sent to the server
  • Fully idempotent: re-running the patch removes and re-injects the block cleanly

Login Page Branding

  • Displays the site name as a styled heading beneath the logo on the login screen
  • Falls back to "Vector Asset Management Tool" if no site name is configured
  • Logo padded and sized correctly (max-height: 80px) for clean presentation
  • Works with or without a logo configured in Admin Settings

Dark Mode Default

  • Patches the theme-toggle JavaScript so dark mode is the default on first visit
  • Only sets the preference if localStorage does not already have one — respects user preference on subsequent visits
  • Single-line patch, safe to re-apply

Favicon Generator

  • Converts the Vector Solutions logo (.webp) to a 64×64 PNG favicon
  • Saves directly to the Snipe-IT public uploads path
  • Uses PHP GD library (included in the Snipe-IT Docker image)

API Token Generator

  • Generates a fresh OAuth bearer token for the admin user (ID 1) directly via PDO
  • Finds the personal access OAuth client, creates a new oauth_access_tokens record
  • Outputs TOKEN: and TOKEN_ID: for use by other scripts (e.g., inject_chat.py reads this)
  • Token is set to expire in 100 years — persistent across container restarts

Docker Orchestration

  • docker-compose.yml spins up the full stack with a single command
  • Two services: mysql (MySQL 8.0) + vector-asset-management (Snipe-IT latest)
  • Named volumes for data persistence: mysql-data (database), vector-data (uploads/files)
  • Environment loaded from .env — credentials never hardcoded in the compose file
  • Both services set to restart: unless-stopped for production reliability

File Reference

File Language Purpose
docker-compose.yml YAML Spins up MySQL + Vector Asset Management containers
.env ENV Database credentials and app config (not committed)
update_theme.py Python Injects full dark theme CSS via MySQL connector
update_theme.php PHP Injects full dark theme CSS via PDO (run inside container)
patch_darkmode.py Python Sets dark mode as the default on first page load
patch_login.py Python Brands the login page with site name heading
patch_ai_settings.py Python Injects AI settings panel into the Admin Settings page
inject_chat.py Python Injects the floating AI chatbox widget on all pages
gen_api_token.php PHP Generates an OAuth bearer token for the admin user
make_favicon.php PHP Converts the Vector Solutions logo to a PNG favicon

Requirements

  • Docker & Docker Compose
  • PHP (inside container, for .php scripts)
  • Python 3 + mysql-connector-python (for .py scripts run against the DB directly)
  • Anthropic API key (console.anthropic.com)

Deployment

1. Start the stack

docker-compose up -d

Wait ~60 seconds for Snipe-IT to finish its first-time setup.

2. Apply dark theme

# PHP variant (run inside container)
docker exec -it vector-asset-management php /tmp/update_theme.php

# OR Python variant (run from host with DB access)
python3 update_theme.py

3. Set dark mode as default

docker exec -it vector-asset-management python3 /tmp/patch_darkmode.py

4. Brand the login page

docker exec -it vector-asset-management python3 /tmp/patch_login.py

5. Inject AI settings into Admin panel

docker exec -it vector-asset-management python3 /tmp/patch_ai_settings.py

6. Inject AI chatbox

docker exec -it vector-asset-management python3 /tmp/inject_chat.py

7. Generate favicon (optional)

docker exec -it vector-asset-management php /tmp/make_favicon.php

Configuration

.env (not committed — create this file)

APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:<your-laravel-app-key>
APP_URL=http://<your-server-ip>:8000

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=vector_asset_db
DB_USERNAME=vector_asset
DB_PASSWORD=vector_pass

MAIL_DRIVER=log

Anthropic API Key (in-app)

  1. Open the app at http://localhost:8000
  2. Go to Admin → Settings
  3. Scroll to Vector AI Assistant — Configuration
  4. Paste your Anthropic API key and click Save Key
  5. Click Test Connection to verify

The key is stored in your browser's localStorage only — it is never sent to the server or stored in the database.


Architecture

vector-asset-management/
├── docker-compose.yml          # Container orchestration
├── .env                        # Credentials (gitignored)
├── .gitignore
│
├── Theme & UI
│   ├── update_theme.py         # Dark theme via Python/MySQL
│   ├── update_theme.php        # Dark theme via PHP/PDO
│   ├── patch_darkmode.py       # Force dark mode default
│   └── make_favicon.php        # Favicon from logo
│
├── Login & Branding
│   └── patch_login.py          # Branded login page
│
└── AI Integration
    ├── patch_ai_settings.py    # Admin settings panel
    ├── inject_chat.py          # Floating chatbox widget
    └── gen_api_token.php       # OAuth token for API access

Changelog

v1.2.0 — 2026-03-14

Full rebrand to Vector Asset Management

  • Renamed all Docker container names, service names, and volume names from snipe-* to vector-*
  • Updated all database credentials (snipeitvector_asset_db, vector_asset, vector_pass)
  • Updated MySQL host references in all PHP/Python scripts (snipe-mysqlvector-mysql)
  • Renamed Python variable snipe_tokenvam_token and JS variable _vsSnipe_vsToken
  • Updated all code comments from "Snipe-IT token" to "Vector Asset Management token"
  • Repository moved to D3c3pt1c0nCyber/Vector-Asset-Management

v1.1.0 — 2026-03-13

AI Chatbox & Admin Settings

  • Added inject_chat.py — floating AI chatbox widget on every page
    • Draggable panel, live status dot, quick-action chips, markdown rendering
    • Parallel API data fetching (hardware, users, licenses, locations, departments, and more)
    • Powered by claude-haiku-4-5-20251001
  • Added patch_ai_settings.py — Anthropic API key configuration in Admin Settings
    • Save, Test Connection, and Clear buttons
    • Live connection status badge with color-coded indicator
    • Fully idempotent (safe to re-run)
  • Added gen_api_token.php — generates OAuth bearer token for API access
    • Used by inject_chat.py to authorize live data fetches
    • Token valid for 100 years, persists across restarts

v1.0.0 — 2026-03-01

Initial Release

  • Added docker-compose.yml — full Docker stack (MySQL 8.0 + Snipe-IT latest)
  • Added update_theme.py / update_theme.php — full dark theme CSS injection
    • GitHub-inspired palette with CSS custom properties
    • Covers all UI components: navbar, sidebar, tables, forms, modals, badges, dropdowns, etc.
  • Added patch_darkmode.py — sets dark mode as default on first visit
  • Added patch_login.py — branded login page with site name heading and logo sizing
  • Added make_favicon.php — converts Vector Solutions logo to favicon

Security Notes

  • .env is gitignored — never commit credentials
  • Anthropic API key lives in browser localStorage only — not stored server-side
  • OAuth tokens are scoped to read-only API endpoints
  • All patch scripts are idempotent — safe to re-run without duplicating changes

License

MIT — free to use, modify, and distribute.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors