Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions apps/gateway/src/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,24 @@ static APP_PROVIDERS: &[AppProvider] = &[
}],
refresh: Some(&GOOGLE_REFRESH),
},
AppProvider {
provider: "youtube",
display_name: "YouTube",
host_rules: &[
HostRule {
host: "youtube.googleapis.com",
path_prefix: None,
strategy: AuthStrategy::Bearer,
},
// Legacy endpoint — some clients still use www.googleapis.com/youtube/
HostRule {
host: "www.googleapis.com",
path_prefix: Some("/youtube/"),
strategy: AuthStrategy::Bearer,
},
],
refresh: Some(&GOOGLE_REFRESH),
},
AppProvider {
provider: "google-health",
display_name: "Google Health",
Expand Down Expand Up @@ -712,6 +730,10 @@ mod tests {
providers_for_host("health.googleapis.com"),
vec!["google-health"]
);
assert_eq!(
providers_for_host("youtube.googleapis.com"),
vec!["youtube"]
);
}

#[test]
Expand All @@ -729,6 +751,7 @@ mod tests {
("google-meet", "meet.googleapis.com"),
("google-photos", "photoslibrary.googleapis.com"),
("google-health", "health.googleapis.com"),
("youtube", "youtube.googleapis.com"),
];
for (provider, host) in &hosts {
let injections = build_app_injections(provider, host, "ya29.test");
Expand Down Expand Up @@ -856,6 +879,9 @@ mod tests {

let result = provider_for_host_and_path("www.googleapis.com", "/drive/v3/files");
assert_eq!(result, Some(("google-drive", "Google Drive")));

let result = provider_for_host_and_path("www.googleapis.com", "/youtube/v3/playlists");
assert_eq!(result, Some(("youtube", "YouTube")));
}

#[test]
Expand Down
4 changes: 4 additions & 0 deletions apps/web/public/icons/youtube.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions apps/web/src/lib/apps/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { googleSlides } from "./google-slides";
import { googleTasks } from "./google-tasks";
import { resend } from "./resend";
import { spotify } from "./spotify";
import { youtube } from "./youtube";

export const apps: AppDefinition[] = [
github,
Expand All @@ -37,6 +38,7 @@ export const apps: AppDefinition[] = [
googleTasks,
resend,
spotify,
youtube,
];

export const getApp = (id: string): AppDefinition | undefined =>
Expand Down
51 changes: 51 additions & 0 deletions apps/web/src/lib/apps/youtube.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { AppDefinition } from "./types";
import {
buildGoogleAuthUrl,
exchangeGoogleCode,
googleConfigFields,
googleEnvDefaults,
} from "./google-oauth";

export const youtube: AppDefinition = {
id: "youtube",
name: "YouTube",
icon: "/icons/youtube.svg",
description:
"Read your channels, playlists, playlist items, and subscriptions.",
connectionMethod: {
type: "oauth",
defaultScopes: [
"openid",
"email",
"profile",
"https://www.googleapis.com/auth/youtube.readonly",
],
permissions: [
{
scope: "https://www.googleapis.com/auth/youtube.readonly",
name: "YouTube account",
description: "Channels, playlists, subscriptions, and uploads",
access: "read",
},
{
scope: "https://www.googleapis.com/auth/userinfo.email",
name: "Email address",
description: "View your email address",
access: "read",
},
{
scope: "https://www.googleapis.com/auth/userinfo.profile",
name: "Profile",
description: "Name and profile picture",
access: "read",
},
],
buildAuthUrl: buildGoogleAuthUrl,
exchangeCode: exchangeGoogleCode,
},
available: true,
configurable: {
fields: googleConfigFields,
envDefaults: googleEnvDefaults,
},
};
Loading