diff --git a/app.py b/app.py
index 5bfee3b..1955810 100644
--- a/app.py
+++ b/app.py
@@ -205,7 +205,9 @@ def create_app(config=Config):
else:
return redirect(url_for('index'))
-
+ @app.route('/manifest.json')
+ def manifest():
+ return send_from_directory('static', 'manifest.json')
@app.route('/dashboard')
@login_required
@@ -241,7 +243,31 @@ def create_app(config=Config):
}
mongo.db.users.insert_one(admin_user)
print(f"Admin {username} added! Referral code is {admin_user['referral_code']}")
-
+ @app.route("/camera", methods=["GET", "POST"])
+ @login_required
+ def camera():
+ if request.method == "POST":
+ # 1. Grab geolocation data from the form
+ latitude = request.form.get("latitude")
+ longitude = request.form.get("longitude")
+
+ # 2. Grab the photo file
+ photo = request.files.get("photo")
+
+ # 3. Save the file if it exists
+ if photo:
+ # Make sure your 'uploads' folder exists or handle dynamically
+ photo_path = os.path.join(app.config['UPLOAD_FOLDER'], photo.filename)
+ photo.save(photo_path)
+
+ # TODO: Optionally embed latitude/longitude into the photo’s EXIF here
+ # using piexif or Pillow
+
+ # For demonstration, just redirect or return a success message
+ return f"Photo uploaded! Lat: {latitude}, Lng: {longitude}"
+
+ # If GET request, just render the camera page
+ return render_template("camera.html")
@app.route('/leaderboard')
def leaderboard():
pipeline = [
diff --git a/static/images/contract.png b/static/images/contract.png
new file mode 100644
index 0000000..26791f6
Binary files /dev/null and b/static/images/contract.png differ
diff --git a/static/images/contract2.png b/static/images/contract2.png
new file mode 100644
index 0000000..ff7f302
Binary files /dev/null and b/static/images/contract2.png differ
diff --git a/static/manifest.json b/static/manifest.json
new file mode 100644
index 0000000..b5199a2
--- /dev/null
+++ b/static/manifest.json
@@ -0,0 +1,21 @@
+{
+ "name": "El glorioso y nunca bien ponderado Bachemapa",
+ "short_name": "Bachemapa",
+ "start_url": "/camera",
+ "scope": "/",
+ "icons": [
+ {
+ "src": "/static/images/contract.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "/static/images/contract2.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ],
+ "theme_color": "#ffd31d",
+ "background_color": "#333",
+ "display": "standalone"
+ }
\ No newline at end of file
diff --git a/static/service-worker.js b/static/service-worker.js
new file mode 100644
index 0000000..76fdb4a
--- /dev/null
+++ b/static/service-worker.js
@@ -0,0 +1,42 @@
+
+
+const CACHE_NAME = 'bachemapa-pwa-v2';
+const urlsToCache = [
+ '/',
+ '/quienes',
+ '/dashboard',
+ '/leaderboard',
+ '/thelogin',
+ '/static/css/main.css',
+ '/static/js/main.js',
+ '/static/js/leaflet.js',
+ '/static/css/styles.css',
+ '/static/images/marker-icon.png',
+ '/static/images/marker-shadow.png',
+ '/static/images/leaflet.css',
+ '/static/images/contract.png',
+ '/static/images/contract2.png',
+ '/static/manifest.json',
+ '/manifest.json',
+ '/static/service-worker.js'
+];
+
+self.addEventListener('install', event => {
+ event.waitUntil(
+ caches.open(CACHE_NAME)
+ .then(cache => {
+ console.log('Opened cache');
+ return cache.addAll(urlsToCache);
+ })
+ );
+});
+
+self.addEventListener('fetch', event => {
+ event.respondWith(
+ caches.match(event.request)
+ .then(response => {
+ // Return cached asset if available, otherwise fetch from network
+ return response || fetch(event.request);
+ })
+ );
+});
diff --git a/static/styles.css b/static/styles.css
index 1b4a656..ad749ea 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -302,7 +302,19 @@ section#pinner-modal::-webkit-scrollbar-thumb {
.eaflet-popup-content {
width: 100%;
}
-
+.control-button {
+ position: fixed;
+ bottom: 30px;
+ left: 50%;
+ transform: translateX(-50%);
+ padding: 15px 30px;
+ background-color: rgba(255, 255, 255, 0.7);
+ border-radius: 50px;
+ border: none;
+ font-size: 18px;
+ z-index: 100;
+ color: black;
+}
.marker-cluster {
background-color: rgb(249, 170, 61) !important;
border-radius: 100px;
diff --git a/templates/base.html b/templates/base.html
index 1946c20..f0600fe 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -21,6 +21,7 @@
+
@@ -43,6 +44,8 @@
+ {% block head %}
+ {% endblock %}
@@ -58,7 +61,7 @@
{% endif %}
{% endwith %}
-
+
{% block content %}
@@ -115,5 +118,18 @@ window.addEventListener('load', function() {
pinnerDesktop.addEventListener('click', toggleSlide);
}
});
+
+
+