Skip to content

Commit

Permalink
Avoid hard-coded URL (#33)
Browse files Browse the repository at this point in the history
Avoid hard-coded URL so that we can share URL deployed under any domain
  • Loading branch information
Atry committed Jul 7, 2023
1 parent 3acc3f5 commit 775ca09
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@
xhr.setRequestHeader('Content-Type', 'application/json');
/* love and peace; don't let me down :) */
xhr.setRequestHeader('Authorization', 'Bearer 5959ae0ffc42f5e6b8cee4ebf1b7ee0218bfc291');
xhr.send(JSON.stringify({ "long_url": "https://dreampuf.github.io/GraphvizOnline/#" + content}));
const longUrl = new URL(location.href);
longUrl.hash = content;

xhr.send(JSON.stringify({ "long_url": longUrl.toString() }));
xhr.onreadystatechange = function () {
if (this.readyState != 4) return;

Expand All @@ -293,7 +296,7 @@
var result = JSON.parse(this.responseText);
shareURLEl.value = result.link;
} else {
shareURLEl.value = "https://dreampuf.github.io/GraphvizOnline/#" + content
shareURLEl.value = longUrl.toString();
}
};
}
Expand Down

0 comments on commit 775ca09

Please sign in to comment.