Page MenuHomePhabricator

D3406.id10487.diff
No OneTemporary

D3406.id10487.diff

diff --git a/server/src/creators/report-creator.js b/server/src/creators/report-creator.js
--- a/server/src/creators/report-creator.js
+++ b/server/src/creators/report-creator.js
@@ -27,11 +27,11 @@
import { handleAsyncPromise } from '../responders/handlers';
import { createBotViewer } from '../session/bots';
import type { Viewer } from '../session/viewer';
-import { getAppURLFacts } from '../utils/urls';
+import { getSquadCalURLFacts } from '../utils/urls';
import createIDs from './id-creator';
import createMessages from './message-creator';
-const { baseDomain, basePath } = getAppURLFacts();
+const { baseDomain, basePath } = getSquadCalURLFacts();
const { commbot } = bots;
async function createReport(
diff --git a/server/src/fetchers/upload-fetchers.js b/server/src/fetchers/upload-fetchers.js
--- a/server/src/fetchers/upload-fetchers.js
+++ b/server/src/fetchers/upload-fetchers.js
@@ -5,9 +5,9 @@
import { dbQuery, SQL } from '../database/database';
import type { Viewer } from '../session/viewer';
-import { getAppURLFacts } from '../utils/urls';
+import { getSquadCalURLFacts } from '../utils/urls';
-const { baseDomain, basePath } = getAppURLFacts();
+const { baseDomain, basePath } = getSquadCalURLFacts();
type UploadInfo = {
content: Buffer,
diff --git a/server/src/responders/website-responders.js b/server/src/responders/website-responders.js
--- a/server/src/responders/website-responders.js
+++ b/server/src/responders/website-responders.js
@@ -41,9 +41,9 @@
import { setNewSession } from '../session/cookies';
import { Viewer } from '../session/viewer';
import { streamJSON, waitForStream } from '../utils/json-stream';
-import { getAppURLFacts } from '../utils/urls';
+import { getSquadCalURLFacts } from '../utils/urls';
-const { basePath, baseDomain } = getAppURLFacts();
+const { basePath, baseDomain } = getSquadCalURLFacts();
const { renderToNodeStream } = ReactDOMServer;
const baseURL = basePath.replace(/\/$/, '');
diff --git a/server/src/session/cookies.js b/server/src/session/cookies.js
--- a/server/src/session/cookies.js
+++ b/server/src/session/cookies.js
@@ -32,11 +32,11 @@
import { clearDeviceToken } from '../updaters/device-token-updaters';
import { updateThreadMembers } from '../updaters/thread-updaters';
import { assertSecureRequest } from '../utils/security-utils';
-import { getAppURLFacts } from '../utils/urls';
+import { getSquadCalURLFacts } from '../utils/urls';
import { Viewer } from './viewer';
import type { AnonymousViewerData, UserViewerData } from './viewer';
-const { baseDomain, basePath, https } = getAppURLFacts();
+const { baseDomain, basePath, https } = getSquadCalURLFacts();
function cookieIsExpired(lastUsed: number) {
return lastUsed + cookieLifetime <= Date.now();
diff --git a/server/src/utils/security-utils.js b/server/src/utils/security-utils.js
--- a/server/src/utils/security-utils.js
+++ b/server/src/utils/security-utils.js
@@ -2,9 +2,9 @@
import type { $Request } from 'express';
-import { getAppURLFacts } from './urls';
+import { getSquadCalURLFacts } from './urls';
-const { https } = getAppURLFacts();
+const { https } = getSquadCalURLFacts();
function assertSecureRequest(req: $Request) {
if (https && req.get('X-Forwarded-SSL') !== 'on') {
diff --git a/server/src/utils/urls.js b/server/src/utils/urls.js
--- a/server/src/utils/urls.js
+++ b/server/src/utils/urls.js
@@ -1,7 +1,8 @@
// @flow
-import appURLFacts from '../../facts/app_url';
+import commAppURLFacts from '../../facts/commapp_url';
import landingURLFacts from '../../facts/landing_url';
+import squadCalURLFacts from '../../facts/squadcal_url';
import baseURLFacts from '../../facts/url';
type GlobalURLFacts = {
@@ -12,7 +13,7 @@
return baseURLFacts;
}
-type AppURLFacts = {
+export type AppURLFacts = {
+baseDomain: string,
+basePath: string,
+https: boolean,
@@ -22,12 +23,29 @@
+baseRoutePath: string,
};
-function getAppURLFacts(): AppURLFacts {
- return appURLFacts;
+function getSquadCalURLFacts(): AppURLFacts {
+ return squadCalURLFacts;
+}
+
+function getCommAppURLFacts(): AppURLFacts {
+ return commAppURLFacts;
+}
+
+function getAppURLFactsFromRequestURL(url: string): AppURLFacts {
+ const commURLFacts = getCommAppURLFacts();
+ return url.startsWith(commURLFacts.basePath)
+ ? commURLFacts
+ : getSquadCalURLFacts();
}
function getLandingURLFacts(): LandingURLFacts {
return landingURLFacts;
}
-export { getGlobalURLFacts, getAppURLFacts, getLandingURLFacts };
+export {
+ getGlobalURLFacts,
+ getSquadCalURLFacts,
+ getCommAppURLFacts,
+ getLandingURLFacts,
+ getAppURLFactsFromRequestURL,
+};

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 1:44 PM (22 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611491
Default Alt Text
D3406.id10487.diff (4 KB)

Event Timeline