mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-26 02:34:58 +08:00
fix: serval bugs
This commit is contained in:
41
Dockerfile
41
Dockerfile
@@ -1,30 +1,8 @@
|
|||||||
FROM ubuntu:20.04 as flutter_build
|
FROM instrumentisto/flutter:3 AS flutter
|
||||||
|
WORKDIR /app
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
COPY ./ui/pubspec.yaml ./ui/pubspec.lock ./
|
||||||
|
RUN flutter pub get
|
||||||
RUN apt-get update
|
COPY ./ui/ ./
|
||||||
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback python3
|
|
||||||
RUN apt-get clean
|
|
||||||
|
|
||||||
|
|
||||||
# download Flutter SDK from Flutter Github repo
|
|
||||||
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
|
|
||||||
|
|
||||||
# Set flutter environment path
|
|
||||||
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
|
|
||||||
|
|
||||||
# Run flutter doctor
|
|
||||||
RUN flutter doctor
|
|
||||||
|
|
||||||
# Enable flutter web
|
|
||||||
RUN flutter channel stable
|
|
||||||
RUN flutter upgrade
|
|
||||||
RUN flutter config --enable-web
|
|
||||||
|
|
||||||
# Copy files to container and build
|
|
||||||
RUN mkdir /app/
|
|
||||||
COPY . /app/
|
|
||||||
WORKDIR /app/
|
|
||||||
RUN flutter build web
|
RUN flutter build web
|
||||||
|
|
||||||
|
|
||||||
@@ -37,14 +15,15 @@ ENV GO111MODULE=on \
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=flutter_build go.mod .
|
COPY go.mod .
|
||||||
COPY --from=flutter_build go.sum .
|
COPY go.sum .
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
COPY --from=flutter_build . .
|
COPY . .
|
||||||
|
|
||||||
|
COPY --from=flutter /app/build/web ./ui/build/web/
|
||||||
# 指定OS等,并go build
|
# 指定OS等,并go build
|
||||||
RUN GOOS=linux GOARCH=amd64 go build -o polaris ./cmd/
|
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o polaris ./cmd/
|
||||||
|
|
||||||
FROM debian:12
|
FROM debian:12
|
||||||
|
|
||||||
|
|||||||
7
db/db.go
7
db/db.go
@@ -245,12 +245,19 @@ func (c *Client) AddStorage(s StorageInfo) error {
|
|||||||
SetImplementation(s.Implementation).
|
SetImplementation(s.Implementation).
|
||||||
SetPath(s.Path).
|
SetPath(s.Path).
|
||||||
SetUser(s.User).
|
SetUser(s.User).
|
||||||
|
SetDefault(s.Default).
|
||||||
SetPassword(s.Password).Exec(context.TODO())
|
SetPassword(s.Password).Exec(context.TODO())
|
||||||
}
|
}
|
||||||
|
countAll := c.ent.Storage.Query().CountX(context.TODO())
|
||||||
|
if countAll == 0 {
|
||||||
|
log.Infof("first storage, make it default: %s", s.Name)
|
||||||
|
s.Default = true
|
||||||
|
}
|
||||||
_, err := c.ent.Storage.Create().SetName(s.Name).
|
_, err := c.ent.Storage.Create().SetName(s.Name).
|
||||||
SetImplementation(s.Implementation).
|
SetImplementation(s.Implementation).
|
||||||
SetPath(s.Path).
|
SetPath(s.Path).
|
||||||
SetUser(s.User).
|
SetUser(s.User).
|
||||||
|
SetDefault(s.Default).
|
||||||
SetPassword(s.Password).Save(context.TODO())
|
SetPassword(s.Password).Save(context.TODO())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
11
ui/lib/activity.dart
Normal file
11
ui/lib/activity.dart
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
class ActivityPage extends ConsumerWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
// TODO: implement build
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -63,6 +63,9 @@ class IndexerSetting extends AsyncNotifier<List<Indexer>> {
|
|||||||
throw sp.message;
|
throw sp.message;
|
||||||
}
|
}
|
||||||
List<Indexer> indexers = List.empty(growable: true);
|
List<Indexer> indexers = List.empty(growable: true);
|
||||||
|
if (sp.data == null) {
|
||||||
|
return indexers;
|
||||||
|
}
|
||||||
for (final item in sp.data as List) {
|
for (final item in sp.data as List) {
|
||||||
indexers.add(Indexer.fromJson(item));
|
indexers.add(Indexer.fromJson(item));
|
||||||
}
|
}
|
||||||
@@ -128,6 +131,9 @@ class DownloadClientSetting extends AsyncNotifier<List<DownloadClient>> {
|
|||||||
throw sp.message;
|
throw sp.message;
|
||||||
}
|
}
|
||||||
List<DownloadClient> indexers = List.empty(growable: true);
|
List<DownloadClient> indexers = List.empty(growable: true);
|
||||||
|
if (sp.data == null) {
|
||||||
|
return indexers;
|
||||||
|
}
|
||||||
for (final item in sp.data as List) {
|
for (final item in sp.data as List) {
|
||||||
indexers.add(DownloadClient.fromJson(item));
|
indexers.add(DownloadClient.fromJson(item));
|
||||||
}
|
}
|
||||||
@@ -203,7 +209,6 @@ class DownloadClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class StorageSettingData extends AsyncNotifier<List<Storage>> {
|
class StorageSettingData extends AsyncNotifier<List<Storage>> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureOr<List<Storage>> build() async {
|
FutureOr<List<Storage>> build() async {
|
||||||
final dio = await APIs.getDio();
|
final dio = await APIs.getDio();
|
||||||
@@ -237,6 +242,7 @@ class StorageSettingData extends AsyncNotifier<List<Storage>> {
|
|||||||
if (sp.code != 0) {
|
if (sp.code != 0) {
|
||||||
throw sp.message;
|
throw sp.message;
|
||||||
}
|
}
|
||||||
|
ref.invalidateSelf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:ui/providers/APIs.dart';
|
import 'package:ui/providers/APIs.dart';
|
||||||
|
import 'package:ui/providers/settings.dart';
|
||||||
import 'package:ui/providers/welcome_data.dart';
|
import 'package:ui/providers/welcome_data.dart';
|
||||||
|
|
||||||
class SearchPage extends ConsumerStatefulWidget {
|
class SearchPage extends ConsumerStatefulWidget {
|
||||||
@@ -89,12 +90,42 @@ class _SearchPageState extends ConsumerState<SearchPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showSubmitDialog(BuildContext context, SearchResult item) {
|
Future<void> _showSubmitDialog(BuildContext context, SearchResult item) {
|
||||||
|
TextEditingController resolutionController =
|
||||||
|
TextEditingController(text: "1080p");
|
||||||
|
TextEditingController storageController = TextEditingController();
|
||||||
|
var storage = ref.watch(storageSettingProvider);
|
||||||
return showDialog<void>(
|
return showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('添加剧集'),
|
title: Text('添加剧集: ${item.name}'),
|
||||||
content: Text("是否添加剧集: ${item.name}"),
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
DropdownMenu(
|
||||||
|
label: const Text("清晰度"),
|
||||||
|
controller: resolutionController,
|
||||||
|
dropdownMenuEntries: const [
|
||||||
|
DropdownMenuEntry(value: "720p", label: "720p"),
|
||||||
|
DropdownMenuEntry(value: "1080p", label: "1080p"),
|
||||||
|
DropdownMenuEntry(value: "4k", label: "4k"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
storage.when(
|
||||||
|
data: (v) {
|
||||||
|
return DropdownMenu(
|
||||||
|
label: const Text("存储位置"),
|
||||||
|
controller: storageController,
|
||||||
|
dropdownMenuEntries: v
|
||||||
|
.map((s) =>
|
||||||
|
DropdownMenuEntry(label: s.name!, value: s.id))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
error: (err, trace) => Text("$err"),
|
||||||
|
loading: () => const CircularProgressIndicator()),
|
||||||
|
],
|
||||||
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ class _TvDetailsPageState extends ConsumerState<TvDetailsPage> {
|
|||||||
});
|
});
|
||||||
if (!Utils.showError(context, snapshot)) {
|
if (!Utils.showError(context, snapshot)) {
|
||||||
var name = await f;
|
var name = await f;
|
||||||
Utils.showSnakeBar(
|
Utils.showSnakeBar(context, "开始下载: $name");
|
||||||
context, "开始下载: $name");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.search))
|
icon: const Icon(Icons.search))
|
||||||
@@ -140,7 +139,11 @@ class _TvDetailsPageState extends ConsumerState<TvDetailsPage> {
|
|||||||
error: (err, trace) {
|
error: (err, trace) {
|
||||||
return Text("$err");
|
return Text("$err");
|
||||||
},
|
},
|
||||||
loading: () => const CircularProgressIndicator());
|
loading: () => const Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 30,
|
||||||
|
height: 30,
|
||||||
|
child: CircularProgressIndicator())));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ class WelcomePage extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
_ => const CircularProgressIndicator(),
|
_ => const Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 30, height: 30, child: CircularProgressIndicator())),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user