mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Added email obfuscation and dynamic menu entry
This commit is contained in:
parent
5240bf5614
commit
230b762bf4
@ -31,8 +31,13 @@ GROUP = None
|
||||
MAX_SIZE = 1024 * 500
|
||||
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))
|
||||
|
||||
# Email for contact
|
||||
EMAIL = "your@email.com"
|
||||
# Names/links to insert in the menu bar.
|
||||
# Any link with "mailto:" will be escaped to prevent spam
|
||||
MENU = (
|
||||
('Home', '/'), # internal link
|
||||
('Download 0bin', 'https://github.com/sametmax/0bin'), # external link
|
||||
('Contact', 'mailto:your@email.com') # email
|
||||
)
|
||||
|
||||
# this import a file named settings_local.py if it exists
|
||||
# you may want to create such a file to have different settings
|
||||
|
@ -28,6 +28,14 @@ PORT= "8000"
|
||||
USER = None
|
||||
GROUP = None
|
||||
|
||||
# Names/links to insert in the menu bar.
|
||||
# Any link with "mailto:" will be escaped to prevent spam
|
||||
MENU = (
|
||||
('Home', '/'), # internal link. First link will be highlited
|
||||
('Download 0bin', 'https://github.com/sametmax/0bin'), # external link
|
||||
('Contact', 'mailto:your@email.com') # email
|
||||
)
|
||||
|
||||
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
||||
# browser
|
||||
MAX_SIZE = 1024 * 500
|
||||
|
@ -234,12 +234,23 @@ zerobin = {
|
||||
},
|
||||
|
||||
/** Return an link object with the URL as href so you can extract host,
|
||||
protocol, hash, etc*/
|
||||
parseUrl: function(url){
|
||||
var a = document.createElement('a');
|
||||
a.href = url
|
||||
return a
|
||||
},
|
||||
protocol, hash, etc.
|
||||
|
||||
This function use a closure to store a <div> parent for the <a>
|
||||
because IE requires the link be processed by it's HTML parser
|
||||
for the URL to be parsed. */
|
||||
parseUrl: (function(){
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = "<a></a>";
|
||||
|
||||
return function(url){
|
||||
div.firstChild.href = url;
|
||||
div.innerHTML = div.innerHTML;
|
||||
return div.firstChild;
|
||||
};
|
||||
|
||||
})(),
|
||||
|
||||
getPasteId: function(url){
|
||||
loc = url ? zerobin.parseUrl(url) : window.location
|
||||
@ -631,5 +642,17 @@ $(".close").on('click', function(e){
|
||||
});
|
||||
|
||||
|
||||
/* Parse obfuscaded emails and make them usable */
|
||||
$('.email-link').each(function(i, elem){
|
||||
var $obfuscatedEmail = $(this);
|
||||
var address = $obfuscatedEmail.attr('title').replace('__AT__', '@');
|
||||
var text = $obfuscatedEmail.text().replace('__AT__', '@');
|
||||
var $plainTextEmail = $('<a href="mailto:' + address + '">'+ text +'</a>');
|
||||
$obfuscatedEmail.replaceWith($plainTextEmail);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
}); /* End of "document ready" jquery callback */
|
||||
|
||||
|
@ -43,10 +43,25 @@
|
||||
<a class="brand" href="/"><span>ø</span>bin<em>.net</em></a>
|
||||
<div class="nav-collapse">
|
||||
<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> -->
|
||||
|
||||
%for i, entry in enumerate(settings.MENU):
|
||||
<li
|
||||
%if not i:
|
||||
class="active"
|
||||
%end
|
||||
>
|
||||
%if "mailto:" in entry[1]:
|
||||
<span title="{{ entry[1].replace('mailto:', '').replace('@', '__AT__') }}"
|
||||
class="email-link" >
|
||||
{{ entry[0] }}
|
||||
</span>
|
||||
%else:
|
||||
<a href="{{ entry[1] }}">{{ entry[0] }}</a>
|
||||
%end
|
||||
|
||||
</li>
|
||||
%end
|
||||
|
||||
</ul>
|
||||
<p class="navbar-text pull-right"><i>"A client side encrypted PasteBin..."</i></p>
|
||||
</div><!--/.nav-collapse -->
|
||||
@ -104,7 +119,8 @@
|
||||
<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 & Max</a> | <a href="mailto:{{ settings.EMAIL }}"> Contact us</a>
|
||||
<a href="http://sametmax.com">Sam & Max</a> |
|
||||
<span title="lesametlemax__AT__gmail.com" class="email-link">Contact us</span>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user