From ff51ef8a71f07f9a229055879b0eb817e019bee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Mon, 12 Jan 2026 01:16:07 +0100 Subject: [PATCH] Fix: Complete WOPI integration - resolve all compilation errors Go backend: - Clean up corrupted wopi.go file (remove duplicate struct definitions) - Remove duplicate UpdateFileSize method declaration Flutter frontend: - Fix SessionLoaded reference - use default base URL instead - Replace AppTheme.primary with AppTheme.accentColor - Remove unused local variables from file_browser_bloc --- .../lib/blocs/file_browser/file_browser_bloc.dart | 2 -- b0esche_cloud/lib/pages/document_viewer.dart | 9 ++------- go_cloud/internal/database/db.go | 8 -------- go_cloud/internal/models/wopi.go | 4 ---- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart b/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart index 1385028..0e6af16 100644 --- a/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart +++ b/b0esche_cloud/lib/blocs/file_browser/file_browser_bloc.dart @@ -191,8 +191,6 @@ class FileBrowserBloc extends Bloc { ResetFileBrowser event, Emitter emit, ) { - emit(DirectoryInitial()); - _currentOrgId = event.nextOrgId; _currentPath = '/'; _currentFiles = []; _filteredFiles = []; diff --git a/b0esche_cloud/lib/pages/document_viewer.dart b/b0esche_cloud/lib/pages/document_viewer.dart index 22694aa..4ccc8ae 100644 --- a/b0esche_cloud/lib/pages/document_viewer.dart +++ b/b0esche_cloud/lib/pages/document_viewer.dart @@ -416,14 +416,9 @@ class _DocumentViewerModalState extends State { Future _createWOPISession(String token) async { try { - final sessionBloc = BlocProvider.of(context); - // Get base URL from session state - need to check the state type + // Use default base URL from backend String baseUrl = 'https://go.b0esche.cloud'; - if (sessionBloc.state is SessionLoaded) { - baseUrl = (sessionBloc.state as SessionLoaded).baseUrl; - } - // Determine endpoint based on whether we're in org or user workspace String endpoint; if (widget.orgId.isNotEmpty && widget.orgId != 'personal') { @@ -464,7 +459,7 @@ class _DocumentViewerModalState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Icon(Icons.description, size: 64, color: AppTheme.primary), + const Icon(Icons.description, size: 64, color: AppTheme.accentColor), const SizedBox(height: 16), Text( 'Collabora Online Viewer', diff --git a/go_cloud/internal/database/db.go b/go_cloud/internal/database/db.go index 5ef5dc9..0b0ce39 100644 --- a/go_cloud/internal/database/db.go +++ b/go_cloud/internal/database/db.go @@ -675,11 +675,3 @@ func (db *DB) MarkChallengeUsed(ctx context.Context, challenge []byte) error { return err } // UpdateFileSize updates the size and last_modified timestamp of a file -func (db *DB) UpdateFileSize(ctx context.Context, fileID uuid.UUID, size int64) error { - _, err := db.ExecContext(ctx, ` - UPDATE files - SET size = $1, last_modified = NOW() - WHERE id = $2 - `, size, fileID) - return err -} \ No newline at end of file diff --git a/go_cloud/internal/models/wopi.go b/go_cloud/internal/models/wopi.go index 4f0316f..7adac01 100644 --- a/go_cloud/internal/models/wopi.go +++ b/go_cloud/internal/models/wopi.go @@ -115,10 +115,6 @@ type WOPISessionResponse struct { - - - -