Refactor settings
This commit is contained in:
1 parent
68a4f9fade
commit
becb8b04f5
9 files changed
+47
-20
No files matched your search
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- German translation
|
- German translation
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Settings: Added a "backend" section, and removed backend selection from Playback to avoid confusion
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Display issue in playlist view
|
- Display issue in playlist view
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function SearchSuggestionsTask(input as object) as object
|
|||||||
suggestions: []
|
suggestions: []
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
backend = preferencesNode["playback.backend"]
|
backend = preferencesNode["backend.selected"]
|
||||||
if backend = "playlet"
|
if backend = "playlet"
|
||||||
searchSuggestsions = InnertubeService.SearchSuggestions(q, m.top.cancellation)
|
searchSuggestsions = InnertubeService.SearchSuggestions(q, m.top.cancellation)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -70,18 +70,18 @@ namespace Invidious
|
|||||||
if m.preferences = invalid
|
if m.preferences = invalid
|
||||||
m.preferences = m.invidiousNode.preferences
|
m.preferences = m.invidiousNode.preferences
|
||||||
end if
|
end if
|
||||||
instance = m.preferences["invidious.instance"]
|
|
||||||
|
|
||||||
if not StringUtils.IsNullOrEmpty(instance)
|
backend = m.preferences["backend.selected"]
|
||||||
return instance
|
if backend = "invidious"
|
||||||
|
instance = m.preferences["invidious.instance"]
|
||||||
|
if not StringUtils.IsNullOrEmpty(instance)
|
||||||
|
return instance
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
instance = DEFAULT_INSTANCE
|
instance = DEFAULT_INSTANCE
|
||||||
if instance.StartsWith("http://127.0.0.1:8888")
|
address = m.invidiousNode.webServer@.GetServerAddress()
|
||||||
address = m.invidiousNode.webServer@.GetServerAddress()
|
instance = instance.Replace("http://127.0.0.1:8888", address)
|
||||||
instance = instance.Replace("http://127.0.0.1:8888", address)
|
|
||||||
end if
|
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,23 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
|
|||||||
isDirty = true
|
isDirty = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if userPrefs.__version = 3
|
||||||
|
if IsString(userPrefs["playback.backend"])
|
||||||
|
backend = userPrefs["playback.backend"]
|
||||||
|
userPrefs.Delete("playback.backend")
|
||||||
|
userPrefs["backend.selected"] = backend
|
||||||
|
end if
|
||||||
|
userPrefs.__version = 4
|
||||||
|
isDirty = true
|
||||||
|
end if
|
||||||
|
|
||||||
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
|
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if userPrefs.__version <> m.top.__version
|
||||||
|
throw "Preferences version mismatch. Expected: " + m.top.__version + ", found: " + userPrefs.__version
|
||||||
|
end if
|
||||||
|
#end if
|
||||||
return isDirty
|
return isDirty
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
user prefs saved need to be migrated. If the version is less than the
|
user prefs saved need to be migrated. If the version is less than the
|
||||||
current version, a migration is needed.
|
current version, a migration is needed.
|
||||||
-->
|
-->
|
||||||
<field id="__version" type="integer" value="2" />
|
<field id="__version" type="integer" value="4" />
|
||||||
<field id="prefsModel" type="array" />
|
<field id="prefsModel" type="array" />
|
||||||
<field id="preferenceFields" type="assocarray" />
|
<field id="preferenceFields" type="assocarray" />
|
||||||
<function name="GetUserPreferences" />
|
<function name="GetUserPreferences" />
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function VideoContentTask(input as object) as object
|
|||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
service = new Invidious.InvidiousService(invidiousNode)
|
||||||
|
|
||||||
backend = preferencesNode["playback.backend"]
|
backend = preferencesNode["backend.selected"]
|
||||||
if backend = "playlet"
|
if backend = "playlet"
|
||||||
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
|
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
|
||||||
"cancellation": m.top.cancellation
|
"cancellation": m.top.cancellation
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function VideoContentTaskDev(input as object) as object
|
|||||||
|
|
||||||
backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg`
|
backgroundPoster.uri = `${instance}/vi/${videoId}/maxresdefault.jpg`
|
||||||
|
|
||||||
backend = preferencesNode["playback.backend"]
|
backend = preferencesNode["backend.selected"]
|
||||||
if backend = "playlet"
|
if backend = "playlet"
|
||||||
metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: m.top.cancellation })
|
metadata = InnertubeService.GetVideoMetadata(videoId, { cancellation: m.top.cancellation })
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function VideoQueueViewContentTask(input as object) as object
|
|||||||
|
|
||||||
index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1)
|
index = MathUtils.Clamp(input.index - 2, 0, videoNodes.Count() - 1)
|
||||||
|
|
||||||
backend = preferencesNode["playback.backend"]
|
backend = preferencesNode["backend.selected"]
|
||||||
|
|
||||||
requestOptions = {
|
requestOptions = {
|
||||||
cacheSeconds: 8640000 ' 100 days
|
cacheSeconds: 8640000 ' 100 days
|
||||||
|
|||||||
@@ -27,21 +27,28 @@
|
|||||||
visibility: "web",
|
visibility: "web",
|
||||||
svelteComponent: "EditQualityControl",
|
svelteComponent: "EditQualityControl",
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayText: "Backend",
|
||||||
|
key: "backend",
|
||||||
|
description: "Backend preferences",
|
||||||
|
children: [
|
||||||
{
|
{
|
||||||
displayText: "Backend",
|
displayText: "Selected backend",
|
||||||
key: "playback.backend",
|
key: "backend.selected",
|
||||||
description: "The backend used for fetching video data. The Playlet backend is experimental",
|
description: "The backend used for browsing and playing videos.",
|
||||||
type: "radio",
|
type: "radio",
|
||||||
defaultValue: "playlet",
|
defaultValue: "playlet",
|
||||||
options: [
|
options: [
|
||||||
{
|
|
||||||
displayText: "Invidious",
|
|
||||||
value: "invidious",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayText: "Playlet (local)",
|
displayText: "Playlet (local)",
|
||||||
value: "playlet",
|
value: "playlet",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayText: "Invidious",
|
||||||
|
value: "invidious",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user