mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
feat: shorten youtube links when sharing video
This commit is contained in:
parent
770bb0e39f
commit
87835f9747
@ -58,12 +58,12 @@ class ShareDialog : DialogFragment() {
|
|||||||
// only available for custom instances
|
// only available for custom instances
|
||||||
else -> instanceUrl
|
else -> instanceUrl
|
||||||
}
|
}
|
||||||
val path = when (shareObjectType) {
|
var url = when {
|
||||||
ShareObjectType.VIDEO -> "/watch?v=$id"
|
shareObjectType == ShareObjectType.VIDEO && host == YOUTUBE_SHORT_URL -> "$YOUTUBE_SHORT_URL/$id"
|
||||||
ShareObjectType.PLAYLIST -> "/playlist?list=$id"
|
shareObjectType == ShareObjectType.VIDEO -> "$host/watch?v=$id"
|
||||||
else -> "/channel/$id"
|
shareObjectType == ShareObjectType.PLAYLIST -> "${host}/playlist?list=$id"
|
||||||
|
else -> "${host}/channel/$id"
|
||||||
}
|
}
|
||||||
var url = "$host$path"
|
|
||||||
|
|
||||||
if (shareObjectType == ShareObjectType.VIDEO && binding.timeCodeSwitch.isChecked) {
|
if (shareObjectType == ShareObjectType.VIDEO && binding.timeCodeSwitch.isChecked) {
|
||||||
url += "&t=${binding.timeStamp.text}"
|
url += "&t=${binding.timeStamp.text}"
|
||||||
@ -118,6 +118,7 @@ class ShareDialog : DialogFragment() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val YOUTUBE_FRONTEND_URL = "https://www.youtube.com"
|
const val YOUTUBE_FRONTEND_URL = "https://www.youtube.com"
|
||||||
|
const val YOUTUBE_SHORT_URL = "https://youtu.be"
|
||||||
const val PIPED_FRONTEND_URL = "https://piped.video"
|
const val PIPED_FRONTEND_URL = "https://piped.video"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user