diff options
author | Erich Eckner <git@eckner.net> | 2018-09-28 14:35:21 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-09-28 14:35:21 +0200 |
commit | f99d7ae1442c2fe84479dbfe472aba733d062924 (patch) | |
tree | 7de27ecb002a085205fb02cab0379f60e604c6ce | |
parent | ae5d9e45f7de537c22e6e4e36524ef15b739007b (diff) | |
download | archive-server-f99d7ae1442c2fe84479dbfe472aba733d062924.tar.xz |
httpdocs/index.php new
-rw-r--r-- | httpdocs/index.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/httpdocs/index.php b/httpdocs/index.php new file mode 100644 index 0000000..4f11f49 --- /dev/null +++ b/httpdocs/index.php @@ -0,0 +1,41 @@ +<?php + +if (isset($_GET['r'])) { + + if (base64_decode($_GET['r'],true)===false) + die('Invalid base64'); + + if (!is_dir('../work/repositories/' . $_GET['r'])) { + $wish_list = fopen('../work/wish-list','a'); + if ($wish_list === false) + die('Cannot open wish-list'); + fwrite($wish_list, $_GET['r'] . "\n"); + fclose($wish_list); + die('I put repository on wish-list'); + } + + if (isset($_GET['tag'])) { + if (base64_decode($_GET['tag'],true)===false) + $_GET['tag'] = base64_encode($_GET['tag']); + + $handle = popen( + 'git -C "../work/repositories/' . $_GET['r'] . '" archive "$(' . + 'echo "' . $_GET['tag'] . '" | ' . + 'base64 -d' . + ')" | ' . + 'gzip -nc', + 'r' + ); + if ($handle === false) + die('Unable to create archive'); + header('Content-type: application/x-gzip'); + header('Content-Disposition: attachment; filename="archive.tar.gz"'); + fpassthru($handle); + pclose($handle); + die(); + } + + die('errrm, this is not yet implemented'); + +} + |