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

Favourite hearts on downloaded static scoreboard have no effect when opened as local file #2724

Open
mpsijm opened this issue Sep 27, 2024 · 3 comments

Comments

@mpsijm
Copy link
Contributor

mpsijm commented Sep 27, 2024

Description of the problem

When I download the "Public static scoreboard ZIP", it includes the favourite hearts. It appears that a cookie is used to store which teams are favourited, and the pinned teams are rendered client-side on page load. However, when opening the scoreboard's index.html as file in my browser, it does not work.

Your environment

DemoWeb

Steps to reproduce

  1. Download static scoreboard from https://www.domjudge.org/demoweb/jury/contests/7/public-scoreboard.zip
  2. Unzip it
  3. Open file:///home/[user]/Downloads/scoreboard/index.html in your browser
  4. Click a heart

Expected behaviour

The team is favourited and pinned to the top.

Actual behaviour

No visual change, and an error in the console:
image

Any other information that you want to share?

Since everything is managed on the client and there is no server involved anymore, I expect that it is not necessary to make an XMLHttpRequest. Instead, the page should simply window.reload() after updating the cookie.

Note that this does work when serving the unzipped scoreboard folder using python3 -m http.server and accessing http://localhost:8000.

I'm also wondering why cookies are used instead of the browser's localStorage.

@meisterT
Copy link
Member

I'm also wondering why cookies are used instead of the browser's localStorage

No particular reason, I just didn't know any better

@meisterT
Copy link
Member

@mpsijm do you want to contribute a fix here?

@mpsijm
Copy link
Contributor Author

mpsijm commented Oct 22, 2024

I'll be happy to take a look after the upcoming contest(s), since I'm currently kind of swamped 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants