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

Compare commits

..

No commits in common. "master" and "v1.0.2" have entirely different histories.

13 changed files with 81 additions and 262 deletions

3
.gitignore vendored
View File

@ -7,15 +7,12 @@
*_index
*.orig
*.swp
*.old
# binaries
*.pyc
*.pyo
*.pyz
*.zip
__pycache__
.mypy*
*.db

View File

@ -1,7 +1,7 @@
0bin: a client side encrypted pastebin
===========================================
0bin is a pastebin that encrypts the user content in the browser and can run without a database.
0bin is a pastebin that encrypts the user content in the browsder and can run without a database.
* Try it: `0bin.net <http://0bin.net>`_
* `Report a bug <https://github.com/sametmax/0bin/issues>`_
@ -12,18 +12,15 @@ to `moderate the pastebin content`_ as they have no way to decrypt it.
It's an Python implementation of the `zerobin project`_, created by sebsauvage, under the `WTFPL licence`_.
To run zerobin, download zerobin.pyz from the latest release_ then:
For now tested with IE9, and the last opera, safari, chrome and FF.
::
There is a `good doc <http://readthedocs.org/docs/0bin/en/latest/>`_,
but in short::
python zerobin.pyz
0bin requires Python 3.7 or higher.
You may need to type :code:`py -3.7 zerobin.pyz` on Windows, or :code:`python3.7 zerobin.pyz` on Mac/Linux, depending on your configuration.
If you are familiar with the Python ecosystem, you can also :code:`python -m pip install zerobin --user` and run :code:`python -m zerobin` for the same effect.
pip install zerobin
zerobin
0bin runs on Python 3.7+.
How it works
=============
@ -73,7 +70,6 @@ Known issues
.. _node.js: http://nodejs.org/
.. _is not worth it: http://stackoverflow.com/questions/201705/how-many-random-elements-before-md5-produces-collisions
.. _WTFPL licence: http://en.wikipedia.org/wiki/WTFPL
.. _release: https://github.com/Tygs/0bin/releases
Contributing
=============

View File

@ -1,7 +1,5 @@
#! /bin/bash
export PYTHONWARNINGS=ignore::FutureWarning # scss prints future warnings
python -c "import scss" || {
echo >&2 "Error: this script requires the scss python module. pip install -r dev-requirements.txt"
exit 1
@ -25,12 +23,15 @@ echo "Compressing CSS..."
echo $'\n''/* Prettify */' >>$CSS_OUTPUT
python -m scss $CSSDIR'prettify.css' >>$CSS_OUTPUT
rm $CSSDIR'prettify.min.css'
echo $'\n''/* Desert prettify theme */' >>$CSS_OUTPUT
python -m scss $CSSDIR'desert.css' >>$CSS_OUTPUT
rm $CSSDIR'desert.min.css'
echo $'\n''/* Bootswatch bootstrap theme */' >>$CSS_OUTPUT
python -m scss $CSSDIR'bootswatch.4.5.css' >>$CSS_OUTPUT
rm $CSSDIR'bootswatch.4.5.min.css'
echo $'\n''/* Our own CSS */' >>$CSS_OUTPUT
python -m scss $CSSDIR'style.css' >>$CSS_OUTPUT

View File

@ -1,3 +1,2 @@
doit==0.32.0
pyScss==1.3.7
twine==3.2.0

View File

@ -44,15 +44,10 @@ GROUP = None
# Names/links to insert in the menu bar.
# Any link with "mailto:" will be escaped to prevent spam
MENU = (
("Github", "https://github.com/Tygs/0bin"),
("Faq", "/faq/"), # You probably want to keep this
# Any link with "mailto:" will be escaped to limit spam, but displayed
# correctly to the user using JS.
("Contact", "mailto:your@email.com"),
("Zerobin Pastebin", "https://www.0bin.net/"), # Thanks the authors :)
("How to buy Bitcoin?", "/buy_bitcoin"), # Thanks the authors :)
('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 careful allowing too much size can slow down user's

132
dodo.py
View File

@ -1,67 +1,37 @@
import sys
import subprocess
from pathlib import Path
from fnmatch import fnmatch
from doit.tools import PythonInteractiveAction
import zerobin
try:
from local_dodo import *
except ImportError:
pass
ROOT = Path(__file__).absolute().parent
SOURCE_DIR = ROOT / "zerobin/"
DIST_DIR = ROOT / "dist"
ZEROBIN_VERSION = (SOURCE_DIR / "VERSION").read_text().strip()
DOIT_CONFIG = {
"default_tasks": ["task_compress"],
"action_string_formatting": "new",
}
def git(*args, **kwargs):
return subprocess.check_output(
["git", *args], stderr=subprocess.STDOUT, universal_newlines=True,
).rstrip("\n")
def source_files(extensions=None, exclude=()):
exclude_filter = ["*.pyc", ".*"]
exclude_filter.extend(exclude)
def source_files(extensions=None):
extensions = extensions or [".*"]
for ext in extensions:
for file in SOURCE_DIR.rglob(f"*{ext}"):
if not (
file.is_dir()
or any(fnmatch(file, pattern) for pattern in exclude_filter)
if (
not file.suffix.endswith("pyc")
and not file.is_dir()
and not "/." in str(file)
):
yield file
def task_generate_manifest():
def generate():
globs = " ".join(set(f"*{f.suffix}" for f in source_files()))
globs += " VERSION"
(ROOT / "MANIFEST.in").write_text(f"recursive-include zerobin {globs}")
return {
"targets": [ROOT / "MANIFEST.in"],
"actions": [generate],
}
def generate_manifest():
extensions = " ".join(set(f"*{f.suffix}" for f in source_files()))
(ROOT / "MANIFEST.in").write_text(f"recursive-include zerobin {extensions}")
def task_compress():
main_js = str(SOURCE_DIR / "static/js/main.min.js")
main_css = str(SOURCE_DIR / "static/css/style.min.css")
return {
"targets": [main_js, main_css],
"file_dep": list(
str(f) for f in source_files([".css", ".js"], exclude=[main_css, main_js])
),
"targets": [
str(SOURCE_DIR / "static/js/main.min.js"),
str(SOURCE_DIR / "static/css/style.min.css"),
],
"file_dep": list(str(f) for f in source_files([".css", ".js"])),
"actions": [str(ROOT / "compress.sh")],
}
@ -69,78 +39,8 @@ def task_compress():
def task_build():
return {
"targets": [DIST_DIR / f"zerobin-{ZEROBIN_VERSION}-py3-none-any.whl"],
"targets": [DIST_DIR / f"zerobin-{zerobin.__version__}-py3-none-any.whl"],
"file_dep": list(str(f) for f in source_files() if ".min." not in str(f)),
"task_dep": ["compress", "generate_manifest"],
"actions": ["python setup.py bdist_wheel"],
"actions": [task_compress, generate_manifest, "python setup.py bdist_wheel",],
}
def task_publish_to_pypi():
return {
"task_dep": ["build"],
"actions": ["twine upload ./dist/*.whl"],
}
def task_build_pyz():
return {
"actions": ["shiv zerobin -o dist/zerobin.pyz -c zerobin"],
}
def task_bump_version():
def bump():
if git("branch", "--show-current") != "master":
sys.exit("You must be on the branch master to do that")
git("fetch", "origin", "master")
if git("rev-parse", "@{u}") != git("merge-base", "@", "@{u}"):
sys.exit("Cannot push a new version, you need to pull first")
git_status = git("status", "--porcelain=1").split("\n")
if not all(
line.startswith(" ") for line in git_status if not line.startswith("?")
):
sys.exit("Cannot commit the new version: you have changes to be commited.")
print("Current version is:", ZEROBIN_VERSION)
action = "0"
while action not in "123":
print("What kind of version is it?\n")
print("1) Major")
print("2) Minor")
print("3) Fix")
action = input("Enter 1, 2 or 3 (Ctrl + C to quit): ")
new_version = list(map(int, ZEROBIN_VERSION.split(".")))
action = int(action) - 1
new_version[action] += 1
new_version = ".".join(map(str, new_version))
print("The new version will be:", new_version)
if input("Ok? [y/N] ").strip().lower() != "y":
sys.exit("The version has NOT been bumped")
print("- Updating VERSION file")
(SOURCE_DIR / "VERSION").write_text(new_version)
print("- Commiting VERSION file")
git("add", "zerobin/VERSION")
git(
"commit", "-m", f"Bumping to version {new_version}",
)
print(f"- Adding v{new_version} tag")
git("tag", f"v{new_version}")
print("- Pushing tag")
git("push", "origin", "master", "--tag")
return {
"actions": [PythonInteractiveAction(bump),],
}
def task_release_to_pypi():
return {"task_dep": ["bump_version", "publish_to_pypi"], "actions": []}

View File

@ -1,4 +0,0 @@
from setuptools import setup
setup()

View File

@ -1 +0,0 @@
1.0.5

View File

@ -1,5 +1,5 @@
from pathlib import Path
__version__ = (Path(__file__).parent / "VERSION").read_text().strip()
__version__ = "1.0.2"
ROOT_DIR = Path(__file__).absolute().parent

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,7 @@ class SettingsContainer(object):
Update settings with values from the given module file.
Uses update_with_dict() behind the scenes.
"""
params = run_path(str(filepath))
params = run_path(filepath)
return self.update_with_dict(params)

View File

@ -5,7 +5,9 @@
<meta charset="utf-8">
<title>0bin - encrypted pastebin</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta name="description" content="0bin is a client-side-encrypted alternative pastebin. You can store code/text/images online for a set period of time and share with the world. Featuring burn after reading, history, clipboard.">
<meta name="description" content="0bin is a client-side-encrypted
pastebin featuring burn after reading, history, and
a clipboard">
<link rel="icon" href="/static/img/favicon.ico" />
<link rel="apple-touch-icon" href="/static/img/apple-touch-icon.png" />

View File

@ -1,151 +1,85 @@
<div class="well" id="buy_bitcoin">
<h1>How To Buy Bitcoin?</h1>
<p></p>
<p></p>
<h4>What is Bitcoin?</h4>
<p>Bitcoin was created by Satoshi Nakamoto, a pseudonymous person or team who outlined the technology in a 2008 white
paper. Its an appealingly simple concept: <strong>bitcoin is digital money</strong> that allows for secure
peer-to-peer transactions on the internet.
</p>
<p>Unlike services like Venmo and PayPal, which rely on the traditional financial system for permission to transfer
money and on existing debit/credit accounts, bitcoin is decentralized: any two people, anywhere in the world, can
send bitcoin to each other without the involvement of a bank, the government, or other institution.
<p>
Every transaction involving Bitcoin is tracked on the blockchain, which is similar to a bank ledger, or log of
customers funds going in and out of the bank. In simple terms, its a record of every transaction ever made
using bitcoin.
</p>
<p>
There will only ever be 21 million bitcoin. This is digital money that cannot be inflated or manipulated in any
way.
</p>
<p>
It isnt necessary to buy an entire bitcoin: you can buy just a fraction of one if thats all you want or need.
</p>
<h4>What is Bitcoin?</h4>
<p>Bitcoin was created by Satoshi Nakamoto, a pseudonymous person or team who outlined the technology in a 2008 white paper. Its an appealingly simple concept: <strong>bitcoin is digital money</strong> that allows for secure peer-to-peer transactions on the internet.
</p>
<p>Unlike services like Venmo and PayPal, which rely on the traditional financial system for permission to transfer money and on existing debit/credit accounts, bitcoin is decentralized: any two people, anywhere in the world, can send bitcoin to each other without the involvement of a bank, government, or other institution.
<p>
Every transaction involving Bitcoin is tracked on the blockchain, which is similar to a banks ledger, or log of customers funds going in and out of the bank. In simple terms, its a record of every transaction ever made using bitcoin.
</p>
<p>
There will only ever be 21 million bitcoin. This is digital money that cannot be inflated or manipulated in any way.
</p>
<p>
It isnt necessary to buy an entire bitcoin: you can buy just a fraction of one if thats all you want or need.
</p>
<h4>Why would I buy Bitcoin?</h4>
<p>Bitcoin is in the news today more than ever. Thanks to skyrocketing prices and rollercoaster dips, everyone and
their dogs are interested in learning how to buy and sell Bitcoin. As the most popular form of cryptocurrency,
Bitcoin is now widely accepted around the world and has a growing number of applications. If you want to take
advantage of that though, you first need to know how to buy Bitcoin and what to do with it when you have.
</p>
<p>Bitcoin is in the news today more than ever. Thanks to skyrocketing prices and rollercoaster dips, everyone and their dogs are interested in learning how to buy and sell Bitcoin. As the most popular form of cryptocurrency, Bitcoin is now widely accepted around the world and has a growing number of applications. If you want to take advantage of that though, you first need to know how to buy Bitcoin and what to do with it when you have.
</p>
<h4>How to buy Bitcoin ?</h4>
<p>The best place to make your first Bitcoin purchase is on an exchange. There are a whole lot of exchanges out
there, with varying performance. Some are less trustworthy than others, and some can be quite limited, so its
crucial to pick the right exchange in the first place. We recommend using <a
href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a>, follow the simple
guide below to buy your first Bitcoins.
</p>
<p>The best place to make your first Bitcoin purchase is on an exchange. There are a whole lot of exchanges out there, with varying performance. Some are less trustworthy than others, and some can be quite limited, so its crucial to pick the right exchange in the first place. We recommend using <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a>, follow the simple guide bellow to buy your first Bitcoins.
</p>
<h6>1. Buy Bitcoin on Binance</h6>
<p>We recommend buying Bitcoins on <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> because in terms of volume, it is considered to be the world's leading platform.
In 2019, Binance reports an average trading volume of <strong>$2.8 billion per day</strong>. This platform, launched on July 14, 2017 in Hong Kong, has the advantage of operating with technical assistance 24 hours a day, 7 days a week. Its <strong>CEO Zhao Changpeng</strong>, who has become a billionaire, was featured on the cover of the prestigious Forbes magazine in February 2018.
</p>
<p>We recommend buying Bitcoins on <a href="https://www.binance.com/en/register?ref=CAWS9NNE"
title="Buy Bitcoin">Binance</a> because in terms of volume, it is considered to be the world's leading
platform.
In 2019, Binance reports an average trading volume of <strong>$2.8 billion per day</strong>. This platform,
launched on July 14, 2017, in Hong Kong, has the advantage of operating with technical assistance 24 hours a
day, 7 days a week. Its <strong>CEO Zhao Changpeng</strong>, who has become a billionaire, was featured on the
cover of the prestigious Forbes magazine in February 2018.
</p>
<h6>2. How do I register with <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> to buy Bitcoin?</h6>
<p>The first step before buying Bitcoin on <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> is to register. The user must first select the language in which they want to access the site, then enter a valid email address and finally choose a password.
</p>
<h6>2. How do I register with <a href="https://www.binance.com/en/register?ref=CAWS9NNE"
title="Buy Bitcoin">Binance</a> to buy Bitcoin?</h6>
<h3 class="text-center"><a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Click here to register an account with Binance now!<a></h3>
<img src="/static/img/binance1.png" alt="Register Binance">
<p>The first step before buying Bitcoin on <a href="https://www.binance.com/en/register?ref=CAWS9NNE"
title="Buy Bitcoin">Binance</a> is to register. The user must first select the language in which they want
to access the site, then enter a valid email address and finally choose a password.
</p>
<p>For your security, the platform offers you to proceed to the 2FA, also called "Two Step Verification", which consists in logging in with your password and your phone using <a href="https://support.google.com/accounts/answer/1066447?co=GENIE.Platform%3DAndroid">Google Authenticator</a>. Both we and the platform recommend that you delay the purchase of your Bitcoins by opting for this extra layer of security. Binance Academy 2fa available <a href="https://academy.binance.com/tutorials/binance-2fa-guide">here</a>.
</p>
<img src="/static/img/binance2.png" alt="2FA Binance">
<h3 class="text-center"><a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Click here
to register an account with Binance now!<a></h3>
<p>The second step is to verify your identity. Indeed, <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> is subject to KYC regulations as part of the fight against money laundering and terrorist financing. The platform will ask you whether or not you reside in China, before moving on to other personal information (surname, first name, gender, country of residence).
</p>
<img src="/static/img/binance3.png" alt="Verify identity Binance">
<img src="/static/img/binance1.png" alt="Register Binance">
<p>Authentication is done by sending the number and a photocopy of both sides of your ID and a photo of you. On this photo, you must show the same ID and a newspaper (or other document) with the current date.
</p>
<img src="/static/img/binance4.png" alt="Verify identity Binance">
<p>For your security, the platform offers you to proceed to the 2FA, also called "Two Step Verification", which
consists in logging in with your password and your phone using <a
href="https://support.google.com/accounts/answer/1066447?co=GENIE.Platform%3DAndroid">Google
Authenticator</a>. Both we and the platform recommend that you delay the purchase of your Bitcoins by opting
for this extra layer of security. Binance Academy 2FA available <a
href="https://academy.binance.com/tutorials/binance-2fa-guide">here</a>.
</p>
<p>The easiest way to get Bitcoin at Binance is to buy it by credit card. To do so, head over to the “Buy Crypto” section on the <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> toolbar, and choose the “Buy with Credit Card” option.
</p>
<img src="/static/img/binance6.png" alt="Verify identity Binance">
<img src="/static/img/binance2.png" alt="2FA Binance">
<p>Select your currency and BTC coin you wish to purchase and enter the amount before clicking "Buy BTC". All you will need to do is enter your bank details and the purchase will be completed.</p>
<img src="/static/img/binance5.png" alt="Verify identity Binance">
<p>The second step is to verify your identity. Indeed, <a href="https://www.binance.com/en/register?ref=CAWS9NNE"
title="Buy Bitcoin">Binance</a> is subject to KYC regulations as part of the fight against money laundering
and terrorist financing. The platform will ask you whether or not you reside in China, before moving on to
other personal information (surname, first name, gender, country of residence).
</p>
<p>Although it is mainly focused on the exchange of cryptomoney, <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> is now establishing itself as a very competitive platform for the purchase of cryptomoney by credit card. It is also reassuring because of its reputation, its activity and its ecosystem.</p>
<h4>You're now a part of the future! Congrats!</h4>
<img src="/static/img/binance3.png" alt="Verify identity Binance">
<p>Authentication is done by sending the number and a photocopy of both sides of your ID and a photo of you. On
this photo, you must show the same ID and a newspaper (or other document) with the current date.
</p>
<img src="/static/img/binance4.png" alt="Verify identity Binance">
<p>The easiest way to get Bitcoin at Binance is to buy it by credit card. To do so, head over to the “Buy Crypto”
section on the <a href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a>
toolbar, and choose the “Buy with Credit Card” option.
</p>
<img src="/static/img/binance6.png" alt="Verify identity Binance">
<p>Select your currency and BTC coin you wish to purchase and enter the amount before clicking "Buy BTC". All you
will need to do is enter your bank details and the purchase will be completed.</p>
<img src="/static/img/binance5.png" alt="Verify identity Binance">
<p>Although it is mainly focused on the exchange of cryptomoney, <a
href="https://www.binance.com/en/register?ref=CAWS9NNE" title="Buy Bitcoin">Binance</a> is now establishing
itself as a very competitive platform for the purchase of cryptomoney by credit card. It is also reassuring
because of its reputation, its activity and its ecosystem.</p>
<h4>You're now a part of the future! Congrats!</h4>
<p></p>
<p>Read more about Bitcoins
<br><a href="https://bitcoin.org/en/">Bitcoin.org</a>
</p>
<p></p>
<p>Read more about Bitcoins
<br><a href="https://bitcoin.org/en/">Bitcoin.org</a>
</p>
</div>
% rebase("base", settings=settings, pastes_count=pastes_count)