Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/basic auth issues #600

Merged
merged 4 commits into from
Sep 22, 2024
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
2 changes: 1 addition & 1 deletion lib/app/states/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:invidious/router.dart';
import 'package:clipious/router.dart';
import 'package:logging/logging.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/app/states/tv_home.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:bloc/bloc.dart';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/cupertino.dart';
import 'package:invidious/globals.dart';
import 'package:clipious/globals.dart';

class TvHomeCubit extends Cubit<bool> {
ScrollController scrollController = ScrollController();
Expand Down
4 changes: 2 additions & 2 deletions lib/app/views/components/player_placeholder.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/player/states/player.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/player/states/player.dart';

class PlayerPlaceHolder extends StatelessWidget {
const PlayerPlaceHolder({super.key});
Expand Down
4 changes: 2 additions & 2 deletions lib/app/views/screens/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:invidious/app/views/components/player_placeholder.dart';
import 'package:invidious/player/views/components/player.dart';
import 'package:clipious/app/views/components/player_placeholder.dart';
import 'package:clipious/player/views/components/player.dart';

import '../../../player/states/player.dart';
import '../../../player/views/components/mini_player_aware.dart';
Expand Down
16 changes: 8 additions & 8 deletions lib/app/views/tv/screens/tv_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import 'package:flutter/services.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/app/states/tv_home.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/settings/states/settings.dart';
import 'package:invidious/utils/models/paginated_list.dart';
import 'package:invidious/utils/views/tv/components/tv_button.dart';
import 'package:invidious/utils/views/tv/components/tv_overscan.dart';
import 'package:invidious/videos/views/components/subscriptions.dart';
import 'package:invidious/videos/views/components/trending.dart';
import 'package:clipious/app/states/tv_home.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/settings/states/settings.dart';
import 'package:clipious/utils/models/paginated_list.dart';
import 'package:clipious/utils/views/tv/components/tv_button.dart';
import 'package:clipious/utils/views/tv/components/tv_overscan.dart';
import 'package:clipious/videos/views/components/subscriptions.dart';
import 'package:clipious/videos/views/components/trending.dart';

import '../../../../home/models/db/home_layout.dart';
import '../../../../router.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/channels/models/channel.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:invidious/settings/models/db/server.dart';
import 'package:invidious/utils/models/sharelink.dart';
import 'package:invidious/videos/models/video_in_list.dart';
import 'package:clipious/settings/models/db/server.dart';
import 'package:clipious/utils/models/sharelink.dart';
import 'package:clipious/videos/models/video_in_list.dart';
import 'package:json_annotation/json_annotation.dart';

import '../../utils/models/image_object.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/channels/models/channel_playlists.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:invidious/playlists/models/playlist.dart';
import 'package:invidious/utils/models/item_with_continuation.dart';
import 'package:clipious/playlists/models/playlist.dart';
import 'package:clipious/utils/models/item_with_continuation.dart';
import 'package:json_annotation/json_annotation.dart';

part 'channel_playlists.g.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/channels/models/channel_videos.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:invidious/videos/models/video_in_list.dart';
import 'package:clipious/videos/models/video_in_list.dart';
import 'package:json_annotation/json_annotation.dart';

import '../../utils/models/item_with_continuation.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/channels/states/channel.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:invidious/channels/models/channel_sort_by.dart';
import 'package:clipious/channels/models/channel_sort_by.dart';

import '../../globals.dart';
import '../models/channel.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/channels/states/tv_channel.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:bloc/bloc.dart';
import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:invidious/globals.dart';
import 'package:clipious/globals.dart';

part 'tv_channel.freezed.dart';

Expand Down
6 changes: 3 additions & 3 deletions lib/channels/views/components/info.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:invidious/channels/models/channel.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/utils.dart';
import 'package:clipious/channels/models/channel.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/utils.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../../subscription_management/view/components/subscribe_button.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/channels/views/components/playlists.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/playlists/views/components/playlist_list.dart';
import 'package:invidious/utils/models/paginated_list.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/playlists/views/components/playlist_list.dart';
import 'package:clipious/utils/models/paginated_list.dart';

import '../../../playlists/models/playlist.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/channels/views/components/sort_dropdown_button.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/channels/models/channel_sort_by.dart';
import 'package:clipious/channels/models/channel_sort_by.dart';

class SortDropdownButton extends StatelessWidget {
final ChannelSortBy selectedSortingOption;
Expand Down
8 changes: 4 additions & 4 deletions lib/channels/views/components/videos.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:invidious/channels/models/channel_videos.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/videos/models/video_in_list.dart';
import 'package:invidious/videos/views/components/video_list.dart';
import 'package:clipious/channels/models/channel_videos.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/videos/models/video_in_list.dart';
import 'package:clipious/videos/views/components/video_list.dart';

import '../../../utils/models/paginated_list.dart';
import '../../models/channel.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/channels/views/screens/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_fadein/flutter_fadein.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/channels/states/channel.dart';
import 'package:invidious/router.dart';
import 'package:clipious/channels/states/channel.dart';
import 'package:clipious/router.dart';

import '../../../utils.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/channels/views/screens/info_tab.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:invidious/channels/views/components/info.dart';
import 'package:invidious/utils/views/components/placeholders.dart';
import 'package:clipious/channels/views/components/info.dart';
import 'package:clipious/utils/views/components/placeholders.dart';

import '../../models/channel.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/channels/views/screens/playlists_tab.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:invidious/channels/views/components/playlists.dart';
import 'package:clipious/channels/views/components/playlists.dart';

@RoutePage()
class ChannelPlaylistsTab extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion lib/channels/views/screens/shorts_tab.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:invidious/channels/views/components/videos.dart';
import 'package:clipious/channels/views/components/videos.dart';

import '../../../globals.dart';
import '../../models/channel.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/channels/views/screens/stream_tab.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:invidious/channels/views/components/videos.dart';
import 'package:clipious/channels/views/components/videos.dart';

import '../../../globals.dart';
import '../../models/channel.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/channels/views/screens/video_tab.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:auto_route/annotations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:invidious/channels/models/channel_sort_by.dart';
import 'package:clipious/channels/models/channel_sort_by.dart';

import '../../../globals.dart';
import '../../models/channel.dart';
Expand Down
22 changes: 11 additions & 11 deletions lib/channels/views/tv/screens/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/app/views/tv/screens/tv_home.dart';
import 'package:invidious/channels/states/channel.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/subscription_management/view/tv/tv_subscribe_button.dart';
import 'package:invidious/utils/models/image_object.dart';
import 'package:invidious/utils/models/paginated_list.dart';
import 'package:invidious/utils/views/components/placeholders.dart';
import 'package:invidious/utils/views/tv/components/tv_expandable_text.dart';
import 'package:invidious/utils/views/tv/components/tv_horizontal_item_list.dart';
import 'package:invidious/utils/views/tv/components/tv_overscan.dart';
import 'package:invidious/videos/models/video_in_list.dart';
import 'package:clipious/app/views/tv/screens/tv_home.dart';
import 'package:clipious/channels/states/channel.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/subscription_management/view/tv/tv_subscribe_button.dart';
import 'package:clipious/utils/models/image_object.dart';
import 'package:clipious/utils/models/paginated_list.dart';
import 'package:clipious/utils/views/components/placeholders.dart';
import 'package:clipious/utils/views/tv/components/tv_expandable_text.dart';
import 'package:clipious/utils/views/tv/components/tv_horizontal_item_list.dart';
import 'package:clipious/utils/views/tv/components/tv_overscan.dart';
import 'package:clipious/videos/models/video_in_list.dart';

import '../../../../playlists/models/playlist.dart';
import '../../../../playlists/views/components/playlist_in_list.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/comments/models/comment.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:invidious/comments/models/comment_replies.dart';
import 'package:invidious/comments/models/creator_heart.dart';
import 'package:clipious/comments/models/comment_replies.dart';
import 'package:clipious/comments/models/creator_heart.dart';
import 'package:json_annotation/json_annotation.dart';

import '../../utils/models/image_object.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/comments/states/comments.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:invidious/comments/models/video_comments.dart';
import 'package:invidious/videos/models/base_video.dart';
import 'package:clipious/comments/models/video_comments.dart';
import 'package:clipious/videos/models/base_video.dart';

import '../../globals.dart';
import '../../settings/models/errors/invidious_service_error.dart';
Expand Down
10 changes: 5 additions & 5 deletions lib/comments/views/components/comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/comments/states/single_comment.dart';
import 'package:invidious/comments/views/components/comments.dart';
import 'package:invidious/router.dart';
import 'package:invidious/utils/views/components/text_linkified.dart';
import 'package:invidious/videos/views/components/video_thumbnail.dart';
import 'package:clipious/comments/states/single_comment.dart';
import 'package:clipious/comments/views/components/comments.dart';
import 'package:clipious/router.dart';
import 'package:clipious/utils/views/components/text_linkified.dart';
import 'package:clipious/videos/views/components/video_thumbnail.dart';

import '../../../player/states/player.dart';
import '../../../utils/models/image_object.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/comments/views/components/comments.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/comments/states/comments.dart';
import 'package:invidious/comments/views/components/comment.dart';
import 'package:clipious/comments/states/comments.dart';
import 'package:clipious/comments/views/components/comment.dart';

import '../../../videos/models/base_video.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/comments/views/components/comments_container.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/comments/states/comments_container.dart';
import 'package:invidious/videos/models/video.dart';
import 'package:clipious/comments/states/comments_container.dart';
import 'package:clipious/videos/models/video.dart';

import 'comments.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/downloads/models/downloaded_video.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:invidious/videos/models/base_video.dart';
import 'package:clipious/videos/models/base_video.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as p;
Expand Down
19 changes: 13 additions & 6 deletions lib/downloads/states/download_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import 'package:downloadsfolder/downloadsfolder.dart';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:ffmpeg_kit_flutter_full/ffmpeg_kit.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:invidious/downloads/models/downloaded_video.dart';
import 'package:invidious/extensions.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/utils/models/image_object.dart';
import 'package:clipious/downloads/models/downloaded_video.dart';
import 'package:clipious/extensions.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/utils/models/image_object.dart';
import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as p;
Expand Down Expand Up @@ -113,6 +113,9 @@ class DownloadManagerCubit extends Cubit<DownloadManagerState> {
return false;
} else {
Video vid = await service.getVideo(videoId);

final server = await db.getCurrentlySelectedServer();

var downloadedVideo = DownloadedVideo(
videoId: vid.videoId,
title: vid.title,
Expand Down Expand Up @@ -157,7 +160,9 @@ class DownloadManagerCubit extends Cubit<DownloadManagerState> {
//download thumbnail
var thumbnailPath = await downloadedVideo.thumbnailPath;
log.fine("Downloading thumbnail to: $thumbnailPath");
await dio.download(thumbUrl, thumbnailPath, cancelToken: cancelToken);
await dio.download(thumbUrl, thumbnailPath,
cancelToken: cancelToken,
options: Options(headers: server.headersForUrl(thumbUrl)));
}

// download video
Expand All @@ -176,7 +181,8 @@ class DownloadManagerCubit extends Cubit<DownloadManagerState> {
count, total, downloadedVideo,
step: 1, totalSteps: audioOnly ? 2 : 3),
cancelToken: cancelToken,
deleteOnError: true)
deleteOnError: true,
options: Options(headers: server.headersForUrl(audioUrl)))
.catchError((err) {
onDownloadError(err, downloadedVideo);
return Response<void>(requestOptions: RequestOptions());
Expand All @@ -193,6 +199,7 @@ class DownloadManagerCubit extends Cubit<DownloadManagerState> {
totalSteps: 3,
),
cancelToken: cancelToken,
options: Options(headers: server.headersForUrl(videoUrl)),
deleteOnError: true)
.catchError((err) {
onDownloadError(err, downloadedVideo);
Expand Down
6 changes: 3 additions & 3 deletions lib/downloads/states/downloaded_video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import 'dart:io';

import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:invidious/downloads/models/downloaded_video.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/player/states/player.dart';
import 'package:clipious/downloads/models/downloaded_video.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/player/states/player.dart';
import 'package:logging/logging.dart';

import 'download_manager.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/downloads/views/components/download_app_bar_button.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/router.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/router.dart';

import '../../states/download_manager.dart';

Expand Down
10 changes: 5 additions & 5 deletions lib/downloads/views/components/downloaded_video.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:invidious/downloads/models/downloaded_video.dart';
import 'package:invidious/downloads/states/download_manager.dart';
import 'package:invidious/downloads/states/downloaded_video.dart';
import 'package:invidious/globals.dart';
import 'package:invidious/player/states/player.dart';
import 'package:clipious/downloads/models/downloaded_video.dart';
import 'package:clipious/downloads/states/download_manager.dart';
import 'package:clipious/downloads/states/downloaded_video.dart';
import 'package:clipious/globals.dart';
import 'package:clipious/player/states/player.dart';

import '../../../videos/views/components/compact_video.dart';

Expand Down
Loading
Loading