-
Notifications
You must be signed in to change notification settings - Fork 8
#6006 add path and thumbnails to yust file #399
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
Draft
cJannik
wants to merge
21
commits into
master
Choose a base branch
from
6006-preview-of-images-and-files
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
03c3605
#6006 add path and thumbnails to yust file
cJannik 8e43865
#6006 readd removed update function
cJannik 0989b8d
#6006 add signed url functions
cJannik 95ad14e
#6006 move signed url logic to helper
cJannik 170d257
#6006 add copyWith function to file
cJannik 51d924a
#6006 sign url without port
cJannik 6156a0b
#6006 fix YustFile.fromJson implementation
cJannik d171ae4
#6006 add support for additional query params
cJannik 96eacf0
#6006 refactor comment
cJannik 361ffd5
#6006 strip port for prefix urls
cJannik c6b6208
#6006 create file access service
cJannik 909f617
#6006 export new models
cJannik 05331c0
#6006 refactor file access interface
cJannik 65e3e37
#6006 comments
cJannik 550dac2
Merge remote-tracking branch 'origin/master' into 6006-preview-of-ima…
cJannik 910aaae
#6006 add thumbnails to file interface
cJannik 9ce1a1f
#6006 add create thumbnail to yust file
cJannik c3add2e
#6006 add createThumbnail to yust image
cJannik fde659f
Merge remote-tracking branch 'origin/master' into 6006-preview-of-ima…
cJannik 65b619a
#6006 multiple small improvements
cJannik 2406b1c
#6006 refactor signed url generation
cJannik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export './yust_file_access_service_dart.dart' | ||
| if (dart.library.ui) './yust_file_access_service_flutter.dart'; | ||
| export './yust_file_access_service_interface.dart'; |
cJannik marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import 'package:collection/collection.dart'; | ||
|
|
||
| import '../models/yust_file.dart'; | ||
| import '../util/file_access/yust_cdn_configuration.dart'; | ||
| import '../util/file_access/yust_file_access_grant.dart'; | ||
| import '../util/google_cloud_cdn_helper.dart'; | ||
| import 'yust_file_access_service_interface.dart'; | ||
|
|
||
| class YustFileAccessService implements IYustFileAccessService { | ||
| @override | ||
| final String? originalCdnBaseUrl; | ||
|
|
||
| @override | ||
| final String? thumbnailCdnBaseUrl; | ||
|
|
||
| @override | ||
| List<YustFileAccessGrant> grants = []; | ||
|
|
||
| @override | ||
| Future<String?> Function(YustFile)? generateDownloadUrl; | ||
|
|
||
| YustFileAccessService({ | ||
| required this.originalCdnBaseUrl, | ||
| required this.thumbnailCdnBaseUrl, | ||
| }); | ||
|
|
||
| @override | ||
| String createSignedUrlForFile({ | ||
| required String path, | ||
| required String name, | ||
| required Duration validFor, | ||
| required YustCdnConfiguration cdnConfiguration, | ||
| Map<String, String>? additionalQueryParams, | ||
| }) { | ||
| final helper = GoogleCloudCdnHelper( | ||
| baseUrl: cdnConfiguration.baseUrl, | ||
| keyName: cdnConfiguration.keyName, | ||
| keyBase64: cdnConfiguration.keyBase64, | ||
| ); | ||
| return helper.signFilePath( | ||
| objectPath: '$path/$name', | ||
| validFor: validFor, | ||
| additionalQueryParams: additionalQueryParams, | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| String createSignedUrlPartForFolder({ | ||
| required String path, | ||
| required Duration validFor, | ||
| required YustCdnConfiguration cdnConfiguration, | ||
| }) { | ||
| final helper = GoogleCloudCdnHelper( | ||
| baseUrl: cdnConfiguration.baseUrl, | ||
| keyName: cdnConfiguration.keyName, | ||
| keyBase64: cdnConfiguration.keyBase64, | ||
| ); | ||
| return helper.signPrefix(prefixPath: path, validFor: validFor); | ||
| } | ||
|
|
||
| @override | ||
| void setGrants(List<YustFileAccessGrant> grants) { | ||
| this.grants = grants; | ||
| } | ||
|
|
||
| @override | ||
| YustFileAccessGrant? getGrantForFile(YustFile file) { | ||
| return grants.firstWhereOrNull( | ||
| (grant) => file.path?.startsWith(grant.pathPrefix) ?? false, | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.