Skip to content

Commit

Permalink
Fixed version update not being handled correctly (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkelM authored Dec 4, 2023
1 parent 2e93157 commit 8c2e18a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Changelog

## v3.0.0
## v3.0.1

<!--Releasenotes start-->
- Fixed the old "Ignore shorts" option not being updated to the new format correctly.
<!--Releasenotes end-->

## v3.0.0

- Shorts pages are now supported! Shuffle buttons can now be found on all shorts pages.
- Added a new option to shuffle only from shorts.
- Added a 'welcome' page that will be shown when you first install the extension and guide you through the first steps.
Expand All @@ -14,7 +19,6 @@
- The popup now feels smoother in some places, and will make it clearer when some inputs are invalid.
- If certain errors are encountered, the playlist will still be saved locally and in the database, to speed up the next shuffle.
- Fixed bugs that would prevent some initialization logic to run after the extension is updated.
<!--Releasenotes end-->

## v2.3.0

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Firefox:
alt="View changelog"></a>
</p>

Download the extension for: [Chrome/Chromium](https://chromewebstore.google.com/detail/random-youtube-video/kijgnjhogkjodpakfmhgleobifempckf) | [Edge](https://microsoftedge.microsoft.com/addons/detail/random-youtube-video/fccfflipicelkilpmgniblpoflkbhdbe) | [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/random-youtube-video/)
Download the extension for: [Chrome/Chromium](https://chromewebstore.google.com/detail/random-youtube-video/kijgnjhogkjodpakfmhgleobifempckf) | [Firefox](https://addons.mozilla.org/en-GB/firefox/addon/random-youtube-video/) | [Edge](https://microsoftedge.microsoft.com/addons/detail/random-youtube-video/fccfflipicelkilpmgniblpoflkbhdbe)

*The Chrome Web Store version can be installed on any Chromium-based browser, such as Edge, Brave, Opera and many more.*

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "random-youtube-video",
"version": "3.0.0",
"version": "3.0.1",
"description": "Customize, shuffle and play random videos from any YouTube channel.",
"scripts": {
"dev": "concurrently \"npm run dev:chromium\" \"npm run dev:firefox\"",
Expand Down
10 changes: 6 additions & 4 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ async function initExtension() {
await setSyncStorageValue("previousVersion", manifestData.version);
const welcomeUrl = chrome.runtime.getURL("html/welcome.html");
await chrome.tabs.create({ url: welcomeUrl });
} else if (configSync.previousVersion < manifestData.version) {
}
// 3.0.0 introduced the previousVersion config value, so the update would not be handled correctly here
if (configSync.previousVersion < manifestData.version || configSync.previousVersion === "3.0.0") {
await handleExtensionUpdate(manifestData, configSync.previousVersion);
}

Expand Down Expand Up @@ -72,9 +74,9 @@ async function handleExtensionUpdate(manifestData, previousVersion) {
}

async function handleVersionSpecificUpdates(previousVersion) {
// v3.0.0 changed the data type for the shuffleIgnoreShortsOption from boolean to number
if (previousVersion < "3.0.0") {
console.log("Updating sync storage to v3.0.0 format...");
// v3.0.1 changed the data type for the shuffleIgnoreShortsOption from boolean to number
if (previousVersion < "3.0.1") {
console.log("Updating sync storage to v3.0.1 format...");
const syncStorageContents = await chrome.storage.sync.get();
if (syncStorageContents["shuffleIgnoreShortsOption"] == true) {
await setSyncStorageValue("shuffleIgnoreShortsOption", 2);
Expand Down
2 changes: 1 addition & 1 deletion static/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Random YouTube Video",
"description": "Customize, shuffle and play random videos from any YouTube channel.",
"version": "3.0.0",
"version": "3.0.1",
"manifest_version": 3,
"content_scripts": [
{
Expand Down

0 comments on commit 8c2e18a

Please sign in to comment.