Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@iconscout/react-unicons": "^2.2.5",
"@internxt/css-config": "1.1.1",
"@internxt/lib": "=1.5.1",
"@internxt/sdk": "=1.23.0",
"@internxt/sdk": "=1.25.0",
"@internxt/ui": "=0.1.21",
"@marsidev/react-turnstile": "^1.6.1",
"@phosphor-icons/react": "^2.1.10",
Expand Down
6 changes: 6 additions & 0 deletions src/app/core/factory/sdk/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ describe('SdkFactory', () => {
clientVersion: packageJson.version,
},
expect.any(Object),
{ withCredentials: true },
);
});

Expand All @@ -352,6 +353,7 @@ describe('SdkFactory', () => {
},
},
expect.any(Object),
{ withCredentials: true },
);
});

Expand All @@ -373,6 +375,7 @@ describe('SdkFactory', () => {
},
},
expect.any(Object),
{ withCredentials: true },
);
});

Expand All @@ -396,6 +399,7 @@ describe('SdkFactory', () => {
},
},
expect.any(Object),
{ withCredentials: true },
);
});

Expand All @@ -417,6 +421,7 @@ describe('SdkFactory', () => {
},
},
expect.any(Object),
{ withCredentials: true },
);
});

Expand All @@ -434,6 +439,7 @@ describe('SdkFactory', () => {
customHeaders: undefined,
},
expect.any(Object),
{ withCredentials: true },
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/factory/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class SdkFactory {
turnstileToken: options?.turnstileToken,
});
const apiSecurity = this.getNewApiSecurity(options?.unauthorizedCallback);
return Auth.client(apiUrl, appDetails, apiSecurity);
return Auth.client(apiUrl, appDetails, apiSecurity, { withCredentials: true });
}

public createDesktopAuthClient(options?: { turnstileToken?: string }): Auth {
Expand All @@ -74,7 +74,7 @@ export class SdkFactory {
options?.turnstileToken ? { 'x-internxt-turnstile': options.turnstileToken } : undefined,
);
const apiSecurity = this.getNewApiSecurity();
return Auth.client(apiUrl, appDetails, apiSecurity);
return Auth.client(apiUrl, appDetails, apiSecurity, { withCredentials: true });
}

public createNewStorageClient(): Storage {
Expand Down
12 changes: 9 additions & 3 deletions src/app/drive/services/new-storage.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
CheckDuplicatedFilesResponse,
CheckDuplicatedFoldersResponse,
FetchFolderMetaResponse,
FileStructure,
FetchFolderContentResponse,
FolderAncestor,
FolderMeta,
FolderAncestorWorkspace,
FolderStatsResponse,
} from '@internxt/sdk/dist/drive/storage/types';
Expand Down Expand Up @@ -33,7 +33,11 @@
return storageClient.getFolderAncestorsInWorkspace(workspaceId, itemType, uuid, resourcesToken);
}

export async function getFolderMeta(uuid: string, workspaceId?: string, resourcesToken?: string): Promise<FolderMeta> {
export async function getFolderMeta(
uuid: string,
workspaceId?: string,
resourcesToken?: string,
): Promise<FetchFolderMetaResponse> {
const storageClient = SdkFactory.getNewApiInstance().createNewStorageClient();
return storageClient.getFolderMeta(uuid, workspaceId, resourcesToken);
}
Expand All @@ -56,7 +60,9 @@
folderNamesList: string[],
): Promise<CheckDuplicatedFoldersResponse> {
const storageClient = SdkFactory.getNewApiInstance().createNewStorageClient();
return storageClient.checkDuplicatedFolders({ folderUuid, folderNamesList });
// TODO: remove cast once callers use the SDK's FetchExistentFoldersResponse type

Check warning on line 63 in src/app/drive/services/new-storage.service.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=internxt_drive-web&issues=AaGhCxy9r0FOs6WgICwH&open=AaGhCxy9r0FOs6WgICwH&pullRequest=2265
const response = await storageClient.checkDuplicatedFolders({ folderUuid, folderNamesList });
return response as unknown as CheckDuplicatedFoldersResponse;
}

export function getFolderContentByUuid({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ const isStorageHost = (url: URL) => !url.hostname.includes('internxt') && url.ho

const allowApiCallsFromLocalhost = (page: Page) =>
page.route(isInternxtApi, async (route, request) => {
const corsHeaders = { 'access-control-allow-origin': LOCAL_ORIGIN, 'access-control-allow-headers': '*' };
const corsHeaders = {
'access-control-allow-origin': LOCAL_ORIGIN,
'access-control-allow-credentials': 'true',
'access-control-allow-headers': request.headers()['access-control-request-headers'] ?? '',
'access-control-allow-methods': request.headers()['access-control-request-method'] ?? '',
};
const isPreflight = request.method() === 'OPTIONS';
if (isPreflight) return route.fulfill({ status: 204, headers: corsHeaders });

Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1939,12 +1939,12 @@
resolved "https://registry.yarnpkg.com/@internxt/prettier-config/-/prettier-config-2.0.1.tgz#a25e7a16f62a990aed2bd1804e04140cc8c33e77"
integrity sha512-sCnOMX7GR7BYDJ5OH1RiV/JaOBLE3uhL6QN6tYhMKi7QXK/cnM/77qmDlIEBlhTNIFEMLFljSkc0vZEvf6m2xA==

"@internxt/sdk@=1.23.0":
version "1.23.0"
resolved "https://registry.yarnpkg.com/@internxt/sdk/-/sdk-1.23.0.tgz#ea6ce0f33f551f380f7ab246e220f6f4141d5b44"
integrity sha512-ljgn8oHmu7+pSkDlWktIf26jboqg/c5daA7LTyxbKIyw+b5I3qi2ZtNOVO0F6pJlrVWJHrTI+FG4qjdQGgNmAA==
"@internxt/sdk@=1.25.0":
version "1.25.0"
resolved "https://registry.yarnpkg.com/@internxt/sdk/-/sdk-1.25.0.tgz#3a66d7b8a8b5daa3bc1980c5820e9863933f083a"
integrity sha512-kpbqz7YmqheBBHJgReJ9dr189Qim312JyfhGw1M3D0m6xPLXFgPi8FEViND70+YnAdWC3CRVXrD0hH3JjM+ZrQ==
dependencies:
axios "^1.16.0"
axios "^1.20.0"

"@internxt/ui@=0.1.21":
version "0.1.21"
Expand Down Expand Up @@ -4216,7 +4216,7 @@ available-typed-arrays@^1.0.7:
dependencies:
possible-typed-array-names "^1.0.0"

axios@^1.16.0, axios@^1.20.0:
axios@^1.20.0:
version "1.20.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.20.0.tgz#515513445aa60e71d04b6521ca6210829ccb4786"
integrity sha512-r8aOh8j9cGKpgQAqpzrUHnSIc6a59Y3Xf/cv8sy1DrHCkZHzQGEuoq1tARk6qSyDdtQGSDgpb9kFlruzPvrgwg==
Expand Down
Loading