Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt: fix cam access by restoring window.isSecureContext #3074

Merged
merged 2 commits into from
Nov 26, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

# 4.46.3
- Fix camera access on linux

# 4.46.2
- Fix Linux blank screen issue related to the local mimetype database

Expand Down
2 changes: 1 addition & 1 deletion backend/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const updateFileURL = "https://bitboxapp.shiftcrypto.io/desktop.json"

var (
// Version of the backend as displayed to the user.
Version = semver.NewSemVer(4, 46, 2)
Version = semver.NewSemVer(4, 46, 3)
)

// UpdateFile is retrieved from the server.
Expand Down
4 changes: 2 additions & 2 deletions frontends/android/BitBoxApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "ch.shiftcrypto.bitboxapp"
minSdkVersion 21
targetSdkVersion 34
versionCode 57
versionName "android-4.46.2"
versionCode 58
versionName "android-4.46.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions frontends/ios/BitBoxApp/Config.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// https://help.apple.com/xcode/#/dev745c5c974

// App version
MARKETING_VERSION = 4.46.2
MARKETING_VERSION = 4.46.3

// Build number, increment this for every separate publication,
// even if the app version is the same.
CURRENT_PROJECT_VERSION = 5
CURRENT_PROJECT_VERSION = 6
4 changes: 2 additions & 2 deletions frontends/qt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ linux:
cp resources/linux/usr/share/icons/hicolor/128x128/apps/bitbox.png build/linux-tmp
mkdir build/tmp-deb/opt/
cp -aR build/linux-tmp build/tmp-deb/opt/bitbox
cd build/linux && fpm --after-install ../../resources/deb-afterinstall.sh -s dir -t deb -n bitbox -v 4.46.2 -C ../tmp-deb/
cd build/linux && fpm --after-install ../../resources/deb-afterinstall.sh -s dir -t rpm -n bitbox -v 4.46.2 -C ../tmp-deb/
cd build/linux && fpm --after-install ../../resources/deb-afterinstall.sh -s dir -t deb -n bitbox -v 4.46.3 -C ../tmp-deb/
cd build/linux && fpm --after-install ../../resources/deb-afterinstall.sh -s dir -t rpm -n bitbox -v 4.46.3 -C ../tmp-deb/
# create AppImage
cd build/linux-tmp && /opt/linuxdeployqt-continuous-x86_64.AppImage BitBox -appimage -unsupported-allow-new-glibc
mv build/linux-tmp/BitBoxApp-*-x86_64.AppImage build/linux/
Expand Down
13 changes: 5 additions & 8 deletions frontends/qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ class RequestInterceptor : public QWebEngineUrlRequestInterceptor {
// We treat the exchange pages specially because we need to allow exchange
// widgets to load in an iframe as well as let them open external links
// in a browser.
bool onExchangePage = currentUrl.contains(QRegularExpression(QString("^%1:/exchange/.*$").arg(scheme)));
bool onBitsurancePage = currentUrl.contains(QRegularExpression(QString("^%1:/bitsurance/.*$").arg(scheme)));
bool onExchangePage = currentUrl.contains(QRegularExpression(QString("^%1:/index\.html\#/exchange/.*$").arg(scheme)));
bool onBitsurancePage = currentUrl.contains(QRegularExpression(QString("^%1:/index\.html\#/bitsurance/.*$").arg(scheme)));
if (onExchangePage || onBitsurancePage) {
if (info.firstPartyUrl().toString() == info.requestUrl().toString()) {
// Ignore requests for certain file types (e.g., .js, .css) Somehow Moonpay loads
Expand All @@ -208,7 +208,7 @@ class RequestInterceptor : public QWebEngineUrlRequestInterceptor {

// All the requests originated in the wallet-connect section are allowed, as they are needed to
// load the Dapp logos and it is not easy to filter out non-images requests.
bool onWCPage = currentUrl.contains(QRegularExpression(QString(R"(^%1:/account/[^\/]+/wallet-connect/.*$)").arg(scheme)));
bool onWCPage = currentUrl.contains(QRegularExpression(QString(R"(^%1:/index\.html\#/account/[^\/]+/wallet-connect/.*$)").arg(scheme)));
if (onWCPage) {
return;
}
Expand Down Expand Up @@ -339,11 +339,8 @@ int main(int argc, char *argv[])
}

QWebEngineUrlScheme bbappScheme(scheme);
bbappScheme.setSyntax(QWebEngineUrlScheme::Syntax::HostAndPort);
bbappScheme.setFlags(
QWebEngineUrlScheme::LocalScheme |
QWebEngineUrlScheme::SecureScheme |
QWebEngineUrlScheme::LocalAccessAllowed);
bbappScheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
bbappScheme.setFlags(QWebEngineUrlScheme::SecureScheme);
QWebEngineUrlScheme::registerScheme(bbappScheme);

view = new WebEngineView();
Expand Down
4 changes: 2 additions & 2 deletions frontends/qt/resources/MacOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<string>APPL</string>

<key>CFBundleVersion</key>
<string>4.46.2</string>
<string>4.46.3</string>

<key>CFBundleShortVersionString</key>
<string>4.46.2</string>
<string>4.46.3</string>

<key>CFBundleSignature</key>
<string>????</string>
Expand Down
2 changes: 1 addition & 1 deletion frontends/qt/setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SetCompressor /SOLID lzma

# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 4.46.2.0
!define VERSION 4.46.3.0
!define COMPANY "Shift Crypto AG"
!define URL https://github.com/BitBoxSwiss/bitbox-wallet-app/releases/
!define BINDIR "build\windows"
Expand Down
4 changes: 2 additions & 2 deletions frontends/web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export const App = () => {
}, [t]);

const maybeRoute = useCallback(() => {
const currentURL = window.location.pathname;
const isIndex = currentURL === '/' || currentURL === '/index.html' || currentURL === '/android_asset/web/index.html' || currentURL.endsWith('/assets/web/index.html');
const currentURL = window.location.hash.replace(/^#/, '');
const isIndex = currentURL === '' || currentURL === '/';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

const inAccounts = currentURL.startsWith('/account/');

// QT and Android start their apps in '/index.html' and '/android_asset/web/index.html' respectively
Expand Down
6 changes: 3 additions & 3 deletions frontends/web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { I18nextProvider } from 'react-i18next';
import { BrowserRouter } from 'react-router-dom';
import { HashRouter } from 'react-router-dom';
import { App } from './app';
import { i18n } from './i18n/i18n';
import './style/index.css';
Expand All @@ -30,9 +30,9 @@ root.render(
<React.StrictMode>
<I18nextProvider i18n={i18n}>
<React.Suspense fallback={null}>
<BrowserRouter>
<HashRouter>
<App />
</BrowserRouter>
</HashRouter>
</React.Suspense>
</I18nextProvider>
</React.StrictMode>
Expand Down