Archived
1
0
Fork 0

initial commit

This commit is contained in:
Henrik Hautakoski 2017-09-01 17:10:27 +02:00
commit e869a1cab4
107 changed files with 9029 additions and 0 deletions

View file

@ -0,0 +1,61 @@
{%- macro max(a, b) %}
{% return a > b ? a : b %}
{%- endmacro %}
{%- macro min(a, b) %}
{% return a < b ? a : b %}
{%- endmacro %}
{% set pagination_slider = 2 %}
{% if (page.total_pages > 1) %}
<ul class="pagination">
{% if page.current !== page.before %}
<li>
<a href="{{ pagination_url ~ page.before }}">
{{ icon('android-arrow-back') }} Previous
</a>
</li>
{% endif %}
{% if page.total_pages > pagination_slider and page.current > pagination_slider %}
<li>
<a href="{{ pagination_url ~ 1 }}">1</a>
</li>
<li class="middle">
...
</li>
{% endif %}
{% for n in max(page.current - pagination_slider, 1)..min(page.current + pagination_slider, page.total_pages) %}
{% if (n == page.current) %}
<li class="active">
{% else %}
<li>
{% endif %}
<a href="{{ pagination_url ~ n }}">{{ n }}</a>
</li>
{% endfor %}
{% if page.total_pages > pagination_slider and page.current < page.total_pages - pagination_slider %}
<li class="middle">
...
</li>
<li>
<a href="{{ pagination_url ~ page.total_pages }}">{{ page.total_pages }}</a>
</li>
{% endif %}
{% if page.current !== page.next %}
<li>
<a href="{{ pagination_url ~ page.next }}">
Next {{ icon('android-arrow-forward') }}
</a>
</li>
{% endif %}
</ul>
{% endif %}

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,22 @@
{% set types = {
'error': 'danger',
'success': 'success',
'notice': 'info',
'warning': 'warning'
} %}
{% if (flash.has()) %}
{% for type, messages in flash.getMessages() %}
{% for message in messages %}
<div class="alert alert-{{ types[type] }} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>{{ type|capitalize }}</strong>
<p>
{{ message }}
</p>
</div>
{% endfor%}
{% endfor %}
{% endif %}

View file

@ -0,0 +1,19 @@
<footer class="footer">
<div class="footer-left">
Copyright &copy; 2017
<a target="_blank" href="http://www.shufflingpixels.com">
Shufflingpixels
</a>
</div>
<div class="footer-middle">
<a class="footer-button-top" href="#top">
{{ icon('android-arrow-dropup') }}
</a>
</div>
<div class="footer-right">
Version 0.1
</div>
</footer>

View file

@ -0,0 +1,20 @@
<div class="navigation" role="navigation">
<button class="menu-button" type="button" data-toggle="collapse" data-target="#main-menu" aria-expanded="false" aria-label="Toggle navigation">
<i class="icon ion-navicon-round"></i>
</button>
<ul class="navigation-user-menu">
{% if auth.hasIdentity() %}
<li>{{ icon('android-person') }} Signed in as <strong>{{ auth.getUser().username }}</strong></li>
<li>{{ link_to(['for': 'logout'], '<i class="icon ion-log-out"></i> Log out') }}</li>
{% else %}
<li>{{ link_to(['for': 'login'], '<i class="icon ion-log-in"></i> Login', 'class': 'login-button') }}</li>
{% endif %}
</ul>
<nav class="navigation-menu collapse" id="main-menu">
{{ menu.render(0) }}
</nav>
</div>

42
app/views/auth/index.volt Normal file
View file

@ -0,0 +1,42 @@
<div class="login-container section">
<h3>Login</h3>
<div class="alert alert-info">
<p class="text-center"><strong>Heads up!</strong> Signup is currently not available.</p>
<p>
Login using username/password can be setup after registration.
First time users can only register with third party services below
</p>
</div>
<span class="spacer"></span>
<form class="form" method="post" action="">
<div class="form-group">
{{ form.render('Email') }}
</div>
<div class="form-group">
{{ form.render('Password') }}
</div>
<div class="form-group">
{{ form.render('Login') }}
</div>
</form>
<span class="spacer"></span>
<div class="oauth">
<a class="button button-github" href="{{ url(['for': 'oauth', 'strategy': 'github']) }}">
{{ icon('social-github') }} GitHub
</a>
<a class="button button-google" href="{{ url(['for': 'oauth', 'strategy': 'google']) }}">
{{ icon('social-google') }} Google
</a>
</div>
</div>

View file

@ -0,0 +1,47 @@
{% if error %}
<p><strong>Error: </strong>{{ error }}</p>
{% else %}
<section>
<h2>Authentication sucessful</h2>
<p>Authentication is successful and auth response is <span>validated</span>.</p>
<p>Returned auth response:</p>
<table class="table table-striped">
<tbody>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
{% for key,auth in auths['auth'] %}
{% if auth is scalar %}
<tr>
<th> {{key }}</th>
<th> {{auth}} </th>
</tr>
{% else %}
<tr>
<th> {{key}} </th>
<td><ul>
{% for key1,item in auth %}
{% if key1 is sameas('image') %}
<li><strong>{{key1}}</strong>:<img src="{{item}}" width="100" height="100"> </li>
{% elseif key1 == 'urls' %}
<li><strong>{{key1}}</strong>: {{item['google']}} </li>
{% else %}
<li><strong>{{key1}}</strong>: {{item}} </li>
{% endif %}
{% endfor %}
</ul></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<h2>Raw response</h2>
{{"<pre>"}}
<?php print_r($auths);?>
</section>
{% endif %}

View file

@ -0,0 +1,14 @@
<div class="section">
<h1>Callback created</h1>
<p>Set this link as callback url for the service you want to debug:</p>
<strong>{{ serverUrl() }}{{ url(['for': 'cb-endpoint', 'id': id]) }}</strong>
<a class="button button-default" href="{{ url('/callback/show/' ~ id) }}">
{{ icon('eye') }} View
</a>
</div>

View file

@ -0,0 +1,69 @@
<div class="section">
<div class="clearfix">
<h2 class="pull-left">Callbacks</h2>
<div class="pull-right">
<a class="button button-large button-primary" href="{{ url('/callback/new') }}">
{{ icon('android-add') }} New
</a>
</div>
</div>
{% if page.items|length > 0 %}
<div class="callback-list">
{% for item in page.items %}
<div class="callback-list-item">
<div class="callback-list-item-header">
<a class="callback-list-item-name" href="/callback/show/{{ item.public_id }}">{{ item.name|e }}</a>
{% if item.countRequests() > 0 %}
<span class="badge badge-primary">
{{ item.countRequests() }} Requests
</span>
{% endif %}
</div>
<div class="callback-list-item-info">
<span>{{ icon('android-time') }} Created at: {{ item.created_at }}</span>
<span>
{{ icon('paper-airplane') }}
{% if item.countRequests() > 0 %}
Last request: {{ item.last_request }}
{% else %}
No requests yet.
{% endif %}
</span>
<span>
{{ icon('link') }}
{{ serverUrl() }}{{ url(['for': 'cb-endpoint', 'id': item.public_id]) }}
</span>
</div>
<a class="callback-list-item-arrow" href="/callback/show/{{ item.public_id }}">
{{ icon('android-arrow-dropright-circle') }}
</a>
</div>
{% endfor %}
</div>
{% else %}
<div class="blankslate">
<h3>No callbacks made yet.</h3>
<p><a href="{{ url('/callback/new') }}">Create</a> a callback to begin!</p>
</div>
{% endif %}
<nav class="text-center" aria-label="Page navigation">
{{ partial('pagination') }}
</nav>
</div>

View file

@ -0,0 +1,39 @@
<div class="section center-block" style="width: 400px">
<h2>Create callback</h2>
<!--
<form class="form-horizontal" method="post">
<div class="form-group">
<label class="col-sm-2 control-label" for="name">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" id="name">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" class="button button-brand" value="Create">
</div>
</div>
</form>
-->
<form class="form-horizontal" method="post">
<div class="form-group">
<label class="col-sm-2 control-label" for="name">Name</label>
<div class="col-sm-10">
{{ form.render('Name') }}
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
{{ form.render('Create') }}
</div>
</div>
</form>
</div>

View file

@ -0,0 +1,95 @@
<div class="section">
<div class="clearfix">
<h3 class="pull-left">{{ item.name|e }}</h3>
<h5 class="pull-right"><strong>Created at:</strong> {{ item.created_at }}</h5>
</div>
<div class="request-list" id="request-log" role="tablist" aria-multiselectable="true">
{% for index, req in page.items %}
<div class="request-list-item">
<a class="request-list-item-header collapsed" href="#request{{ index }}"
data-toggle="collapse" data-parent="#request-log"
aria-expanded="true" aria-controls="request{{ index }}">
<span class="request-list-item-header-index">
#{{ index + 1 }}
</span>
<span class="request-list-item-header-timestamp">
{{ icon('android-time') }} {{ req.getTimestamp() }}
</span>
<span class="request-list-item-header-type">
{{ icon('android-list') }} {{ req.getType() }}
</span>
<span class="request-list-item-header-size">
{{ icon('cube') }} {{ req.getSize() }} b
</span>
</a>
<div class="collapse" id="request{{ index }}"
role="tabpanel" aria-labelledby="head{{ index }}">
<div class="request-list-item-detail">
<button class="request-list-item-detail-button" type="button"
data-toggle="collapse" data-target="#headers{{ index }}"
aria-expanded="false" aria-controls="headers{{ index }}">
Headers
</button>
<div class="collapse" id="headers{{ index }}">
<table class="request-list-item-detail-headers">
<thead>
<th class="request-list-item-detail-headers-key">Key</th>
<th class="request-list-item-detail-headers-value">Value</th>
</thead>
<tbody>
{% for key, val in req.getHeaders() %}
<tr>
<td><strong>{{ key|e }}</strong></td>
<td>{{ val|e }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<button class="request-list-item-detail-button" type="button"
data-toggle="collapse" data-target="#body{{ index }}"
aria-expanded="false" aria-controls="body{{ index }}">
Body
</button>
<div class="request-list-item-detail-body collapse in" id="body{{ index }}">
{% if (req.getBody()|length < 1) %}
<div class="blankslate blankslate-sm">
<h3>Empty body</h3>
</div>
{% else %}
<pre>{{ req.getBody() }}</pre>
{% endif %}
</div>
</div>
</div>
</div>
{% else %}
<div class="blankslate">
<h3>No requests made yet.</h3>
<p>No http requests has been made to this callback.</p>
</div>
{% endfor %}
</div>
<nav class="text-center" aria-label="Page navigation">
{{ partial('pagination') }}
</nav>
</div>

View file

@ -0,0 +1,2 @@
<h1>Error</h1>

View file

@ -0,0 +1,4 @@
<div class="text-center">
<h1>404 not found</h1>
</div>

View file

@ -0,0 +1,64 @@
<div class="about">
<div class="about-main">
<div class="section">
<div class="section-header">
<h1>About</h1>
</div>
<p>
httpcb was created because I needed to debug some API's with
the callback concept over the years (The problem is you can't call
your local webserver most of the time because it's behind NAT and
your development server is not configured to handle public traffic etc.)
</p>
<p>
There is ofcourse alot of similar applications out there
(alot of people run into the <i>"local dev server"</i>-problem).
However. They where mostly annoying with trail periods, super
advanced UI and limited amount of requests. etc. So i decided to
make my own.
</p>
<p>
Later this project evolved to be my
<i>"try that new thing"</i>-project.
So now, it serves as both a quick tool to check the HTTP request
some API will send you and a place where i can try out new web technologies.
And because the whole point of this application is that it's on a public webserver.
Why not let others use it if they want!
</p>
<p>
So if you want you can send me a <a href="mailto:henrik.hautakoski@gmail.com">email</a>
if you find a bug, request som future or just to let me know that i helped someone with debugging.
</p>
</div>
</div>
<div class="about-reference">
<div class="section">
<h4 class="text-center">Built with</h4>
<div class="phalcon">
<a target="_blank" href="http://phalconphp.com">
<img class="img-responsive" src="/img/phalcon-php.png" />
</a>
</div>
<br/>
<div class="text-center">
<a target="_blank" href="http://getbootstrap.com">
<img height="40" src="/img/bootstrap-solid.svg" />
Bootstrap
</a>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,32 @@
<div class="feature-section">
<div class="section-header">
<h1>How Does It Work?</h1>
</div>
<div class="steps">
<div class="steps-step1">
<div class="steps-img"></div>
<h3>1. Create a new Callback</h3>
<p>Register a callback and you will be given a unique url</p>
</div>
<div class="steps-step2">
<div class="steps-img"></div>
<h3>2. Set endpoint URL</h3>
<p>Configure your API that you want to test to send to that url</p>
</div>
<div class="steps-step3">
<div class="steps-img"></div>
<h3>3. Monitor traffic</h3>
<p>Make API Calls and watch what your API will send you</p>
</div>
</div>
<div class="text-center">
<a href="/callback/new" class="button button-large button-brand">Get started</a>
</div>
</div>

View file

@ -0,0 +1,23 @@
{% extends 'layout.volt' %}
{% block masthead %}
<div class="masthead">
<h1>Welcome to HTTP Callback</h1>
<p>
This tool is created to help developers integrate
API's that uses HTTP Callbacks. Give it a go!
</p>
<p>
Find out what HTTP Callback can do for you today!
</p>
<a class="button button-large masthead-get-started-button" href="/callback/new">Get started</a>
</div>
{% endblock %}

35
app/views/layout.volt Normal file
View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
{{ assets.outputCss() }}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTTP Callback</title>
</head>
<body>
{% block body %}{% endblock %}
<header class="head-section">
<div class="top-section">
{% include "_templates/navigation.volt" %}
</div>
{% block masthead %}{% endblock %}
</header>
<main class="content-section">
{% include "_templates/flash.volt" %}
{{ content() }}
</main>
<div class="footer-section">
{% include "_templates/footer.volt" %}
</div>
{{ assets.outputJs() }}
</body>
</html>