-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement MSC4039 download_file action #99
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,40 @@ | ||||
/* | ||||
* Copyright 2024 Nordeck IT + Consulting GmbH | ||||
* | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | ||||
* | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | ||||
* Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
* See the License for the specific language governing permissions and | ||||
* limitations under the License. | ||||
*/ | ||||
|
||||
import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; | ||||
import { IWidgetApiResponseData } from "./IWidgetApiResponse"; | ||||
import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; | ||||
|
||||
export interface IDownloadFileActionFromWidgetRequestData | ||||
extends IWidgetApiRequestData { | ||||
content_uri: string; // eslint-disable-line camelcase | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this need to be an exception? Is it taken directly from the wire and we don't want to convert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, careful of cargoculting then - the other instance has zero comments on why the exception exists too. Doesn't feel like a blocker though. |
||||
} | ||||
|
||||
export interface IDownloadFileActionFromWidgetActionRequest | ||||
extends IWidgetApiRequest { | ||||
action: WidgetApiFromWidgetAction.MSC4039DownloadFileAction; | ||||
data: IDownloadFileActionFromWidgetRequestData; | ||||
} | ||||
|
||||
export interface IDownloadFileActionFromWidgetResponseData | ||||
extends IWidgetApiResponseData { | ||||
file: XMLHttpRequestBodyInit; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is more a comment on the MSC, but maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, another comment that's really on the MSC, but... why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The explanations I can offer is, quoting from the MSC: To your first question:
To be consistent, would you think that we would also have to rename the upload's data.file? We would then need to spend some thoughts on backwards compatibility. To the second one:
Again, to be consistent we would need to change it there too and manage version incompatibilities. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, IMO renaming file on the upload API would be clearer, but that's for the MSC discussion anyway. If we think the right way to go is to change upload too, then we'd need a new version of the MSC anyway, so we may as well implement download as the MSC is now and then change both at the same time, at a later date? |
||||
} | ||||
|
||||
export interface IDownloadFileActionFromWidgetActionResponse | ||||
extends IDownloadFileActionFromWidgetActionRequest { | ||||
response: IDownloadFileActionFromWidgetResponseData; | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, more for the MSC but... what about large files? I guess the answer is that since there's no specific limit on postMessage, we can add a different API later if it's needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see an obvious issue with postMessage at a glance. Mostly, we assume that we can do whatever we already can do for uploading. This update to MSC4039 seeks to address Authenticated Media, which got overlooked so far for the widget API. The real answer is probably to revamp the widget API entirely to enable widgets to use their own scoped access tokens to access the C-S API directly, but we won't get there before Matrix 1.12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I don't think trying to download a 1GB file over the postmessage API is going to be a great user experience, but yeah, if this is more of a stop-gap solution until we have scoped access tokens then that's probably okay.