mirror of
https://github.com/miggymofongo/asteroid.git
synced 2024-11-24 06:00:27 +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
|
# Initialize Flask app
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
# Directory containing EPUB files
|
# Directory containing resumes
|
||||||
RESUME_DIR = './resumes/'
|
RESUME_DIR = './resumes/'
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
|
@ -17,26 +17,21 @@ def search():
|
||||||
# Get the search query parameter and convert it to lowercase for case-insensitive matching
|
# Get the search query parameter and convert it to lowercase for case-insensitive matching
|
||||||
query = request.args.get('searchQuery', '').lower()
|
query = request.args.get('searchQuery', '').lower()
|
||||||
|
|
||||||
# List to store filenames of matching EPUB files
|
# List to store filenames of matching PDF files
|
||||||
matching_files = []
|
matching_files = []
|
||||||
|
|
||||||
# Fetch all EPUB files from the directory and filter them based on the search query
|
# 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('.epub')]
|
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()]
|
matching_files += [f for f in all_files if query in f.lower()]
|
||||||
|
|
||||||
# Generate HTML for the list of matching files
|
# 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
|
return results_html
|
||||||
|
|
||||||
@app.route('/bookshelf/<filename>')
|
@app.route('/resumes/<filename>')
|
||||||
def serve_epub(filename):
|
def serve_resume(filename):
|
||||||
# Serve an EPUB file from the bookshelf directory
|
# Serve a resume from the resumes directory
|
||||||
return send_from_directory(EPUBS_DIR, filename)
|
return send_from_directory(RESUME_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('/favicon.ico')
|
@app.route('/favicon.ico')
|
||||||
def favicon():
|
def favicon():
|
||||||
|
|
25
index.html
25
index.html
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
<script src="./scripts.js"></script>
|
<script src="./scripts.js"></script>
|
||||||
|
|
||||||
<script src="../epub.js/src/reader.js"></script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,16 +53,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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>
|
<section>
|
||||||
<div class="container my-5">
|
<div class="container my-5">
|
||||||
|
@ -90,19 +78,6 @@
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<div class="container-fluid">
|
<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><div class="card mb-4 text-center mx-auto" style="max-width: 75%;">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit c7a4c12a0a903ed1109f177f228a6c23e62abe45
|
|
Loading…
Reference in a new issue