<?php require_once __DIR__ . '/Page.php'; class RawPage implements Page { private $git; private $hash; public function __construct( $git, $hash ) { $this->git = $git; $this->hash = $hash; } public function render() { $filename = basename( $_GET['name'] ?? '' ) ?: 'file'; $file = $this->git->readFile( $this->hash, $filename ); while( ob_get_level() ) { ob_end_clean(); } $file->emitRawHeaders(); $this->git->stream( $this->hash, function( $d ) { echo $d; } ); exit; } }