Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3096075
D7188.id24182.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7188.id24182.diff
View Options
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -20,6 +20,7 @@
parsePendingThreadID,
createPendingThread,
} from 'lib/shared/thread-utils.js';
+import { isStaff } from 'lib/shared/user-utils.js';
import { defaultWebEnabledApps } from 'lib/types/enabled-apps.js';
import { defaultCalendarFilters } from 'lib/types/filter-types.js';
import { defaultNumberPerThread } from 'lib/types/message-types.js';
@@ -27,6 +28,7 @@
import { defaultConnectionInfo } from 'lib/types/socket-types.js';
import { threadPermissions, threadTypes } from 'lib/types/thread-types.js';
import { currentDateInTimeZone } from 'lib/utils/date-utils.js';
+import { isDev } from 'lib/utils/dev-utils.js';
import { ServerError } from 'lib/utils/errors.js';
import { promiseAll } from 'lib/utils/promises.js';
import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js';
@@ -46,6 +48,7 @@
import { Viewer } from '../session/viewer.js';
import { streamJSON, waitForStream } from '../utils/json-stream.js';
import { getAppURLFactsFromRequestURL } from '../utils/urls.js';
+import { isMobileBrowser } from '../utils/validation-utils.js';
const { renderToNodeStream } = ReactDOMServer;
@@ -427,12 +430,18 @@
});
const jsonStream = streamJSON(res, initialReduxState);
+ const userAgent = req.header('user-agent');
+ const isMobileClient = userAgent && isMobileBrowser(userAgent);
+ const canUseSqlite = isDev || isStaff(initialReduxState.currentUserInfo.id);
+ const supportSqlite = canUseSqlite && !isMobileClient;
+
await waitForStream(jsonStream);
res.end(html`
;
var baseURL = "${baseURL}";
var olmFilename = "${olmFilename}";
var sqljsFilename = "${sqljsFilename}";
+ var supportSqlite = "${supportSqlite.toString()}";
</script>
<script src="${jsURL}"></script>
</body>
diff --git a/keyserver/src/utils/validation-utils.js b/keyserver/src/utils/validation-utils.js
--- a/keyserver/src/utils/validation-utils.js
+++ b/keyserver/src/utils/validation-utils.js
@@ -179,9 +179,15 @@
}
}
+const mobileRegex = /\b(android|ip[aho]ne|ipad|mobile)\b/i;
+function isMobileBrowser(userAgent: string) {
+ return mobileRegex.test(userAgent);
+}
+
export {
validateInput,
checkInputValidator,
checkClientSupported,
policiesValidator,
+ isMobileBrowser,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 30, 10:38 AM (2 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2387065
Default Alt Text
D7188.id24182.diff (2 KB)
Attached To
Mode
D7188: [web-db] support SQLite for staff and non-mobile browsers
Attached
Detach File
Event Timeline
Log In to Comment