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:
parent
a2edd3fe31
commit
3eb9ea89fb
|
@ -31,3 +31,7 @@ GROUP = None
|
||||||
# browser
|
# browser
|
||||||
MAX_SIZE = 1024 * 500
|
MAX_SIZE = 1024 * 500
|
||||||
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))
|
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))
|
||||||
|
|
||||||
|
|
||||||
|
# Email for contact
|
||||||
|
EMAIL = "your@email.com"
|
|
@ -9,5 +9,5 @@ import sys
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
from paste import Paste
|
from paste import Paste
|
||||||
from utils import drop_privileges
|
from utils import drop_privileges, dmerge
|
||||||
|
|
||||||
|
|
15
src/utils.py
15
src/utils.py
|
@ -29,4 +29,17 @@ def drop_privileges():
|
||||||
|
|
||||||
drop_privileges_permanently(settings.USER, settings.GROUP, ())
|
drop_privileges_permanently(settings.USER, settings.GROUP, ())
|
||||||
except Exception:
|
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
|
23
start.py
23
start.py
|
@ -23,16 +23,19 @@ from bottle import (Bottle, route, run, abort, error,
|
||||||
|
|
||||||
import clize
|
import clize
|
||||||
|
|
||||||
from src import settings, Paste, drop_privileges
|
from src import settings, Paste, drop_privileges, dmerge
|
||||||
|
|
||||||
|
|
||||||
app = Bottle()
|
app = Bottle()
|
||||||
|
|
||||||
|
global_vars = {
|
||||||
|
'settings' : settings
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@view('home')
|
@view('home')
|
||||||
def index():
|
def index():
|
||||||
return {'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
|
return global_vars
|
||||||
|
|
||||||
|
|
||||||
@app.route('/paste/create', method='POST')
|
@app.route('/paste/create', method='POST')
|
||||||
|
@ -66,6 +69,7 @@ def create_paste():
|
||||||
@view('paste')
|
@view('paste')
|
||||||
def display_paste(paste_id):
|
def display_paste(paste_id):
|
||||||
|
|
||||||
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
keep_alive = False
|
keep_alive = False
|
||||||
try:
|
try:
|
||||||
|
@ -93,14 +97,15 @@ def display_paste(paste_id):
|
||||||
#abort(404, u"This paste doesn't exist or has expired")
|
#abort(404, u"This paste doesn't exist or has expired")
|
||||||
return error404(ValueError)
|
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)
|
@app.error(404)
|
||||||
@view('404')
|
@view('404')
|
||||||
def error404(code):
|
def error404(code):
|
||||||
return {'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
|
return global_vars
|
||||||
|
|
||||||
|
|
||||||
@clize.clize
|
@clize.clize
|
||||||
def runserver(host=settings.HOST, port=settings.PORT, debug=settings.DEBUG,
|
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")
|
run(app, host=host, port=port, server="cherrypy")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
clize.run(runserver)
|
clize.run(runserver)
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,8 @@ li.L5, li.L6, li.L7, li.L8, li.L9
|
||||||
list-style-type: decimal;
|
list-style-type: decimal;
|
||||||
background: inherit;
|
background: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.prettyprint.linenums {
|
.margin-color {
|
||||||
-webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
|
-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;
|
-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;
|
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-indent: 10px;
|
||||||
text-align:left;
|
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;
|
|
|
@ -409,6 +409,9 @@ if (content && key) {
|
||||||
/** Syntaxic coloration */
|
/** Syntaxic coloration */
|
||||||
prettyPrint();
|
prettyPrint();
|
||||||
|
|
||||||
|
/** Add margin color */
|
||||||
|
$("#paste-content").addClass("margin-color");
|
||||||
|
|
||||||
/* Display result */
|
/* Display result */
|
||||||
$loading.text('Done').css('width', '100%');
|
$loading.text('Done').css('width', '100%');
|
||||||
$bar.hide();
|
$bar.hide();
|
||||||
|
|
|
@ -33,4 +33,4 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
%rebase base max_size=max_size
|
%rebase base settings=settings
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<script src="/static/js/jquery-1.7.2.min.js"></script>
|
<script src="/static/js/jquery-1.7.2.min.js"></script>
|
||||||
<script src="/static/js/behavior.js"></script>
|
<script src="/static/js/behavior.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
zerobin.max_size = {{ get('max_size', -1)}};
|
zerobin.max_size = {{ settings.MAX_SIZE }};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li class="active"><a href="/">Home</a></li>
|
<li class="active"><a href="/">Home</a></li>
|
||||||
<li><a href="https://github.com/sametmax/0bin">Download 0bin</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> -->
|
<!-- <li><a href="#faq">Faq</a></li> -->
|
||||||
</ul>
|
</ul>
|
||||||
<p class="navbar-text pull-right"><i>"A client side encrypted PasteBin..."</i></p>
|
<p class="navbar-text pull-right"><i>"A client side encrypted PasteBin..."</i></p>
|
||||||
|
@ -90,7 +91,7 @@
|
||||||
<p class="greetings span12">
|
<p class="greetings span12">
|
||||||
Based on an original idea from
|
Based on an original idea from
|
||||||
<a href="http://sebsauvage.net/paste/">sebsauvage.net</a><br>
|
<a href="http://sebsauvage.net/paste/">sebsauvage.net</a><br>
|
||||||
<a href="http://sametmax.com">Sam & Max</a>
|
<a href="http://sametmax.com">Sam & Max</a> | <a href="mailto:{{ settings.EMAIL }}"> Contact us</a>
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|
|
@ -25,4 +25,4 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
%rebase base max_size=max_size
|
%rebase base settings=settings
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<pre id="paste-content" class="prettyprint linenums">
|
<pre id="paste-content" class="prettyprint linenums">
|
||||||
<code>
|
<code>
|
||||||
{{ paste.content }}
|
{{ paste.content }}
|
||||||
</code>
|
</code>
|
||||||
|
@ -74,4 +74,4 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
%rebase base max_size=max_size
|
%rebase base settings=settings
|
||||||
|
|
Loading…
Reference in New Issue
Block a user