Updated background.js to use config server as well

This commit is contained in:
Ajay Ramachandran 2019-07-13 19:15:47 -04:00
parent 598e15203b
commit a1d51656c5
6 changed files with 13 additions and 7 deletions

View file

@ -21,8 +21,8 @@ This project is partially based off of [this experimental extension](https://git
# Chrome extension
It will be on the chrome webstore soon once I get some more UI features in, such as an icon. For now, you can load this project as an unpacked extension. Make sure to rename the `content-config.js.example` file to `content-config.js` before installing.
It will be on the chrome webstore soon once I get some more UI features in, such as an icon. For now, you can load this project as an unpacked extension. Make sure to rename the `config.js.example` file to `config.js` before installing.
# Firefox extension
None at the moment
None at the moment

View file

@ -92,7 +92,7 @@ function submitTimes(videoID) {
let userIDStorage = getUserID(function(userIDStorage) {
//submit the sponsorTime
xmlhttp.open('GET', 'http://localhost/api/postVideoSponsorTimes?videoID=' + videoID + "&startTime=" + sponsorTimes[i][0] + "&endTime=" + sponsorTimes[i][1]
xmlhttp.open('GET', serverAddress + "/api/postVideoSponsorTimes?videoID=" + videoID + "&startTime=" + sponsorTimes[i][0] + "&endTime=" + sponsorTimes[i][1]
+ "&userID=" + userIDStorage, true);
xmlhttp.send();
});

View file

@ -1,3 +1,3 @@
//this file is loaded along iwth content.js
//this file sets the server to connect to, and is gitignored
var serverAddresss = "https://sponsor.ajay.app";
var serverAddress = "http://localhost";

3
config.js.example Normal file
View file

@ -0,0 +1,3 @@
//this file is loaded along iwth content.js
//this file sets the server to connect to, and is gitignored
var serverAddress = "https://sponsor.ajay.app";

View file

@ -114,7 +114,7 @@ function sponsorsLookup(id) {
let xmlhttp = new XMLHttpRequest();
//check database for sponsor times
xmlhttp.open('GET', serverAddresss + "/api/getVideoSponsorTimes?videoID=" + id, true);
xmlhttp.open('GET', serverAddress + "/api/getVideoSponsorTimes?videoID=" + id, true);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

View file

@ -8,7 +8,7 @@
"https://*.youtube.com/*"
],
"js": [
"content-config.js",
"config.js",
"content.js"
],
"css": [
@ -33,7 +33,10 @@
"default_popup": "popup.html"
},
"background": {
"scripts":["background.js"]
"scripts":[
"config.js",
"background.js"
]
},
"icons": {
"16": "icons/IconSponsorBlocker16px.png",