Skip to content

Commit

Permalink
Merge pull request #2180 from raszpl/patch-6
Browse files Browse the repository at this point in the history
Update core.js limit localstorage writes to only essential ones
  • Loading branch information
ImprovedTube authored Apr 21, 2024
2 parents 2d0f628 + 8a70c17 commit 9c4e5f6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions js&css/web-accessible/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,20 @@ document.addEventListener('it-message-from-extension', function () {
ImprovedTube.storage = message.storage;

if (ImprovedTube.storage.block_vp9 || ImprovedTube.storage.block_av1 || ImprovedTube.storage.block_h264) {
let atlas = {block_vp9:'vp9|vp09', block_h264:'avc1', block_av1:'av01'}
localStorage['it-codec'] = Object.keys(atlas).reduce(function (all, key) {
let atlas = {block_vp9:'vp9|vp09', block_h264:'avc1', block_av1:'av01'},
codec = Object.keys(atlas).reduce(function (all, key) {
return ImprovedTube.storage[key] ? ((all?all+'|':'') + atlas[key]) : all}, '');
} else {
if (localStorage['it-codec'] != codec) {
localStorage['it-codec'] = codec;
}
} else if (localStorage['it-codec']) {
localStorage.removeItem('it-codec');
}
if (ImprovedTube.storage.player_60fps === false) {
localStorage['it-player30fps'] = true;
} else {
if (!localStorage['it-player30fps']) {
localStorage['it-player30fps'] = true;
}
} else if (localStorage['it-player30fps']) {
localStorage.removeItem('it-player30fps');
}

Expand Down

0 comments on commit 9c4e5f6

Please sign in to comment.