Compare commits
3 Commits
13a5310ba5
...
0d41cdeebf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d41cdeebf | ||
|
|
083ab8c95d | ||
|
|
62d976eae5 |
@@ -26,7 +26,6 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
||||
String? _error;
|
||||
Map<String, dynamic>? _fileData;
|
||||
VideoPlayerController? _videoController;
|
||||
List<int>? _pdfBytes;
|
||||
String? _videoViewType;
|
||||
|
||||
@override
|
||||
@@ -51,11 +50,6 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
||||
_isLoading = false;
|
||||
});
|
||||
|
||||
// Load PDF bytes if it's a PDF file
|
||||
if (_isPdfFile()) {
|
||||
await _loadPdfBytes();
|
||||
}
|
||||
|
||||
// Initialize video player if it's a video file
|
||||
if (_isVideoFile()) {
|
||||
await _initializeVideoPlayer();
|
||||
@@ -68,28 +62,6 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _loadPdfBytes() async {
|
||||
if (_fileData?['viewUrl'] != null) {
|
||||
try {
|
||||
final apiClient = getIt<ApiClient>();
|
||||
// Extract the path from viewUrl and call it directly
|
||||
final viewUrl = _fileData!['viewUrl'] as String;
|
||||
final uri = Uri.parse(viewUrl);
|
||||
final path = uri.path + (uri.query.isNotEmpty ? '?${uri.query}' : '');
|
||||
|
||||
final bytes = await apiClient.getBytes(path);
|
||||
setState(() {
|
||||
_pdfBytes = bytes;
|
||||
});
|
||||
} catch (e) {
|
||||
// If loading fails, we'll show an error or fallback
|
||||
setState(() {
|
||||
_error = 'Failed to load PDF content.';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _initializeVideoPlayer() async {
|
||||
if (!kIsWeb) {
|
||||
// For mobile, use VideoPlayerController
|
||||
@@ -184,35 +156,20 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
||||
if (viewUrl == null) return const SizedBox();
|
||||
|
||||
if (_isPdfFile()) {
|
||||
if (_pdfBytes != null) {
|
||||
return Expanded(
|
||||
child: SfPdfViewer.memory(
|
||||
Uint8List.fromList(_pdfBytes!),
|
||||
canShowScrollHead: false,
|
||||
canShowScrollStatus: false,
|
||||
enableDoubleTapZooming: true,
|
||||
enableTextSelection: false,
|
||||
),
|
||||
);
|
||||
} else if (_error != null) {
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
_error!,
|
||||
style: TextStyle(color: AppTheme.primaryText),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const Expanded(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppTheme.accentColor),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Expanded(
|
||||
child: SfPdfViewer.network(
|
||||
viewUrl,
|
||||
onDocumentLoadFailed: (details) {
|
||||
setState(() {
|
||||
_error = 'Failed to load PDF: ${details.description}';
|
||||
});
|
||||
},
|
||||
canShowScrollHead: false,
|
||||
canShowScrollStatus: false,
|
||||
enableDoubleTapZooming: true,
|
||||
enableTextSelection: false,
|
||||
),
|
||||
);
|
||||
} else if (_isVideoFile()) {
|
||||
if (kIsWeb && _videoViewType != null) {
|
||||
// Use HTML video element for web
|
||||
|
||||
@@ -77,19 +77,6 @@ echo "Restarting flutter-web container..."
|
||||
cd /opt/traefik
|
||||
docker-compose up -d --force-recreate flutter-web
|
||||
|
||||
# Copy Traefik dynamic configs (public share proxy)
|
||||
echo "Copying traefik dynamic configs..."
|
||||
mkdir -p /opt/traefik/dynamic
|
||||
if [ -d "$DEPLOY_DIR/traefik/dynamic" ]; then
|
||||
cp -r "$DEPLOY_DIR/traefik/dynamic"/* /opt/traefik/dynamic/ || true
|
||||
fi
|
||||
|
||||
# Reload Traefik to pick up dynamic config
|
||||
echo "Reloading Traefik..."
|
||||
cd /opt/traefik
|
||||
# Try graceful recreate, fallback to restart
|
||||
docker-compose up -d --no-deps --force-recreate traefik || docker-compose restart traefik
|
||||
|
||||
echo "=== Deployment completed successfully at $(date) ==="
|
||||
|
||||
# Record deployment time
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
http:
|
||||
routers:
|
||||
public-share-router:
|
||||
rule: 'Host("www.b0esche.cloud") && PathPrefix("/public/")'
|
||||
entryPoints:
|
||||
- websecure
|
||||
service: public-share-service
|
||||
tls: {}
|
||||
services:
|
||||
public-share-service:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://go-backend:8080"
|
||||
passHostHeader: true
|
||||
Reference in New Issue
Block a user