ViewTube / viewtube

▶️ ViewTube: The open source, privacy-conscious way to enjoy your favorite YouTube content. Docs: https://viewtube.wiki, Status: https://uptime.viewtube.io
https://viewtube.io
GNU Affero General Public License v3.0
1.31k stars 75 forks source link

Allow for sub folder URIs #1298

Closed sdfg2 closed 1 year ago

sdfg2 commented 2 years ago

description

Allow for sub folder URIs. Not much more to say really! Instead of having to use viewtube.domain.tld, allow for http://domain.tld/viewtube.

It already seems part of the way there:

docker-compose.yml

version: "3"

services:
  viewtube:
    container_name: viewtube
    restart: unless-stopped
    image: mauriceo/viewtube:dev
    depends_on:
      - viewtube-mongodb
      - viewtube-redis
    networks:
      - viewtube
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./data:/data
    environment:
      - VIEWTUBE_URL=http://heracles/viewtube
      - VIEWTUBE_DATABASE_HOST=viewtube-mongodb
      - VIEWTUBE_REDIS_HOST=viewtube-redis
      - VIEWTUBE_DATA_DIRECTORY=/data
    ports:
      - 8066:8066

  viewtube-mongodb:
    container_name: viewtube-mongodb
    image: mongo:4.4
    networks:
      - viewtube
    restart: unless-stopped
    volumes:
      - ./data/db:/data/db

  viewtube-redis:
    container_name: viewtube-redis
    image: redis:6
    networks:
      - viewtube
    restart: unless-stopped
    volumes:
      - ./data/redis:/data

networks:
  viewtube:

nginx.conf

...
        location /viewtube {
            proxy_pass http://127.0.0.1:8066/; # REPLACE HERE
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
        }
        location /viewtube/api {
            proxy_pass http://127.0.0.1:8066/api; # REPLACE HERE
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
            proxy_http_version 1.1;
            proxy_set_header Connection "";
        }
...

This lets you get to domain.tld/viewtube, and the main page mostly displays, but the console errors show that some assets aren't using the sub folder:

viewtube:4           GET http://heracles/_nuxt/e0e8330.modern.js net::ERR_ABORTED 404 (Not Found)
viewtube:56          GET http://heracles/_nuxt/img/icon.dc8b72c.svg 404 (Not Found)
viewtube:60          GET http://heracles/_nuxt/fonts/ExpletusSans-Bold.86afd36.woff2 net::ERR_ABORTED 404 (Not Found)
viewtube:60          GET http://heracles/_nuxt/fonts/notosans-regular.f8bbfe2.woff2 net::ERR_ABORTED 404 (Not Found)
viewtube:4          GET http://heracles/_nuxt/312ce76.modern.js net::ERR_ABORTED 404 (Not Found)
viewtube:4          GET http://heracles/_nuxt/89e2047.modern.js net::ERR_ABORTED 404 (Not Found)
viewtube:4          GET http://heracles/_nuxt/d6239a8.modern.js net::ERR_ABORTED 404 (Not Found)
viewtube:4          GET http://heracles/_nuxt/8008218.modern.js net::ERR_ABORTED 404 (Not Found)
viewtube:63          GET http://heracles/_nuxt/fonts/ExpletusSans-Bold.fd68a4b.woff net::ERR_ABORTED 404 (Not Found)
viewtube:63          GET http://heracles/_nuxt/fonts/notosans-regular.1a1efd8.woff net::ERR_ABORTED 404 (Not Found)
viewtube:60          GET http://heracles/_nuxt/e0e8330.modern.js net::ERR_ABORTED 404 (Not Found)
viewtube:63          GET http://heracles/_nuxt/fonts/ExpletusSans-Bold.9fae514.otf net::ERR_ABORTED 404 (Not Found)
viewtube:63          GET http://heracles/_nuxt/fonts/notosans-regular.fb9e8ae.ttf net::ERR_ABORTED 404 (Not Found)
viewtube:1          GET http://heracles/_nuxt/fonts/ExpletusSans-Bold.8bd647e.ttf 404 (Not Found)
icon-192.png:1          GET http://heracles/icon-192.png 404 (Not Found)
favicon.ico:1          GET http://heracles/favicon.ico 404 (Not Found)

acceptance criterias

moisout commented 1 year ago

This is pretty difficult with the frameworks I'm using. This also breaks compatibility with YouTube URLs. I will not be implementing this myself, however you (or anyone) can make a pull request.