Merge pull request #8 from EaterOfCode/master
Update release to new version with new fancy featuresmaster
commit
6498a21b56
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$basedir = realpath(__DIR__ . '/../');
|
||||
# All calls are now relative to the root directory
|
||||
chdir($basedir);
|
||||
|
||||
include $basedir . '/vendor/autoload.php';
|
||||
|
||||
$core = new \Eater\Glim\Core();
|
||||
$core->startTimer(["total"]);
|
||||
$core->boot($basedir);
|
||||
echo $core->get('user')->createInvite();
|
||||
$core->endTimer(["total"]);
|
||||
|
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "$(realpath "$(dirname "$0")/..")";
|
||||
|
||||
composer install;
|
||||
mkdir storage;
|
||||
touch storage/db.sqlite;
|
||||
./vendor/bin/propel sql:build
|
||||
./vendor/bin/propel sql:insert;
|
||||
|
||||
echo "Done setting up web environment"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"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;EACf,OAAO,EAAE,IAAI;;AAEf,oCAAmC;EACjC,8BAA8B;IAC5B,OAAO,EAAE,IAAI;;EACf,iBAAiB;IACf,KAAK,EAAE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Y;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"],
|
||||
"names": [],
|
||||
"file": "main.css"
|
||||
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Eater\Glim\Handler\Panel;
|
||||
|
||||
|
||||
use Aura\Session\Segment;
|
||||
use Eater\Glim\Handler\Session;
|
||||
|
||||
class Invites extends Session
|
||||
{
|
||||
protected $shouldHaveUser = true;
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$user = $this->getUser();
|
||||
|
||||
$invites = $user->getInvites();
|
||||
|
||||
/** @var Segment $segment */
|
||||
$segment = $this->get('session')->getSegment('main');
|
||||
|
||||
return $this->render('panel/invites.html.twig', [
|
||||
'invites' => $invites,
|
||||
'error' => $segment->getFlash('error'),
|
||||
'used_invites' => $user->getUsedInvites(),
|
||||
'max_invites' => $user->getMaxInvites()
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Eater\Glim\Handler\Panel\Invites;
|
||||
|
||||
|
||||
use Eater\Glim\Handler\Session;
|
||||
use Eater\Glim\Service\User;
|
||||
use Aura\Session\Segment;
|
||||
|
||||
class Create extends Session
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->get('user');
|
||||
|
||||
$userModel = $this->getUser();
|
||||
|
||||
if ($userModel->getUsedInvites() < $userModel->getMaxInvites() || $userModel->getMaxInvites() === -1) {
|
||||
$user->createInvite($userModel);
|
||||
} else {
|
||||
/** @var Segment $segment */
|
||||
$segment = $this->get('session')->getSegment('main');
|
||||
$segment->setFlash('error', 'You dont have any invites anymore');
|
||||
}
|
||||
|
||||
return $this->redirect('/panel/invites');
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
{% extends "base_bootstrap.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h2 id="certificates">Invites <small>You used {{ used_invites }} from your {{ max_invites == -1 ? 'infinite' : max_invites }} invites</small></h2>
|
||||
</div>
|
||||
{% if error %}
|
||||
<div class="row">
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Invite</th>
|
||||
<th>
|
||||
{% if max_invites > used_invites or max_invites == -1 %}
|
||||
<form action="/panel/invites/create" method="post">
|
||||
<button class="btn btn-default pull-right" type="submit">Create new invite</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for invite in invites %}
|
||||
<tr>
|
||||
<td>
|
||||
<kbd>{{ invite.getInvite() }}</kbd>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-default">Copy</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="2">You don't have any invites :(</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue