invidious icon indicating copy to clipboard operation
invidious copied to clipboard

Towards using only next endpoint for the major data. (Partial solution to #5003)

Open mk-pmb opened this issue 11 months ago • 4 comments

From my discussion with @unixfox , these are the changes that I was able to salvage from #5003 that either were not critizised in code review or where I was able to apply the suggestions.

mk-pmb avatar Apr 11 '25 13:04 mk-pmb

Looks like some of the commits in this branch are outdated as it is missing changes that are already in the master branch such as #4934.

absidue avatar Apr 11 '25 16:04 absidue

That may well be. I don't understand enough crystal to be able to identify redundant code; I could only transplant changes that @unixfox made. If you tell me which (parts of) commits I shall omit, I can of course do that.

mk-pmb avatar Apr 11 '25 16:04 mk-pmb

There's also this commit that looks important: https://github.com/mk-pmb/invidious/commit/108ee36c19e2bccc4fde5ae7abb0c25684327d2f … but should probably be solved by instead duplicating the unconditional part at the end into the tiny "else" branch and adding early return (then invert the condition to make it a tiny "then" branch), to avoid having to indent the huge original "then" branch.

(If you do decide to indent, please do that in a separate commit or git will make a reeeeeeally confusing diff. It will be bad enough already but at least that way a diff with proper ignore-whitespace options can assure you that no actual code was changed.)

Shouldn't really belong to this PR though.

Update: I learned enough crystal to do the early return transformation, but now I see that the common tail below has grown with companion stuff, so probably now the better choice is to factor out the "then" branch into its own function.

mk-pmb avatar Apr 11 '25 16:04 mk-pmb

Ok yeah, some things seem to have been broken by git's rebase. I now discovered the UTC fallback, and it seems obvious even to me that the rebased commit does the opposite of what it claims. I removed that commit.

mk-pmb avatar Apr 11 '25 17:04 mk-pmb