mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 13:23:28 +00:00
Fix login in Tauri v2 (#2493)
This commit is contained in:
parent
e7ced995b9
commit
f847b76154
|
@ -4,22 +4,27 @@
|
|||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"path:default",
|
||||
"event:default",
|
||||
"window:default",
|
||||
"app:default",
|
||||
"event:default",
|
||||
"image:default",
|
||||
"resources:default",
|
||||
"menu:default",
|
||||
"path:default",
|
||||
"resources:default",
|
||||
"window:default",
|
||||
"tray:default",
|
||||
"webview:default",
|
||||
"webview:allow-internal-toggle-devtools",
|
||||
"os:allow-os-type",
|
||||
"window:allow-start-dragging",
|
||||
"window:default",
|
||||
"shell:allow-open",
|
||||
"dialog:allow-open",
|
||||
"dialog:allow-save",
|
||||
"dialog:allow-confirm",
|
||||
"os:allow-os-type",
|
||||
"window:allow-close",
|
||||
"window:allow-create",
|
||||
"window:allow-maximize",
|
||||
"window:allow-minimize",
|
||||
"window:allow-toggle-maximize",
|
||||
"dialog:allow-confirm"
|
||||
"window:allow-start-dragging",
|
||||
"webview:allow-internal-toggle-devtools"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import { OperatingSystem, Platform } from '@sd/interface';
|
|||
|
||||
import { commands, events } from './commands';
|
||||
import { env } from './env';
|
||||
import { createUpdater } from './updater';
|
||||
|
||||
const customUriAuthToken = (window as any).__SD_CUSTOM_SERVER_AUTH_TOKEN__ as string | undefined;
|
||||
const customUriServerUrl = (window as any).__SD_CUSTOM_URI_SERVER__ as string[] | undefined;
|
||||
|
@ -86,7 +85,7 @@ export const platform = {
|
|||
userHomeDir: homeDir,
|
||||
auth: {
|
||||
start(url) {
|
||||
open(url);
|
||||
return shellOpen(url);
|
||||
}
|
||||
},
|
||||
...commands,
|
||||
|
|
|
@ -51,9 +51,17 @@ export function login(config: ProviderConfig) {
|
|||
if (data === 'Complete') {
|
||||
config.finish?.(authCleanup);
|
||||
loginCallbacks.forEach((cb) => cb('success'));
|
||||
} else if ('Error' in data) onError(data.Error);
|
||||
else {
|
||||
authCleanup = config.start(data.Start.verification_url_complete);
|
||||
} else if ('Error' in data) {
|
||||
onError(data.Error);
|
||||
} else {
|
||||
Promise.resolve()
|
||||
.then(() => config.start(data.Start.verification_url_complete))
|
||||
.then(
|
||||
(res) => {
|
||||
authCleanup = res;
|
||||
},
|
||||
(e) => onError(e.message)
|
||||
);
|
||||
}
|
||||
},
|
||||
onError(e) {
|
||||
|
|
Loading…
Reference in a new issue