Skip to content

Commit

Permalink
automatically get the right download helper link
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Feb 28, 2024
1 parent cbdea1c commit f8b1b1d
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions src/options/imports/components/Import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { MemexLocalBackend } from 'src/pkm-integrations/background/backend'
import { TooltipBox } from '@worldbrain/memex-common/lib/common-ui/components/tooltip-box'
import Checkbox from 'src/common-ui/components/Checkbox'
import { LOCAL_SERVER_ROOT } from 'src/backup-restore/ui/backup-pane/constants'
import { downloadMemexDesktop } from 'src/util/subscriptions/storage'

const localStyles = require('./Import.css')

Expand Down Expand Up @@ -290,6 +291,27 @@ class Import extends React.PureComponent<Props> {
})
}

getSystemArchAndOS = async () => {
let os
let arch
await browser.runtime.getPlatformInfo().then(function (info) {
os = info.os
arch = info.arch
})

if (arch === 'aarch64' || arch === 'arm' || arch === 'arm64') {
arch = 'arm'
}
if (arch === 'x86-64') {
arch = 'x64'
}

return {
arch,
os,
}
}

private async getPathsFromLocalStorage() {
const data = await browser.storage.local.get('PKMSYNCpkmFolders')

Expand Down Expand Up @@ -658,10 +680,11 @@ class Import extends React.PureComponent<Props> {
<PrimaryAction
label={'Download Sync Helper'}
onClick={async (event) => {
window.open(
'https://github.com/WorldBrain/memex-local-sync/releases/latest',
'_blank',
const url = await downloadMemexDesktop(
await this.getSystemArchAndOS(),
)

window.open(url, '_blank')
}}
icon={'inbox'}
size={'medium'}
Expand Down Expand Up @@ -1004,10 +1027,11 @@ class Import extends React.PureComponent<Props> {
<PrimaryAction
label={'Download Sync Helper'}
onClick={async (event) => {
window.open(
'https://github.com/WorldBrain/memex-local-sync/releases/latest',
'_blank',
const url = await downloadMemexDesktop(
await this.getSystemArchAndOS(),
)

window.open(url, '_blank')
}}
icon={'inbox'}
size={'medium'}
Expand Down

0 comments on commit f8b1b1d

Please sign in to comment.