Compare commits

...

2 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
9 changed files with 141 additions and 102 deletions

View File

@ -4,8 +4,8 @@
# This file should be version controlled and should not be manually edited.
version:
revision: "8b18dde77fa59ba7f87540c05d1aba787198e77a"
channel: "master"
revision: "01fde956f0d13551843a44ae16eda7ca87478603"
channel: "beta"
project_type: app
@ -13,27 +13,8 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
- 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
create_revision: 01fde956f0d13551843a44ae16eda7ca87478603
base_revision: 01fde956f0d13551843a44ae16eda7ca87478603
# User provided section
# 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:encrypt_shared_preferences/provider.dart';
import 'package:http/http.dart' as http;
import 'package:f0ckapp/models/user.dart';
@ -10,6 +9,8 @@ class AuthController extends GetxController {
final EncryptedSharedPreferencesAsync storage =
EncryptedSharedPreferencesAsync.getInstance();
final GetConnect http = GetConnect();
RxnString token = RxnString();
Rxn<User> user = Rxn<User>();
RxBool isLoading = false.obs;
@ -38,7 +39,8 @@ class AuthController extends GetxController {
if (token.value != null) {
try {
await http.post(
Uri.parse('https://api.f0ck.me/logout'),
'https://api.f0ck.me/logout',
{},
headers: {
'Authorization': 'Bearer ${token.value}',
'Content-Type': 'application/json',
@ -55,13 +57,15 @@ class AuthController extends GetxController {
isLoading.value = true;
error.value = null;
try {
final http.Response response = await http.post(
Uri.parse('https://api.f0ck.me/login'),
final Response<dynamic> response = await http.post(
'https://api.f0ck.me/login',
json.encode({'username': username, 'password': password}),
headers: {'Content-Type': 'application/json'},
body: json.encode({'username': username, 'password': password}),
);
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) {
await saveToken(data['token']);
user.value = User.fromJson(data);
@ -83,12 +87,14 @@ class AuthController extends GetxController {
Future<void> fetchUserInfo() async {
if (token.value == null) return;
try {
final http.Response response = await http.get(
Uri.parse('https://api.f0ck.me/login/check'),
final Response<dynamic> response = await http.get(
'https://api.f0ck.me/login/check',
headers: {'Authorization': 'Bearer ${token.value}'},
);
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);
} else {
await logout();

View File

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

View File

@ -305,7 +305,9 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
() => PullexRefreshController(),
);
return PullexRefresh(
return Stack(
children: [
PullexRefresh(
onRefresh: () => _onRefresh(item.id, refreshController),
header: const WaterDropHeader(),
controller: refreshController,
@ -324,12 +326,15 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
);
},
child: Obx(
() => _buildMedia(item, index == _currentIndex.value),
() =>
_buildMedia(item, index == _currentIndex.value),
),
),
),
if (isReady)
SliverToBoxAdapter(
SliverFillRemaining(
hasScrollBody: false,
fillOverscroll: true,
child: GestureDetector(
onTap: () => settingsController.hideVideoControls(),
behavior: HitTestBehavior.translucent,
@ -337,21 +342,7 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
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,
),
),
),
),
],
children: [TagSection(tags: item.tags ?? [])],
),
),
),
@ -361,6 +352,48 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
),
],
),
),
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 ScrollController scrollController;
@override
Widget build(BuildContext context) {
return PullexRefresh(

View File

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

View File

@ -4,13 +4,13 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:f0ckapp/controller/mediacontroller.dart';
import 'package:f0ckapp/models/suggestion.dart';
class CustomSearchDelegate extends SearchDelegate<String> {
final MediaController controller = Get.find<MediaController>();
final GetConnect http = GetConnect();
Timer? _debounceTimer;
List<Suggestion>? _suggestions;
bool _isLoading = false;
@ -48,14 +48,16 @@ class CustomSearchDelegate extends SearchDelegate<String> {
}
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 {
final http.Response response = await http
.get(uri)
final Response<dynamic> response = await http
.get(url)
.timeout(const Duration(seconds: 5));
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) {
final suggestions = decoded
.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.');
}
} 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>
? error['detail']?.toString() ?? 'Unbekannter Fehler.'
: 'Unbekannter Fehler.';

View File

@ -249,7 +249,7 @@ packages:
source: hosted
version: "0.15.6"
http:
dependency: "direct main"
dependency: transitive
description:
name: http
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
@ -268,10 +268,10 @@ packages:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
url: "https://pub.dev"
source: hosted
version: "0.6.7"
version: "0.7.2"
json_rpc_2:
dependency: transitive
description:
@ -761,10 +761,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
url: "https://pub.dev"
source: hosted
version: "15.0.0"
version: "15.0.2"
web:
dependency: transitive
description:
@ -801,10 +801,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
url: "https://pub.dev"
source: hosted
version: "5.13.0"
version: "5.14.0"
xdg_directories:
dependency: transitive
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
# 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.
version: 1.4.5+66
version: 1.4.6+67
environment:
sdk: ^3.9.0-100.2.beta
@ -30,7 +30,6 @@ environment:
dependencies:
flutter:
sdk: flutter
http: ^1.4.0
get: ^4.7.2
encrypt_shared_preferences: ^0.9.9
cached_network_image: ^3.4.1