Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deldesir
Copy link
Collaborator

@deldesir deldesir commented Nov 9, 2023

Switch to next url if previous fails

Switch to next url if previous fails
@deldesir deldesir added the bug Something isn't working label Nov 9, 2023
@deldesir deldesir requested a review from holta November 9, 2023 08:18
@deldesir deldesir self-assigned this Nov 9, 2023
@holta
Copy link
Member

holta commented Nov 9, 2023

Is it necessary to hard-code /books/media in 2 different places?

https://github.com/deldesir/calibre-web/blob/60e9c77f0161298171518710294f723c7852a7a4/cps/static/js/main.js#L218
https://github.com/deldesir/calibre-web/blob/60e9c77f0161298171518710294f723c7852a7a4/cps/static/js/main.js#L251

Is DRY / SSOT not possible in this situation?


ASIDE: Hard-coding is fine for now, but in future months (if future-proof automation is genuinely safe!) then we can consider driving off of...

/etc/iiab/local_vars.yml customized variables like these three:

calibreweb_url1: /books     # For SHORT URL http://box/books  (English)
calibreweb_url2: /libros    # For SHORT URL http://box/libros (Spanish)
calibreweb_url3: /livres    # For SHORT URL http://box/livres (French)

https://github.com/iiab/iiab/blob/579cfac36eca6e8c3916b4d91fa4c430bbf69cbf/vars/default_vars.yml#L661-L663

...as mentioned in:

@holta
Copy link
Member

holta commented Nov 9, 2023

@deldesir thanks for the excellent, long & edifying design review earlier this morning. 💯

Quick summary:

Feel free to re-work this PR in-place — or perhaps to replace it with an entirely new PR — either way! ✅

Determine the appropriate endpoint based on user input
@deldesir deldesir marked this pull request as ready for review November 9, 2023 20:12
@deldesir deldesir marked this pull request as draft November 9, 2023 20:23
Use the referrer too determine the endpoint
@deldesir deldesir marked this pull request as ready for review November 9, 2023 23:40
@holta
Copy link
Member

holta commented Nov 10, 2023

Fantastic progress.

No matter if a future PR later steers this in a slightly different direction.

Extract the correct path and add the endpoint to it.
@deldesir
Copy link
Collaborator Author

Now, we get the path in a better way by just extracting the last part of the current url and add the endpoint to it.

@deldesir deldesir linked an issue Nov 10, 2023 that may be closed by this pull request
@holta
Copy link
Member

holta commented Nov 10, 2023

Looks incredible! If in addition, HTTP_REFERER's also no longer being used!

@holta holta merged commit bda1439 into iiab:master Nov 10, 2023
@deldesir deldesir deleted the deldesir-requests-patch branch November 10, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

2 participants