diff --git a/.github/workflows/spotube-nightly.yml b/.github/workflows/spotube-nightly.yml index 2be5ba277..a73b4be70 100644 --- a/.github/workflows/spotube-nightly.yml +++ b/.github/workflows/spotube-nightly.yml @@ -28,6 +28,7 @@ jobs: curl -sS https://webi.sh/yq | sh yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml + echo '${{ secrets.DOT_ENV }}' > .env flutter config --enable-linux-desktop flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' @@ -63,6 +64,7 @@ jobs: curl -sS https://webi.sh/yq | sh yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml + echo '${{ secrets.DOT_ENV }}' > .env flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks @@ -93,6 +95,7 @@ jobs: yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml sed -i "s/%{{SPOTUBE_VERSION}}%/${{ env.GITHUB_RUN_NUMBER }}/" windows/runner/Runner.rc + echo '${{ secrets.DOT_ENV }}' > .env flutter config --enable-windows-desktop flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' @@ -120,6 +123,7 @@ jobs: - run: brew install yq - run: yq -i '.version |= sub("\+\d+", "-nightly-")' pubspec.yaml - run: yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml + - run: echo '${{ secrets.DOT_ENV }}' > .env - run: flutter config --enable-macos-desktop - run: flutter pub get - run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' diff --git a/.github/workflows/spotube-release.yml b/.github/workflows/spotube-release.yml index f00d20a9b..11045c7d8 100644 --- a/.github/workflows/spotube-release.yml +++ b/.github/workflows/spotube-release.yml @@ -31,6 +31,7 @@ jobs: with: cache: true - run: | + echo '${{ secrets.DOT_ENV }}' > .env flutter config --enable-windows-desktop flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' @@ -72,6 +73,7 @@ jobs: - uses: subosito/flutter-action@v2.8.0 with: cache: true + - run: echo '${{ secrets.DOT_ENV }}' > .env - run: flutter config --enable-macos-desktop - run: flutter pub get - run: dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' @@ -112,6 +114,7 @@ jobs: # replacing & adding new release version with older version - run: | sed -i 's|%{{APPDATA_RELEASE}}%||' linux/com.github.KRTirtho.Spotube.appdata.xml + echo '${{ secrets.DOT_ENV }}' > .env - run: | flutter config --enable-linux-desktop @@ -146,6 +149,7 @@ jobs: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse - run: | + echo '${{ secrets.DOT_ENV }}' > .env flutter pub get dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}' echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks diff --git a/.gitignore b/.gitignore index 55a9a29f3..1782ec11b 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,5 @@ appimage-build android/key.properties .fvm/flutter_sdk + +**/pb_data \ No newline at end of file diff --git a/lib/collections/env.dart b/lib/collections/env.dart new file mode 100644 index 000000000..0361a7bc2 --- /dev/null +++ b/lib/collections/env.dart @@ -0,0 +1,11 @@ +import 'package:flutter_dotenv/flutter_dotenv.dart'; + +abstract class Env { + static final String pocketbaseUrl = dotenv.get('POCKETBASE_URL'); + static final String username = dotenv.get('USERNAME'); + static final String password = dotenv.get('PASSWORD'); + + static configure() async { + await dotenv.load(fileName: ".env"); + } +} diff --git a/lib/extensions/video.dart b/lib/extensions/video.dart index 37eca8336..6b5a537c6 100644 --- a/lib/extensions/video.dart +++ b/lib/extensions/video.dart @@ -1,4 +1,5 @@ import 'package:spotube/entities/cache_track.dart'; +import 'package:spotube/models/track.dart'; import 'package:spotube/utils/duration.dart'; import 'package:youtube_explode_dart/youtube_explode_dart.dart'; @@ -30,6 +31,11 @@ extension VideoFromCacheTrackExtension on Video { false, ); } + + static Future