Remove not needed utils

This commit is contained in:
Brahim Hadriche committed 2023-01-22 21:40:11 -05:00
1 parent 9848c2a31a
commit ee29d7a4b3
5 files changed
+7 -25

No files matched your search

@@ -28,7 +28,7 @@ namespace Http
path_in_route = request.route.Mid(router.route.Len())
decoded_path = WebUtils.UrlUnescape(path_in_route)
decoded_path = path_in_route.DecodeUri()
full_path = PathJoin(router.root, decoded_path)
path = CreateObject("roPath", full_path)
@@ -142,7 +142,7 @@ namespace Http
listing = listing + "<title>" + response.settings.ServerName + "</title>" + UnixNL()
listing = listing + "</head>" + UnixNL()
listing = listing + "<body>" + UnixNL()
listing = listing + "<h1>" + WebUtils.URLUnescape(request.uri) + "</h1>" + UnixNL()
listing = listing + "<h1>" + request.uri.DecodeUri() + "</h1>" + UnixNL()
listing = listing + "<tt><pre>" + UnixNL()
dir = path.getString()
@@ -34,8 +34,8 @@ namespace Http
if request.query["token"] <> invalid and request.query["referer"] <> invalid
' Token is encoded twice for some reason
token = WebUtils.UrlUnescape(request.query["token"]).DecodeUriComponent()
referer = WebUtils.UrlUnescape(request.query["referer"])
token = request.query["token"].DecodeUri().DecodeUriComponent()
referer = request.query["referer"].DecodeUri()
InvidiousSettings.SetAuthToken(token, referer)
server.task.top.login = true
end if
+1 -1
View File
@@ -126,7 +126,7 @@ namespace Invidious
webServerPort = 8888
expire = TimeUtils.Now().AsSeconds() + 60 * 60 * 24 * 365 * 2 '2 years from now
callbackUrl = WebUtils.UrlEscape(`http://${localIp}:${webServerPort}${Invidious.TOKEN_CALLBACK}?referer=${instance}`)
callbackUrl = `http://${localIp}:${webServerPort}${Invidious.TOKEN_CALLBACK}?referer=${instance}`.EncodeUriComponent()
return `${invidiousHost}/authorize_token?scopes=${Invidious.AUTH_SCOPE}&callback_url=${callbackUrl}&expire=${expire}`
end function
+2 -2
View File
@@ -57,8 +57,8 @@ namespace SponsorBlock
categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "chapter", "filler", "exclusive_access"]
actionTypes = ["skip", "mute", "chapter", "full", "poi"]
categoriesJson = WebUtils.UrlEscape(FormatJson(categories))
actionTypesJson = WebUtils.UrlEscape(FormatJson(actionTypes))
categoriesJson = FormatJson(categories).EncodeUriComponent()
actionTypesJson = FormatJson(actionTypes).EncodeUriComponent()
' From SponsorBlock docs: It should be the first 4 - 32 characters (4 is recommended).
hashPrefix = GetSha256(videoId).Left(4)
-18
View File
@@ -1,24 +1,6 @@
import "pkg:/source/utils/Types.bs"
namespace WebUtils
function UrlEscape(url as string) as string
ue = m.UrlEncoder
if ue = invalid
ue = CreateObject("roUrlTransfer")
m.UrlEncoder = ue
end if
return ue.escape(url)
end function
function UrlUnescape(url as string) as string
ue = m.UrlEncoder
if ue = invalid
ue = CreateObject("roUrlTransfer")
m.UrlEncoder = ue
end if
return ue.unescape(url)
end function
function UrlQueryComponents(url as string) as object
query = {}
index = Instr(0, url, "?")