placeholder
This commit is contained in:
1 parent
f3f9327c1c
commit
af4a6ee726
2 files changed
+72
No files matched your search
+55
@@ -197,6 +197,49 @@ namespace Http
|
||||
return true
|
||||
end function
|
||||
|
||||
function AuthMarkVideoWatched(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
route = request.route
|
||||
|
||||
accessToken = request.headers["authorization"]
|
||||
if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
|
||||
response.Json({
|
||||
"error": "Missing or invalid 'Authorization' header"
|
||||
})
|
||||
response.http_code = 403
|
||||
return true
|
||||
end if
|
||||
|
||||
videoId = route.Mid("/playlet-invidious-backend/api/v1/auth/history/".Len())
|
||||
if videoId.InStr("?") > 0
|
||||
videoId = videoId.Left(videoId.InStr("?"))
|
||||
end if
|
||||
|
||||
if StringUtils.IsNullOrEmpty(videoId)
|
||||
response.Json({
|
||||
"error": "Missing 'videoId' path parameter"
|
||||
})
|
||||
response.http_code = 400
|
||||
return true
|
||||
end if
|
||||
|
||||
options = {
|
||||
"accessToken": accessToken.Mid("Bearer ".Len())
|
||||
}
|
||||
|
||||
if not InnertubeService.AuthMarkVideoWatched(videoId, options)
|
||||
response.Json({
|
||||
"error": "Failed to mark video as watched"
|
||||
})
|
||||
response.http_code = 500
|
||||
return true
|
||||
end if
|
||||
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/api/v1/stats")
|
||||
function GetStats(context as object) as boolean
|
||||
response = context.response
|
||||
@@ -444,6 +487,18 @@ namespace Http
|
||||
return false
|
||||
end function
|
||||
|
||||
@post("*")
|
||||
function PostAll(context as object) as boolean
|
||||
request = context.request
|
||||
route = request.route
|
||||
|
||||
if route.StartsWith("/playlet-invidious-backend/api/v1/auth/history/")
|
||||
return m.AuthMarkVideoWatched(context)
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetVideo(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
Reference in new issue
Block a user