Commit graph

5553 commits

Author SHA1 Message Date
syeopite
6ff616d9a4
Ensure http-proxy is not used for companion 2025-05-13 05:18:52 -07:00
syeopite
bd2f00f6df
Formatting 2025-05-13 05:18:52 -07:00
syeopite
d70b05e5c3
Remove idle_pool_size config
Clients created when idle_capacity is reached but not max_capacity
are discarded as soon as the client is checked back into the pool,
not when the connection is closed.

This means that allowing idle_capacity to be lower than max_capacity
essentially just makes the remaining clients a checkout timeout
deterrent that gets thrown away as soon as it is used. Not useful
for reusing connections whatsoever during peak load times
2025-05-13 05:18:52 -07:00
syeopite
924ae11721
Remove extraneous space 2025-05-13 05:18:52 -07:00
syeopite
43f9af2015
Fix ameba complaints 2025-05-13 05:18:52 -07:00
syeopite
4628f98eeb
Merge companion and standard pool into one 2025-05-13 05:18:52 -07:00
syeopite
60b45290bd
Pool: raise custom error when DB::PoolTimeout 2025-05-13 05:18:52 -07:00
syeopite
e5795cab3d
Pool: Make Pool#client method public 2025-05-13 05:18:52 -07:00
syeopite
b79177f07e
Add tests for connection pool 2025-05-13 05:18:52 -07:00
syeopite
7fe8f6f24e
Use non-streaming api when not invoked with block
Defaulting to the streaming api of `HTTP::Client` causes some issues
since the streaming respone content needs to be accessed
through #body_io rather than #body
2025-05-13 05:18:52 -07:00
syeopite
936c0ff61b
Update comment on reiniting proxy of pooled client 2025-05-13 05:18:52 -07:00
syeopite
802790e468
Simplify namespace calls to ConnectionPool 2025-05-13 05:18:52 -07:00
syeopite
3dd68872f9
Pool: remove redundant properties 2025-05-13 05:18:52 -07:00
syeopite
be9749aefd
Pool: Refactor logic for request methods
Make non-block request method internally call
the block based request method.
2025-05-13 05:18:51 -07:00
syeopite
7cd974dc24
Release client only when it still exists
@pool.release should not be called when the client has already been
deleted from the pool.
2025-05-13 05:18:51 -07:00
syeopite
bf2eccbcaf
Connection pool: ensure response is fully read
The streaming API of HTTP::Client has an internal buffer
that will continue to persist onto the next request unless
the response is fully read.

This commit privatizes the #client method of Pool and instead
expose various HTTP request methods that will call and yield
the underlying request and response.

This way, we can ensure that the resposne is fully read before
the client is passed back into the pool for another request.
2025-05-13 05:18:51 -07:00
syeopite
586dfcc1e3
Improve documentation of idle pool size 2025-05-13 05:18:51 -07:00
syeopite
4e4a084f22
Delete broken clients from the pool explicitly 2025-05-13 05:18:51 -07:00
syeopite
65e6929037
Remove redundant pool.release
pool.checkout(&block) already ensures that the checked out item
will be released back into the pool
2025-05-13 05:18:51 -07:00
syeopite
2f52ebc7e3
Typo 2025-05-13 05:18:51 -07:00
syeopite
97b13c042e
Add config to set connection pool checkout timeout 2025-05-13 05:18:51 -07:00
syeopite
c86846e7b7
Move ytimg pool logic to Invidious::ConnectionPool 2025-05-13 05:18:51 -07:00
syeopite
95a1f632d8
Move client logic file to connection subfolder 2025-05-13 05:18:51 -07:00
syeopite
220adf53f4
Refactor connection pooling logic
- Remove duplication between standard and companion pool
- Raises a wrapped exception on any DB:Error
- Don't use a non-pool client when client fails
- Ensure that client is always released
- Add documentation to various pool methods
2025-05-13 05:18:51 -07:00
syeopite
c2ede1d2a5
Add support for setting max idle http pool size 2025-05-13 05:18:51 -07:00
dependabot[bot]
81ca831439
Bump crystallang/crystal from 1.12.2-alpine to 1.16.2-alpine in /docker (#5290)
Bumps crystallang/crystal from 1.12.2-alpine to 1.16.2-alpine.

---
updated-dependencies:
- dependency-name: crystallang/crystal
  dependency-version: 1.16.2-alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 22:19:04 +02:00
Émilien (perso)
8feea29607
Fix crystal version used in alpine 3.21 2025-05-09 22:09:09 +02:00
dependabot[bot]
c4944ee061
Bump crystal-lang/install-crystal from 1.8.0 to 1.8.2 (#5286)
Bumps [crystal-lang/install-crystal](https://github.com/crystal-lang/install-crystal) from 1.8.0 to 1.8.2.
- [Release notes](https://github.com/crystal-lang/install-crystal/releases)
- [Commits](https://github.com/crystal-lang/install-crystal/compare/v1.8.0...v1.8.2)

---
updated-dependencies:
- dependency-name: crystal-lang/install-crystal
  dependency-version: 1.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 22:00:24 +02:00
dependabot[bot]
406277b16f
Bump docker/build-push-action from 5 to 6 (#5287)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 22:00:15 +02:00
dependabot[bot]
7259c63648
Bump alpine from 3.20 to 3.21 in /docker (#5288)
Bumps alpine from 3.20 to 3.21.

---
updated-dependencies:
- dependency-name: alpine
  dependency-version: '3.21'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 22:00:06 +02:00
dependabot[bot]
73f524fccd
Bump actions/cache from 3 to 4 (#5289)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 21:59:56 +02:00
dependabot[bot]
03e06b239b
Bump actions/stale from 8 to 9 (#5291)
Bumps [actions/stale](https://github.com/actions/stale) from 8 to 9.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 21:59:03 +02:00
Émilien (perso)
c304ea6db3
chore: Add dependabot for docker and github actions (#5285) 2025-05-09 21:58:06 +02:00
Émilien (perso)
9e3c0dfd85
fix: fallback first with TVHTML then MWEB
fixes #5273
2025-05-08 19:55:22 +02:00
Emilien
d1bc15b8bf Release v2.20250504.0 2025-05-04 11:59:42 +02:00
Vyquos
1f028fee0f
Reflect companion secret character limit in example config comment (#5269)
Update the comments in the example config to show that the companion secret key must be exactly 16 characters long as per https://github.com/iv-org/invidious-companion/pull/81#issuecomment-2750675405.
2025-05-04 07:47:42 +00:00
absidue
2c1400c41e
Fix proxying live DASH streams (#4589) 2025-05-03 20:28:19 +00:00
Alex Maras
8fd0b82c38
feat: route to invidious companion on downloads (#5224) 2025-05-03 01:28:18 +02:00
Émilien (perso)
7579adc3a3
fix: fallback other yt clients no url found for adaptive formats (#5262) 2025-05-02 16:57:02 +02:00
efb4f5ff-1298-471a-8973-3d47447115dc
d567c6be6e
Fix minor casing issues in brand names (#5258) 2025-05-02 15:36:31 +02:00
Émilien (perso)
0c07e9d27a
chore: set dash by default (#5216) 2025-04-04 14:00:29 +02:00
Émilien (perso)
23ff6135bb
chore: enforce 16 characters for invidious_companion_key (#5220) 2025-03-26 15:27:59 +01:00
syeopite
409d12a81e
Prepare for next release (#5206) 2025-03-16 01:03:01 +00:00
Émilien (perso)
70ff463cc6
Add invidious companion support (#4985)
* add support for invidious companion

* redirect latest_version and dash manifest to invidious companion

* fix Shadowing outer local variable `response`

* fixing condition for Content-Security-Policy

* throw error if inv_sig_helper and invidious_companion used same time

* Use sample instead of Random.rand

Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>

* Remove debug puts functions

Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>

* modify the description for config.example.yaml about invidious companion

* move config checks for invidious companion

* separate invidious_companion logic + better config.yaml config

* fixing "end" misplacement

* fix linting + use .empty?

* crystal handle decompression already by itself

* fix download function when invidious companion used

* fix linting

* invidious companion always used so always add CSP and redirect latest_version

* apply all the suggestions + rework invidious_companion parameter

* format watch.cr

* fix ameba Redundant use of `Object#to_s` in interpolation

* add ability for invidious companion to check request from invidious

* Better document private_url and public_url

* Better doc for invidious_companion_key

* !empty? to present?

* skip proxy for invidious companion

* fixing format

* missing ,

* add companion pooling http

* fix: don't use http proxy when sending requests to companion

* fix: logic where we want to have the invidious logic if companion is not used

* chore: remove baseurl usage from invidious companion

* chore: change from inv-sig-helper to companion for required playback

* fix: use puts + add warning for inv-sig-helper deprecated

---------

Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>
2025-03-13 16:44:00 +01:00
syeopite
e23d0d13be
Add changelog for v2.20250314.0 (#5197)
* Release v2.20250314.0

* Update CHANGELOG.md
2025-03-12 03:31:15 -07:00
syeopite
5c8b4eb379
Warn when po_token, visitor_data and/or inv-sig-helper is not configured (#5202)
* Warn when required configs for playback is missing

* Add link to documentation in warnings

* Direct users to /installation instead
2025-03-12 10:11:17 +01:00
syeopite
adcdb8cb92
Fix lint and formatting 2025-02-26 14:18:50 -08:00
syeopite
fe4fa0480a
Fix HLS being used for non-livestream videos (#5189)
Invidious does not currently support non-livestream hls playback

Originally, the HLS manifest check was essentially a boolean:
if the HLS manifest field was present, it was assumed to be a
livestream. Some videos include the HLS Manifest but aren't
livestreams.

In the case where they are livestreams, the video contains a videoType
field with the value "Livestream". In the case that they're normal
videos, the videoType is "Video". This is exposed via the
`video.live_now` property.

This commit just checks that `video.live_now` is true before treating
it as a livestream
2025-02-26 14:14:29 -08:00
syeopite
dbbcacc955
Images: fix typo in thumbnail logic 2025-02-26 14:13:58 -08:00
syeopite
58ad848d56
Channels: Support YouTube's change to from /community to /posts (#5183) 2025-02-26 14:13:22 -08:00