Compare commits

...

2 Commits

3 changed files with 13 additions and 7 deletions

View File

@@ -52,9 +52,13 @@ class EditorSessionBloc extends Bloc<EditorSessionEvent, EditorSessionState> {
return; return;
} }
if (!session.readOnly) { if (!session.readOnly) {
emit(EditorSessionActive(editUrl: session.editUrl)); emit(
EditorSessionActive(editUrl: session.editUrl, token: session.token),
);
} else { } else {
emit(EditorSessionReadOnly(viewUrl: session.editUrl)); emit(
EditorSessionReadOnly(viewUrl: session.editUrl, token: session.token),
);
} }
_expiryTimer = Timer( _expiryTimer = Timer(
session.expiresAt.difference(DateTime.now()), session.expiresAt.difference(DateTime.now()),

View File

@@ -13,20 +13,22 @@ class EditorSessionStarting extends EditorSessionState {}
class EditorSessionActive extends EditorSessionState { class EditorSessionActive extends EditorSessionState {
final Uri editUrl; final Uri editUrl;
final String token;
const EditorSessionActive({required this.editUrl}); const EditorSessionActive({required this.editUrl, required this.token});
@override @override
List<Object> get props => [editUrl]; List<Object> get props => [editUrl, token];
} }
class EditorSessionReadOnly extends EditorSessionState { class EditorSessionReadOnly extends EditorSessionState {
final Uri viewUrl; final Uri viewUrl;
final String token;
const EditorSessionReadOnly({required this.viewUrl}); const EditorSessionReadOnly({required this.viewUrl, required this.token});
@override @override
List<Object> get props => [viewUrl]; List<Object> get props => [viewUrl, token];
} }
class EditorSessionFailed extends EditorSessionState { class EditorSessionFailed extends EditorSessionState {

View File

@@ -483,7 +483,7 @@ func editorHandler(w http.ResponseWriter, r *http.Request, db *database.DB, audi
// Build Collabora editor URL - Collabora needs the file download URL as the WOPISrc parameter // Build Collabora editor URL - Collabora needs the file download URL as the WOPISrc parameter
editUrl := fmt.Sprintf("https://go.b0esche.cloud/orgs/%s/files/download?path=%s", orgID.String(), url.QueryEscape(file.Path)) editUrl := fmt.Sprintf("https://go.b0esche.cloud/orgs/%s/files/download?path=%s", orgID.String(), url.QueryEscape(file.Path))
collaboraUrl := fmt.Sprintf("https://collabora.b0esche.cloud/lool/dist/mobile/cool.html?WOPISrc=%s", url.QueryEscape(editUrl)) collaboraUrl := fmt.Sprintf("https://of.b0esche.cloud/lool/dist/mobile/cool.html?WOPISrc=%s", url.QueryEscape(editUrl))
// Check if user can edit (for now, all org members can edit) // Check if user can edit (for now, all org members can edit)
readOnly := false readOnly := false