Skip to content

Commit b170108

Browse files
authored
Merge pull request #1886 from floccusaddon/fix/orion
fix(Orion): Add an exception for Orion's permissions API
2 parents edd169c + 7d1cc34 commit b170108

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

src/lib/adapters/Git.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
SlashError
1616
} from '../../errors/Error'
1717
import Crypto from '../Crypto'
18+
import { isOrion } from '../isOrion'
1819

1920
const LOCK_INTERVAL = 2 * 60 * 1000 // Lock every 2mins while syncing
2021
const LOCK_TIMEOUT = 15 * 60 * 1000 // Override lock 0.25h after last time lock has been set
@@ -71,7 +72,7 @@ export default class GitAdapter extends CachingAdapter {
7172
this.hash = await Crypto.sha256(JSON.stringify(this.server)) + Date.now()
7273
this.dir = '/' + this.hash + '/'
7374

74-
if (Capacitor.getPlatform() === 'web') {
75+
if (Capacitor.getPlatform() === 'web' && !isOrion) {
7576
const browser = (await import('../browser-api')).default
7677
let hasPermissions, error = false
7778
try {

src/lib/adapters/GoogleDrive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '../../errors/Error'
1313
import { OAuth2Client } from '@byteowls/capacitor-oauth2'
1414
import { Capacitor, CapacitorHttp as Http } from '@capacitor/core'
15+
import { isOrion } from '../isOrion'
1516

1617
const OAuthConfig = {
1718
authorizationBaseUrl: 'https://accounts.google.com/o/oauth2/auth',
@@ -198,7 +199,7 @@ export default class GoogleDriveAdapter extends CachingAdapter {
198199
async onSyncStart(needLock = true, forceLock = false) {
199200
Logger.log('onSyncStart: begin')
200201

201-
if (Capacitor.getPlatform() === 'web') {
202+
if (Capacitor.getPlatform() === 'web' && !isOrion) {
202203
const browser = (await import('../browser-api')).default
203204
const origins = ['https://oauth2.googleapis.com/', 'https://www.googleapis.com/']
204205
let hasPermissions, error = false

src/lib/adapters/NextcloudBookmarks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
UnknownFolderUpdateError,
3232
UnknownMoveTargetError, UpdateBookmarkError
3333
} from '../../errors/Error'
34+
import { isOrion } from '../isOrion'
3435

3536
const PAGE_SIZE = 300
3637
const TIMEOUT = 300000
@@ -133,7 +134,7 @@ export default class NextcloudBookmarksAdapter implements Adapter, BulkImportRes
133134
}
134135

135136
async onSyncStart(needLock = true, forceLock = false): Promise<void> {
136-
if (Capacitor.getPlatform() === 'web') {
137+
if (Capacitor.getPlatform() === 'web' && !isOrion) {
137138
const browser = (await import('../browser-api')).default
138139
let hasPermissions, error = false
139140
try {

src/lib/adapters/WebDav.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import { CapacitorHttp as Http } from '@capacitor/core'
1616
import { Capacitor } from '@capacitor/core'
1717
import Html from '../serializers/Html'
18+
import { isOrion } from '../isOrion'
1819

1920
const LOCK_INTERVAL = 2 * 60 * 1000 // Lock every 2mins while syncing
2021
const LOCK_TIMEOUT = 15 * 60 * 1000 // Override lock 0.25h after last time lock has been set
@@ -269,7 +270,7 @@ export default class WebDavAdapter extends CachingAdapter {
269270
Logger.log('onSyncStart: begin')
270271
this.ended = false
271272

272-
if (Capacitor.getPlatform() === 'web') {
273+
if (Capacitor.getPlatform() === 'web' && !isOrion) {
273274
const browser = (await import('../browser-api')).default
274275
let hasPermissions, error = false
275276
try {

src/lib/isOrion.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const isOrion = 'userAgentData' in navigator && JSON.stringify(navigator.userAgentData).includes('Orion')

0 commit comments

Comments
 (0)