Code Monkey home page Code Monkey logo

viewer-for-reddit's Introduction

Viewer for Reddit

๐Ÿ™ˆ Anonymously browse Reddit https://reddit-viewer.com/

With a focus on privacy, there's no tracking or logging of your activityโ€”aside from the minimal server logs (maintained for operational integrity). Enjoy a clean, fast, and untracked browsing experience.


Contributing

Please read the contributing guide to get started.


viewer-for-reddit's People

Contributors

agarwalamn avatar allcontributors[bot] avatar aloybrancheung avatar dependabot[bot] avatar gregrickaby avatar icegotcha avatar indiehjaerta avatar infinixius avatar jmoranin98 avatar rendely avatar rudychung avatar vladcuciureanu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

viewer-for-reddit's Issues

Video poster image: CORS issue

I refactored the <video> player to support a poster attribute, which points at https://external-preview.redd.it/. Unfortuntely, that URL throws CORS errors:

Access to image at 'https://external-preview.redd.it/_1TOYrQfE2OdJEzynRMOII_9sckKh14T1DYdf07CjoQ.png?width=320&crop=smart&format=pjpg&auto=webp&s=794a4499f058e3a5be291ce690870eb2e80b6dcc' from origin 'https://reddit-image-viewer.vercel.app' has been blocked by CORS policy: The 'Access-Control-Allow-Origin'
  • Use a different URL for the poster image

Auth w/ Reddit so we can get optimized media

Right now we're using Reddit's public .json to grab data and media. The issue is, without authenticating with Reddit, we have no access to optimized media. As the user scrolls, they're downloading non-optimized images, which can be upwards of 10-15MB!

If we authenticated with Reddit, we could get access to properly optimized and sized media.

Feature request: Auto play videos/GIFs

Hey there, love the project. I was thinking of forking and adding auto play and loop videos/GIFs. Is this type of feature change OK? Would you want it controllable via a toggle in the settings?

Thought I would ask before I fork.

Update Search Bar

When a user types in a subreddit, and then clicks one of the 4 links on the header, the search bar needs to update to the sub that was clicked.

screenshot

Use Mantine

After working with Mantine over the last several months, I'd like to convert this hobby app from TailwindCSS to Mantine.

Add navigation drawer

When on mobile, screen real-estate is limited. Move all the things to a drawer.

  • Add react hamburger nav
  • Move the search bar to drawer
  • Move dark mode toggle to drawer
  • Move popular subs to drawer
  • Add sorting (top, new, hot)

Eventually add history?

Back to top button

Add one.

  • Fade in button after user scrolls a little
  • Smooth scroll animation to go back to top
  • Fade out button when user is back at top

Logo link and other functionality

When a user clicks the "Reddit Image Viewer" text in the header, it should clear the search, which will load the default sub itookapicture.

  • Create clear function
  • Hook up to header "logo" text

Non-image based subs

If I start my session looking at r/itookapicture, and search a new sub, say "greenbaypackers"... the images persist if a post doesn't have one. Need to double-check for images, before trying to display them

screenshot

Videos - Link to original post

Currently you can click an image to view the original post on Reddit. For other media like videos, you cannot, because clicking it plays the video.

  • Either above or below each video, add the Post Title
  • The Post Title should back to the original post on Reddit
  • Nice to have: Show the Post Title underneath images too

No Results

Need a conditional to check if there are results, before trying to map() over them.

Allow multi-subreddits in search

It would be cool if a user could use itookapicture+pics+aww in the search to pull in all of those subreddits and their respective media.

Add mobile styles

Search area needs to go full-width, and be sticky (like a sticky nav bar) while the user scrolls.

Auto generate bearer token

The autocomplete / typeahead search requires OAuth2 authorization, which I'm currently doing manually. This needs to be an automatic process, because I've learned over the last two days, the bearer token expires every 24 hours (even though it's set for permanent). ๐Ÿ˜ฌ

There is already code in the develop branch for this.

  • Use next/auth to handle automatic generation of a new bearer token every 24 hours

Further reading:

Better infinite scroll

On the initial page load, we're grabbing 200 items from Reddit. This request can take up 10 seconds to resolve.

Is there a way to grab the first 5 items, and then continue to make requests as the user scrolls?

Error in install command in Readme.md

  1. I think it should be create-next-app rather than create next-app
  2. Also, the GitHub repo link contains / at the end which gives an error, repo not found

I was using npx

Show History

It'd be cool to see a list of all the searches. Maybe even make them clickable. History does not persist beyond browser session.

screenshot

Dark Mode

Sniff out the user's OS preference and use it.

Support HLS Video

In addition to .MP4, Reddit also returns HLS-based video playlists in the API response. HLS is supported by all major browsers and has advantages, such as optimized video delivery for mobile devices.

The motivation for this is that the .MP4s returned by the Reddit API do not have sound, but the HLS versions do.

  • Create an <HlsPlayer /> component leveraging hls.js
  • The component must support <video> fallbacks with the MP4 URL
  • Replace the <video> tag in the <Card /> component with <HlsPlayer />

Additional Types

When I refactored the codebase for TypeScript, I missed a few props that need types-checking.

  • Go through the codebase and add Interfaces

Add sorting options

It would be great if users could sort a subreddit by: hot, new, top, and rising from the header after they search.

Add discernible name to footer link

Per PageSpeed Insights:

  • Links do not have a discernible name
  • Also, style with monospace font
<a href="https://github.com/gregrickaby/reddit-image-viewer" target="_blank" rel="noopener noreferrer">

Break up into components

Right now, this is a simple SPA with everything contained in /pages/index.js.

Really, I need a <Layout />, and <Header /> components, so we can easily create other pages.

NSFW

Deal with NSFW content:

The /api/reddit.ts and /api/search.ts routes both already return over_18 props. The data is there, we just need to deal with it.

Add popular subreddits to search drawer on initial focus

When a user clicks/taps the search bar the drop down reads, "nothing found try searching".

Instead, it should show the the Top 5 (or 10) popular Subreddits. See Mantine's Autocomplete docs.

  • When a user clicks/taps into search bar, display 5 or 10 Popular Subreddits
  • Follow the API docs for the query
  • The subreddits listed in the drodpown should match the style and display NSFW badge if necessary

Better CORS support

Need to investigate how to get around CORS issues. Asking users to disable ad-blockers and trackers before they can view is poor UX.

CORS Issues

Everything was working perfectly...but now there are endless CORS issues.

Not sure how to fix this, is there a CORS header I need to apply? Or has Reddit put CORS restrictions on URLs?

Access to image at 'https://external-preview.redd.it/6eZXVePWtcXm9esra74fXQSkI5X4YKz58vVpj4yf-rc.png?width=1080&crop=smart&format=pjpg&auto=webp&s=e1485b5fabd6f050707ff3190a05e4a53e61b38d' from origin 'https://reddit-image-viewer.vercel.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

URL's affected:

  • external-preview.redd.it

Media affected:

  • poster images
  • gifs
  • videos

Screenshot 2022-11-08 at 12 17 37

Contrast Ratio Error

Per PageSpeed Insights:

  • Low-contrast text is difficult or impossible for many users to read.
Load more<span class="mantine-qo1k2 mantine-Button-label">
Load more<button class="mantine-UnstyledButton-root mantine-Button-root mantine-1ggl3ol" type="button" data-button="true">

Infinite Loading via SWR

This is a nice to have

Currently, infinite loading is handled via a custom fetch() function. This works, but by leveraging SWR's built in caching, we could potentially decrease the amount of requests to the Reddit API, which is currently capped at 60 hits per minute.

  • Refactor <Results /> to use SWR instead of custom fetch()

Note: The SWR library is already installed and used for <Search />

Autocomplete search

The search bar is lame. It needs some autocomplete/type ahead functionality. Leverage the Mantine <Autocomplete /> component and the Reddit Autocomplete v2 API.

Note: the search endpoint must be an Edge function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.