Compare commits

...

21 Commits

Author SHA1 Message Date
ksamuel c65d5c4d09
Merge pull request #142 from shashwata27/master
Fixing Typo
2021-03-28 22:00:55 +02:00
Shashwata Saha 3b3cae831a Fixing Typo 2021-03-28 17:06:22 +05:30
ksamuel 3e0c4da193 Removing debug code from dodo file 2020-08-31 17:35:33 +02:00
ksamuel ab10db69b4 Bumping to version 1.0.5 2020-08-31 17:25:50 +02:00
ksamuel ff6fc227eb Fix bug with pyz release on 3.8 2020-08-31 17:25:18 +02:00
ksamuel dff881ee90 Bumping to version 1.0.4 2020-08-31 17:20:07 +02:00
ksamuel 8ce3793ff6 Changing repo status checking strategy, again, again 2020-08-31 16:30:05 +02:00
ksamuel b873215dd8 Changing repo status checking strategy, again 2020-08-31 16:20:59 +02:00
ksamuel 788cf0118d Commiting the new version of compressed css 2020-08-31 16:15:17 +02:00
ksamuel 5dcb0d407e Changing repo status checking strategy 2020-08-31 16:13:57 +02:00
ksamuel 4ab4bffc0f Fix doit API misusage in dodo.py 2020-08-31 16:04:40 +02:00
ksamuel 75d272d430 Automate release to pypi 2020-08-31 15:58:53 +02:00
ksamuel 2725cd10b4 [WIP] automating release 2020-08-31 14:26:14 +02:00
papee b83f284b98 Merge branch 'v2' of github.com:Tygs/0bin into v2 2020-08-26 12:58:14 +02:00
papee 90672f7b39 change meta description 2020-08-26 12:58:10 +02:00
ksamuel 536fa12975 Merge ok 2020-08-25 20:19:32 +02:00
ksamuel b86bc2c0ce Bump version 2020-08-25 20:18:42 +02:00
ksamuel 73ce7c4e14 Merge branch 'v2' 2020-08-25 20:12:30 +02:00
ksamuel a29a7cb961 Fix typos in buy bitcoin page 2020-08-25 20:12:16 +02:00
ksamuel a9b2f53e65 Fix inline code block in README 2020-08-19 12:41:39 +02:00
ksamuel 6c64f28643 Update README to demonstrate pyz 2020-08-19 12:38:50 +02:00
13 changed files with 262 additions and 81 deletions

3
.gitignore vendored
View File

@ -7,12 +7,15 @@
*_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 browsder and can run without a database.
0bin is a pastebin that encrypts the user content in the browser and can run without a database.
* Try it: `0bin.net <http://0bin.net>`_
* `Report a bug <https://github.com/sametmax/0bin/issues>`_
@ -12,15 +12,18 @@ 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`_.
For now tested with IE9, and the last opera, safari, chrome and FF.
To run zerobin, download zerobin.pyz from the latest release_ then:
There is a `good doc <http://readthedocs.org/docs/0bin/en/latest/>`_,
but in short::
::
pip install zerobin
zerobin
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.
0bin runs on Python 3.7+.
How it works
=============
@ -70,6 +73,7 @@ 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,5 +1,7 @@
#! /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
@ -23,15 +25,12 @@ 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,2 +1,3 @@
doit==0.32.0
pyScss==1.3.7
twine==3.2.0

View File

@ -44,10 +44,15 @@ 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
("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 :)
)
# limit size of pasted text in bytes. Be careful allowing too much size can slow down user's

132
dodo.py
View File

@ -1,37 +1,67 @@
import sys
import subprocess
from pathlib import Path
from fnmatch import fnmatch
import zerobin
from doit.tools import PythonInteractiveAction
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()
def source_files(extensions=None):
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)
extensions = extensions or [".*"]
for ext in extensions:
for file in SOURCE_DIR.rglob(f"*{ext}"):
if (
not file.suffix.endswith("pyc")
and not file.is_dir()
and not "/." in str(file)
if not (
file.is_dir()
or any(fnmatch(file, pattern) for pattern in exclude_filter)
):
yield file
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_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 task_compress():
main_js = str(SOURCE_DIR / "static/js/main.min.js")
main_css = str(SOURCE_DIR / "static/css/style.min.css")
return {
"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"])),
"targets": [main_js, main_css],
"file_dep": list(
str(f) for f in source_files([".css", ".js"], exclude=[main_css, main_js])
),
"actions": [str(ROOT / "compress.sh")],
}
@ -39,8 +69,78 @@ 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)),
"actions": [task_compress, generate_manifest, "python setup.py bdist_wheel",],
"task_dep": ["compress", "generate_manifest"],
"actions": ["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": []}

4
setup.py Normal file
View File

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

1
zerobin/VERSION Normal file
View File

@ -0,0 +1 @@
1.0.5

View File

@ -1,5 +1,5 @@
from pathlib import Path
__version__ = "1.0.2"
__version__ = (Path(__file__).parent / "VERSION").read_text().strip()
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(filepath)
params = run_path(str(filepath))
return self.update_with_dict(params)

View File

@ -5,9 +5,7 @@
<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
pastebin featuring burn after reading, history, and
a clipboard">
<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.">
<link rel="icon" href="/static/img/favicon.ico" />
<link rel="apple-touch-icon" href="/static/img/apple-touch-icon.png" />

View File

@ -1,85 +1,151 @@
<div class="well" id="buy_bitcoin">
<h1>How To Buy Bitcoin?</h1>
<p></p>
<h4>What is Bitcoin?</h4>
<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>
<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 bellow 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 below 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>
<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>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>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>
<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>
<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>
<img src="/static/img/binance1.png" alt="Register 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 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>
<img src="/static/img/binance2.png" alt="2FA 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>
<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/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/binance1.png" alt="Register Binance">
<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>
<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/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/binance2.png" alt="2FA Binance">
<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>
<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>
<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>
<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>
</div>
% rebase("base", settings=settings, pastes_count=pastes_count)