(&self)
| 481 | impl GenericProvider for YoutubeProvider { |
| 482 | #[tracing::instrument(level = "debug", skip(self))] |
| 483 | async fn initialize(&self) -> Result<()> { |
| 484 | let _ = self |
| 485 | .status_tx |
| 486 | .lock() |
| 487 | .await |
| 488 | .send(self.get_provider_status(None).await) |
| 489 | .await; |
| 490 | |
| 491 | let preferences: State<PreferenceConfig> = self.app.state(); |
| 492 | let youtube_config: Value = preferences |
| 493 | .inner() |
| 494 | .load_selective("youtube".into()) |
| 495 | .unwrap_or_default(); |
| 496 | |
| 497 | tracing::info!("{:?}", youtube_config); |
| 498 | let client_id = youtube_config.get("client_id"); |
| 499 | let client_secret = youtube_config.get("client_secret"); |
| 500 | |
| 501 | *self.config.lock().await = YoutubeConfig { |
| 502 | client_id: client_id.map(|v| v.as_str().unwrap().to_string()), |
| 503 | client_secret: client_secret.map(|v| v.as_str().unwrap().to_string()), |
| 504 | redirect_uri: "https://moosync.app/youtube", |
| 505 | scopes: vec!["https://www.googleapis.com/auth/youtube.readonly"], |
| 506 | }; |
| 507 | |
| 508 | let res = self.refresh_login().await; |
| 509 | if let Err(err) = res { |
| 510 | tracing::error!("youtube refresh login err: {:?}", err); |
| 511 | } |
| 512 | |
| 513 | Ok(()) |
| 514 | } |
| 515 | |
| 516 | #[tracing::instrument(level = "debug", skip(self))] |
| 517 | async fn get_provider_scopes(&self) -> Result<Vec<ExtensionProviderScope>> { |
no test coverage detected