FilePublisher is a tool designed for workshop presenters to share their code files with attendees in real-time. It allows workshop participants to view and follow along with the presenter's code without needing to clone repositories or set up development environments.
The system consists of two main components:
- PublisherApi: A Node.js/Express backend server that provides access to files in specified directories
- Frontend: A web client that allows attendees to view files using a session ID
- The presenter sets up the FilePublisher server on their machine
- They configure session IDs in a
sessions.jsonfile, mapping each ID to a specific directory path - They share the relevant session ID with workshop attendees
- Attendees open the FilePublisher web interface in their browser
- They enter the session ID provided by the presenter
- They can browse and view all files in the presenter's shared directory
- Files are automatically refreshed every 30 seconds to show updates
- Session Management: Access to files is controlled via session IDs
- File Navigation: Browse all files in the shared directory
- Syntax Highlighting: Code is displayed with proper syntax highlighting
- Auto-Refresh: Files are automatically refreshed to show the latest changes
- Caching: ETag-based caching to reduce bandwidth usage
- Security: Path normalization to prevent directory traversal attacks
- Persistence: Session IDs are saved in localStorage for convenience
- Built with Express.js and TypeScript
- Uses a JSON file (
sessions.json) to map session IDs to directory paths - Implements caching for session data with a 5-minute TTL
- Provides API endpoints for:
- Listing all files in a session directory
- Retrieving the content of a specific file
- Includes security features like path normalization
- Uses ETags for efficient caching
- Built with TypeScript and vanilla JavaScript
- Simple, intuitive UI for browsing and viewing files
- Implements automatic refresh every 30 seconds
- Uses highlight.js for syntax highlighting
- Stores the last used session ID in localStorage
- Clone the repository
- Install dependencies for both the backend and frontend
npm --prefix PublisherApi install npm --prefix Frontend install
- Create a
sessions.jsonfile in the root of the PublisherApi directory with the following format:{ "session1": "/path/to/directory1", "session2": "/path/to/directory2" } - Build the frontend (
npm run build, copies dist into backend server)npm --prefix Frontend run build
- Start the backend server
npm --prefix PublisherApi start