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

Add support for community post page/comments #4010

Merged

Conversation

ChunkyProgrammer
Copy link
Contributor

@ChunkyProgrammer ChunkyProgrammer commented Jul 26, 2023

Related issues:
#3635 (comment)
FreeTubeApp/FreeTube#3253

Example endpoints:
/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56

/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYNE6H8uQQuVA
image

API Endpoints:
/api/v1/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYN

/api/v1/post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56/comments?ucid=UCX6OQ3DkcsbYNE6H8uQQuVA

Closes #1614

@ChunkyProgrammer ChunkyProgrammer requested a review from a team as a code owner July 26, 2023 17:52
@ChunkyProgrammer ChunkyProgrammer requested review from syeopite and removed request for a team July 26, 2023 17:52
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from 9c10f68 to 58e08f8 Compare July 26, 2023 17:57
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/views/post.ecr Show resolved Hide resolved
src/invidious/comments/youtube.cr Outdated Show resolved Hide resolved
@syeopite
Copy link
Member

The example you gave, /post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYN, errors on request.

Title: Index out of bounds (IndexError)
Date: 2023-07-26T20:04:59Z
Route: /post/UgkxjepRkIStMdEDVFi-hJV5pqdsSCbfEE56?ucid=UCX6OQ3DkcsbYN
Version: 2023.07.26-81cbc298 @ community

Backtrace

Index out of bounds (IndexError)
  from /usr/lib/crystal/indexable.cr:89:20 in '[]'
  from src/invidious/channels/community.cr:56:16 in 'extract_channel_community:ucid:locale:format:thin_mode:hide_continuation'
  from src/invidious/channels/community.cr:52:10 in 'fetch_channel_community_post'
  from src/invidious/routes/channels.cr:207:7 in 'post'
  from src/invidious/routing.cr:130:22 in '->'
  from lib/kemal/src/kemal/route.cr:12:26 in '->'
  from src/invidious/helpers/handlers.cr:30:37 in 'process_request'
  from lib/kemal/src/kemal/route_handler.cr:17:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/websocket_handler.cr:13:14 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/filter_handler.cr:21:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:212:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:94:12 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:145:12 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/handlers.cr:70:5 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/ext/kemal_static_file_handler.cr:162:16 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/exception_handler.cr:8:7 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from src/invidious/helpers/logger.cr:17:35 in 'call'
  from /usr/lib/crystal/http/server/handler.cr:30:7 in 'call_next'
  from lib/kemal/src/kemal/init_handler.cr:12:7 in 'call'
  from /usr/lib/crystal/http/server/request_processor.cr:51:11 in 'process'
  from /usr/lib/crystal/http/server.cr:521:5 in 'handle_client'
  from /usr/lib/crystal/http/server.cr:451:5 in '->'
  from /usr/lib/crystal/fiber.cr:146:11 in 'run'
  from /usr/lib/crystal/fiber.cr:98:34 in '->'
  from ???

@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from 58e08f8 to d7c5707 Compare July 26, 2023 21:34
Copy link
Member

@SamantazFox SamantazFox left a comment

Choose a reason for hiding this comment

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

One thing I'm wondering: do a post below a video and one on the channel 's community page have the same structure?

If that's the case, then you'd could tackle #409 too!

src/invidious/channels/community.cr Show resolved Hide resolved
src/invidious/channels/community.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
@ChunkyProgrammer
Copy link
Contributor Author

One thing I'm wondering: do a post below a video and one on the channel 's community page have the same structure?

If that's the case, then you'd could tackle #409 too!

I think tackling 409 in this PR might overcomplicate this PR but I can look into it after this PR is merged

src/invidious/comments/youtube.cr Outdated Show resolved Hide resolved
src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/channels.cr Outdated Show resolved Hide resolved
src/invidious/views/post.ecr Outdated Show resolved Hide resolved
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch 2 times, most recently from e6e7d3d to 91bffb4 Compare August 30, 2023 02:35
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from 91bffb4 to 9ec9717 Compare September 18, 2023 18:10
ChunkyProgrammer and others added 4 commits September 18, 2023 20:10
Co-Authored-By: Samantaz Fox <coding@samantaz.fr>
add videoId to resolve_url function

Co-Authored-By: Samantaz Fox <coding@samantaz.fr>
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from 9ec9717 to bb04bcc Compare September 19, 2023 00:10
src/invidious/routes/api/v1/channels.cr Outdated Show resolved Hide resolved
src/invidious/routes/api/v1/misc.cr Outdated Show resolved Hide resolved
assets/js/comments.js Show resolved Hide resolved
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from ea8539b to 8fa43e8 Compare September 26, 2023 23:07
simplify resolve url

remove trailing spaces

Co-Authored-By: Samantaz Fox <coding@samantaz.fr>
@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from 8fa43e8 to 4f25069 Compare September 27, 2023 21:36
Copy link
Member

@SamantazFox SamantazFox left a comment

Choose a reason for hiding this comment

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

This is working great! The layout is a bit weird when replies are folded and the main message might benefit from a slightly different style, but that's minor and can definitely be addressed later ^^

image

src/invidious/routes/channels.cr Outdated Show resolved Hide resolved
src/invidious/views/post.ecr Outdated Show resolved Hide resolved
@ChunkyProgrammer
Copy link
Contributor Author

Did some style improvements + added the ability to view community post comments without javascript 😄

@ChunkyProgrammer ChunkyProgrammer force-pushed the add-support-for-post-page branch from b0e507d to cbbb93c Compare September 27, 2023 22:42
@SamantazFox SamantazFox added in-testing This feature has been deployed and is being tested ready and removed in-testing This feature has been deployed and is being tested labels Oct 1, 2023
@SamantazFox SamantazFox merged commit 60fae01 into iv-org:master Oct 7, 2023
@SamantazFox
Copy link
Member

Thanks for the PR!

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

Successfully merging this pull request may close these issues.

Community - display post comments
3 participants