Verified Commit 52caef72 authored by Booteille's avatar Booteille

Fix subtitles

parent 4d015980
......@@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix some typos.
- Disabling a service in the popup menu now disable its fieldset too.
### Fixed
- Captions where not working due to the use of the wrong url parameter.
- `captions` url parameter renamed to `subtitles`
## [0.12.0] - 2019-10-08
### Added
......
{
"manifest_version": 2,
"name": "__MSG_extName__",
"version": "0.12.0",
"version": "0.13.0",
"description": "__MSG_extShortDesc__",
"homepage_url": "https://gitlab.com/Booteille/Invidition",
"default_locale": "en",
......
......@@ -45,7 +45,6 @@ export const config = {
},
instanceSettings: {
autoplay: false,
captions: ",,",
continue: false,
dark_mode: true,
hl: "",
......@@ -56,6 +55,7 @@ export const config = {
player_style: "youtube",
quality: "dash",
region: "",
subtitles: ",,",
thin_mode: false,
},
},
......
......@@ -45,8 +45,9 @@ export const applySearchParams = async (url: URL) => {
// Workaround for old versions not handling true as parameter
v = v ? 1 : 0;
break;
case "captions":
case "subtitles":
cv = v.split(",");
ck = "captions";
v = cv;
break;
case "dark_mode":
......
......@@ -7,7 +7,15 @@ import * as SettingManager from "./settings";
export const updateOldConfig = async (details) => {
try {
if (details.reason === "update") {
if (details.previousVersion < "0.11.0") {
if (details.previousVersion >= "0.11.0" && details.previousVersion < "0.13.0") {
info("Updating configuration from previous version.");
const settings = await SettingManager.load();
config.invidious.instanceSettings.subtitles = settings.invidious.instanceSettings.captions;
await SettingManager.save(config);
} if (details.previousVersion < "0.11.0") {
info("Updating configuration from previous version.");
const settings = await browser.storage.sync.get();
......@@ -18,7 +26,7 @@ export const updateOldConfig = async (details) => {
config.invidious.instanceSettings.continue = settings.autoplay_next;
config.invidious.instanceSettings.hl = settings.hl;
config.invidious.instanceSettings.local = settings.local === "true";
config.invidious.instanceSettings.captions = settings.subtitles;
config.invidious.instanceSettings.subtitles = settings.subtitles;
await SettingManager.clear(); // Remove old settings before saving new
await SettingManager.save(config);
......
......@@ -135,7 +135,7 @@ export const getSettingsFromDOM = async () => {
break;
case "SELECT":
if (e.className === "defaultCaptions") {
settings[service][category].captions = captionsToQuery();
settings[service][category].subtitles = captionsToQuery();
} else {
settings[service][category][optionName] = (e as HTMLSelectElement).value;
}
......@@ -324,7 +324,7 @@ export const updateDOM = async () => {
_.forEach(options, (category, categoryName) => { // Iterate over categories
_.forEach(category, (value, name) => { // Iterate over settings
if (name !== "captions") {
if (name !== "subtitles") {
const e: HTMLElement = document.getElementById(`${service}-${categoryName}-${name}`) as HTMLElement;
if (e !== null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment