Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
apiKey=
authDomain=
projectId=
databaseURL=
messagingSenderId=
appId=
MAPBOXGL_ACCESSTOKEN=
DATABASE=
PORT=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
npm-debug.log
.DS_Store
/*.env
setenv.sh
setenv.sh
uploads/*
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

1 change: 0 additions & 1 deletion doc/sample.txt

This file was deleted.

1 change: 0 additions & 1 deletion doc/scrath.txt

This file was deleted.

16 changes: 16 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.9"

services:
mongodb:
image: mongo:5.0
ports:
- 27017:27017
# environment:
# - MONGO_INITDB_DATABASE=pjournal
# - MONGO_INITDB_ROOT_USERNAME=mongo
# - MONGO_INITDB_ROOT_PASSWORD=password
volumes:
- mongodb_data_container:/data/db

volumes:
mongodb_data_container:
212 changes: 103 additions & 109 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" />
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
</head>
Expand All @@ -49,7 +49,7 @@
<div class="app-container">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="index.html">PJournal</a>
<button
<!-- <button
class="navbar-toggler"
type="button"
data-toggle="collapse"
Expand All @@ -70,7 +70,7 @@
<a class="nav-link" href="builder.html">App Builder</a>
</li>
</ul>
</div>
</div> -->
</nav>

<div class="upload-section">
Expand All @@ -93,7 +93,7 @@
</div>
<!-- upload-section -->

<div class="editor">
<!-- <div class="editor">
<div id="searchsection">
<div class="mb-3">
<input
Expand Down Expand Up @@ -139,7 +139,7 @@
</button>

<p class="center">Select a color for your geotag</p>
<!--

<div class="btn-group-vertical center">
<button
type="button"
Expand All @@ -162,8 +162,8 @@
id="green">
Green
</button>
</div> -->
</div>
</div>
</div> -->
<!-- editor -->

<div class="map-container">
Expand All @@ -179,96 +179,100 @@
</body>

<script type="text/javascript" src="tagscript.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

<script>

const params = (new URL(document.location)).searchParams;
var GLOBAL_APPNAME = params.get('app');
if (GLOBAL_APPNAME) {searchforapp('query');}

var GLOBAL_UPDATE_POSITION_TIMER;

var GLOBAL_CONFIG = { yesname: false,
yestextmessage: false,
red: false,
blue: false,
green: false,
currentlocation: true
};


function locationSwitch() {
if (($('#location-switch').text() == "Change to YES") &&
(GLOBAL_CONFIG.currentlocation == true)) {
$('#location-switch').text("Change to NO");
GLOBAL_UPDATE_POSITION_TIMER = setInterval(function() { getLocation('black'); }, 5000);
}
else {
$('#location-switch').text("Change to YES");
clearInterval(GLOBAL_UPDATE_POSITION_TIMER);
removeCurrentLoc();
}
}

function reconfigureFromConfig(config) {
$("#hideusername").toggle(config.yesname);
$("#hidemessage").toggle(config.yestextmessage);
$("#blue").toggle(config.blue);
$("#green").toggle(config.green);
$("#red").toggle(config.red);
const currentLocation = (config.currentLocation ===undefined) ? false : config.currentLocation;
$('#location-switch').toggle(currentLocation);
$('#plocation-switch').toggle(currentLocation);
}

function reconfigureFromApp(appName) {
$.ajax({type : "GET",
url: "reconfigureFromApp",
dataType: 'json',
data: {appName: appName},
success: function(result){
reconfigureFromConfig(result);
},
error : function(e) {
console.log("ERROR: ", e);
}
});
}

async function searchforapp(placeUsed) {
$('#location-switch').text("Change to YES");
if (GLOBAL_UPDATE_POSITION_TIMER) {
clearInterval(GLOBAL_UPDATE_POSITION_TIMER);
}
$('#demo').text("");
if (placeUsed == 'searchbar') {
GLOBAL_APPNAME = document.getElementById("searchname").value;
removeCurrentLoc();
}

const appCheck = await checkForAppInDatabase(GLOBAL_APPNAME);

if (appCheck) {
reconfigureFromApp(GLOBAL_APPNAME);
initMap(GLOBAL_APPNAME);
$('#appnametitle').text("Map Application Name: "+GLOBAL_APPNAME);
$('#searchsection').hide();
} else {
alert("app: "+GLOBAL_APPNAME + " not found!");
}
}

document.getElementById('file').addEventListener('change', handleFile);
const params = new URL(document.location).searchParams;
// var GLOBAL_APPNAME = params.get("app");
// if (GLOBAL_APPNAME) {
// searchforapp("query");
// }

// var GLOBAL_UPDATE_POSITION_TIMER;

// var GLOBAL_CONFIG = {
// yesname: false,
// yestextmessage: false,
// red: false,
// blue: false,
// green: false,
// currentlocation: true,
// };

// function locationSwitch() {
// if (
// $("#location-switch").text() == "Change to YES" &&
// GLOBAL_CONFIG.currentlocation == true
// ) {
// $("#location-switch").text("Change to NO");
// GLOBAL_UPDATE_POSITION_TIMER = setInterval(function () {
// getLocation("black");
// }, 5000);
// } else {
// $("#location-switch").text("Change to YES");
// clearInterval(GLOBAL_UPDATE_POSITION_TIMER);
// removeCurrentLoc();
// }
// }

// function reconfigureFromConfig(config) {
// $("#hideusername").toggle(config.yesname);
// $("#hidemessage").toggle(config.yestextmessage);
// $("#blue").toggle(config.blue);
// $("#green").toggle(config.green);
// $("#red").toggle(config.red);
// const currentLocation =
// config.currentLocation === undefined ? false : config.currentLocation;
// $("#location-switch").toggle(currentLocation);
// $("#plocation-switch").toggle(currentLocation);
// }

// function reconfigureFromApp(appName) {
// $.ajax({
// type: "GET",
// url: "reconfigureFromApp",
// dataType: "json",
// data: { appName: appName },
// success: function (result) {
// reconfigureFromConfig(result);
// },
// error: function (e) {
// console.log("ERROR: ", e);
// },
// });
// }

// async function searchforapp(placeUsed) {
// $("#location-switch").text("Change to YES");
// if (GLOBAL_UPDATE_POSITION_TIMER) {
// clearInterval(GLOBAL_UPDATE_POSITION_TIMER);
// }
// $("#demo").text("");
// if (placeUsed == "searchbar") {
// GLOBAL_APPNAME = document.getElementById("searchname").value;
// removeCurrentLoc();
// }

// const appCheck = await checkForAppInDatabase(GLOBAL_APPNAME);

// if (appCheck) {
// reconfigureFromApp(GLOBAL_APPNAME);
// initMap(GLOBAL_APPNAME);
// $("#appnametitle").text("Map Application Name: " + GLOBAL_APPNAME);
// $("#searchsection").hide();
// } else {
// alert("app: " + GLOBAL_APPNAME + " not found!");
// }
// }

document.getElementById("file").addEventListener("change", handleFile);

async function handleFile(event) {
try {

// Does this imply that files may allow multiple uploads and this should be in a loop?
const file = event.target.files[0];
const tags = await ExifReader.load(file);
console.dir(file);
// upload(file).then(resp => console.log(resp));
// upload(file).then(resp => console.log(resp));

// The MakerNote tag can be really large. Remove it to lower
// memory usage if you're parsing a lot of files and saving the
Expand All @@ -277,31 +281,21 @@

// If you want to extract the thumbnail you can use it like
// this:
if (tags['Thumbnail'] && tags['Thumbnail'].image) {
const image = document.getElementById('thumbnail');
image.classList.remove('hidden');
image.src = 'data:image/jpg;base64,' + tags['Thumbnail'].base64;
if (tags["Thumbnail"] && tags["Thumbnail"].image) {
const image = document.getElementById("thumbnail");
image.classList.remove("hidden");
image.src = "data:image/jpg;base64," + tags["Thumbnail"].base64;
}
console.dir(tags);
var username = "spud";
// This should be used for tagging the photo, perhaps
// from a selector, but I don't have that now.
createPhotoUploadTag(file,tags,username,"black");
uploadImage(file, tags, "black");
} catch (error) {
// Handle error.
console.log(error);
}
}


/* eslint-disable no-var */

$(document).ready(function(){
reconfigureFromConfig(GLOBAL_CONFIG);
});
$(initMap(null));


// $(document).ready(function () {
// reconfigureFromConfig(GLOBAL_CONFIG);
// });
$(initMap());
</script>

</html>
Loading