1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

added email settings

This commit is contained in:
max 2012-05-06 18:54:57 +07:00
parent a2edd3fe31
commit 3eb9ea89fb
10 changed files with 47 additions and 24 deletions

View File

@ -31,3 +31,7 @@ GROUP = None
# browser
MAX_SIZE = 1024 * 500
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))
# Email for contact
EMAIL = "your@email.com"

View File

@ -9,5 +9,5 @@ import sys
import settings
from paste import Paste
from utils import drop_privileges
from utils import drop_privileges, dmerge

View File

@ -29,4 +29,17 @@ def drop_privileges():
drop_privileges_permanently(settings.USER, settings.GROUP, ())
except Exception:
print "Failed to drop privileges. Running with current user."
print "Failed to drop privileges. Running with current user."
def dmerge(*args):
"""
return new directionay being the sum of all merged dictionaries passed as arguments
"""
dictionary = {}
for arg in args:
dictionary.update(arg)
return dictionary

View File

@ -23,16 +23,19 @@ from bottle import (Bottle, route, run, abort, error,
import clize
from src import settings, Paste, drop_privileges
from src import settings, Paste, drop_privileges, dmerge
app = Bottle()
global_vars = {
'settings' : settings
}
@app.route('/')
@view('home')
def index():
return {'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
def index():
return global_vars
@app.route('/paste/create', method='POST')
@ -66,6 +69,7 @@ def create_paste():
@view('paste')
def display_paste(paste_id):
now = datetime.now()
keep_alive = False
try:
@ -93,14 +97,15 @@ def display_paste(paste_id):
#abort(404, u"This paste doesn't exist or has expired")
return error404(ValueError)
return {'paste': paste, 'keep_alive': keep_alive, 'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
context = {'paste': paste, 'keep_alive': keep_alive}
return dmerge(context, global_vars)
@app.error(404)
@view('404')
def error404(code):
return {'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
return global_vars
@clize.clize
def runserver(host=settings.HOST, port=settings.PORT, debug=settings.DEBUG,
@ -120,6 +125,8 @@ def runserver(host=settings.HOST, port=settings.PORT, debug=settings.DEBUG,
run(app, host=host, port=port, server="cherrypy")
if __name__ == "__main__":
clize.run(runserver)

View File

@ -176,8 +176,8 @@ li.L5, li.L6, li.L7, li.L8, li.L9
list-style-type: decimal;
background: inherit;
}
.prettyprint.linenums {
.margin-color {
-webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
-moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
@ -274,9 +274,4 @@ button.btn, input[type="submit"].btn {
text-indent: 10px;
text-align:left;
}
-webkit-transition: width 0.1s ease;
-moz-transition: width 0.1s ease;
-ms-transition: width 0.1s ease;
-o-transition: width 0.1s ease;
transition: width 0.1s ease;

View File

@ -409,6 +409,9 @@ if (content && key) {
/** Syntaxic coloration */
prettyPrint();
/** Add margin color */
$("#paste-content").addClass("margin-color");
/* Display result */
$loading.text('Done').css('width', '100%');
$bar.hide();

View File

@ -33,4 +33,4 @@
</form>
%rebase base max_size=max_size
%rebase base settings=settings

View File

@ -23,7 +23,7 @@
<script src="/static/js/jquery-1.7.2.min.js"></script>
<script src="/static/js/behavior.js"></script>
<script type="text/javascript">
zerobin.max_size = {{ get('max_size', -1)}};
zerobin.max_size = {{ settings.MAX_SIZE }};
</script>
</head>
@ -44,6 +44,7 @@
<ul class="nav">
<li class="active"><a href="/">Home</a></li>
<li><a href="https://github.com/sametmax/0bin">Download 0bin</a></li>
<li><a href="mailto:{{ settings.EMAIL }}">Contact us</a></li>
<!-- <li><a href="#faq">Faq</a></li> -->
</ul>
<p class="navbar-text pull-right"><i>"A client side encrypted PasteBin..."</i></p>
@ -90,7 +91,7 @@
<p class="greetings span12">
Based on an original idea from
<a href="http://sebsauvage.net/paste/">sebsauvage.net</a><br>
<a href="http://sametmax.com">Sam &amp; Max</a>
<a href="http://sametmax.com">Sam &amp; Max</a> | <a href="mailto:{{ settings.EMAIL }}"> Contact us</a>
</p>
</footer>

View File

@ -25,4 +25,4 @@
</form>
%rebase base max_size=max_size
%rebase base settings=settings

View File

@ -37,7 +37,7 @@
</div>
<p>
<pre id="paste-content" class="prettyprint linenums">
<pre id="paste-content" class="prettyprint linenums">
<code>
{{ paste.content }}
</code>
@ -74,4 +74,4 @@
</span>
%rebase base max_size=max_size
%rebase base settings=settings