Skip to content

Conversation

@Joshua2504
Copy link

No description provided.

@Joshua2504 Joshua2504 requested a review from Copilot March 29, 2025 15:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR merges updates from the mascal branch into main by standardizing error reporting and refreshing version information. Key changes include:

  • Adding an eprint() function to both warstatus scripts for consistent error output.
  • Replacing print calls with eprint in error-handling blocks.
  • Updating version strings in JavaScript files and adding a maintenance notice in the README.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
warstatus/warstatus.py Introduces error logging via eprint and replaces print calls.
warstatus/stats/generate.py Updates error messages to use eprint for consistency.
js/menu.js Updates version information.
js/bosses.js Updates respawn timestamps and corresponding comments.
README.md Adds a maintenance mode notice with links for further developments.
Comments suppressed due to low confidence (2)

warstatus/warstatus.py:51

  • [nitpick] Consider removing the extra space before the exclamation mark to ensure the error message is clear and consistent.
eprint("Failed to fetch the page ! " + traceback.format_exc())

warstatus/warstatus.py:223

  • [nitpick] Consider rephrasing this error message for clarity, for example: 'Unexpected upstream HTML format or server reboot detected; aborting operation.'
eprint("Messed up upstream HTML or server reboot, write nothing")

@Joshua2504 Joshua2504 self-assigned this Mar 29, 2025
@mascaldotfr
Copy link

mascaldotfr commented Apr 30, 2025

Hi @Joshua2504,

Copilot is WAY too dumb to solve this 🤣 It requires ancient, pre-Github wizardry: mail patches, with path manipulation.

I could have just pushed the branch, but I think it's interesting for you to get to know how to do it, for the future :

git clone https://github.com/mascaldotfr/CoRT.git
cd CoRT

# Get the last 6 patches; you can also specify a specific commit and stuff
# Your menu.js is too different to get merged
git format-patch --stdout -6 ':!js/menu.js' > /tmp/mascal_changes.patch

# Change paths (hopefully I almost never change html stuff ahah)
# That's MacOS syntax already for sed(1) iirc
sed -E -i '' 's@(a|b)/(js|data)@\1/public/\2@g' /tmp/mascal_changes.patch

# Get back to your own repo
cd /where/is/yourCoRT

# We create our own branch
git checkout v2 # your main branch
git checkout -b mascal_import20250430 # create an import branch

# Then we apply the patch
git am /tmp/mascal_changes.patch

# All your commits are already in that branch
git log

# Just push the branch
git push origin mascal_import20250430:mascal_import20250430

And then you can PR from Github :)

48f7681 strikes again. Move the date formatter instanciation in
document.ready.
I've bikeshedded the thing because such occurrence is very rare, but
Chrome (and all its variants) loop indefinitely if a shared setup link
is bad, because it doesn't like :

```
window.alert(...)
window.location.replace(...)
```

Fixed it by replacing the trainer body by an alert message and countdown
for redirection to the trainer.

Also, fixed some bad calls to the function, and removed the legacy
parameter for this function.

You can visit it from that link:
https://mascaldotfr.github.io/CoRT/?t=aea8baaaaabaaaaabaaaaabaaaaabaaaaabaaaaaZaaaaa
No functional change.

Intro: https://caniuse.com/dialog

Until now, there were 2 implementations for getting the saved setup
urls:

1. <dialog> for modern browsers, it excluded especially our current
   baseline browser (FF78) which has always annoyed me
2. Javascript's antiquated `window.prompt` as a fallback

This commit introduces the same "dialog" for everyone by dropping
<dialog>, implementing pre <dialog> solution instead. That may be seen
as a step back, but note that <dialog> has been introduced lately in
Firefox and Safari (late 2021 to be precise).

Tested succesfully on a vast array of configurations (thanks
browserstack!).
webp support: https://caniuse.com/webp

Images size are divided by 3.

It wasn't done before because Safari adopted the format lately (2022).

Actually, it's not a problem for old desktop Macs where you can use
another browser, but for iOS, it was an issue since they force using
Webkit even with when using Firefox or Chrome. But it's no more 2022
anymore.

That change still allows old iPhones compatible with iOS 14 to use CoRT
as usual, meaning iPhones 6s (released in _2015_) and later are
supported.
Replace the old `.skill-*` CSS classes with `data-status` attributes
selectors for managing skill icon states (active, available, disabled)
and button visibility.

This makes the trainer UI consistently attribute-driven and avoid the
javascript middleware that was used for changing classes. Because
classlists are attributes as well, there is no performance change.
It reduces skillbars size from 30 to 50%. See 919a767 for rationale.

A new CoRT-icons release will appear soon.
This mostly concerns saved setups, which used to be slow to load.

Loading the whole tree for a full lvl 60 conjurer saved setup is now 10
times faster than in last June, and 3 times faster than in the previous
commit. Also the global page loading is 2.5 times faster.

In this commit, we're still reducing useless DOM reads and writes:

- Cache selectors when doing multiple click on the same power /
  discipline. And stop clicking, we call directly functions instead.
- Instead of hiding '+' and '-' buttons individually, hide the whole
  spinner instead
- "data-value" attr has become useless for power points (PP) and
  discipline points (DP) left
- Skip intermediate UI updates during automated setup loading,
  `input_from_url()` now only updates trees' visual state once by tree,
  and set PP and DP left only once the whole setup has been put in
  place.
- Defer tooltips binding so skillbars are shown earlier
- Use querySelector for fetching data from the DOM whenever it's
  possible, instead of getElementsByClassName().

Survived tests.html. Special thanks to Chrome's profiler <3
We're also using the nopro version which is a tad shorter in size. Well,
it's still a monster.
But the whole block made no sense at all, so finally I removed it. While here,
fix a badly worded comment.
This make the page loading smoother on mobile. More on media queries in
the next commit ;)
Time to fix CoRT's special kid now I have some better ideas about modern
CSS stuff than I did almost 3 years ago.

This should improve the perceived smoothness while (re)loading the page,
on mobile and low res screens. There should be no change on desktops.

What's new:

- Until now, the layout was flex on desktop, but grid on mobile. Don't
  ask, I don't remember why I made that stupid decision. Now everything
  is flex. Browsers are smarter than me.
- Put ALL sizing stuff that may differ according to screen resolutions
  under media queries. It avoids annoying <div> floating and flicker,
  and useless layout recalculations.
- Stop trying to put a square map in the middle of a bunch of
  rectangular widgets. Include the square map in a rectangular `.card`.
- Mobile mode activates at width <= 512px. Starting from 513px to 1024px
  we reduce the map to 400px so at 1024x768 so you get two columns at
  this resolution instead of big a.. map.

Tested on a vast variety of devices and screen resolutions (thanks
Browserstack!).
Tweak menu.js, so I just have to use a <div> with a "temporary-message"
id and a few attributes to set up various temporary messages.

Before that, I had to change i18n.js, the page javascript and html. Uff
As seen during the anniversary 2025 event with similar epic days. It's
not confirmed for this one but I'm pretty sure it's going to happen.
I dunno when that bug was introduced, but the code was kinda lousy, with
useless use of string manipulations.
I forgot that I have to test in other language, where the hour is
represented differently. Use english for all hours, and ensure leading
zeroes are removed.
This only concerns page called with the ?lang parameter, as such it's
mostly a SEO thing.
Eve's respawn time was drifting 4 cycles earlier than planned, so remove
4 for Daen (I can't assist to a respawn before 2 weeks)
It appears it drifted quite a lot, probably because I figured out too
late I disabled NTP while getting the previous respawn.
So many things changed in 3 years...
1 second too late; drifting haven't changed!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants