diff --git a/apps/cast/src/pages/slideshow.tsx b/apps/cast/src/pages/slideshow.tsx index 15459369a..0441c6c77 100644 --- a/apps/cast/src/pages/slideshow.tsx +++ b/apps/cast/src/pages/slideshow.tsx @@ -1,3 +1,4 @@ +import { logError } from '@ente/shared/sentry'; import PairedSuccessfullyOverlay from 'components/PairedSuccessfullyOverlay'; import Theatre from 'components/Theatre'; import { FILE_TYPE } from 'constants/file'; @@ -7,7 +8,6 @@ import { getCollectionWithKey } from 'services/collectionService'; import { syncFiles } from 'services/fileService'; import { EnteFile } from 'types/file'; import { downloadFileAsBlob, isRawFileFromFileName } from 'utils/file'; -import { logError } from 'utils/sentry'; export const SlideshowContext = createContext<{ showNextSlide: () => void; @@ -31,13 +31,11 @@ export default function Slideshow() { try { // get requested collection id from localStorage const requestedCollectionID = - window.localStorage.getItem('targetCollectionId'); + window.localStorage.getItem('collectionID'); - const requestedCollectionKey = window.localStorage.getItem( - 'targetCollectionKey' - ); - - const castToken = window.localStorage.getItem('token'); + const requestedCollectionKey = + window.localStorage.getItem('collectionKey'); + const castToken = window.localStorage.getItem('castToken'); const collection = await getCollectionWithKey( Number(requestedCollectionID), diff --git a/apps/cast/src/services/cache/cacheStorageService.ts b/apps/cast/src/services/cache/cacheStorageService.ts index adb9731dd..87df2063b 100644 --- a/apps/cast/src/services/cache/cacheStorageService.ts +++ b/apps/cast/src/services/cache/cacheStorageService.ts @@ -1,4 +1,4 @@ -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import { CacheStorageFactory } from './cacheStorageFactory'; const SecurityError = 'SecurityError'; diff --git a/apps/cast/src/services/ffmpeg/ffmpegService.ts b/apps/cast/src/services/ffmpeg/ffmpegService.ts index 4a0148194..776694719 100644 --- a/apps/cast/src/services/ffmpeg/ffmpegService.ts +++ b/apps/cast/src/services/ffmpeg/ffmpegService.ts @@ -5,8 +5,8 @@ import { } from 'constants/ffmpeg'; import { ElectronFile } from 'types/upload'; import { parseFFmpegExtractedMetadata } from 'utils/ffmpeg'; -import { logError } from 'utils/sentry'; import ffmpegFactory from './ffmpegFactory'; +import { logError } from '@ente/shared/sentry'; export async function generateVideoThumbnail( file: File | ElectronFile diff --git a/apps/cast/src/services/fileService.ts b/apps/cast/src/services/fileService.ts index 397e7b645..948c62aae 100644 --- a/apps/cast/src/services/fileService.ts +++ b/apps/cast/src/services/fileService.ts @@ -1,10 +1,8 @@ import { getEndpoint } from '@ente/shared/network/api'; -import localForage from 'utils/storage/localForage'; import { getToken } from '@ente/shared/storage/localStorage/helpers'; import { Collection } from 'types/collection'; -import { logError } from 'utils/sentry'; import { decryptFile, getLatestVersionFiles, @@ -21,7 +19,6 @@ import { } from 'types/file'; import { SetFiles } from 'types/gallery'; import { BulkUpdateMagicMetadataRequest } from 'types/magicMetadata'; -import { addLogLine } from 'utils/logging'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; import { getCollectionLastSyncTime, @@ -30,6 +27,9 @@ import { import { REQUEST_BATCH_SIZE } from 'constants/api'; import { batch } from '@ente/shared/batch'; import HTTPService from '@ente/shared/network/HTTPService'; +import localForage from '@ente/shared/storage/localForage'; +import { logError } from '@ente/shared/sentry'; +import { addLogLine } from '@ente/shared/logging'; const ENDPOINT = getEndpoint(); const FILES_TABLE = 'files'; diff --git a/apps/cast/src/services/heicConversionService.ts b/apps/cast/src/services/heicConversionService.ts index 64efb87da..00f49b7db 100644 --- a/apps/cast/src/services/heicConversionService.ts +++ b/apps/cast/src/services/heicConversionService.ts @@ -1,4 +1,4 @@ -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import WasmHEICConverterService from './wasmHeicConverter/wasmHEICConverterService'; class HeicConversionService { diff --git a/apps/cast/src/services/typeDetectionService.ts b/apps/cast/src/services/typeDetectionService.ts index 889ee2990..4a2f83e51 100644 --- a/apps/cast/src/services/typeDetectionService.ts +++ b/apps/cast/src/services/typeDetectionService.ts @@ -6,7 +6,7 @@ import { } from 'constants/upload'; import { CustomError } from 'utils/error'; import { getFileExtension } from 'utils/file'; -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import { getUint8ArrayView } from './readerService'; import FileType, { FileTypeResult } from 'file-type'; import { convertBytesToHumanReadable } from 'utils/file/size'; diff --git a/apps/cast/src/services/upload/exifService.ts b/apps/cast/src/services/upload/exifService.ts index 8e191665b..92e18747b 100644 --- a/apps/cast/src/services/upload/exifService.ts +++ b/apps/cast/src/services/upload/exifService.ts @@ -3,7 +3,7 @@ import { Location } from 'types/upload'; import exifr from 'exifr'; import piexif from 'piexifjs'; import { FileTypeInfo } from 'types/upload'; -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import { validateAndGetCreationUnixTimeInMicroSeconds } from 'utils/time'; import { CustomError } from 'utils/error'; diff --git a/apps/cast/src/services/wasm/ffmpeg.ts b/apps/cast/src/services/wasm/ffmpeg.ts index fd2f207ab..bb27ed4db 100644 --- a/apps/cast/src/services/wasm/ffmpeg.ts +++ b/apps/cast/src/services/wasm/ffmpeg.ts @@ -2,9 +2,9 @@ import { promiseWithTimeout } from '@ente/shared/promise'; import { createFFmpeg, FFmpeg } from 'ffmpeg-wasm'; import QueueProcessor from 'services/queueProcessor'; import { getUint8ArrayView } from 'services/readerService'; -import { addLogLine } from 'utils/logging'; -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import { generateTempName } from 'utils/temp'; +import { addLogLine } from '@ente/shared/logging'; const INPUT_PATH_PLACEHOLDER = 'INPUT'; const FFMPEG_PLACEHOLDER = 'FFMPEG'; diff --git a/apps/cast/src/services/wasmHeicConverter/wasmHEICConverterService.ts b/apps/cast/src/services/wasmHeicConverter/wasmHEICConverterService.ts index 747c4d560..8733550ff 100644 --- a/apps/cast/src/services/wasmHeicConverter/wasmHEICConverterService.ts +++ b/apps/cast/src/services/wasmHeicConverter/wasmHEICConverterService.ts @@ -1,12 +1,12 @@ import QueueProcessor from 'services/queueProcessor'; import { CustomError } from 'utils/error'; import { retryAsyncFunction } from 'utils/network'; -import { addLogLine } from 'utils/logging'; import { DedicatedConvertWorker } from 'worker/convert.worker'; import { ComlinkWorker } from 'utils/comlink/comlinkWorker'; import { convertBytesToHumanReadable } from 'utils/file/size'; import { getDedicatedConvertWorker } from 'utils/comlink/ComlinkConvertWorker'; import { logError } from '@ente/shared/sentry'; +import { addLogLine } from '@ente/shared/logging'; const WORKER_POOL_SIZE = 2; const MAX_CONVERSION_IN_PARALLEL = 1; diff --git a/apps/cast/src/types/billing/index.ts b/apps/cast/src/types/billing/index.ts deleted file mode 100644 index c72096bfb..000000000 --- a/apps/cast/src/types/billing/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { PLAN_PERIOD } from 'constants/gallery'; - -export interface Subscription { - id: number; - userID: number; - productID: string; - storage: number; - originalTransactionID: string; - expiryTime: number; - paymentProvider: string; - attributes: { - isCancelled: boolean; - }; - price: string; - period: PLAN_PERIOD; -} -export interface Plan { - id: string; - androidID: string; - iosID: string; - storage: number; - price: string; - period: PLAN_PERIOD; - stripeID: string; -} diff --git a/apps/cast/src/types/cast/index.ts b/apps/cast/src/types/cast/index.ts new file mode 100644 index 000000000..f082e433e --- /dev/null +++ b/apps/cast/src/types/cast/index.ts @@ -0,0 +1,5 @@ +export interface CastPayload { + collectionID: number; + collectionKey: string; + castToken: string; +} diff --git a/apps/cast/src/types/user/index.ts b/apps/cast/src/types/user/index.ts deleted file mode 100644 index de2228042..000000000 --- a/apps/cast/src/types/user/index.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { Subscription } from 'types/billing'; - -export interface KeyAttributes { - kekSalt: string; - encryptedKey: string; - keyDecryptionNonce: string; - opsLimit: number; - memLimit: number; - publicKey: string; - encryptedSecretKey: string; - secretKeyDecryptionNonce: string; - masterKeyEncryptedWithRecoveryKey: string; - masterKeyDecryptionNonce: string; - recoveryKeyEncryptedWithMasterKey: string; - recoveryKeyDecryptionNonce: string; -} -export interface KEK { - key: string; - opsLimit: number; - memLimit: number; -} - -export interface UpdatedKey { - kekSalt: string; - encryptedKey: string; - keyDecryptionNonce: string; - memLimit: number; - opsLimit: number; -} - -export interface UpdateSRPAndKeysRequest { - srpM1: string; - setupID: string; - updatedKeyAttr: UpdatedKey; -} - -export interface UpdateSRPAndKeysResponse { - srpM2: string; - setupID: string; -} - -export interface RecoveryKey { - masterKeyEncryptedWithRecoveryKey: string; - masterKeyDecryptionNonce: string; - recoveryKeyEncryptedWithMasterKey: string; - recoveryKeyDecryptionNonce: string; -} -export interface User { - id: number; - email: string; - token: string; - encryptedToken: string; - isTwoFactorEnabled: boolean; - twoFactorSessionID: string; -} -export interface UserVerificationResponse { - id: number; - keyAttributes?: KeyAttributes; - encryptedToken?: string; - token?: string; - twoFactorSessionID: string; - srpM2?: string; -} - -export interface TwoFactorVerificationResponse { - id: number; - keyAttributes: KeyAttributes; - encryptedToken?: string; - token?: string; -} - -export interface TwoFactorSecret { - secretCode: string; - qrCode: string; -} - -export interface TwoFactorRecoveryResponse { - encryptedSecret: string; - secretDecryptionNonce: string; -} - -export interface FamilyMember { - email: string; - usage: number; - id: string; - isAdmin: boolean; -} - -export interface FamilyData { - storage: number; - expiry: number; - members: FamilyMember[]; -} - -export interface UserDetails { - email: string; - usage: number; - fileCount: number; - sharedCollectionCount: number; - subscription: Subscription; - familyData?: FamilyData; - storageBonus?: number; -} - -export interface DeleteChallengeResponse { - allowDelete: boolean; - encryptedChallenge: string; -} - -export interface GetRemoteStoreValueResponse { - value: string; -} - -export interface UpdateRemoteStoreValueRequest { - key: string; - value: string; -} - -export interface SRPAttributes { - srpUserID: string; - srpSalt: string; - memLimit: number; - opsLimit: number; - kekSalt: string; - isEmailMFAEnabled: boolean; -} - -export interface GetSRPAttributesResponse { - attributes: SRPAttributes; -} - -export interface SRPSetupAttributes { - srpSalt: string; - srpVerifier: string; - srpUserID: string; - loginSubKey: string; -} - -export interface SetupSRPRequest { - srpUserID: string; - srpSalt: string; - srpVerifier: string; - srpA: string; -} - -export interface SetupSRPResponse { - setupID: string; - srpB: string; -} - -export interface CompleteSRPSetupRequest { - setupID: string; - srpM1: string; -} - -export interface CompleteSRPSetupResponse { - setupID: string; - srpM2: string; -} - -export interface CreateSRPSessionResponse { - sessionID: string; - srpB: string; -} - -export interface GetFeatureFlagResponse { - disableCFUploadProxy?: boolean; -} diff --git a/apps/cast/src/utils/collection/index.ts b/apps/cast/src/utils/collection/index.ts index 08f50bf96..981d3d140 100644 --- a/apps/cast/src/utils/collection/index.ts +++ b/apps/cast/src/utils/collection/index.ts @@ -12,9 +12,7 @@ import { } from 'services/collectionService'; import { EnteFile } from 'types/file'; import { CustomError } from 'utils/error'; -import { User } from 'types/user'; -import { getData, LS_KEYS } from 'utils/storage/localStorage'; -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import { COLLECTION_ROLE, Collection, @@ -38,6 +36,8 @@ import { isArchivedCollection, updateMagicMetadata } from 'utils/magicMetadata'; import bs58 from 'bs58'; import { t } from 'i18next'; import { getAlbumsURL } from '@ente/shared/network/api'; +import { User } from '@ente/shared/user/types'; +import { getData, LS_KEYS } from '@ente/shared/storage/localStorage'; // import { SetCollectionDownloadProgressAttributes } from 'types/gallery'; // import ElectronService from 'services/electron/common'; // import { diff --git a/apps/cast/src/utils/comlink/comlinkWorker.ts b/apps/cast/src/utils/comlink/comlinkWorker.ts index 20b6b7072..f566a3f90 100644 --- a/apps/cast/src/utils/comlink/comlinkWorker.ts +++ b/apps/cast/src/utils/comlink/comlinkWorker.ts @@ -1,6 +1,6 @@ +import { addLocalLog } from '@ente/shared/logging'; import { Remote, wrap } from 'comlink'; // import { WorkerElectronCacheStorageClient } from 'services/workerElectronCache/client'; -import { addLocalLog } from 'utils/logging'; export class ComlinkWorker InstanceType> { public remote: Promise>>; diff --git a/apps/cast/src/utils/crypto/index.ts b/apps/cast/src/utils/crypto/index.ts index ce1fb2fb0..dfae5f78a 100644 --- a/apps/cast/src/utils/crypto/index.ts +++ b/apps/cast/src/utils/crypto/index.ts @@ -2,7 +2,7 @@ import { KeyAttributes, SRPSetupAttributes } from 'types/user'; import { SESSION_KEYS, setKey } from 'utils/storage/sessionStorage'; import { getData, LS_KEYS, setData } from 'utils/storage/localStorage'; import { setRecoveryKey } from 'services/userService'; -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; import isElectron from 'is-electron'; // import safeStorageService from 'services/electron/safeStorage'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; diff --git a/apps/cast/src/utils/file/index.ts b/apps/cast/src/utils/file/index.ts index bf01b921b..9f31b6189 100644 --- a/apps/cast/src/utils/file/index.ts +++ b/apps/cast/src/utils/file/index.ts @@ -11,9 +11,7 @@ import { import { decodeLivePhoto } from 'services/livePhotoService'; import { getFileType } from 'services/typeDetectionService'; import DownloadManager from 'services/downloadManager'; -import { logError } from 'utils/sentry'; -import { User } from 'types/user'; -import { getData, LS_KEYS } from 'utils/storage/localStorage'; +import { logError } from '@ente/shared/sentry'; import { updateFileCreationDateInEXIF } from 'services/upload/exifService'; import { TYPE_JPEG, @@ -30,7 +28,6 @@ import * as ffmpegService from 'services/ffmpeg/ffmpegService'; import { VISIBILITY_STATE } from 'types/magicMetadata'; import { isArchivedFile, updateMagicMetadata } from 'utils/magicMetadata'; -import { addLocalLog, addLogLine } from 'utils/logging'; import { CustomError } from 'utils/error'; import { convertBytesToHumanReadable } from './size'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; @@ -45,6 +42,9 @@ import isElectron from 'is-electron'; import { isPlaybackPossible } from 'utils/photoFrame'; import { FileTypeInfo } from 'types/upload'; import { moveToHiddenCollection } from 'services/collectionService'; +import { getData, LS_KEYS } from '@ente/shared/storage/localStorage'; +import { User } from '@ente/shared/user/types'; +import { addLogLine, addLocalLog } from '@ente/shared/logging'; // import ElectronFSService from 'services/electron/fs'; // import { getFileExportPath, getUniqueFileExportName } from 'utils/export'; diff --git a/apps/cast/src/utils/logging/index.ts b/apps/cast/src/utils/logging/index.ts deleted file mode 100644 index e7b1e79e2..000000000 --- a/apps/cast/src/utils/logging/index.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { ElectronFile } from 'types/upload'; -import { convertBytesToHumanReadable } from 'utils/file/size'; -import { formatDateTimeShort } from 'utils/time/format'; -import { isDEVSentryENV } from 'constants/sentry'; -import isElectron from 'is-electron'; -// import ElectronService from 'services/electron/common'; -import { logError } from 'utils/sentry'; -import { - getData, - LS_KEYS, - removeData, - setData, -} from 'utils/storage/localStorage'; - -export const MAX_LOG_SIZE = 5 * 1024 * 1024; // 5MB -export const MAX_LOG_LINES = 1000; - -export interface Log { - timestamp: number; - logLine: string; -} - -export function addLogLine( - log: string | number | boolean, - ...optionalParams: (string | number | boolean)[] -) { - try { - const completeLog = [log, ...optionalParams].join(' '); - if (isDEVSentryENV()) { - console.log(completeLog); - } - - if (isElectron()) { - // ElectronService.logToDisk(completeLog); - } else { - saveLogLine({ - timestamp: Date.now(), - logLine: completeLog, - }); - } - } catch (e) { - if (e.name === 'QuotaExceededError') { - deleteLogs(); - addLogLine('logs cleared'); - } - logError(e, 'failed to addLogLine', undefined, true); - // ignore - } -} - -export const addLocalLog = (getLog: () => string) => { - if (isDEVSentryENV()) { - console.log(getLog()); - } -}; - -export function getDebugLogs() { - return combineLogLines(getLogs()); -} - -export function getFileNameSize(file: File | ElectronFile) { - return `${file.name}_${convertBytesToHumanReadable(file.size)}`; -} - -export const clearLogsIfLocalStorageLimitExceeded = () => { - try { - const logs = getDebugLogs(); - const logSize = getStringSize(logs); - if (logSize > MAX_LOG_SIZE) { - deleteLogs(); - addLogLine('Logs cleared due to size limit exceeded'); - } else { - try { - addLogLine(`app started`); - } catch (e) { - deleteLogs(); - } - } - addLogLine(`logs size: ${convertBytesToHumanReadable(logSize)}`); - } catch (e) { - logError(e, 'failed to clearLogsIfLocalStorageLimitExceeded'); - } -}; - -function saveLogLine(log: Log) { - const logs = getLogs(); - if (logs.length > MAX_LOG_LINES) { - logs.slice(logs.length - MAX_LOG_LINES); - } - logs.push(log); - setLogs(logs); -} - -function getLogs(): Log[] { - return getData(LS_KEYS.LOGS)?.logs ?? []; -} - -function setLogs(logs: Log[]) { - setData(LS_KEYS.LOGS, { logs }); -} - -function deleteLogs() { - removeData(LS_KEYS.LOGS); -} - -function getStringSize(str: string) { - return new Blob([str]).size; -} - -function formatLog(log: Log) { - return `[${formatDateTimeShort(log.timestamp)}] ${log.logLine}`; -} - -function combineLogLines(logs: Log[]) { - return logs.map(formatLog).join('\n'); -} diff --git a/apps/cast/src/utils/logging/upload/index.ts b/apps/cast/src/utils/logging/upload/index.ts deleted file mode 100644 index 6c420c77b..000000000 --- a/apps/cast/src/utils/logging/upload/index.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { FILE_TYPE } from 'constants/file'; -import { Collection } from 'types/collection'; -import { B64EncryptionResult, LocalFileAttributes } from 'types/crypto'; -import { - MetadataFileAttributes, - S3FileAttributes, - FilePublicMagicMetadata, - FilePublicMagicMetadataProps, -} from 'types/file'; -import { EncryptedMagicMetadata } from 'types/magicMetadata'; - -export interface DataStream { - stream: ReadableStream; - chunkCount: number; -} - -export function isDataStream(object: any): object is DataStream { - return 'stream' in object; -} - -export type Logger = (message: string) => void; - -export interface Metadata { - title: string; - creationTime: number; - modificationTime: number; - latitude: number; - longitude: number; - fileType: FILE_TYPE; - hasStaticThumbnail?: boolean; - hash?: string; - imageHash?: string; - videoHash?: string; - localID?: number; - version?: number; - deviceFolder?: string; -} - -export interface Location { - latitude: number; - longitude: number; -} - -export interface ParsedMetadataJSON { - creationTime: number; - modificationTime: number; - latitude: number; - longitude: number; -} - -export interface MultipartUploadURLs { - objectKey: string; - partURLs: string[]; - completeURL: string; -} - -export interface FileTypeInfo { - fileType: FILE_TYPE; - exactType: string; - mimeType?: string; - imageType?: string; - videoType?: string; -} - -/* - * ElectronFile is a custom interface that is used to represent - * any file on disk as a File-like object in the Electron desktop app. - * - * This was added to support the auto-resuming of failed uploads - * which needed absolute paths to the files which the - * normal File interface does not provide. - */ -export interface ElectronFile { - name: string; - path: string; - size: number; - lastModified: number; - stream: () => Promise>; - blob: () => Promise; - arrayBuffer: () => Promise; -} - -export interface UploadAsset { - isLivePhoto?: boolean; - file?: File | ElectronFile; - livePhotoAssets?: LivePhotoAssets; - isElectron?: boolean; -} -export interface LivePhotoAssets { - image: globalThis.File | ElectronFile; - video: globalThis.File | ElectronFile; -} - -export interface FileWithCollection extends UploadAsset { - localID: number; - collection?: Collection; - collectionID?: number; -} - -export type ParsedMetadataJSONMap = Map; - -export interface UploadURL { - url: string; - objectKey: string; -} - -export interface FileInMemory { - filedata: Uint8Array | DataStream; - thumbnail: Uint8Array; - hasStaticThumbnail: boolean; -} - -export interface FileWithMetadata - extends Omit { - metadata: Metadata; - localID: number; - pubMagicMetadata: FilePublicMagicMetadata; -} - -export interface EncryptedFile { - file: ProcessedFile; - fileKey: B64EncryptionResult; -} -export interface ProcessedFile { - file: LocalFileAttributes; - thumbnail: LocalFileAttributes; - metadata: LocalFileAttributes; - pubMagicMetadata: EncryptedMagicMetadata; - localID: number; -} -export interface BackupedFile { - file: S3FileAttributes; - thumbnail: S3FileAttributes; - metadata: MetadataFileAttributes; - pubMagicMetadata: EncryptedMagicMetadata; -} - -export interface UploadFile extends BackupedFile { - collectionID: number; - encryptedKey: string; - keyDecryptionNonce: string; -} - -export interface ParsedExtractedMetadata { - location: Location; - creationTime: number; - width: number; - height: number; -} - -// This is used to prompt the user the make upload strategy choice -export interface ImportSuggestion { - rootFolderName: string; - hasNestedFolders: boolean; - hasRootLevelFileWithFolder: boolean; -} - -export interface PublicUploadProps { - token: string; - passwordToken: string; - accessedThroughSharedURL: boolean; -} - -export interface ExtractMetadataResult { - metadata: Metadata; - publicMagicMetadata: FilePublicMagicMetadataProps; -} diff --git a/apps/cast/src/utils/logging/upload/ui.ts b/apps/cast/src/utils/logging/upload/ui.ts deleted file mode 100644 index 4283e30a1..000000000 --- a/apps/cast/src/utils/logging/upload/ui.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { UPLOAD_RESULT, UPLOAD_STAGES } from 'constants/upload'; - -export type FileID = number; -export type FileName = string; - -export type PercentageUploaded = number; -export type UploadFileNames = Map; - -export interface UploadCounter { - finished: number; - total: number; -} - -export interface InProgressUpload { - localFileID: FileID; - progress: PercentageUploaded; -} - -export interface FinishedUpload { - localFileID: FileID; - result: UPLOAD_RESULT; -} - -export type InProgressUploads = Map; - -export type FinishedUploads = Map; - -export type SegregatedFinishedUploads = Map; - -export interface ProgressUpdater { - setPercentComplete: React.Dispatch>; - setUploadCounter: React.Dispatch>; - setUploadStage: React.Dispatch>; - setInProgressUploads: React.Dispatch< - React.SetStateAction - >; - setFinishedUploads: React.Dispatch< - React.SetStateAction - >; - setUploadFilenames: React.Dispatch>; - setHasLivePhotos: React.Dispatch>; - setUploadProgressView: React.Dispatch>; -} diff --git a/apps/cast/src/utils/photoFrame/index.ts b/apps/cast/src/utils/photoFrame/index.ts index 168f90f6e..7637898f9 100644 --- a/apps/cast/src/utils/photoFrame/index.ts +++ b/apps/cast/src/utils/photoFrame/index.ts @@ -1,7 +1,7 @@ import { FILE_TYPE } from 'constants/file'; import { EnteFile } from 'types/file'; import { MergedSourceURL } from 'types/gallery'; -import { logError } from 'utils/sentry'; +import { logError } from '@ente/shared/sentry'; const WAIT_FOR_VIDEO_PLAYBACK = 1 * 1000; diff --git a/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx b/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx index 6882a3b82..79d414be9 100644 --- a/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx +++ b/apps/photos/src/components/Collections/CollectionOptions/AlbumCastDialog.tsx @@ -72,9 +72,9 @@ export default function AlbumCastDialog(props: Props) { // ok, they exist. let's give them the good stuff. const payload = JSON.stringify({ - token: getToken(), - targetCollectionId: props.currentCollection.id, - targetCollectionKey: props.currentCollection.key, + castToken: getToken(), + collectionID: props.currentCollection.id, + collectionKey: props.currentCollection.key, }); const encryptedPayload = await boxSeal( diff --git a/packages/shared/network/cast.ts b/packages/shared/network/cast.ts index fe218362e..9082edc2b 100644 --- a/packages/shared/network/cast.ts +++ b/packages/shared/network/cast.ts @@ -3,9 +3,7 @@ import HTTPService from './HTTPService'; import { getEndpoint } from './api'; class CastGateway { - constructor() { - console.log('CastGateway'); - } + constructor() {} public async getCastData(code: string): Promise { let resp;