mirror of
https://github.com/miggymofongo/asteroid.git
synced 2024-12-25 01:19:41 +00:00
practicing my git flow
This commit is contained in:
parent
8ce5edef06
commit
f45d60abba
3 changed files with 10 additions and 41 deletions
23
app.py
23
app.py
|
@ -4,7 +4,7 @@ import os
|
|||
# Initialize Flask app
|
||||
app = Flask(__name__)
|
||||
|
||||
# Directory containing EPUB files
|
||||
# Directory containing resumes
|
||||
RESUME_DIR = './resumes/'
|
||||
|
||||
@app.route('/')
|
||||
|
@ -17,26 +17,21 @@ def search():
|
|||
# Get the search query parameter and convert it to lowercase for case-insensitive matching
|
||||
query = request.args.get('searchQuery', '').lower()
|
||||
|
||||
# List to store filenames of matching EPUB files
|
||||
# List to store filenames of matching PDF files
|
||||
matching_files = []
|
||||
|
||||
# Fetch all EPUB files from the directory and filter them based on the search query
|
||||
all_files = [f for f in os.listdir(RESUME_DIR) if f.lower().endswith('.epub')]
|
||||
# Fetch all resumes from the directory and filter them based on the search query
|
||||
all_files = [f for f in os.listdir(RESUME_DIR) if f.lower().endswith('.pdf')]
|
||||
matching_files += [f for f in all_files if query in f.lower()]
|
||||
|
||||
# Generate HTML for the list of matching files
|
||||
results_html = "".join([f'<li><a href="#" onclick="loadEpubInBibi(\'/bookshelf/{file}\'); return false;">{file}</a></li>' for file in matching_files])
|
||||
results_html = "".join([f'<li><a href="/resumes/{file}">{file}</a></li>' for file in matching_files])
|
||||
return results_html
|
||||
|
||||
@app.route('/bookshelf/<filename>')
|
||||
def serve_epub(filename):
|
||||
# Serve an EPUB file from the bookshelf directory
|
||||
return send_from_directory(EPUBS_DIR, filename)
|
||||
|
||||
@app.route('/reader/<path:subpath>')
|
||||
def serve_bibi_assets(subpath):
|
||||
# Serve assets for the Bibi EPUB reader (JavaScript, CSS, etc.)
|
||||
return send_from_directory('./reader', subpath)
|
||||
@app.route('/resumes/<filename>')
|
||||
def serve_resume(filename):
|
||||
# Serve a resume from the resumes directory
|
||||
return send_from_directory(RESUME_DIR, filename)
|
||||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
|
|
27
index.html
27
index.html
|
@ -15,8 +15,6 @@
|
|||
|
||||
<script src="./scripts.js"></script>
|
||||
|
||||
<script src="../epub.js/src/reader.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -55,17 +53,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="d-flex mt-3" role="search" hx-get="/search" hx-target="#resultsContainer" hx-trigger="keyup changed delay:300ms" hx-params="searchQuery:value">
|
||||
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search" name="searchQuery"> </form>
|
||||
|
||||
<!-- Results -->
|
||||
<div id="resultsContainer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.10" crossorigin="anonymous"></script>
|
||||
|
||||
</nav>
|
||||
</nav>
|
||||
<section>
|
||||
<div class="container my-5">
|
||||
<div class="row p-4 pb-0 pe-lg-0 pt-lg-5 align-items-center rounded-3 border shadow-lg">
|
||||
|
@ -90,19 +78,6 @@
|
|||
|
||||
<section>
|
||||
<div class="container-fluid">
|
||||
<!-- <div><div class="card mb-4 text-center mx-auto" style="max-width: 75%;">
|
||||
<div id="area">
|
||||
|
||||
<script>
|
||||
var rendition = book.renderTo("area", {
|
||||
width: 600,
|
||||
height: 400,
|
||||
allowScriptedContent: true
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
</div></div> -->
|
||||
|
||||
<div><div class="card mb-4 text-center mx-auto" style="max-width: 75%;">
|
||||
<div class="card-body">
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit c7a4c12a0a903ed1109f177f228a6c23e62abe45
|
Loading…
Reference in a new issue