Skip to content

Commit

Permalink
Remove youtube.js from web app
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Dec 24, 2024
1 parent e20fb7d commit 0f6266a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 262 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing worth mentioning yet.
### Removed

- [YouTube.js](https://github.com/LuanRT/YouTube.js) from web app. It is no longer needed, so this reduces app size.

## [0.35.0] - 2024-12-24

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import "pkg:/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendR
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayletLibUrlsRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/PreferencesRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/ProfilesRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/ProxyRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/RegistryRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/SearchHistoryRouter.bs"
import "pkg:/components/Web/PlayletWebServer/Middleware/StateApiRouter.bs"
Expand Down Expand Up @@ -56,7 +55,6 @@ function SetupRoutes(server as object)
server.UseRouter(new Http.PlayletLibUrlsRouter(server))
server.UseRouter(new Http.DialRouter(server))
server.UseRouter(new Http.CacheRouter())
server.UseRouter(new Http.ProxyRouter(server))
server.UseRouter(new Http.RegistryRouter(server))
server.UseRouter(new Http.PlayletInvidiousBackendRouter())

Expand Down
58 changes: 3 additions & 55 deletions playlet-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions playlet-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@
"vite": "^5.4.11",
"vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^5.1.4"
},
"dependencies": {
"youtubei.js": "^12.2.0"
}
}
5 changes: 5 additions & 0 deletions playlet-web/src/lib/Api/PlayletApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { getHost } from "lib/Api/Host";
export class PlayletApi {
static host = () => `http://${getHost()}`

static async getVideoInfo(videoId) {
const response = await fetch(`${PlayletApi.host()}/playlet-invidious-backend/api/v1/videos/${videoId}`);
return await response.json();
}

static async getState() {
const response = await fetch(`${PlayletApi.host()}/api/state`);
return await response.json();
Expand Down
156 changes: 0 additions & 156 deletions playlet-web/src/lib/Api/YoutubeJs.ts

This file was deleted.

4 changes: 2 additions & 2 deletions playlet-web/src/lib/LinkDragDrop.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { onDestroy, onMount } from "svelte";
import { playletStateStore, tr } from "lib/Stores";
import { InvidiousApi } from "lib/Api/InvidiousApi";
import { YoutubeJs } from "./Api/YoutubeJs";
import { PlayletApi } from "./Api/PlayletApi";
import VideoCastDialog from "./VideoFeed/VideoCastDialog.svelte";
import ChannelCastDialog from "./VideoFeed/ChannelCastDialog.svelte";
import PlaylistCastDialog from "./VideoFeed/PlaylistCastDialog.svelte";
Expand Down Expand Up @@ -109,7 +109,7 @@
async function searchForVideoById(videoId, timestamp) {
try {
isLoading = true;
videoMetadata = await YoutubeJs.getVideoInfo(videoId);
videoMetadata = await PlayletApi.getVideoInfo(videoId);
videoStartAtChecked = timestamp !== undefined;
if (videoStartAtChecked) {
videoStartAtTimestamp = timestamp;
Expand Down
2 changes: 1 addition & 1 deletion playlet-web/src/lib/VideoFeed/PlaylistCastDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}
}
if (url === "") {
url = `${invidiousInstance}/vi/-----------/mqdefault.jpg`;
url = `https://i.ytimg.com/vi/-----------/mqdefault.jpg`;
}
return url;
}
Expand Down
2 changes: 1 addition & 1 deletion playlet-web/src/lib/VideoFeed/PlaylistThumbnail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
}
if (url === "") {
url = `${invidiousInstance}/vi/-----------/mqdefault.jpg`;
url = `https://i.ytimg.com/vi/-----------/mqdefault.jpg`;
}
thumbnailUrl = url;
}
Expand Down

0 comments on commit 0f6266a

Please sign in to comment.