mirror of
https://github.com/yattee/yattee.git
synced 2026-05-14 03:15:03 +00:00
Resolve URL shorteners and prompt for ambiguous description links
Tapping bit.ly/tinyurl/t.co/etc. in a description or comment previously opened Safari even when the destination was a playable YouTube URL. Added an opt-in "Resolve Short Links" toggle under YouTube Enhancements (off by default) that follows the redirect on tap: if the target is a YouTube/PeerTube/direct-media URL, open it in-app; otherwise prompt the user before falling back to yt-dlp extraction or the browser. Also added a confirmation dialog for non-shortener links that only matched the loose .externalVideo yt-dlp fallback, so arbitrary web pages in descriptions no longer silently kick off extraction. Prompts live on NavigationCoordinator and are dual-hosted by YatteeApp and ExpandedPlayerSheet so they remain visible whether or not the expanded player is covering the main view.
This commit is contained in:
@@ -41,6 +41,9 @@ enum SettingsKey: String, CaseIterable {
|
||||
case deArrowAPIURL
|
||||
case deArrowThumbnailAPIURL
|
||||
|
||||
// Short link resolution
|
||||
case resolveShortLinksEnabled
|
||||
|
||||
// Platform-specific
|
||||
case macPlayerMode
|
||||
case playerSheetAutoResize
|
||||
|
||||
@@ -87,4 +87,21 @@ extension SettingsManager {
|
||||
set(newValue, for: .deArrowThumbnailAPIURL)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Short Link Resolution
|
||||
|
||||
/// When enabled, taps on known URL shorteners (bit.ly, tinyurl, t.co, …) in
|
||||
/// descriptions and comments follow the redirect and, if the destination is a
|
||||
/// supported YouTube/PeerTube URL, open it in-app. Off by default because it
|
||||
/// performs a network request to the shortener host on tap.
|
||||
var resolveShortLinksEnabled: Bool {
|
||||
get {
|
||||
if let cached = _resolveShortLinksEnabled { return cached }
|
||||
return bool(for: .resolveShortLinksEnabled, default: false)
|
||||
}
|
||||
set {
|
||||
_resolveShortLinksEnabled = newValue
|
||||
set(newValue, for: .resolveShortLinksEnabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user