Skip to content

Commit

Permalink
Merge branch 'actualbudget:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shall0pass authored Feb 9, 2023
2 parents 5e4030b + f75ff99 commit 214f0a3
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/desktop-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actual-app/web",
"version": "23.2.5",
"version": "23.2.9",
"license": "MIT",
"files": [
"build"
Expand Down
9 changes: 8 additions & 1 deletion packages/desktop-client/src/browser-preload.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ function createBackendWorker() {
worker = new BackendWorker();
initSQLBackend(worker);

if (window.SharedArrayBuffer) {
localStorage.removeItem('SharedArrayBufferOverride');
}

worker.postMessage({
type: 'init',
version: ACTUAL_VERSION,
isDev: IS_DEV,
hash: process.env.REACT_APP_BACKEND_WORKER_HASH
hash: process.env.REACT_APP_BACKEND_WORKER_HASH,
isSharedArrayBufferOverrideEnabled: localStorage.getItem(
'SharedArrayBufferOverride'
)
});

if (IS_DEV || IS_PERF_BUILD) {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/browser-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ self.addEventListener('message', e => {
let version = msg.version;
let hash = msg.hash;

if (!self.SharedArrayBuffer) {
if (!self.SharedArrayBuffer && !msg.isSharedArrayBufferOverrideEnabled) {
self.postMessage({
type: 'app-init-failure',
SharedArrayBufferMissing: true
Expand Down
54 changes: 52 additions & 2 deletions packages/desktop-client/src/components/FatalError.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';

import {
View,
Expand All @@ -10,6 +10,7 @@ import {
Link,
Button
} from 'loot-design/src/components/common';
import { Checkbox } from 'loot-design/src/components/forms';
import { colors } from 'loot-design/src/style';

class FatalError extends React.Component {
Expand Down Expand Up @@ -38,7 +39,7 @@ class FatalError extends React.Component {
<a href="https://actualbudget.github.io/docs/Troubleshooting/SharedArrayBuffer">
our troubleshooting documentation
</a>{' '}
for more information.
to learn more. <SharedArrayBufferOverride />
</Text>
);
} else {
Expand Down Expand Up @@ -140,3 +141,52 @@ class FatalError extends React.Component {
}
}
export default FatalError;

function SharedArrayBufferOverride() {
let [expanded, setExpanded] = useState(false);
let [understand, setUnderstand] = useState(false);

return expanded ? (
<>
<P style={{ marginTop: 10 }}>
Actual uses <code>SharedArrayBuffer</code> to allow usage from multiple
tabs at once and to ensure correct behavior when switching files. While
it can run without access to <code>SharedArrayBuffer</code>, you may
encounter data loss or notice multiple budget files being merged with
each other.
</P>
<label
style={{ display: 'flex', alignItems: 'center', marginBottom: 10 }}
>
<Checkbox checked={understand} onChange={setUnderstand} /> I understand
the risks, run Actual in the unsupported fallback mode
</label>
<Button
disabled={!understand}
onClick={() => {
window.localStorage.setItem('SharedArrayBufferOverride', 'true');
window.location.reload();
}}
>
Open Actual
</Button>
</>
) : (
<Link
onClick={() => setExpanded(true)}
style={{
color: `inherit !important`,
marginLeft: 5,
border: 'none !important',
background: 'none !important',
padding: '0 !important',
textDecoration: 'underline !important',
boxShadow: 'none !important',
display: 'inline !important',
font: 'inherit !important'
}}
>
Advanced options
</Link>
);
}
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/settings/Encryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function EncryptionSettings({ prefs, pushModal }) {
</Setting>
) : serverURL ? (
<Setting
button={
primaryAction={
<Button onClick={() => pushModal('create-encryption-key')}>
Enable encryption…
</Button>
Expand All @@ -58,7 +58,7 @@ export default function EncryptionSettings({ prefs, pushModal }) {
</Text>
</Setting>
) : (
<Setting button={<Button disabled>Enable encryption…</Button>}>
<Setting primaryAction={<Button disabled>Enable encryption…</Button>}>
<Text>
<strong>End-to-end encryption</strong> is not available when running
without a server. Budget files are always kept unencrypted locally, and
Expand Down
3 changes: 3 additions & 0 deletions packages/loot-core/src/client/actions/budgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ export function closeBudget() {
dispatch(setAppState({ loadingText: 'Closing...' }));
await send('close-budget');
dispatch(setAppState({ loadingText: null }));
if (localStorage.getItem('SharedArrayBufferOverride')) {
location.reload();
}
}
};
}
Expand Down

0 comments on commit 214f0a3

Please sign in to comment.