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

Drop privilege

This commit is contained in:
sam 2012-04-29 04:51:54 +07:00
parent ea93fcf35e
commit 1a4c5d399b
6 changed files with 80 additions and 73 deletions

View File

@ -16,3 +16,14 @@ DEBUG = True
# default in projectdirectory/static/content/ # default in projectdirectory/static/content/
# use "/" even under Windows # use "/" even under Windows
PASTE_FILES_ROOT = os.path.join(STATIC_FILES_ROOT, 'content') PASTE_FILES_ROOT = os.path.join(STATIC_FILES_ROOT, 'content')
# Port and host the embeded python server should be using in prod and in dev
PROD_HOST = "0.0.0.0"
PROD_PORT= "80"
DEV_HOST = "127.0.0.1"
DEV_PORT= "8000"
# User and group the server should run as. Set to None if it should be the
# current user
USER = None
GROUP = None

View File

@ -156,10 +156,9 @@ li.L5, li.L6, li.L7, li.L8, li.L9
background: inherit; background: inherit;
} }
#clip-container div:hover, a#clip-button.hover{
#clip-button:hover,
#clip-button a:hover{
cursor:pointer; cursor:pointer;
text-decoration:underline;
} }
#copy-success, #short-url-success { #copy-success, #short-url-success {

View File

@ -81,6 +81,13 @@ zerobin = {
}else{ }else{
return 'Sorry your browser does not support LocalStorage, We cannot display your previous pastes.'; return 'Sorry your browser does not support LocalStorage, We cannot display your previous pastes.';
} }
},
get_paste_content: function(){
var content_clone = '' ;
$("#paste-content li").each(function(index) {
content_clone = content_clone + $(this).text() + '\n';
});
return content_clone;
} }
}; };
@ -152,17 +159,15 @@ if (content && key) {
/* Setup flash clipboard button */ /* Setup flash clipboard button */
ZeroClipboard.setMoviePath('/static/js/ZeroClipboard.swf' ); ZeroClipboard.setMoviePath('/static/js/ZeroClipboard.swf' );
var clip = new ZeroClipboard.Client();
clip.addEventListener('onMouseUp', function(){ var clip = new ZeroClipboard.Client();
clip.setText($('#paste-content').text()); clip.addEventListener('mouseup', function(){
clip.setText(zerobin.get_paste_content());
}); });
clip.addEventListener('complete', function(){ clip.addEventListener('complete', function(){
$('#copy-success').show('fadeUp'); $('#copy-success').show('fadeUp', function(){clip.reposition()});
}); });
clip.addEventListener('onLoad', function(){ clip.glue('clip-button');
});
clip.glue('clip-button', 'clip-container' );
window.onresize = clip.reposition; window.onresize = clip.reposition;
} }
@ -200,10 +205,7 @@ $('.previous-pastes .items').html(zerobin.get_pastes());
/* clone a paste */ /* clone a paste */
$('.btn-clone').click(function(e){ $('.btn-clone').click(function(e){
e.preventDefault(); e.preventDefault();
var content_clone = '' ; var content_clone = zerobin.get_paste_content();
$("#paste-content li").each(function(index) {
content_clone = content_clone + $(this).text() + '\n';
});
$('.submit-form').show(); $('.submit-form').show();
$('.paste-form').remove(); $('.paste-form').remove();
$('#content').val(content_clone); $('#content').val(content_clone);

File diff suppressed because one or more lines are too long

View File

@ -22,9 +22,8 @@
<div class="well paste-form"> <div class="well paste-form">
<form action="/" method="get" accept-charset="utf-8"> <form action="/" method="get" accept-charset="utf-8">
<p> <p>
<span id="clip-container" style="position:relative">
<a id="clip-button">Copy To Clipboard</a> <a id="clip-button">Copy To Clipboard</a>
</span> | |
<a id="short-url" href="" <a id="short-url" href=""
target="_blank">Get short url</a> target="_blank">Get short url</a>