another url format

This commit is contained in:
Alex Grintsvayg 2020-12-02 15:44:17 -05:00
parent 694faae00f
commit 1050699e4c
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -15,6 +15,7 @@ import (
"os" "os"
"os/user" "os/user"
"path/filepath" "path/filepath"
"regexp"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -111,6 +112,11 @@ func view(c *gin.Context) {
return return
} }
if parts := regexp.MustCompile(`^(view/)?([a-f0-9]+)/(.*?)\.(.*)$`).FindStringSubmatch(url); parts != nil {
c.Redirect(302, fmt.Sprintf("https://cdn.lbryplayer.xyz/speech/%s:%s.%s", parts[3], parts[2], parts[4]))
return
}
c.Redirect(302, "https://cdn.lbryplayer.xyz/speech/"+url) c.Redirect(302, "https://cdn.lbryplayer.xyz/speech/"+url)
return return
} }