zero-to-mastery / ascii-art Goto Github PK
View Code? Open in Web Editor NEWA ZTM Hacktoberfest Challenge
A ZTM Hacktoberfest Challenge
@MattCSmith can I create a new folder and in that use react as frontend and Django as a backend for creating a full-stack app.
The PR #84 added an option for the user to send their input text as a clarg instead of the prompt. This is cool. But we can merge the 2 options: --textinput & --text so that if an argument isn't given, the user gets prompted for text.
See https://click.palletsprojects.com/en/7.x/options/#prompting (2nd example)
The following options don't really modify the creation of ascii images. They're logically independent from that logic. Because of this, we always exit (or return) after completing them. We need to change them into sub-commands.
This is a bit of work and might require a read up of the click library docs.
Operations are:
When this is done, the way we'll show credits (for instance) should be to run: ascii_art credits
. Meaning 'credits' is a subcommand of 'ascii_art'. And we should be able to run help on it: ascii_art credits --help
.
The Flask app (under web version) has a few messages it prints to the console, which gives the user useful feedback on their actions. We need to move these to the browser (via flash messages) since the users wouldn't have access to the terminal to see them when deployed
command line arguments can be used to exploit servers, machines etc in which this code will be running just for example.
Issue --> we can put any command just after "python community-version.py two.png" (here two.png can be replaced by any file I've taken that as an example)
Issue Examples:
So More Fun Here it is
5) python community-version.py two.png; cat /etc/passwd
so the thing is we have to block these commands and the issue I think should be clear to you and it is very severe and should be taken care if you program such a code like this where we put inputs as an argument.
For New to Linux or Command Line Users
" ; " this character after statement represent new command after it.
therefore for example python community.py two.png; ipconfig here python community.py two.png is first command that will be run and after that " ; " this will stop and new command will run after this character.
Problem: Because setup.py
is outdated, the How to contribute instruction in the readme is kinda broken. The installation works (pip install -e .
) but when trying to run the code, a lot of commands give errors.
Solution: We just need to add packages used by ascii_art
to /setup.py
.
The program crashes if you pass a brightness value of over 1.0 into the command line arguments.
Although this is in the web version (Flask app), the changes only require python knowledge, and not Flask.
We need to replace the message only png files are accepted in web version/app.py
with a formatted string version that gets the supported types from the configuration: ALLOWED_IMAGE_EXTENSIONS.
Issue:
Run the flask app (web/)
Click on the given link (http://127.0.0.1:5000) to access the app
Expected: Should show the img-upload page
Actual: Gives an error with this as part of the stacktrace (Only external files are shown in the stacktrace):
127.0.0.1 - - [01/Nov/2020 15:06:37] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "ascii-art/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
ctx.push()
File "ascii-art/venv/lib/python3.8/site-packages/flask/ctx.py", line 390, in push
self.session = session_interface.open_session(self.app, self.request)
File "ascii-art/venv/lib/python3.8/site-packages/flask/sessions.py", line 348, in open_session
data = s.loads(val, max_age=max_age)
File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/timed.py", line 130, in loads
base64d, timestamp = signer.unsign(s, max_age, return_timestamp=True)
File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/timed.py", line 52, in unsign
result = Signer.unsign(self, value)
File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/signer.py", line 167, in unsign
if self.verify_signature(value, sig):
File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/signer.py", line 153, in verify_signature
key = self.derive_key()
File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/signer.py", line 132, in derive_key
mac = hmac.new(self.secret_key, digestmod=self.digest_method)
File "/usr/lib/python3.8/hmac.py", line 153, in new
return HMAC(key, msg, digestmod)
File "/usr/lib/python3.8/hmac.py", line 48, in __init__
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
ascii-art/community-version.py
Line 53 in 5481f4d
The method write_image_to_text_file
references an undeclared variable image_file_path
. Either this should be declared in the signature or the method removed, since it doesn't get called.
How about having a frontend with React where you can:
It would be nice to be able to
it would be great for the user_upload and ascii_art display pages to have good UI design
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.