Merge branch 'pr/85'

This commit is contained in:
Martin Zimmermann 2014-04-24 17:39:31 +02:00
commit d3aa8129c4
3 changed files with 26 additions and 2 deletions

View File

@ -180,7 +180,9 @@ def make_app(conf=None, threading=True, multiprocessing=False, uwsgi=False):
wrapper.append(partial(SharedDataMiddleware, exports={
'/js': join(dirname(__file__), 'js/'),
'/css': join(dirname(__file__), 'css/')}))
'/css': join(dirname(__file__), 'css/'),
'/demo': join(dirname(__file__), 'demo/')
}))
wrapper.append(partial(wsgi.CORSMiddleware,
origin=origin(isso.conf.getiter("general", "host")),

16
isso/demo/index.html Normal file
View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<head>
<title>Isso Demo</title>
<meta charset="utf-8">
</head>
<body>
<div id="page" style="text-align:center;">
<div id="wrapper" style="width: 900px; text-align: left; margin-left: auto; margin-right: auto;">
<h2><a href="index.html">Isso Demo</a></h2>
<script src="../js/embed.min.js"></script>
<section id="isso-thread" data-title="Isso Test"></section>
</div>
</div>
</body>

View File

@ -12,6 +12,8 @@ from werkzeug.http import dump_cookie
from werkzeug.routing import Rule
from werkzeug.wrappers import Response
from werkzeug.exceptions import BadRequest, Forbidden, NotFound
from werkzeug.wsgi import get_current_url
from werkzeug.utils import redirect
from isso.compat import text_type as str
@ -69,7 +71,8 @@ class API(object):
('moderate',('POST', '/id/<int:id>/<any(activate,delete):action>/<string:key>')),
('like', ('POST', '/id/<int:id>/like')),
('dislike', ('POST', '/id/<int:id>/dislike')),
('checkip', ('GET', '/check-ip'))
('checkip', ('GET', '/check-ip')),
('demo', ('GET', '/demo'))
]
def __init__(self, isso):
@ -375,3 +378,6 @@ class API(object):
def checkip(self, env, req):
return Response(utils.anonymize(str(req.remote_addr)), 200)
def demo(self, env, req):
return redirect(get_current_url(env) + '/index.html')