Skip to content

Commit

Permalink
Support http links
Browse files Browse the repository at this point in the history
  • Loading branch information
beatgammit committed Jun 15, 2023
1 parent 7bc1030 commit 50b96c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/com/jerboa/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,14 @@ fun LazyListState.isScrolledToEnd(): Boolean {
* Parses a "url" and returns a spec-compliant Url:
*
* - https://host/path - leave as-is
* - http://host/path - leave as-is
* - /c/community -> https://currentInstance/c/community
* - /c/community@instance -> https://instance/c/community
* - !community@instance -> https://instance/c/community
* - @user@instance -> https://instance/u/user
*/
fun parseUrl(url: String): String? {
if (url.startsWith("https://")) {
if (url.startsWith("https://") || url.startsWith("https://")) {
return url
} else if (url.startsWith("/c/")) {
if (url.count({ c -> c == '@' }) == 1) {
Expand Down

0 comments on commit 50b96c0

Please sign in to comment.