Closed KaneOne closed 1 year ago
This looks right. Perhaps we can check the database name, and if it equals __op
, don't rewrite it. This is rather hacky, but we can't modify the idb
module.
Added in 5c7bb3257c77b130af4f89b7db19fc88fcc3485c Unless there's a better solution, I will be closing this
Added in 5c7bb32 Unless there's a better solution, I will be closing this
https://github.com/titaniumnetwork-dev/Ultraviolet/blob/3f920ee7b4ac35b429a7fa9c38baaec1615e2b1f/src/uv.handler.js#L299 This also needs to be fixed, otherwise document.cookie cannot write to idb.
https://github.com/titaniumnetwork-dev/Ultraviolet/blob/3f920ee7b4ac35b429a7fa9c38baaec1615e2b1f/src/uv.handler.js#L297-L306 When there is a document.cookie written on the page, it will be overwritten and written into iDB by the code here. However, the uv.handler does not assign a value to uv.db, so it is always undefined and cannot be written into idb. Changing it to await uv.cookie.db() allows writing into idb.
The following code is to store cookies from different websites in separate IDBs, and everything seems fine. https://github.com/titaniumnetwork-dev/Ultraviolet/blob/3f920ee7b4ac35b429a7fa9c38baaec1615e2b1f/src/uv.handler.js#L413-L415 But when uv.sw.js processes the injected cookie information in the HTML header, it does not modify the name of idb. Therefore, only the cookie of _op database can be retrieved here instead of the proxy website's cookie, which causes a bug. https://github.com/titaniumnetwork-dev/Ultraviolet/blob/3f920ee7b4ac35b429a7fa9c38baaec1615e2b1f/src/uv.sw.js#L108-L113
Finally, I had to comment out the code that modifies the IDB database name. This way, all cookies are saved in the _op database and now it seems to be working fine.