diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..bd2389f
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+BBB_frontend
+target
diff --git a/BBB_frontend/.dockerignore b/BBB_frontend/.dockerignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/BBB_frontend/.dockerignore
@@ -0,0 +1 @@
+node_modules
diff --git a/BBB_frontend/Dockerfile b/BBB_frontend/Dockerfile
new file mode 100644
index 0000000..301c43c
--- /dev/null
+++ b/BBB_frontend/Dockerfile
@@ -0,0 +1,26 @@
+FROM debian:latest
+
+RUN apt-get update && apt-get upgrade && apt-get -y install wget xz-utils
+
+RUN wget https://factorio.com/get-download/stable/headless/linux64 -O factorio-stable.tar.xz
+
+RUN tar xf factorio-stable.tar.xz
+
+WORKDIR /factorio
+
+RUN useradd -M factorio
+
+RUN chown -R factorio /factorio
+
+USER factorio
+
+RUN mkdir -p saves
+
+VOLUME ["/factorio/saves"]
+
+EXPOSE 34197/udp
+EXPOSE 27015/tcp
+
+ENTRYPOINT ["/factorio/bin/x64/factorio"]
+
+CMD ["/factorio/bin/x64/factorio", "--start-server", "/factorio/saves/default.zip"]
diff --git a/BBB_frontend/index.html b/BBB_frontend/index.html
index e5e5993..0c9386f 100644
--- a/BBB_frontend/index.html
+++ b/BBB_frontend/index.html
@@ -6,6 +6,16 @@
Binghamton Better Bus
+
+
+
diff --git a/BBB_frontend/main.js b/BBB_frontend/main.js
index cab743a..802ddb4 100644
--- a/BBB_frontend/main.js
+++ b/BBB_frontend/main.js
@@ -1 +1,84 @@
import './style.css'
+
+async function main(){
+ const {Map} = await google.maps.importLibrary("maps");
+ const map = new Map(document.getElementById("map"),{
+ center: {lat: 42.10125081757972, lng:-75.94181323552698},
+ zoom: 14
+ });
+ const UI = document.createElement("div");
+ UI.id = "UI";
+
+ const from_lattitude_input = document.createElement("input");
+ from_lattitude_input.placeholder = "42.10125081757972";
+ from_lattitude_input.type = "number";
+ from_lattitude_input.id = "from_lattitude_input";
+ UI.appendChild(from_lattitude_input);
+
+ const from_longitude_input = document.createElement("input");
+ from_longitude_input.type = "number";
+ from_longitude_input.placeholder = "-75.94181323552698";
+ from_longitude_input.id = "from_longitude_input";
+ UI.appendChild(from_longitude_input);
+
+ const from_pos_button = document.createElement("button");
+ from_pos_button.id = "from_pos_button";
+ from_pos_button.innerText = "Set Start Position";
+ let from_pos_toggle = false;
+ UI.appendChild(from_pos_button);
+ from_pos_button.addEventListener("click",e=>{
+ from_pos_toggle = !from_pos_toggle;
+ to_pos_toggle = false;
+ });
+
+ const to_lattitude_input = document.createElement("input");
+ to_lattitude_input.placeholder = "42.10125081757972";
+ to_lattitude_input.type = "number";
+ UI.appendChild(to_lattitude_input);
+
+ const to_longitude_input = document.createElement("input");
+ to_longitude_input.type = "number";
+ to_longitude_input.placeholder = "-75.94181323552698";
+ UI.appendChild(to_longitude_input);
+
+ const to_pos_button = document.createElement("button");
+ to_pos_button.id = "to_pos_button"
+ to_pos_button.innerText = "Set End Position"
+ let to_pos_toggle = false;
+ to_pos_button.addEventListener("click",e=>{
+ to_pos_toggle = !to_pos_toggle;
+ from_pos_toggle = false;
+ });
+ UI.appendChild(to_pos_button);
+
+ const sub_button = document.createElement("button");
+ sub_button.addEventListener("click",submit_func(map));
+ sub_button.id = "sub_button";
+ sub_button.innerText = "Submit";
+ UI.appendChild(sub_button);
+
+ map.addListener("click", e=>{
+ const {lat, lng} = e.latLng;
+ if(from_pos_toggle){
+ from_lattitude_input.value = lat();
+ from_longitude_input.value = lng();
+ }
+ if(to_pos_toggle){
+ to_lattitude_input.value = lat();
+ to_longitude_input.value = lng();
+ }
+ });
+ document.body.appendChild(UI)
+ const time = new Date().toISOString();
+
+}
+function submit_func(map){
+//TODO: grab the path and show the poly lines and the bus route name
+async function submit(clickEvent){
+ let from_lat = document.getElementById("from_lattitude_input");
+ let from_lon = document.getElementById("from_longitude_input");
+}
+return submit;
+}
+
+main();
diff --git a/BBB_frontend/style.css b/BBB_frontend/style.css
index e407b17..92eb67d 100644
--- a/BBB_frontend/style.css
+++ b/BBB_frontend/style.css
@@ -32,6 +32,13 @@ body {
height: 100%;
margin: 0 auto;
padding: 0rem;
+ position: absolute;
+}
+
+#UI {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ position:relative;
}
button {
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..301c43c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,26 @@
+FROM debian:latest
+
+RUN apt-get update && apt-get upgrade && apt-get -y install wget xz-utils
+
+RUN wget https://factorio.com/get-download/stable/headless/linux64 -O factorio-stable.tar.xz
+
+RUN tar xf factorio-stable.tar.xz
+
+WORKDIR /factorio
+
+RUN useradd -M factorio
+
+RUN chown -R factorio /factorio
+
+USER factorio
+
+RUN mkdir -p saves
+
+VOLUME ["/factorio/saves"]
+
+EXPOSE 34197/udp
+EXPOSE 27015/tcp
+
+ENTRYPOINT ["/factorio/bin/x64/factorio"]
+
+CMD ["/factorio/bin/x64/factorio", "--start-server", "/factorio/saves/default.zip"]
diff --git a/README.md b/README.md
index 4c64719..7c2dfd8 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,14 @@
# BinghamtonBetterBus
Currently just an api to get the best bus route from point a to point b, currently building frontend
+to run you need a file called GOOGLE_API_KEY in the dir the app is run in which has access to the routes api
+
## TODO:
- Build frontend
- test with OCCT buses
- Change api to give a not shitty poly line for Broome county buses
+- refactor to work within docker and setup within docker-compose
- make route checking more advanced with better walking heuristic
- make route checking more advanced by allowing multiple factors with multiple weights including
- walking time (don't remove it)
diff --git a/src/google.rs b/src/google.rs
index c1b06c8..3ffd751 100644
--- a/src/google.rs
+++ b/src/google.rs
@@ -54,8 +54,6 @@ struct LocIn{
longitude: f64
}
fn build_route_body_pain(path:&[crate::types::Coords])->serde_json::Value{
- let time = chrono::offset::Utc::now()
- .to_rfc3339_opts(chrono::SecondsFormat::Nanos,true);
let inter = &path[1..path.len()-1];
let val = serde_json::json!({
"origin":{
@@ -68,7 +66,6 @@ fn build_route_body_pain(path:&[crate::types::Coords])->serde_json::Value{
"intermediates": inter,
"travelMode": "DRIVE",
"routingPreference": "TRAFFIC_UNAWARE",
- "departureTime": time,
"computeAlternativeRoutes": false,
"routeModifiers": {
"avoidTolls": false,