Open Leo32345 opened 2 years ago
hm, sorry that you are having problems with the library. thanks for submitting an issue :)
the notification URL is built like so (index.js:556)
this.district.district_baseurl + notification.linkUrl + notification.linkContext,
based on your screenshot it looks like the .linkUrl
and .linkContext
properties are missing from the notification object returned by Infinite Campus. It's likely that the Infinite Campus server version your school is using has a different way of storing this info, probably .urlLink
instead of .linkUrl
or something like that. I.C. likes to change the property names around which really makes my life difficult.
Anyways, on to fixing this. If you send me the debug output from here: https://replit.com/@qwazwsx/Infinite-Campus-Debug, I'll add support for your version of Infinite Campus and update the library ASAP. Feel free to redact any info you feel is sensitive. Alternatively, you can make these changes to the library to get the same debug output locally.
Send me the debug output and I'll get back to you ASAP.
Thanks for the fast response!
Also, I just was looking at my school's infinite campus site, and it says: Version: Campus.2148.8
.
Anyway the (beginning part of) the output is below:
User {
_events: [Object: null prototype] { error: [Function], ready: [Function] },
_eventsCount: 2,
_maxListeners: undefined,
meta: { version: '2.0.0', github: 'qwazwsx/infinite-campus' },
authenticated: false,
cookies: RequestJar {
_jar: CookieJar { enableLooseMode: true, store: { idx: {} } }
},
hasErrorListener: false,
[Symbol(kCapture)]: false
}
Hint: hit control+c anytime to enter REPL.
FETCHING NOTIFICATIONS...
[GET NOTIFICATIONS][#0] {
notificationID: '660642045',
userID: '231660',
creationTimestamp: '01/18/2022 09:12:55 -0700',
notificationTypeID: '4',
read: 'false',
notificationText: 'Leo received a score of 10 out of 10 on *** in ***',
notificationTypeText: 'Assignment Score Event',
displayedDate: 'Today, 9:12 AM',
finalText: 'Leo received a score of 10 out of 10 on *** in ***',
finalUrl: ''
}
…
Then it ends with stuff that looks like this:
[
{
id: '660642045',
text: 'Leo received a score of 10 out of 10 on *** in ***,
timestamp: 1642522375,
timestampText: 'Today, 9:12 AM',
type: '4',
link: 'https://campus.************.com/campus/undefinedundefined',
read: false,
toggleRead: [Function: toggleRead]
},
… ]
If you need more information, feel free to let me know.
Thanks for posting your debug output!
From what I can see from the important bit here
...
[GET NOTIFICATIONS][#0] {
notificationID: '660642045',
userID: '231660',
creationTimestamp: '01/18/2022 09:12:55 -0700',
notificationTypeID: '4',
read: 'false',
notificationText: 'Leo received a score of 10 out of 10 on *** in ***',
notificationTypeText: 'Assignment Score Event',
displayedDate: 'Today, 9:12 AM',
finalText: 'Leo received a score of 10 out of 10 on *** in ***',
finalUrl: ''
}
...
As suspected, the notification objects returned from I.C. do not contain the .linkUrl
and .linkContext
properties that this library uses. I suspect that your version of I.C. uses the notification ID to construct a URL rather than specifying the URL directly. It'd look a little something like this
'https://my-district.infinitecampus.org/campus/API/whatever/blah/blah/notification?id=660642045
Unfortunately, I no longer have access to Infinite Campus, which makes maintaining an Infinite Campus library very difficult. Is there any way you can send me an example of the notification link from the Infinite Campus website? Maybe by right-clicking on the notification and copying the link? If not I'll have a friend get me the link format in the morning and I should be able to investigate this more. Sorry for the delay.
The URL for that notification when you click on it is:
https://campus.***************.com/campus/nav-wrapper/student/portal/student/classroom/2023019/curriculum/resource/7521225/view?studentID=466894¬ification=true&userType=student
It looks like that the IDs in the URL are different from the one in the API sadly.
hmm, okay that's unfortunate.
let's try this new debug version https://replit.com/@qwazwsx/Infinite-Campus-Notification-Debug-2
and then could you send me the output labeled "[RAW NOTIFICATION PRISM OUTPUT]". This should be the raw output from the getNotification API endpoint. Feel free to anonymize anything or send the output to my email
There's a chance they restructured the whole layout of the Notifications API. This will just let me get a closer look at how the data is structured.
Okay, so the output looks like this:
{"status":"OK","data":{"NotificationList":{"Notification":[{"notificationID":"660642045","userID":"231660","creationTimestamp":"01/18/2022 09:12:55 -0700","notificationTypeID":"4","read":"true","notificationText":"Leo received a score of 10 out of 10 on **** in ********","notificationTypeText":"Assignment Score Event","displayedDate":"Today, 9:12 AM","finalText":"Leo received a score of 10 out of 10 on **** in ********","finalUrl":""},{"notificationID":"660642013","userID":"231660","creationTimestamp":"01/18/2022 09:12:55 -0700","notificationTypeID":"3","read":"true","notificationText":"Leo has an updated grade of A (100.00%) in ****: QUARTER GRADE","notificationTypeText":"Grade Event","displayedDate":"Today, 9:12 AM","finalText":"Leo has an updated grade of A (100.00%) in ******* QUARTER GRADE","finalUrl":""},
Anyways, thanks for the fast response. Unfortunately, I will be offline soon for about almost a day, so I may not reply for a while.
I had a friend with access to I.C. check it out and they are having the same issue.
I'll have to look into this more. If the URL's aren't coming from the getNotifications endpoint I'm not sure where they are coming from
I know @Lathryx expressed some interest in helping me maintain this library. Perhaps they could look into this?
Heres a recap on what we know so far
.linkUrl
and .linkContext
properties of the notification object
(index.js:556)
this.district.district_baseurl + notification.linkUrl + notification.linkContext,
.finalUrl
property which always returns an empty string
{
notificationID: '660642045',
userID: '231660',
creationTimestamp: '01/18/2022 09:12:55 -0700',
notificationTypeID: '4',
read: 'false',
notificationText: 'Leo received a score of 10 out of 10 on *** in ***',
notificationTypeText: 'Assignment Score Event',
displayedDate: 'Today, 9:12 AM',
finalText: 'Leo received a score of 10 out of 10 on *** in ***',
finalUrl: '',
// the below properties used to exist but now they don't
linkUrl: undefined
linkContext: undefined
}
It's important to note that we should always maintain backward maintainability so any changes must support both the old and new ways of building notification URL's.
Any and all help is appreciated in investigating this.
There is an "undefinedundefined" part in the url that does not work. Is there any way I can fix this?