NAME

Developer::Dashboard::Web::App - local web application for Developer Dashboard

SYNOPSIS

my $app = Developer::Dashboard::Web::App->new(
    auth     => $auth,
    pages    => $pages,
    sessions => $sessions,
);

DESCRIPTION

This module handles the browser-facing dashboard routes, helper login flow, page rendering modes, and page/action execution endpoints. It also provides static file serving for JavaScript, CSS, and other assets from the public directory structure (~/.developer-dashboard/dashboard/public/{js,css,others}).

METHODS

new, handle

Construct and dispatch the local web application.

_serve_static_file($type, $filename)

Serves static files from the public directory.

Input: $type (js, css, or others subdirectory), $filename (requested filename). Output: array reference of [status_code, content_type, body].

Security: Prevents directory traversal attacks and verifies files are within the public directory before serving.

_get_content_type($type, $filename)

Determines the MIME type for a file based on its type and extension.

Input: $type (js, css, or others), $filename (requested filename). Output: MIME type string suitable for Content-Type header.

Supports: JS, CSS, JSON, XML, HTML, SVG, PNG, JPEG, GIF, WebP, ICO, and others.