mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
merge
This commit is contained in:
parent
36216fe118
commit
c770457883
@ -29,4 +29,4 @@ GROUP = None
|
|||||||
|
|
||||||
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
||||||
# browser
|
# browser
|
||||||
MAX_SIZE = 500 * 1000
|
MAX_SIZE = 1024 * 50
|
||||||
|
16
src/paste.py
16
src/paste.py
@ -153,15 +153,13 @@ class Paste(object):
|
|||||||
if self.expiration == "burn_after_reading":
|
if self.expiration == "burn_after_reading":
|
||||||
self.expiration = self.expiration + '#%s' % datetime.now()
|
self.expiration = self.expiration + '#%s' % datetime.now()
|
||||||
|
|
||||||
# write the paste
|
# write the paste
|
||||||
try:
|
with open(self.path, 'w') as f:
|
||||||
with open(self.path, 'w') as f:
|
f.write(unicode(self.expiration) + '\n')
|
||||||
f.write(unicode(self.expiration) + '\n')
|
f.write(self.content + '\n')
|
||||||
f.write(self.content + '\n')
|
if self.comments:
|
||||||
if self.comments:
|
f.write(comments)
|
||||||
f.write(comments)
|
|
||||||
except Exception as e:
|
|
||||||
import ipdb; ipdb.set_trace()
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
14
start.py
14
start.py
@ -54,11 +54,15 @@ def create_paste():
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
if content:
|
if content:
|
||||||
expiration = request.forms.get('expiration', u'burn_after_reading')
|
# check size of the paste. if more than settings return error without saving paste.
|
||||||
paste = Paste(expiration=expiration, content=content)
|
# prevent from unusual use of the system.
|
||||||
paste.save()
|
# need to be improved
|
||||||
return {'status': 'ok',
|
if len(content) < settings.MAX_SIZE:
|
||||||
'paste': paste.uuid}
|
expiration = request.forms.get('expiration', u'burn_after_reading')
|
||||||
|
paste = Paste(expiration=expiration, content=content)
|
||||||
|
paste.save()
|
||||||
|
return {'status': 'ok',
|
||||||
|
'paste': paste.uuid}
|
||||||
|
|
||||||
return {'status': 'error',
|
return {'status': 'error',
|
||||||
'message': u"Serveur error: the paste couldn't be saved. Please try later."}
|
'message': u"Serveur error: the paste couldn't be saved. Please try later."}
|
||||||
|
@ -259,6 +259,10 @@ button.btn, input[type="submit"].btn {
|
|||||||
top:-4px;
|
top:-4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#alert-template {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/** Progress bar */
|
/** Progress bar */
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
|
@ -74,4 +74,4 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
%rebase base
|
%rebase base
|
||||||
|
Loading…
Reference in New Issue
Block a user