Skip to content

Commit

Permalink
Implement experimental workaround for Android Server pairing
Browse files Browse the repository at this point in the history
The new android platform introduced in 6.5.0 made the app be served from
the HTTPS context by default. This broke pairing, because requests to
Server are sent via insecure HTTP (we use our own TLS certificate to
secure the communication once pairing is complete) and chrome disallows
"mixed content" requests.

I implemented a preference here that forces the app to load from HTTP,
which "fixes" the issue, but it has some drawbacks:

- Some browser features are disabled when loaded from an insecure
  context. We don't know what these are, exactly.
- iOS uses its own preference for 'scheme', so pairing is presumably
  still broken there.
  • Loading branch information
jthrilly committed Dec 1, 2023
1 parent dd3ceb9 commit 26dde0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget android-versionCode="6374" id="org.codaco.NetworkCanvasInterviewer6" ios-CFBundleIdentifier="org.codaco.networkCanvasInterviewerBusiness" ios-CFBundleVersion="6374" version="6.5.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="6388" id="org.codaco.NetworkCanvasInterviewer6" ios-CFBundleIdentifier="org.codaco.networkCanvasInterviewerBusiness" ios-CFBundleVersion="6388" version="6.5.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Network Canvas Interviewer</name>
<description>
A tool for conducting Network Canvas Interviews.
Expand Down Expand Up @@ -28,6 +28,7 @@
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:largeHeap="true"/>
<application android:usesCleartextTraffic="true"/>
<application android:debuggable="true"/>
</edit-config>
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/supports-screens">
<supports-screens android:anyDensity="false" android:largeScreens="true" android:normalScreens="false" android:requiresSmallestWidthDp="600" android:resizeable="false" android:smallScreens="false" android:xlargeScreens="true"/>
Expand All @@ -37,6 +38,7 @@
</edit-config>
</platform>
<platform name="ios">
<allow-navigation href="*"/>
<allow-navigation href="*"/>
<preference name="WKWebViewOnly" value="true"/>
<preference name="Allow3DTouchLinkPreview" value="false"/>
Expand Down Expand Up @@ -64,6 +66,7 @@
<icon height="1024" src="www/icons/ios/NC-Square-1024.png" width="1024"/>
<splash src="www/icons/ios/Default@2x~universal~anyany.png"/>
</platform>
<preference name="scheme" value="http"/>
<preference name="Orientation" value="landscape"/>
<preference name="target-device" value="tablet"/>
<preference name="DisallowOverscroll" value="true"/>
Expand Down
4 changes: 3 additions & 1 deletion config/nc-dev-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ const devServerContentBase = () => {
};

// Webpack default is 'web'. To get electron working with dev server, use 'electron-renderer'.
const reactBundleTarget = () => (isTargetingElectron ? 'electron-renderer' : 'web');
// const reactBundleTarget = () => (isTargetingElectron ? 'electron-renderer' : 'web');

const reactBundleTarget = () => 'web';

module.exports = {
cleanDevUrlFile,
Expand Down

0 comments on commit 26dde0f

Please sign in to comment.