Unverified Commit 3a8d265b authored by Christina Delimitrou's avatar Christina Delimitrou Committed by GitHub

Merge pull request #7 from guillaumerosinosky/master

Replace hard-coded host by dynamic host in front-end pages
parents 9c43be5b 10df2979
......@@ -12,7 +12,7 @@ function clickEvent(){
if (document.getElementById('media').value != "") {
var formData = new FormData(document.getElementById('media-form'));
const Http = new XMLHttpRequest();
const url='http://ath-8.ece.cornell.edu:8081/upload-media';
const url='http://' + window.location.hostname + ':8081/upload-media';
Http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var resp = JSON.parse(Http.responseText);
......@@ -31,7 +31,7 @@ function clickEvent(){
function uploadPost(media_json) {
if (document.getElementById('post_text').value !== "") {
const Http = new XMLHttpRequest();
const url='http://ath-8.ece.cornell.edu:8080/api/post/compose';
const url='http://' + window.location.hostname + ':8080/api/post/compose';
Http.open("POST", url, true);
var body = "post_type=0&text=" + document.getElementById('post_text').value
Http.onreadystatechange = function() {
......@@ -62,4 +62,4 @@ function uploadPost(media_json) {
</body>
</html>
\ No newline at end of file
</html>
......@@ -17,7 +17,7 @@
if (start !== "" && stop !== "") {
var params = "start=" + start + "&stop=" + stop;
const Http = new XMLHttpRequest();
const url='http://ath-8.ece.cornell.edu:8080/api/home-timeline/read';
const url='http://' + window.location.hostname + ':8080/api/home-timeline/read';
Http.open("GET", url + "?" + params, true);
Http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
......@@ -29,7 +29,7 @@
for (var j = 0; j < post_json["media"].length; j++) {
var media_json = post_json["media"][j];
var img = document.createElement("img");
img.src = "http://ath-8.ece.cornell.edu:8081/get-media/?filename=" +
img.src = "http://" + window.location.hostname + ":8081/get-media/?filename=" +
media_json["media_id"] + "." +
media_json["media_type"];
document.getElementById("block").appendChild(img);
......@@ -63,4 +63,4 @@
</body>
</html>
\ No newline at end of file
</html>
......@@ -17,7 +17,7 @@
if (start !== "" && stop !== "") {
var params = "start=" + start + "&stop=" + stop;
const Http = new XMLHttpRequest();
const url='http://ath-8.ece.cornell.edu:8080/api/user-timeline/read';
const url='http://' + window.location.hostname + ':8080/api/user-timeline/read';
Http.open("GET", url + "?" + params, true);
Http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
......@@ -63,4 +63,4 @@ stop: <input type="text" id="stop" name="stop"><br>
</body>
</html>
\ No newline at end of file
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment