add headers
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Roy Olav Purser 2022-03-05 19:10:41 +01:00
parent f6b708b247
commit 601ff195ff
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 26 additions and 8 deletions

View File

@ -7,8 +7,9 @@
"48": "icon-48.png",
"128": "icon-128.png"
},
"version": "102.0",
"version": "104.0",
"manifest_version": 3,
"host_permissions": ["http://127.0.0.1:8083/jsonrpc", "http://127.0.0.1:8080/jsonrpc"],
"permissions": ["tabs"],
"action": {
"default_title": "Proxy Stream",

View File

@ -40,7 +40,7 @@ document.addEventListener("DOMContentLoaded", () => {
newurl = new URL("plugin://plugin.video.youtube")
search.append("action", "play_video")
let video_id = oldurl.searchParams.get("v");
if(newpath) {
if(video_id) {
search.append("videoid", video_id)
}
}
@ -49,18 +49,35 @@ document.addEventListener("DOMContentLoaded", () => {
let req = {
jsonrpc: "2.0",
method: "Player.Open",
id: secrets.token_hex(),
id: 12345,
params: {
item: {
file: newurl.href
}
}
}
try {
fetch("http://127.0.0.1:8080/jsonrpc", {
method: "POST",
body: JSON.stringify(req),
headers: {
"Content-Type": "application/json; charset=utf-8"
}
}).then(resp => console.log(resp))
} catch(e) {
console.log(e)
}
try {
fetch("http://127.0.0.1:8083/jsonrpc", {
method: "POST",
body: JSON.stringify(req)
body: JSON.stringify(req),
headers: {
"Content-Type": "application/json; charset=utf-8"
}
}).then(resp => console.log(resp))
} catch(e) {
console.log(e)
}
});
});
});