Skip to content

Commit d305dec

Browse files
committed
Only checked if user is on cloudworkstation for ssl
1 parent 07f44b6 commit d305dec

File tree

21 files changed

+52
-33
lines changed

21 files changed

+52
-33
lines changed

common/api-review/firestore-lite.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export class CollectionReference<AppModelType = DocumentData, DbModelType extend
103103
// @public
104104
export function connectFirestoreEmulator(firestore: Firestore, host: string, port: number, options?: {
105105
mockUserToken?: EmulatorMockTokenOptions | string;
106-
ssl?: boolean;
107106
}): void;
108107

109108
// @public

common/api-review/firestore.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ export class CollectionReference<AppModelType = DocumentData, DbModelType extend
109109
// @public
110110
export function connectFirestoreEmulator(firestore: Firestore, host: string, port: number, options?: {
111111
mockUserToken?: EmulatorMockTokenOptions | string;
112-
ssl?: boolean;
113112
}): void;
114113

115114
// @public

common/api-review/functions.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { FirebaseApp } from '@firebase/app';
88
import { FirebaseError } from '@firebase/util';
99

1010
// @public
11-
export function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number, ssl?: boolean): void;
11+
export function connectFunctionsEmulator(functionsInstance: Functions, host: string, port: number): void;
1212

1313
// @public
1414
export interface Functions {

common/api-review/storage.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { Unsubscribe } from '@firebase/util';
1919
// @public
2020
export function connectStorageEmulator(storage: FirebaseStorage, host: string, port: number, options?: {
2121
mockUserToken?: EmulatorMockTokenOptions | string;
22-
ssl?: boolean;
2322
}): void;
2423

2524
// Warning: (ae-forgotten-export) The symbol "StringData" needs to be exported by the entry point index.d.ts

common/api-review/util.api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ export function isBrowserExtension(): boolean;
269269
// @public
270270
export function isCloudflareWorker(): boolean;
271271

272+
// Warning: (ae-missing-release-tag) "isCloudWorkstation" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
273+
//
274+
// @public
275+
export function isCloudWorkstation(host: string): boolean;
276+
272277
// Warning: (ae-missing-release-tag) "isElectron" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
273278
//
274279
// @public

packages/database-compat/src/api/Database.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export class Database implements FirebaseService, Compat<ModularDatabase> {
7272
port: number,
7373
options: {
7474
mockUserToken?: EmulatorMockTokenOptions;
75-
ssl?: boolean;
7675
} = {}
7776
): void {
7877
connectDatabaseEmulator(this._delegate, host, port, options);

packages/database-types/index.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export interface Database {
4747
port: number,
4848
options?: {
4949
mockUserToken?: EmulatorMockTokenOptions | string;
50-
ssl?: boolean;
5150
}
5251
): void;
5352
goOffline(): void;
@@ -64,7 +63,6 @@ export class FirebaseDatabase implements Database {
6463
port: number,
6564
options?: {
6665
mockUserToken?: EmulatorMockTokenOptions | string;
67-
ssl?: boolean;
6866
}
6967
): void;
7068
goOffline(): void;

packages/database/src/api/Database.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import {
2929
createMockUserToken,
3030
deepEqual,
3131
EmulatorMockTokenOptions,
32-
getDefaultEmulatorHostnameAndPort
32+
getDefaultEmulatorHostnameAndPort,
33+
isCloudWorkstation
3334
} from '@firebase/util';
3435

3536
import { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';
@@ -89,9 +90,12 @@ function repoManagerApplyEmulatorSettings(
8990
emulatorOptions: RepoInfoEmulatorOptions,
9091
tokenProvider?: AuthTokenProvider
9192
): void {
93+
const portIndex = hostAndPort.lastIndexOf(':');
94+
const host = hostAndPort.substring(portIndex);
95+
const useSsl = isCloudWorkstation(host);
9296
repo.repoInfo_ = new RepoInfo(
9397
hostAndPort,
94-
/* secure= */ emulatorOptions?.ssl ?? false,
98+
/* secure= */ useSsl,
9599
repo.repoInfo_.namespace,
96100
repo.repoInfo_.webSocketOnly,
97101
repo.repoInfo_.nodeAdmin,
@@ -348,7 +352,6 @@ export function connectDatabaseEmulator(
348352
port: number,
349353
options: {
350354
mockUserToken?: EmulatorMockTokenOptions | string;
351-
ssl?: boolean;
352355
} = {}
353356
): void {
354357
db = getModularInstance(db);

packages/database/src/core/RepoInfo.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { each } from './util/util';
2424

2525
export interface RepoInfoEmulatorOptions {
2626
mockUserToken?: string | EmulatorMockTokenOptions;
27-
ssl?: boolean;
2827
}
2928

3029
/**

packages/firestore/externs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"packages/util/dist/src/compat.d.ts",
3434
"packages/util/dist/src/global.d.ts",
3535
"packages/util/dist/src/obj.d.ts",
36+
"packages/util/dist/src/url.d.ts",
3637
"packages/firestore/src/protos/firestore_bundle_proto.ts",
3738
"packages/firestore/src/protos/firestore_proto_api.ts",
3839
"packages/firestore/src/util/error.ts",

0 commit comments

Comments
 (0)