tagline-randomizer #4

Merged
marek merged 2 commits from tagline-randomizer into master 2 years ago

@ -13,6 +13,7 @@ from io import BytesIO
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
import random
app = Flask(__name__) app = Flask(__name__)
@ -22,6 +23,11 @@ parts = {}
octopartURL ="" octopartURL =""
baseURL = "/parts" baseURL = "/parts"
taglines = []
with open('taglines.txt', 'r') as infile:
for line in infile:
taglines.append(line[:-1])
def getContainers(): def getContainers():
query = "select id, name from containers order by UPPER(name);" query = "select id, name from containers order by UPPER(name);"
r = db_engine.execute(text(query)) r = db_engine.execute(text(query))
@ -68,7 +74,7 @@ def serveImage(img):
@app.route(baseURL, strict_slashes=True) @app.route(baseURL, strict_slashes=True)
def index(): def index():
return render_template('partsearch.html', containers=getContainers(), baseURL=baseURL) return render_template('partsearch.html', containers=getContainers(), baseURL=baseURL, tagline=random.choice(taglines))
@app.route(baseURL+'/getlocationsInContainer/<containerID>') @app.route(baseURL+'/getlocationsInContainer/<containerID>')
def get_locations_in_container(containerID): def get_locations_in_container(containerID):

@ -0,0 +1,32 @@
Looking for obsolete ICs that were discontinued years ago? Just start typing!
Looking for obsolete ICs that were discontinued years ago? Just start typing!
Looking for obsolete ICs that were discontinued years ago? Just start typing!
Looking for obsolete ICs that were discontinued years ago? Just start typing!
Looking for obsolete ICs that were discontinued years ago? Just start typing!
Start typing to find your part
Start typing to find your part
Start typing to find your part
Start typing to find your part
Start typing to find your part
Try typing "mosfet"
Try typing "arduino"
Try typing "led driver"
Try typing "resistor"
Try typing "regulator"
Try typing "led"
Try typing "78L05"
Try typing "drv8833"
Try typing "stm32"
Try typing "logic analyzer"
Try typing "programmer"
Try typing "connector"
Try typing "motor"
Try typing "spring"
Try typing "usb"
Try typing "Flux capacitor". We don't have one, but you can try.
You can also search for tools
Now with emoji support!
I know it's here somwhere!
For every part you find, there is 1000 you won't!
'); DROP TABLE parts;--
Help! I'm trapped in a tagline randomiser!

@ -19,7 +19,7 @@
</head> </head>
<body> <body>
<h1>ELAB Part Search Engine</h1> <h1>ELAB Part Search Engine</h1>
<p>Looking for obsolete ICs that were discontinued years ago? Just start typing!</p> <p>{{ tagline }}</p>
<input type="text" name="search-bar" class="search-bar" placeholder="Search parts"> <input type="text" name="search-bar" class="search-bar" placeholder="Search parts">
<div class="filter-container"> <div class="filter-container">
<p>SEARCH IN</p> <p>SEARCH IN</p>

Loading…
Cancel
Save