-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add auth cookie to avoid using auth token in the url * Fix all download button * Refactor some of the places where we download file
- Loading branch information
Showing
14 changed files
with
61 additions
and
125 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
6 changes: 6 additions & 0 deletions
6
tdrive/backend/node/src/core/platform/services/auth/web/jwt.ts
This file contains 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
This file contains 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
40 changes: 0 additions & 40 deletions
40
tdrive/frontend/src/app/components/search-popup/common.tsx
This file contains 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 |
---|---|---|
@@ -1,48 +1,8 @@ | ||
import Strings from 'features/global/utils/strings'; | ||
import FileUploadService from 'features/files/services/file-upload-service'; | ||
import routerService from '@features/router/services/router-service'; | ||
import { DriveApiClient } from '@features/drive/api-client/api-client'; | ||
import { DriveItem } from '@features/drive/types'; | ||
import { AttachedFileType } from '@features/files/types/file'; | ||
|
||
export const highlightText = (text?: string, highlight?: string) => { | ||
if (!text) { | ||
return ''; | ||
} | ||
if (!highlight) { | ||
return text; | ||
} | ||
const reg = new RegExp('(' + Strings.removeAccents(highlight) + ')', 'ig'); | ||
return Strings.removeAccents(text).replace(reg, "<span class='highlight'>$1</span>"); | ||
}; | ||
|
||
export const getFileMessageDownloadRoute = (file: AttachedFileType): string => { | ||
if (file?.metadata?.source === 'internal') | ||
return FileUploadService.getDownloadRoute({ | ||
companyId: file.metadata?.external_id?.company_id, | ||
fileId: file.metadata?.external_id?.id, | ||
}); | ||
return ''; | ||
}; | ||
|
||
export const onFileDownloadClick = (file: AttachedFileType) => { | ||
const url = getFileMessageDownloadRoute(file); | ||
|
||
url && (window.location.href = url); | ||
}; | ||
|
||
export const openDriveItem = (driveItem: DriveItem, workspace_id: string, drive_app_id: string) => { | ||
routerService.push( | ||
routerService.generateRouteFromState({ | ||
companyId: driveItem.company_id, | ||
workspaceId: workspace_id, | ||
channelId: drive_app_id, | ||
}), | ||
); | ||
}; | ||
|
||
export const onDriveItemDownloadClick = async (driveItem: DriveItem) => { | ||
const url = await DriveApiClient.getDownloadUrl(driveItem.company_id, driveItem.id); | ||
|
||
url && (window.location.href = url); | ||
}; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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