Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW FEATURE]: Automatically open all stared courses #141

Open
A-K-O-R-A opened this issue Jan 24, 2024 · 3 comments
Open

[NEW FEATURE]: Automatically open all stared courses #141

A-K-O-R-A opened this issue Jan 24, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@A-K-O-R-A
Copy link
Contributor

A-K-O-R-A commented Jan 24, 2024

Suggestion

For me it would be very useful to automatically open all my starred courses every time I visit Opal.
So instead of seeing this when opening Opal:
image
I would like to see this:
image

Why?

Because often when I open Opal I want to check multiple things, and this makes switching between my courses so much faster as I don't even have to click on the TUFast extension anymore. Having the tabs with open courses is a builtin feature of Opal and it perfectly solves my problem, it is just annoying that I have to open them all individually every time.

Downsides

Right now I cannot think of any downsides that this feature would have, it might require to refresh the page once all the opening requests are made, but those 200ms is a well worth sacrifice, at least for me.

Technical details

Opening up a course can be done through sending a GET request to /opal/auth/RepositoryEntry/${courseId}. As TUFast already knows all my starred courses, implementing this wouldn't be hard. It would just require a simple toggle switch in the settings.

I think I could implement this on my own and open up a PR when I'm ready but I just wanted to check before doing all the work

@A-K-O-R-A A-K-O-R-A added the enhancement New feature or request label Jan 24, 2024
@OliEfr
Copy link
Member

OliEfr commented Jan 24, 2024

Thanks for the comprehensive explanation. I think I understand your issue.

It sounds perfectly sensible to me to implement this. The technical solution you propose seems also valid to me.

Two things that come to my mind that might be worth checking are:

  • Does Opal close all the tabs by default when logging out? (Otherwise you would spam tabs.)
  • As a security measure, only open the first "X" favorites as tabs, otherwise it might crash the page if someone has 100 favs.

As I think you already mentioned, it would be an optional setting, as users might not want it and it prolongs page load time. (It could be activated by default though for new installs, as of my opinion.)

The feature itself would be implemented in the "Opal content script", I think. If you have any questions, feel free to post them here.

@A-K-O-R-A
Copy link
Contributor Author

Opal does indeed close all tabs when logging out, I tried to find out if there is a way to change this default behavior but my search on the Opal documentation did not yield any results.

The second point of not opening too many tabs is a very valid concern, I will take that into consideration.

My current plan is to add a script to the src/contentScripts/other/opal folder and then add it as a https://bildungsportal.sachsen.de/opal/* matching script. As it only makes sense to do these requests when the user is already logged in I am wondering how to check that. Is it viable to check for the authenticated-marker cookie or what is the preferred way to check if a user is logged in or not?

@OliEfr
Copy link
Member

OliEfr commented Jan 25, 2024

Your idea sounds good. Site checking is a bit messy. Using your suggested cookie is definetely fine if it works, i.e. it might even be better than the methods we are currently using.

Here we are using the window.location.pathname to check if we are on a certain page. (Might not be applicable to this issue.) Here we are checking if a certain DOM-Element exists using optional chaining to determine the injection of a tag. (Props to @C0ntroller for using that syntax.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants