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: windows SSL Certificate error breaking login #905 #1474

Merged
merged 4 commits into from
May 4, 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: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ build
dist
.dart_tool
.idea
.github
.git
23 changes: 9 additions & 14 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
ARG FLUTTER_VERSION
ARG BUILD_VERSION

FROM --platform=arm64 fischerscode/flutter-sudo:${FLUTTER_VERSION}
FROM --platform=linux/arm64 krtirtho/flutter_distributor_arm64:${FLUTTER_VERSION}

WORKDIR /app
ARG BUILD_VERSION

# Install dependencies
RUN sudo apt-get update &&\
sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libunwind-dev locate patchelf gir1.2-appindicator3-0.1 libappindicator3-1 libappindicator3-dev libsecret-1-0 libjsoncpp25 libsecret-1-dev libjsoncpp-dev libnotify-bin libnotify-dev mpv libmpv-dev rpm &&\
sudo rm -rf /var/lib/apt/lists/*
WORKDIR /app

COPY . .

RUN sudo chown -R $(whoami) /app
RUN chown -R $(whoami) /app

RUN flutter pub get &&\
flutter config --enable-linux-desktop &&\
flutter pub get &&\
dart run build_runner build --delete-conflicting-outputs

RUN dart pub global activate flutter_distributor &&\
alias dpkg-deb="dpkg-deb --Zxz" &&\
flutter_distributor package --platform=linux --targets=deb &&\
flutter_distributor package --platform=linux --targets=rpm
RUN alias dpkg-deb="dpkg-deb --Zxz" &&\
flutter_distributor package --platform=linux --targets=deb


RUN make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64

RUN mv build/spotube-linux-*-aarch64.tar.xz dist/ &&\
mv dist/**/spotube-*-linux.deb dist/Spotube-linux-aarch64.deb &&\
mv dist/**/spotube-*-linux.rpm dist/Spotube-linux-aarch64.rpm
mv dist/**/spotube-*-linux.deb dist/Spotube-linux-aarch64.deb

CMD [ "sleep", "5000000" ]
23 changes: 23 additions & 0 deletions .github/Dockerfile.flutter_distributor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM --platform=linux/arm64 ubuntu:22.04

ARG FLUTTER_VERSION

RUN apt-get clean &&\
apt-get update &&\
apt-get install -y bash curl file git unzip xz-utils zip libglu1-mesa cmake tar clang ninja-build pkg-config libgtk-3-dev make python3-pip python3-setuptools desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse libunwind-dev locate patchelf gir1.2-appindicator3-0.1 libappindicator3-1 libappindicator3-dev libsecret-1-0 libjsoncpp25 libsecret-1-dev libjsoncpp-dev libnotify-bin libnotify-dev mpv libmpv-dev rpm && \
rm -rf /var/lib/apt/lists/*

WORKDIR /home/flutter

RUN git clone https://github.com/flutter/flutter.git -b ${FLUTTER_VERSION} --single-branch flutter-sdk

RUN flutter-sdk/bin/flutter precache

RUN flutter-sdk/bin/flutter config --no-analytics

ENV PATH="$PATH:/home/flutter/flutter-sdk/bin"
ENV PATH="$PATH:/home/flutter/flutter-sdk/bin/cache/dart-sdk/bin"
ENV PATH="$PATH:/home/flutter/.pub-cache/bin"
ENV PUB_CACHE="/home/flutter/.pub-cache"

RUN dart pub global activate flutter_distributor
69 changes: 49 additions & 20 deletions .github/workflows/spotube-release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,35 +207,36 @@ jobs:
limit-access-to-actor: true

linux_arm:
runs-on: macos-14
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Install Docker
run: brew install --cask docker
- name: Install Dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y pkg-config make python3-pip python3-setuptools

- name: Replace pubspec version and BUILD_VERSION Env (nightly)
if: ${{ inputs.channel == 'nightly' }}
run: |
brew install yq
curl -sS https://webi.sh/yq | sh
yq -i '.version |= sub("\+\d+", "+${{ inputs.channel }}.")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo "BUILD_VERSION=${{ inputs.version }}+${{ inputs.channel }}.${{ github.run_number }}" >> $GITHUB_ENV


- name: BUILD_VERSION Env (stable)
if: ${{ inputs.channel == 'stable' }}
run: |
echo "BUILD_VERSION=${{ inputs.version }}" >> $GITHUB_ENV

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Replace Version in files
run: |
sed -i '' 's|%{{APPDATA_RELEASE}}%|<release version="${{ env.BUILD_VERSION }}" date="${{ steps.date.outputs.date }}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml

- name: Create Stable .env
if: ${{ inputs.channel == 'stable' }}
run: echo '${{ secrets.DOTENV_RELEASE }}' > .env
Expand All @@ -244,20 +245,42 @@ jobs:
if: ${{ inputs.channel == 'nightly' }}
run: echo '${{ secrets.DOTENV_NIGHTLY }}' > .env

- name: Build Linux Arm
- name: Replace Version in files
run: |
sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${{ env.BUILD_VERSION }}" date="${{ steps.date.outputs.date }}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml

- name: Build Binaries (stable)
if: ${{ inputs.channel == 'stable' }}
run: |
docker buildx build --platform=linux/arm64 -f .github/Dockerfile . --build-arg FLUTTER_VERSION=${{env.FLUTTER_VERSION}} --build-arg BUILD_VERSION=${{env.BUILD_VERSION}} -t krtirtho/spotube_linux_arm:latest --load

- name: Build Binaries (nightly)
if: ${{ inputs.channel == 'nightly' }}
run: |
docker build -t spotube-linux-arm -f .github/Dockerfile . --build-arg BUILD_VERSION=${{ env.BUILD_VERSION }} --build-arg FLUTTER_VERSION=${{ env.FLUTTER_VERSION }}
docker create --name spotube-linux-arm spotube-linux-arm
docker cp spotube-linux-arm:/app/dist .
docker rm -f spotube-linux-arm
docker buildx build --platform=linux/arm64 -f .github/Dockerfile . --build-arg FLUTTER_VERSION=${{env.FLUTTER_VERSION}} --build-arg BUILD_VERSION=nightly -t krtirtho/spotube_linux_arm:latest --load

- name: Copy the built packages
run: |
docker images ls
docker create --name spotube_linux_arm krtirtho/spotube_linux_arm:latest
docker cp spotube_linux_arm:/app/dist/ dist/

- uses: actions/upload-artifact@v3
if: ${{ inputs.channel == 'stable' }}
with:
if-no-files-found: error
name: Spotube-Release-Binaries
path: |
dist/Spotube-linux-aarch64.deb
dist/spotube-linux-${{ env.BUILD_VERSION }}-aarch64.tar.xz

- uses: actions/upload-artifact@v3
if: ${{ inputs.channel == 'nightly' }}
with:
if-no-files-found: error
name: Spotube-Release-Binaries
path: |
dist/Spotube-linux-aarch64.deb
dist/Spotube-linux-aarch64.rpm
dist/spotube-linux-nightly-aarch64.tar.xz

- name: Debug With SSH When fails
Expand All @@ -266,7 +289,6 @@ jobs:
with:
limit-access-to-actor: true


android:
runs-on: ubuntu-latest
steps:
Expand All @@ -275,6 +297,13 @@ jobs:
with:
cache: true
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
check-latest: true

- name: Install Dependencies
run: |
Expand Down
46 changes: 46 additions & 0 deletions lib/components/root/update_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:spotube/components/shared/links/anchor_button.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:version/version.dart';

class RootAppUpdateDialog extends StatelessWidget {
final Version? version;
const RootAppUpdateDialog({super.key, this.version});

@override
Widget build(BuildContext context) {
const url = "https://spotube.krtirtho.dev/downloads";
return AlertDialog(
title: const Text("Spotube has an update"),
actions: [
FilledButton(
child: const Text("Download Now"),
onPressed: () => launchUrlString(
url,
mode: LaunchMode.externalApplication,
),
),
],
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("Spotube v$version has been released"),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Read the latest "),
AnchorButton(
"release notes",
style: const TextStyle(color: Colors.blue),
onTap: () => launchUrlString(
url,
mode: LaunchMode.externalApplication,
),
),
],
),
],
),
);
}
}
100 changes: 0 additions & 100 deletions lib/hooks/configurators/use_update_checker.dart

This file was deleted.

5 changes: 3 additions & 2 deletions lib/pages/root/root_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import 'package:spotube/components/root/sidebar.dart';
import 'package:spotube/components/root/spotube_navigation_bar.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/hooks/configurators/use_endless_playback.dart';
import 'package:spotube/hooks/configurators/use_update_checker.dart';
import 'package:spotube/provider/connect/server.dart';
import 'package:spotube/provider/download_manager_provider.dart';
import 'package:spotube/provider/proxy_playlist/proxy_playlist_provider.dart';
import 'package:spotube/services/connectivity_adapter.dart';
import 'package:spotube/utils/persisted_state_notifier.dart';
import 'package:spotube/utils/platform.dart';
import 'package:spotube/utils/service_utils.dart';

const rootPaths = {
"/": 0,
Expand All @@ -46,6 +46,8 @@ class RootApp extends HookConsumerWidget {

useEffect(() {
WidgetsBinding.instance.addPostFrameCallback((_) async {
ServiceUtils.checkForUpdates(context, ref);

final sharedPreferences = await SharedPreferences.getInstance();

if (sharedPreferences.getBool(kIsUsingEncryption) == false &&
Expand Down Expand Up @@ -160,7 +162,6 @@ class RootApp extends HookConsumerWidget {
}, [downloader]);

// checks for latest version of the application
useUpdateChecker(ref);

useEndlessPlayback(ref);

Expand Down
Loading