Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Motor.com M1 Angular Application

This Angular application was extracted from production sourcemaps and reconstructed for local development.

⚠️ Important Notes

  • This application was reverse-engineered from webpack sourcemaps
  • The API endpoints require authentication via integrated proxy server
  • Some assets (images, fonts, stylesheets) may be missing and need to be recreated
  • The original production app is at: https://sites.motor.com/m1/

πŸ” Integrated Proxy Server

This application includes an integrated proxy server that handles authentication and API proxying automatically.

Quick Setup (Automatic Authentication)

  1. Configure credentials (one-time setup):

    cd proxy-server
    cp .env.example .env
    # Edit .env and add your EBSCO password
  2. Start the proxy server (Terminal 1):

    cd proxy-server
    npm install
    npm start

    The proxy will automatically authenticate with EBSCO on startup! βœ…

  3. Start the Angular app (Terminal 2):

    npm install --legacy-peer-deps
    npm start
  4. Use the app - All API requests (including assets) are automatically proxied with authentication!

πŸ“– Detailed Instructions: See PROXY_INTEGRATION.md for complete setup guide. πŸ“‹ API Documentation: See API_SCHEMA.md for complete API reference. ⚑ Quick Reference: See API_QUICK_REFERENCE.md for common endpoints.

☁️ Cloud Deployment

Firebase Hosting (Recommended)

Deploy the Angular app to Firebase and proxy server to Vercel:

  1. Deploy Proxy Server (Required First):

    cd proxy-server
    npm install -g vercel
    vercel --prod
  2. Update Environment: Edit src/environments/environment.prod.ts with your proxy URL

  3. Deploy to Firebase:

    npm install -g firebase-tools
    firebase login
    npm run deploy

πŸ”₯ Complete Guide: See FIREBASE_DEPLOYMENT.md

Vercel (Alternative)

Both proxy server and Angular app can be deployed to Vercel:

cd proxy-server
vercel --prod

# Then deploy Angular app
npm run build:prod
vercel --prod

πŸ“˜ See proxy-server/VERCEL_DEPLOYMENT.md for complete deployment guide.

πŸš€ Quick Start

Prerequisites

  • Node.js 14.x or higher
  • npm 6.x or higher

Installation

# Install dependencies
cd /Users/phobosair/unwebpack-sourcemap/output
npm install

Development Server

# Start dev server on http://localhost:4200
npm start

The application will automatically reload if you change any source files.

Build

# Development build
npm run build

# Production build
npm run build:prod

Build artifacts will be stored in the dist/ directory.

πŸ“‘ API Configuration

The app connects to the Motor.com M1 API at https://sites.motor.com/m1/api/

Authentication Required

All API requests require these headers:

{
  'x-correlation-id': '<correlation-id>',
  'x-session-id': '<session-id>',
  'Authorization': 'Bearer <api-token>'
}

Getting Credentials

You need to obtain credentials from the authentication endpoint (not included in extracted sources).

Configuring API Base URL

Edit src/app/app.module.ts:

ApiModule.forRoot({ rootUrl: 'https://sites.motor.com/m1' })

Or use a proxy configuration for development (see below).

πŸ”§ Development Proxy (Optional)

To avoid CORS issues during development, create proxy.conf.json:

{
  "/api": {
    "target": "https://sites.motor.com/m1",
    "secure": true,
    "changeOrigin": true,
    "headers": {
      "x-correlation-id": "YOUR_CORRELATION_ID",
      "x-session-id": "YOUR_SESSION_ID",
      "Authorization": "Bearer YOUR_TOKEN"
    }
  }
}

Then update package.json start script:

"start": "ng serve --proxy-config proxy.conf.json"

πŸ“ Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ app.component.ts          # Root component
β”‚   β”œβ”€β”€ app.module.ts             # Root module
β”‚   β”œβ”€β”€ app-routing.module.ts    # Router configuration
β”‚   β”œβ”€β”€ assets/                   # Assets state management
β”‚   β”œβ”€β”€ core/                     # Core services & components
β”‚   β”‚   β”œβ”€β”€ components/           # Shared components (layout, nav, modals)
β”‚   β”‚   β”œβ”€β”€ state/                # Layout state (Akita)
β”‚   β”‚   └── user-settings/        # User settings service
β”‚   β”œβ”€β”€ delta-report/             # Change tracking feature
β”‚   β”œβ”€β”€ directives/               # Custom directives (zoom, routing)
β”‚   β”œβ”€β”€ generated/                # Auto-generated API client
β”‚   β”‚   └── api/
β”‚   β”‚       β”œβ”€β”€ models/           # TypeScript models
β”‚   β”‚       └── services/         # API service classes
β”‚   β”œβ”€β”€ guards/                   # Route guards
β”‚   β”œβ”€β”€ labor-operation/          # Labor operations feature
β”‚   β”œβ”€β”€ maintenance-schedules/    # Maintenance schedules feature
β”‚   β”œβ”€β”€ pipes/                    # Custom pipes (SafeHtml)
β”‚   β”œβ”€β”€ search/                   # Search feature with state
β”‚   β”œβ”€β”€ vehicle-selection/        # Vehicle selection feature
β”‚   └── utilities.ts              # Helper functions
β”œβ”€β”€ assets/                       # Static assets
β”œβ”€β”€ environments/                 # Environment configs
β”œβ”€β”€ main.ts                       # Application entry point
└── polyfills.ts                  # Browser polyfills

πŸ—‚οΈ State Management (Akita)

The app uses Akita for state management with the Store β†’ Query β†’ Facade pattern:

Active Stores

  1. Layout Store - UI layout state
  2. Vehicle Selection Store - Selected vehicle (persisted to sessionStorage)
  3. Search Results Store - Search results and active article
  4. Filter Tabs Store - Search filter tabs
  5. Assets Store - Asset data
  6. Maintenance Schedules Store - Maintenance schedule data

State Persistence

Vehicle selection is persisted to sessionStorage with key 'selected-vehicle'.

πŸ›£οΈ Routes

  • / β†’ Redirects to /vehicles
  • /vehicles β†’ Vehicle selection (Year/Make/Model)
  • /docs/:filterTab β†’ Main content area with articles
  • /maintenance-schedules β†’ Maintenance schedules view
  • /delta-report β†’ Change tracking reports (guarded)
  • /** β†’ 404 Error page

πŸ”Œ API Endpoints

Vehicle API

  • GET /api/years - Get available years
  • GET /api/year/{year}/makes - Get makes for year
  • GET /api/year/{year}/make/{make}/models - Get models

Search API

  • GET /api/source/{contentSource}/vehicle/{vehicleId}/articles/v2 - Search articles

Asset API

  • GET /api/source/{contentSource}/vehicle/{vehicleId}/article/{articleId} - Get article
  • GET /api/source/{contentSource}/vehicle/{vehicleId}/maintenance-schedules/... - Schedules

Other APIs

  • Bookmark API - Manage bookmarks
  • Parts API - Parts information
  • UI API - UI configuration
  • Error Logging API - Client error tracking
  • Track Change API - Change tracking
  • Logout API - Session termination

🎨 Styling

The app uses SCSS for styling with Bootstrap via @ng-bootstrap/ng-bootstrap.

Component-specific styles should be created as *.component.scss files.

🧩 Key Dependencies

  • Angular 12.x - Framework
  • Akita - State management
  • ng-bootstrap - Bootstrap UI components
  • ng-select - Advanced select dropdowns
  • ngx-extended-pdf-viewer - PDF viewing
  • RxJS 6.x - Reactive programming

⚠️ Known Issues

  1. Missing Assets - Images, fonts, and some stylesheets extracted from sourcemaps may not work
  2. API Authentication - You need valid credentials to use the API
  3. CORS - Direct API calls from localhost may be blocked (use proxy)
  4. Component Styles - Some component SCSS files are missing and may need recreation
  5. Environment Variables - May need additional configuration

πŸ” Security Notes

This code was extracted from production sourcemaps which exposed:

  • Full application source code
  • API structure and endpoints
  • Business logic
  • Authentication patterns

This is a security issue in the production deployment.

πŸ“ Development Notes

Adding HTTP Interceptor for Auth

Create an HTTP interceptor to automatically add auth headers:

// src/app/core/auth.interceptor.ts
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler } from '@angular/common/http';

@Injectable()
export class AuthInterceptor implements HttpInterceptor {
  intercept(req: HttpRequest<any>, next: HttpHandler) {
    const authReq = req.clone({
      setHeaders: {
        'x-correlation-id': 'YOUR_ID',
        'x-session-id': 'YOUR_SESSION',
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    });
    return next.handle(authReq);
  }
}

Register in app.module.ts:

import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { AuthInterceptor } from './core/auth.interceptor';

providers: [
  { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }
]

Debugging Akita State

Enable Akita DevTools in development (already configured):

  • Open browser DevTools
  • Look for "Akita" tab
  • Monitor state changes in real-time

πŸ“š Resources

🀝 Contributing

This is a reverse-engineered application. Contributions should focus on:

  • Recreating missing assets
  • Documenting API endpoints
  • Improving type safety
  • Adding tests

πŸ“„ License

Unknown - This code was extracted from a production application.


πŸ”— Related Documentation

API & Integration

Project Documentation


πŸ–ΌοΈ Asset Handling

Articles from Motor.com often reference images, PDFs, and other assets using URLs like /api/assets/{unique-id}.

How it works:

  1. Article HTML contains: <img src="/api/assets/abc-123-def" />
  2. Angular's ProxyAuthInterceptor automatically rewrites to: http://localhost:3001/api/motor-proxy/api/assets/abc-123-def
  3. Proxy server forwards to Motor.com with authentication: https://sites.motor.com/m1/api/assets/abc-123-def
  4. Asset is returned with proper authentication and CORS headers

No special configuration needed - assets are automatically proxied! πŸŽ‰

See API_SCHEMA.md for complete details on the /api/assets/{assetId} endpoint.


Generated from sourcemaps on October 20, 2025
Proxy integration added on October 23, 2025
API schema and asset proxying documented on October 31, 2025

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages