remove admin interface fragments
This commit is contained in:
parent
2cac3f0567
commit
dea4c88162
@ -59,7 +59,7 @@ from jinja2 import Environment, FileSystemLoader
|
|||||||
from isso import db, migrate, views, wsgi
|
from isso import db, migrate, views, wsgi
|
||||||
from isso.core import ThreadedMixin, uWSGIMixin, Config
|
from isso.core import ThreadedMixin, uWSGIMixin, Config
|
||||||
from isso.utils import parse, http
|
from isso.utils import parse, http
|
||||||
from isso.views import comment, admin
|
from isso.views import comment
|
||||||
|
|
||||||
logging.getLogger('werkzeug').setLevel(logging.ERROR)
|
logging.getLogger('werkzeug').setLevel(logging.ERROR)
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@ -80,7 +80,6 @@ rules = Map([
|
|||||||
Rule('/count', methods=['GET'], endpoint=views.comment.count),
|
Rule('/count', methods=['GET'], endpoint=views.comment.count),
|
||||||
Rule('/delete/<string:auth>', endpoint=views.comment.delete),
|
Rule('/delete/<string:auth>', endpoint=views.comment.delete),
|
||||||
Rule('/activate/<string:auth>', endpoint=views.comment.activate),
|
Rule('/activate/<string:auth>', endpoint=views.comment.activate),
|
||||||
Rule('/admin/', endpoint=views.admin.index),
|
|
||||||
|
|
||||||
Rule('/check-ip', endpoint=views.comment.checkip)
|
Rule('/check-ip', endpoint=views.comment.checkip)
|
||||||
])
|
])
|
||||||
@ -173,7 +172,6 @@ def make_app(conf=None):
|
|||||||
logger.warn("unable to connect to HTTP server")
|
logger.warn("unable to connect to HTTP server")
|
||||||
|
|
||||||
app = ProxyFix(wsgi.SubURI(SharedDataMiddleware(isso.wsgi_app, {
|
app = ProxyFix(wsgi.SubURI(SharedDataMiddleware(isso.wsgi_app, {
|
||||||
'/static': join(dirname(__file__), 'static/'),
|
|
||||||
'/js': join(dirname(__file__), 'js/'),
|
'/js': join(dirname(__file__), 'js/'),
|
||||||
'/css': join(dirname(__file__), 'css/')
|
'/css': join(dirname(__file__), 'css/')
|
||||||
})))
|
})))
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<head>
|
|
||||||
|
|
||||||
<title>Hello World</title>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="/isso/css/isso.css" />
|
|
||||||
<script src="/isso/js/embed.min.js"></script>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 700px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr {
|
|
||||||
border: 0;
|
|
||||||
height: 1px;
|
|
||||||
background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
|
|
||||||
<header>
|
|
||||||
<h1>Hello World. Finally!</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
||||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
||||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
||||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
|
||||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
|
||||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
||||||
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
||||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
||||||
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
||||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
|
||||||
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
|
||||||
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<hr />
|
|
||||||
<div id="isso-thread"></div>
|
|
||||||
<noscript>
|
|
||||||
<p>Please enable JavaScript to view the comments powered by Isso™.</a></p>
|
|
||||||
</noscript>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
</article>
|
|
||||||
|
|
||||||
</body>
|
|
@ -1,28 +0,0 @@
|
|||||||
{% extends "base.j2" %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="span4">
|
|
||||||
|
|
||||||
<h2>Overview</h1>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><b>N</b> approved</li>
|
|
||||||
<li><b>N</b> pending</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><b>N</b> Threads</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="span8">
|
|
||||||
|
|
||||||
<h2>Recent Comments</h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,82 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Isso: Admin Console</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta name="description" content="">
|
|
||||||
<meta name="author" content="">
|
|
||||||
|
|
||||||
<!-- Le styles -->
|
|
||||||
<link href="../static/css/bootstrap.css" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
||||||
}
|
|
||||||
|
|
||||||
#footer {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container .credit {
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="../assets/js/html5shiv.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
||||||
<div class="navbar-inner">
|
|
||||||
<div class="container">
|
|
||||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>
|
|
||||||
<a class="brand" href="#">Isso</a>
|
|
||||||
<div class="nav-collapse collapse">
|
|
||||||
<ul class="nav">
|
|
||||||
<li class="active"><a href="#">Dashboard</a></li>
|
|
||||||
<li><a href="#about">About</a></li>
|
|
||||||
</ul>
|
|
||||||
</div><!--/.nav-collapse -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- /container -->
|
|
||||||
|
|
||||||
<footer id="footer">
|
|
||||||
<div class="container">
|
|
||||||
<p class="muted credit"><a href="https://github.com/posativ/isso">Isso</a> – Ich schrei sonst!</p>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<footer class="footer">
|
|
||||||
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<!-- Le javascript
|
|
||||||
================================================== -->
|
|
||||||
<!-- Placed at the end of the document so the pages load faster -->
|
|
||||||
<script src="../static/jquery.min.js"></script>
|
|
||||||
<script src="../static/js/bootstrap.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Sign in · Isso</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta name="description" content="">
|
|
||||||
<meta name="author" content="">
|
|
||||||
|
|
||||||
<!-- Le styles -->
|
|
||||||
<link href="../static/css/bootstrap.css" rel="stylesheet">
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
padding-top: 40px;
|
|
||||||
padding-bottom: 40px;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-signin {
|
|
||||||
max-width: 300px;
|
|
||||||
padding: 19px 29px 29px;
|
|
||||||
margin: 0 auto 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #e5e5e5;
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
|
|
||||||
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
|
|
||||||
box-shadow: 0 1px 2px rgba(0,0,0,.05);
|
|
||||||
}
|
|
||||||
.form-signin .form-signin-heading,
|
|
||||||
.form-signin .checkbox {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.form-signin input[type="text"],
|
|
||||||
.form-signin input[type="password"] {
|
|
||||||
font-size: 16px;
|
|
||||||
height: auto;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
padding: 7px 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="../assets/js/html5shiv.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
<form class="form-signin" action="/admin/", method="post">
|
|
||||||
<h2 class="form-signin-heading">Admin Interface</h2>
|
|
||||||
<input type="password" class="input-block-level" placeholder="secret" name="password">
|
|
||||||
<label class="checkbox">
|
|
||||||
<input type="checkbox" value="remember-me"> Remember me
|
|
||||||
</label>
|
|
||||||
<button class="btn btn-large btn-primary" type="submit">Sign in</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div> <!-- /container -->
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,28 +0,0 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
|
||||||
|
|
||||||
from os.path import join, dirname
|
|
||||||
|
|
||||||
from werkzeug.wrappers import Response
|
|
||||||
from werkzeug.exceptions import abort
|
|
||||||
from werkzeug.utils import redirect
|
|
||||||
|
|
||||||
from itsdangerous import SignatureExpired, BadSignature
|
|
||||||
|
|
||||||
|
|
||||||
def index(app, environ, request):
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
|
||||||
if request.form.get('password') == app.PASSPHRASE:
|
|
||||||
resp = redirect('/admin/', 301)
|
|
||||||
resp.set_cookie('admin', app.signer.dumps('*'), max_age=app.MAX_AGE)
|
|
||||||
return resp
|
|
||||||
else:
|
|
||||||
return abort(403)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
app.unsign(request.cookies.get('admin', ''))
|
|
||||||
except (SignatureExpired, BadSignature):
|
|
||||||
return Response(app.render('login.j2'), content_type='text/html')
|
|
||||||
|
|
||||||
ctx = {'app': app, 'request': request}
|
|
||||||
return Response(app.render('admin.j2', app=app, request=request), content_type='text/html')
|
|
Loading…
Reference in New Issue
Block a user