show contributors and add GitHub and Stash service

master
Corne Oppelaar 9 years ago
parent 10aa559703
commit 530b9de718

@ -17,7 +17,8 @@
"hassankhan/config": "0.10.0", "hassankhan/config": "0.10.0",
"monolog/monolog": "1.18.1", "monolog/monolog": "1.18.1",
"aura/session": "2.0.1", "aura/session": "2.0.1",
"guzzlehttp/guzzle": "^6.2" "guzzlehttp/guzzle": "^6.2",
"tedivm/stash": "^0.14.1"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

110
composer.lock generated

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "95b6dc2302dd6086dbc2b7248a1f5768", "hash": "7f7a5098d89b4841741255592bee1890",
"content-hash": "61847eefe53610226629206b81b6f8b5", "content-hash": "045408fd26a025036d65a2e00bb8a369",
"packages": [ "packages": [
{ {
"name": "aura/session", "name": "aura/session",
@ -558,6 +558,52 @@
], ],
"time": "2015-06-27 11:58:48" "time": "2015-06-27 11:58:48"
}, },
{
"name": "psr/cache",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"time": "2015-12-11 02:52:07"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "1.0", "version": "1.0",
@ -1167,6 +1213,66 @@
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-03-04 07:54:35" "time": "2016-03-04 07:54:35"
}, },
{
"name": "tedivm/stash",
"version": "v0.14.1",
"source": {
"type": "git",
"url": "https://github.com/tedious/Stash.git",
"reference": "bcb739b08b22571e35589ebe5403af9b89a33394"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tedious/Stash/zipball/bcb739b08b22571e35589ebe5403af9b89a33394",
"reference": "bcb739b08b22571e35589ebe5403af9b89a33394",
"shasum": ""
},
"require": {
"php": "^5.4|^7.0",
"psr/cache": "~1.0"
},
"provide": {
"psr/cache-implementation": "1.0.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "^1.9",
"phpunit/phpunit": "4.8.*",
"satooshi/php-coveralls": "1.0.*"
},
"type": "library",
"autoload": {
"psr-4": {
"Stash\\": "src/Stash/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Robert Hafner",
"email": "tedivm@tedivm.com"
},
{
"name": "Josh Hall-Bachner",
"email": "charlequin@gmail.com"
}
],
"description": "The place to keep your cache.",
"homepage": "http://github.com/tedious/Stash",
"keywords": [
"apc",
"cache",
"caching",
"memcached",
"psr-6",
"psr6",
"redis",
"sessions"
],
"time": "2016-02-10 22:23:16"
},
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v1.24.0", "version": "v1.24.0",

@ -3,9 +3,10 @@ core:
level: debug level: debug
debug: true debug: true
container: container:
name: "Glim" name: "Zer.ooo"
author: "Corné Oppelaar <hello@eaterofco.de>" author: "EaterOfCode"
sessionName: '0sess' sessionName: '0sess'
github-repo: 'EaterOfCode/zer.ooo'
services: services:
slim: Eater\Glim\Service\Slim slim: Eater\Glim\Service\Slim
user: Eater\Glim\Service\User user: Eater\Glim\Service\User
@ -13,4 +14,6 @@ core:
twig: Eater\Glim\Service\Twig twig: Eater\Glim\Service\Twig
twig-vars: Eater\Glim\Service\TwigVars twig-vars: Eater\Glim\Service\TwigVars
ca: Eater\Glim\Service\CA ca: Eater\Glim\Service\CA
server: Eater\Glim\Service\Server server: Eater\Glim\Service\Server
stash: Eater\Glim\Service\Stash
github: Eater\Glim\Service\GitHub

@ -151,18 +151,27 @@ body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center; }
height: 20vh; }
.footer-page a { .footer-page a {
color: black; } color: black; }
.footer-page h1 { .footer-page-title, .footer-page h1, .footer-page h2 {
font-family: 'Inconsolata'; font-family: 'Inconsolata';
font-size: 1.5em;
color: #E08E79; color: #E08E79;
letter-spacing: 3pt; letter-spacing: 3pt;
font-weight: lighter; } font-weight: lighter;
text-transform: lowercase; }
.footer-page h1 {
font-size: 1.5em; }
.footer-page h2 {
font-size: 1.2em;
font-weight: bold; }
.footer-page h2 a {
margin-right: -3pt; }
.login-page { .login-page {
background: linear-gradient(#070a15, #252b46); background: linear-gradient(#070a15, #252b46);

@ -1,6 +1,6 @@
{ {
"version": 3, "version": 3,
"mappings": "AAAQ,0BAAe;AACf,yBAAc;AAGd,uBAAY;AAGZ,6IAAqI;AACrI,6GAAqG;ACR7G,SAAS;EACP,eAAe,EAAE,IAAI;EACrB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;EACV,QAAQ,EAAE,MAAM;;AAElB,YAAY;EACV,KAAK,EAAE,IAAI;;AAEb,cAAc;EACZ,OAAO,EAAE,YAAY;EACrB,OAAO,EAAE,SAAS;EAClB,eAAe,EAAE,IAAI;EACrB,SAAS,EAAE,IAAI;EACf,gBAAgB,EAAE,IAAI;EACtB,MAAM,EAAE,eAAe;EACvB,aAAa,EAAE,GAAG;EAClB,KAAK,EAAE,OAAO;;AAEhB,oBAAoB;EAClB,gBAAgB,EAAE,OAAO;EACzB,eAAe,EAAE,IAAI;;AAEvB,iBAAiB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;EAEd,SAAS,EAAE,KAAK;EAChB,WAAW,EAAE,IAAI;;AAGnB,iBAAkB;EAChB,YAAY,EAAE,IAAI;;AAIpB,WAAY;EACV,UAAU,EAAE,iCAAiC;EAAE,qBAAqB;EACpE,OAAO,EAAE,IAAI;EACb,eAAe,EAAE,MAAM;EAAE,sBAAsB;EAC/C,WAAW,EAAE,MAAM;EAAE,oBAAoB;EACzC,cAAc,EAAE,MAAM;EACtB,OAAO,EAAE,IAAI;;AAGf,gBAAiB;EACf,WAAW,EAAE,mBAAmB;EAChC,SAAS,EAAE,GAAG;EACd,WAAW,EAAE,KAAK;EAClB,cAAc,EAAE,SAAS;EACzB,KAAK,EAAE,OAAO;EA3Id,WAAW,EAFC,uOAAmD;;AAgJjE,gBAAiB;EACf,gBAAgB,EAAE,IAAI;EACtB,OAAO,EAAE,KAAK;EACd,UAAU,EAAE,UAAU;EACtB,aAAa,EAAE,GAAG;EAClB,UAAU,EAAE,CAAC;EACb,aAAa,EAAE,iBAAiB;EAChC,YAAY,EAAE,iBAAiB;EAC/B,WAAW,EAAE,CAAC;;AAGhB,WAAY;EACV,UAAU,EAAE,iCAAiC;EAAE,qBAAqB;EACpE,OAAO,EAAE,IAAI;EACb,cAAc,EAAE,MAAM;EACtB,eAAe,EAAE,MAAM;EACvB,WAAW,EAAE,MAAM",
"sources": ["main.scss","navigation.sass","forms.sass"], "sources": ["main.scss","navigation.sass","forms.sass"],
"names": [], "names": [],
"file": "main.css" "file": "main.css"

@ -109,19 +109,35 @@ body {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 20vh;
} }
.footer-page a { .footer-page a {
color: black color: black
} }
.footer-page h1 {
.footer-page-title {
font-family: 'Inconsolata'; font-family: 'Inconsolata';
font-size: 1.5em;
color: #E08E79; color: #E08E79;
letter-spacing: 3pt; letter-spacing: 3pt;
font-weight: lighter; font-weight: lighter;
text-transform: lowercase;
}
.footer-page h1 {
@extend .footer-page-title;
font-size: 1.5em;
}
.footer-page h2 {
@extend .footer-page-title;
font-size: 1.2em;
font-weight: bold;
}
.footer-page h2 a {
margin-right: -3pt;
} }
// login page // login page

@ -1,6 +1,6 @@
<?php <?php
if (is_file(__DIR__ . $_SERVER["REQUEST_URI"]) && preg_match('/\.(?:png|jpg|jpeg|gif|css|js|eot|svg|ttf|woff|woff2)$/', $_SERVER["REQUEST_URI"])) { if (is_file(__DIR__ . $_SERVER["REQUEST_URI"]) && preg_match('/\.(?:png|jpg|jpeg|gif|css|js|eot|svg|ttf|woff|woff2|map)$/', $_SERVER["REQUEST_URI"])) {
return false; // serve the requested resource as-is. return false; // serve the requested resource as-is.
} }

@ -0,0 +1,17 @@
Zerooo.whenReady(function() {
Zerooo.getJSON('https://api.github.com/repos/EaterOfCode/zer.ooo/contributors', function (err, data) {
if (err) return;
var contributors = data.filter(function (data) {
// It's me!
return data.id !== 1922630;
});
var html = Zerooo.joinHumanReadable(contributors.map(function (contributor) {
return '<a href="' + contributor.html_url + '">' + contributor.login + '</a>';
}));
Zerooo.select('#contributors').innerHTML = html;
Zerooo.select('#contributors-container').style.display = 'block';
});
});

@ -0,0 +1,81 @@
Zerooo = {};
Zerooo.getJSON = function (url, callback) {
var x = new XMLHttpRequest();
var callbackSent = false;
x.open("GET", url, true);
x.onerror = function (message, source, lineno, colno, error) {
if (!callbackSent) {
sendCallback(error);
}
};
x.onreadystatechange = function () {
if (x.readyState != 4) return;
if (x.status !== 200) {
sendCallback(new Error(url + " responded with status code " + x.status));
return;
}
var data = x.responseText;
var json = null;
try {
json = JSON.parse(data);
} catch (e) {
sendCallback(e)
}
sendCallback(null, json);
};
x.send();
function sendCallback(err, data)
{
if (!callbackSent) {
callbackSent = true;
callback(err, data || null);
}
}
};
Zerooo.whenReady = function (callback) {
if (document.readyState == "complete") {
setTimeout(callback, 0);
return;
}
document.onreadystatechange = function () {
if (document.readyState == "complete") {
callback();
}
}
};
Zerooo.select = function (sel) {
return document.querySelector(sel);
};
Zerooo.selectAll = function (sel) {
return document.querySelectorAll(sel);
};
Zerooo.joinHumanReadable = function (arr) {
if (arr.length === 0) {
return "";
}
if (arr.length === 1) {
return arr.shift();
}
var str = arr.shift();
while (arr.length > 1) {
str += ', ' + arr.shift();
}
return str + " and " + arr.shift();
};

@ -362,5 +362,4 @@ class Core implements ContainerInterface
{ {
$this->getSlim()->run(); $this->getSlim()->run();
} }
} }

@ -2,10 +2,31 @@
namespace Eater\Glim\Handler; namespace Eater\Glim\Handler;
use Eater\Glim\Service\GitHub;
class Home extends Session class Home extends Session
{ {
function handle() function handle()
{ {
return $this->render("home.html.twig"); /** @var GitHub $github */
$github = $this->get('github');
/** @var string $repo */
$repo = $this->get('github-repo');
/** @var string $author */
$author = $this->get('author');
$info = $github->getRepoInfo();
if ($info !== false) {
$author = $info['owner']['login'];
}
return $this->render("home.html.twig", [
'author' => $author,
'contributors' => $github->getContributors(),
'githubRepo' => $repo
]);
} }
} }

@ -0,0 +1,85 @@
<?php
namespace Eater\Glim\Service;
use Stash\Pool;
class GitHub extends Main
{
public function getContributors() {
/** @var Pool $pool */
$pool = $this->get('stash');
$contributors = $pool->getItem('github/contributors');
if ($contributors->isMiss()) {
$contributorsData = [];
try {
$contributorsJson = @$this->fetch('/repos/' . $this->get('github-repo') . '/contributors');
$contributorsNewData = json_decode($contributorsJson, true);
if ($contributorsNewData !== null) {
$contributorsData = $contributorsNewData;
}
} catch (\Exception $e) {
}
$info = $this->getRepoInfo();
if ($info !== false) {
$ownerId = $info['owner']['id'];
$contributorsNewData = [];
foreach ($contributorsData as $contributor) {
if ($contributor['id'] !== $ownerId) {
$contributorsNewData[] = $contributor;
}
}
$contributorsData = $contributorsNewData;
}
$contributors->expiresAfter(3600);
$contributors->set($contributorsData);
$contributors->save();
}
return $contributors->get();
}
public function getRepoInfo() {
/** @var Pool $pool */
$pool = $this->get('stash');
$info = $pool->getItem('github/info');
if ($info->isMiss()) {
$infoData = false;
try {
$infoJson = @$this->fetch('/repos/' . $this->get('github-repo'));
$infoNewData = json_decode($infoJson, true);
if ($infoNewData !== null) {
$infoData = $infoNewData;
}
} catch (\Exception $e) {
}
$info->expiresAfter(3600);
$info->set($infoData);
$info->save();
}
return $info->get();
}
private function fetch($path)
{
$options = array('http' => array('user_agent'=> $_SERVER['HTTP_USER_AGENT']));
$context = stream_context_create($options);
return file_get_contents('https://api.github.com' . $path, false, $context);
}
}

@ -0,0 +1,15 @@
<?php
namespace Eater\Glim\Service;
use Stash\Pool;
use Stash\Driver\FileSystem;
class Stash
{
static public function init() {
$driver = new FileSystem();
$pool = new Pool($driver);
return $pool;
}
}

@ -1,4 +1,8 @@
{% extends "base.html.twig" %} {% extends "base.html.twig" %}
{% block head %}
<script src="/js/zerooo.js"></script>
<script src="/js/home.js"></script>
{% endblock %}
{% block content %} {% block content %}
<div class="intro-page"> <div class="intro-page">
<div class="intro-page-logo">zer.ooo</div> <div class="intro-page-logo">zer.ooo</div>
@ -36,7 +40,15 @@
</div> </div>
</div> </div>
<div class="footer-page"> <div class="footer-page">
<h1>an eaterofcode production</h1> <h1>an {{ author }} production</h1>
<a href="/"><i class="fa fa-github fa-4x" aria-hidden="true"></i></a> <a href="https://github.com/{{ githubRepo }}"><i class="fa fa-github fa-4x" aria-hidden="true"></i></a>
{% if contributors|length > 0 %}
<h2>with the help of
{% for contributor in contributors %}
{% if loop.index0 < (loop.length - 1) and loop.index0 > 0 %}, {% elseif loop.index0 == (loop.length - 1) %} and {% endif %}
<a href="{{ contributor.html_url }}">{{ contributor.login }}</a>
{% endfor %}
</h2>
{% endif %}
</div> </div>
{% endblock %} {% endblock %}

Loading…
Cancel
Save