Fix adding vToken headers during registration
This commit is contained in:
parent
c1e40d8538
commit
5999e046e4
1 changed files with 6 additions and 8 deletions
|
@ -345,25 +345,23 @@ internal class RegisterRepository(
|
|||
private suspend fun getEduOneDiaries(baseStudentPlus: String, homepage: String): List<RegisterStudent> {
|
||||
val moduleHeaders = getModuleHeadersFromDocument(homepage)
|
||||
|
||||
val contextUrl = (baseStudentPlus + "api/Context")
|
||||
.toHttpUrl()
|
||||
.mapModuleUrls(StudentPlusModuleHost, moduleHeaders.appVersion)
|
||||
val contextUrl = (baseStudentPlus + "api/Context").toHttpUrl()
|
||||
val contextVToken = contextUrl.getMatchedVToken(StudentPlusModuleHost, moduleHeaders)
|
||||
val mappedContextUrl = contextUrl.mapModuleUrls(StudentPlusModuleHost, moduleHeaders.appVersion)
|
||||
|
||||
val semestersUrl = (baseStudentPlus + "api/OkresyKlasyfikacyjne")
|
||||
.toHttpUrl()
|
||||
.mapModuleUrls(StudentPlusModuleHost, moduleHeaders.appVersion)
|
||||
val semestersUrl = (baseStudentPlus + "api/OkresyKlasyfikacyjne").toHttpUrl()
|
||||
val semestersVToken = semestersUrl.getMatchedVToken(StudentPlusModuleHost, moduleHeaders)
|
||||
val mappedSemestersUrl = semestersUrl.mapModuleUrls(StudentPlusModuleHost, moduleHeaders.appVersion)
|
||||
|
||||
return studentPlus
|
||||
.getContextByUrl(vToken = contextVToken, url = contextUrl.toString()).students
|
||||
.getContextByUrl(vToken = contextVToken, url = mappedContextUrl.toString()).students
|
||||
.map { contextStudent ->
|
||||
val semesters = runCatching {
|
||||
when {
|
||||
contextStudent.isAuthorizationRequired -> emptyList()
|
||||
else -> studentPlus.getSemestersByUrl(
|
||||
vToken = semestersVToken,
|
||||
url = semestersUrl.toString(),
|
||||
url = mappedSemestersUrl.toString(),
|
||||
key = contextStudent.key,
|
||||
diaryId = contextStudent.registerId,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue