Compare commits

...

3 Commits

Author SHA1 Message Date
405d388db0 v1.4.6+67
All checks were successful
Flutter Schmutter / build (push) Successful in 3m46s
2025-06-23 02:51:49 +02:00
e30635304b ... 2025-06-22 17:24:43 +02:00
7a1f76ee85 v1.4.5+66
All checks were successful
Flutter Schmutter / build (push) Successful in 3m34s
2025-06-22 03:40:13 +02:00
10 changed files with 148 additions and 102 deletions

View File

@ -4,8 +4,8 @@
# This file should be version controlled and should not be manually edited. # This file should be version controlled and should not be manually edited.
version: version:
revision: "8b18dde77fa59ba7f87540c05d1aba787198e77a" revision: "01fde956f0d13551843a44ae16eda7ca87478603"
channel: "master" channel: "beta"
project_type: app project_type: app
@ -13,27 +13,8 @@ project_type: app
migration: migration:
platforms: platforms:
- platform: root - platform: root
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a create_revision: 01fde956f0d13551843a44ae16eda7ca87478603
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a base_revision: 01fde956f0d13551843a44ae16eda7ca87478603
- platform: android
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
- platform: ios
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
- platform: linux
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
- platform: macos
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
- platform: web
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
- platform: windows
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
# User provided section # User provided section
# List of Local paths (relative to this file) that should be # List of Local paths (relative to this file) that should be

View File

@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:encrypt_shared_preferences/provider.dart'; import 'package:encrypt_shared_preferences/provider.dart';
import 'package:http/http.dart' as http;
import 'package:f0ckapp/models/user.dart'; import 'package:f0ckapp/models/user.dart';
@ -10,6 +9,8 @@ class AuthController extends GetxController {
final EncryptedSharedPreferencesAsync storage = final EncryptedSharedPreferencesAsync storage =
EncryptedSharedPreferencesAsync.getInstance(); EncryptedSharedPreferencesAsync.getInstance();
final GetConnect http = GetConnect();
RxnString token = RxnString(); RxnString token = RxnString();
Rxn<User> user = Rxn<User>(); Rxn<User> user = Rxn<User>();
RxBool isLoading = false.obs; RxBool isLoading = false.obs;
@ -38,7 +39,8 @@ class AuthController extends GetxController {
if (token.value != null) { if (token.value != null) {
try { try {
await http.post( await http.post(
Uri.parse('https://api.f0ck.me/logout'), 'https://api.f0ck.me/logout',
{},
headers: { headers: {
'Authorization': 'Bearer ${token.value}', 'Authorization': 'Bearer ${token.value}',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -55,13 +57,15 @@ class AuthController extends GetxController {
isLoading.value = true; isLoading.value = true;
error.value = null; error.value = null;
try { try {
final http.Response response = await http.post( final Response<dynamic> response = await http.post(
Uri.parse('https://api.f0ck.me/login'), 'https://api.f0ck.me/login',
json.encode({'username': username, 'password': password}),
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},
body: json.encode({'username': username, 'password': password}),
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
final dynamic data = json.decode(response.body); final dynamic data = response.body is String
? json.decode(response.body)
: response.body;
if (data['token'] != null) { if (data['token'] != null) {
await saveToken(data['token']); await saveToken(data['token']);
user.value = User.fromJson(data); user.value = User.fromJson(data);
@ -83,12 +87,14 @@ class AuthController extends GetxController {
Future<void> fetchUserInfo() async { Future<void> fetchUserInfo() async {
if (token.value == null) return; if (token.value == null) return;
try { try {
final http.Response response = await http.get( final Response<dynamic> response = await http.get(
Uri.parse('https://api.f0ck.me/login/check'), 'https://api.f0ck.me/login/check',
headers: {'Authorization': 'Bearer ${token.value}'}, headers: {'Authorization': 'Bearer ${token.value}'},
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
final dynamic data = json.decode(response.body); final dynamic data = response.body is String
? json.decode(response.body)
: response.body;
user.value = User.fromJson(data); user.value = User.fromJson(data);
} else { } else {
await logout(); await logout();

View File

@ -7,6 +7,9 @@ class MediaItem {
final int mode; final int mode;
final List<Tag>? tags; final List<Tag>? tags;
final List<Favorite>? favorites; final List<Favorite>? favorites;
final String? username;
final String? userchannel;
final String? usernetwork;
MediaItem({ MediaItem({
required this.id, required this.id,
@ -17,6 +20,9 @@ class MediaItem {
required this.mode, required this.mode,
this.tags = const [], this.tags = const [],
this.favorites = const [], this.favorites = const [],
this.username,
this.userchannel,
this.usernetwork,
}); });
String get thumbnailUrl => 'https://f0ck.me/t/$id.webp'; String get thumbnailUrl => 'https://f0ck.me/t/$id.webp';
@ -33,6 +39,9 @@ class MediaItem {
int? mode, int? mode,
List<Tag>? tags, List<Tag>? tags,
List<Favorite>? favorites, List<Favorite>? favorites,
String? username,
String? userchannel,
String? usernetwork,
}) { }) {
return MediaItem( return MediaItem(
id: id ?? this.id, id: id ?? this.id,
@ -43,6 +52,9 @@ class MediaItem {
mode: mode ?? this.mode, mode: mode ?? this.mode,
tags: tags ?? this.tags, tags: tags ?? this.tags,
favorites: favorites ?? this.favorites, favorites: favorites ?? this.favorites,
username: username ?? this.username,
userchannel: userchannel ?? this.userchannel,
usernetwork: usernetwork ?? this.usernetwork,
); );
} }
@ -64,6 +76,9 @@ class MediaItem {
?.map((e) => Favorite.fromJson(e)) ?.map((e) => Favorite.fromJson(e))
.toList() ?? .toList() ??
[], [],
username: json['username'],
userchannel: json['userchannel'],
usernetwork: json['usernetwork'],
); );
} }
} }
@ -97,8 +112,8 @@ class Favorite {
factory Favorite.fromJson(Map<String, dynamic> json) { factory Favorite.fromJson(Map<String, dynamic> json) {
return Favorite( return Favorite(
userId: json['user_id'], userId: json['userId'],
username: json['user'], username: json['username'],
avatar: json['avatar'], avatar: json['avatar'],
); );
} }

View File

@ -305,62 +305,95 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
() => PullexRefreshController(), () => PullexRefreshController(),
); );
return PullexRefresh( return Stack(
onRefresh: () => _onRefresh(item.id, refreshController), children: [
header: const WaterDropHeader(), PullexRefresh(
controller: refreshController, onRefresh: () => _onRefresh(item.id, refreshController),
child: CustomScrollView( header: const WaterDropHeader(),
controller: scrollController, controller: refreshController,
slivers: [ child: CustomScrollView(
SliverToBoxAdapter( controller: scrollController,
child: AnimatedBuilder( slivers: [
animation: _pageController!, SliverToBoxAdapter(
builder: (context, child) { child: AnimatedBuilder(
return buildAnimatedTransition( animation: _pageController!,
context: context, builder: (context, child) {
pageController: _pageController!, return buildAnimatedTransition(
index: index, context: context,
child: child!, pageController: _pageController!,
); index: index,
}, child: child!,
child: Obx( );
() => _buildMedia(item, index == _currentIndex.value), },
), child: Obx(
), () =>
), _buildMedia(item, index == _currentIndex.value),
if (isReady)
SliverToBoxAdapter(
child: GestureDetector(
onTap: () => settingsController.hideVideoControls(),
behavior: HitTestBehavior.translucent,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TagSection(tags: item.tags ?? []),
Obx(
() => Visibility(
visible: authController.isLoggedIn,
child: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: FavoriteSection(
item: item,
index: index,
),
),
),
),
],
), ),
), ),
), ),
), if (isReady)
const SliverToBoxAdapter( SliverFillRemaining(
child: SafeArea(child: SizedBox.shrink()), hasScrollBody: false,
fillOverscroll: true,
child: GestureDetector(
onTap: () => settingsController.hideVideoControls(),
behavior: HitTestBehavior.translucent,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [TagSection(tags: item.tags ?? [])],
),
),
),
),
const SliverToBoxAdapter(
child: SafeArea(child: SizedBox.shrink()),
),
],
), ),
], ),
), Obx(() {
if (!authController.isLoggedIn) {
return const SizedBox.shrink();
}
final MediaItem currentItem =
mediaController.items[_currentIndex.value];
return DraggableScrollableSheet(
initialChildSize: 0.11,
minChildSize: 0.11,
maxChildSize: 0.245,
snap: true,
builder: (context, scrollController) => ListView(
controller: scrollController,
padding: const EdgeInsets.only(left: 16, right: 16),
children: [
FavoriteSection(
item: currentItem,
index: _currentIndex.value,
),
const SizedBox(height: 16),
Text(
"Dateigröße: ${(currentItem.size / 1024).toStringAsFixed(1)} KB",
style: Theme.of(context).textTheme.bodySmall,
),
Text(
"Typ: ${currentItem.mime}",
style: Theme.of(context).textTheme.bodySmall,
),
Text(
"ID: ${currentItem.id}",
style: Theme.of(context).textTheme.bodySmall,
),
Text(
"Hochgeladen am: ${DateTime.fromMillisecondsSinceEpoch(currentItem.stamp * 1000)}",
style: Theme.of(context).textTheme.bodySmall,
),
],
),
);
}),
],
); );
}, },
), ),

View File

@ -133,6 +133,7 @@ class _MediaGridBody extends StatelessWidget {
final SettingsController settingsController; final SettingsController settingsController;
final ScrollController scrollController; final ScrollController scrollController;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PullexRefresh( return PullexRefresh(

View File

@ -31,7 +31,7 @@ class ApiService extends GetConnect {
} }
final Response<dynamic> response = await get( final Response<dynamic> response = await get(
'https://api.f0ck.me/items_new/get', 'https://api.f0ck.me/items/get',
query: params, query: params,
headers: headers, headers: headers,
); );

View File

@ -4,13 +4,13 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:f0ckapp/controller/mediacontroller.dart'; import 'package:f0ckapp/controller/mediacontroller.dart';
import 'package:f0ckapp/models/suggestion.dart'; import 'package:f0ckapp/models/suggestion.dart';
class CustomSearchDelegate extends SearchDelegate<String> { class CustomSearchDelegate extends SearchDelegate<String> {
final MediaController controller = Get.find<MediaController>(); final MediaController controller = Get.find<MediaController>();
final GetConnect http = GetConnect();
Timer? _debounceTimer; Timer? _debounceTimer;
List<Suggestion>? _suggestions; List<Suggestion>? _suggestions;
bool _isLoading = false; bool _isLoading = false;
@ -48,14 +48,16 @@ class CustomSearchDelegate extends SearchDelegate<String> {
} }
Future<List<Suggestion>> fetchSuggestions(String query) async { Future<List<Suggestion>> fetchSuggestions(String query) async {
final Uri uri = Uri.parse('https://api.f0ck.me/search/?q=$query'); final String url = 'https://api.f0ck.me/search/?q=$query';
try { try {
final http.Response response = await http final Response<dynamic> response = await http
.get(uri) .get(url)
.timeout(const Duration(seconds: 5)); .timeout(const Duration(seconds: 5));
if (response.statusCode == 200) { if (response.statusCode == 200) {
final dynamic decoded = jsonDecode(response.body); final dynamic decoded = response.body is String
? jsonDecode(response.body)
: response.body;
if (decoded is List) { if (decoded is List) {
final suggestions = decoded final suggestions = decoded
.map((item) => Suggestion.fromJson(item as Map<String, dynamic>)) .map((item) => Suggestion.fromJson(item as Map<String, dynamic>))
@ -66,7 +68,9 @@ class CustomSearchDelegate extends SearchDelegate<String> {
throw Exception('Unerwartetes Format: Es wurde eine Liste erwartet.'); throw Exception('Unerwartetes Format: Es wurde eine Liste erwartet.');
} }
} else if (response.statusCode == 400) { } else if (response.statusCode == 400) {
final dynamic error = jsonDecode(response.body); final dynamic error = response.body is String
? jsonDecode(response.body)
: response.body;
final String message = error is Map<String, dynamic> final String message = error is Map<String, dynamic>
? error['detail']?.toString() ?? 'Unbekannter Fehler.' ? error['detail']?.toString() ?? 'Unbekannter Fehler.'
: 'Unbekannter Fehler.'; : 'Unbekannter Fehler.';

View File

@ -85,6 +85,13 @@ class _VideoWidgetState extends State<VideoWidget> {
@override @override
void didUpdateWidget(covariant VideoWidget oldWidget) { void didUpdateWidget(covariant VideoWidget oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (widget.details.mediaUrl != oldWidget.details.mediaUrl) {
videoController.dispose();
_initController();
return;
}
if (widget.isActive != oldWidget.isActive) { if (widget.isActive != oldWidget.isActive) {
if (widget.isActive) { if (widget.isActive) {
videoController.play(); videoController.play();

View File

@ -249,7 +249,7 @@ packages:
source: hosted source: hosted
version: "0.15.6" version: "0.15.6"
http: http:
dependency: "direct main" dependency: transitive
description: description:
name: http name: http
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
@ -268,10 +268,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: js name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.7" version: "0.7.2"
json_rpc_2: json_rpc_2:
dependency: transitive dependency: transitive
description: description:
@ -761,10 +761,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: vm_service name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "15.0.0" version: "15.0.2"
web: web:
dependency: transitive dependency: transitive
description: description:
@ -801,10 +801,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.13.0" version: "5.14.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.4.4+65 version: 1.4.6+67
environment: environment:
sdk: ^3.9.0-100.2.beta sdk: ^3.9.0-100.2.beta
@ -30,7 +30,6 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
http: ^1.4.0
get: ^4.7.2 get: ^4.7.2
encrypt_shared_preferences: ^0.9.9 encrypt_shared_preferences: ^0.9.9
cached_network_image: ^3.4.1 cached_network_image: ^3.4.1