random id

This commit is contained in:
Roy Olav Purser 2022-03-05 20:33:15 +01:00
parent 108de113d1
commit cd5894429c
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 10 additions and 4 deletions

View File

@ -7,7 +7,7 @@
"48": "icon-48.png", "48": "icon-48.png",
"128": "icon-128.png" "128": "icon-128.png"
}, },
"version": "106.0", "version": "107.0",
"manifest_version": 3, "manifest_version": 3,
"host_permissions": ["http://127.0.0.1:4000/jsonrpc"], "host_permissions": ["http://127.0.0.1:4000/jsonrpc"],
"permissions": ["tabs"], "permissions": ["tabs"],

View File

@ -5,6 +5,12 @@ providers.set("youtu.be", "youtube")
providers.set("tv.nrk.no", "nrk") providers.set("tv.nrk.no", "nrk")
providers.set("seafile.purser.it", "seafile") providers.set("seafile.purser.it", "seafile")
const random = () => {
const arr = new Uint8Array(32)
window.crypto.getRandomValues(arr)
return btoa(arr)
}
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
let [proxyButton, kodiButton] = document.getElementsByTagName("button") let [proxyButton, kodiButton] = document.getElementsByTagName("button")
proxyButton.addEventListener("click", (ev) => { proxyButton.addEventListener("click", (ev) => {
@ -50,13 +56,13 @@ document.addEventListener("DOMContentLoaded", () => {
newurl.pathname = oldurl.pathname newurl.pathname = oldurl.pathname
} }
} }
newurl.search = search.toString() newurl.search = search.toString()
let req = { let req = {
jsonrpc: "2.0", jsonrpc: "2.0",
method: "Player.Open", method: "Player.Open",
id: 12345, id: random(),
params: { params: {
item: { item: {
file: newurl.href file: newurl.href