Browse Source

Squashing: Editing the autoupdater thingie

Andrea Franceschini 8 years ago
parent
commit
a9ca57184b
1 changed files with 10 additions and 8 deletions
  1. 10 8
      pages/api/git-update.php

+ 10 - 8
pages/api/git-update.php

@@ -1,12 +1,14 @@
 <?php
 
+die;
 
-if($_SERVER['REQUEST_METHOD'] != 'POST') {
-	include error(403);
-	die;
-}
+$data = json_decode(file_get_contents('php://input'));
+$secret = $data->secret;
 
-ob_start();
-print_r($_POST);
-file_put_contents('/tmp/log.txt', ob_get_contents(), FILE_APPEND);
-ob_end_clean();
+$url = 'http://git.morpheu5.net/api/v1/repos/morpheu5/af/archive/master.tar.gz';
+
+$cmd = 'curl -L -H "Authorization: token ' . $secret . '" ' . $url . ' > master.tar.gz';
+
+echo $cmd;
+
+system($cmd);