Refactor git and resume
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cbb7490069
commit
bd966f576b
@ -1,7 +1,15 @@
|
||||
<?php
|
||||
function getResumeReleases() {
|
||||
|
||||
class Gitea {
|
||||
private $giteaToken;
|
||||
|
||||
public function __construct(String $token) {
|
||||
$this->giteaToken = $token;
|
||||
}
|
||||
|
||||
public function getResumeReleases() : String {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, "https://git.clortox.com/api/v1/repos/tyler/Resume/releases?per_page=1&access_token=" . getenv("GITEA_TOKEN"));
|
||||
curl_setopt($curl, CURLOPT_URL, "https://git.clortox.com/api/v1/repos/tyler/Resume/releases?per_page=1&access_token=" . $this->giteaToken);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$result = curl_exec($curl);
|
||||
@ -14,11 +22,11 @@ function getResumeReleases() {
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getRecentProjects() {
|
||||
public function getRecentProjects() : array {
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, "https://git.clortox.com/api/v1/user/repos?page=1&limit=100&access_token=" . getenv("GITEA_TOKEN"));
|
||||
curl_setopt($curl, CURLOPT_URL, "https://git.clortox.com/api/v1/user/repos?page=1&limit=100&access_token=" . $this->giteaToken);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$result = curl_exec($curl);
|
||||
@ -42,11 +50,11 @@ function getRecentProjects() {
|
||||
usort($ret, "datecmp");
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function datecmp($lhs, $rhs) {
|
||||
return $lhs["updated_at"] < $rhs["updated_at"];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<link rel="stylesheet" href="/common/header.css">
|
||||
<nav class="navbar sticky">
|
||||
<a href="/">Home</a>
|
||||
<a href="/resume.php">Resume</a>
|
||||
<a href="/resume">Resume</a>
|
||||
<a href="https://git.clortox.com">Git</a>
|
||||
<a href="/utilities/">Utilities</a>
|
||||
<a href="https://wiki.clortox.com">Wiki</a>
|
||||
|
@ -32,7 +32,8 @@
|
||||
<h3>Projects</h3>
|
||||
<div>
|
||||
<?php
|
||||
$result = getRecentProjects();
|
||||
$giteaClient = new Gitea(getenv("GITEA_TOKEN"));
|
||||
$result = $giteaClient->getRecentProjects();
|
||||
array_splice($result, 6, -1);
|
||||
foreach($result as $item){
|
||||
if($item["private"])
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
include 'common/git.php';
|
||||
include '../common/git.php';
|
||||
|
||||
$parsed = json_decode(getResumeReleases(), true);
|
||||
$giteaClient = new Gitea(getenv('GITEA_TOKEN'));
|
||||
|
||||
$parsed = json_decode($giteaClient->getResumeReleases(), true);
|
||||
|
||||
$url = $parsed[0]["assets"][0]["browser_download_url"];
|
||||
if(!$url){
|
Reference in New Issue
Block a user