xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
<root> / inc / api.inc.php (af3f3f5ce126bb3305ae62ce4bb4b970c750a1c3) (1,001B) (mode 100644) [raw]
<?php
require_once($INC . "/util.inc.php");
require_once($INC . "/log.inc.php");
require_once($INC . "/sql.inc.php");
require_once($INC . "/user.inc.php");
require_once($INC . "/repo.inc.php");
require_once($INC . "/bug.inc.php");
require_once($INC . "/keys.inc.php");
require_once($INC . "/prof.inc.php");
require_once($INC . "/watch.inc.php");

/*
 * Main entry point
 */
function rg_api($db, $a)
{
	rg_prof_start('api');
	rg_log_enter('api: a=' . rg_array2string($a));

	$ret = array();
	while (1) {
		$a['cui'] = rg_user_info($db, $a['connect_uid'], '', '');
		if ($a['cui']['exists'] != 1) {
			$ret = array('error' => 'internal error');
			break;
		}

		if (strncmp($a['cmd'], 'user', 4) == 0) {
			$ret = rg_user_api($db, $a);
			break;
		}

		if (strncmp($a['cmd'], 'repo', 4) == 0) {
			$ret = rg_repo_api($db, $a);
			break;
		}

		$ret['error'] = 'invalid command';
		break;
	}

	$ret = json_encode($ret, JSON_PRETTY_PRINT) . "\n";

	rg_log_exit();
	rg_prof_end('api');
	return $ret;
}

?>
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master