Working Social Login buttons in prod

For google at least.
This commit is contained in:
Arnab Chakraborty
2024-08-20 20:47:10 +03:00
parent 094f626659
commit 6b85ebd4d4
13 changed files with 44 additions and 16 deletions

BIN
Cargo.lock generated
View File

Binary file not shown.

View File

@@ -22,6 +22,7 @@
"@tanstack/react-query": "^4.36.1",
"@tauri-apps/api": "=2.0.0-rc.0",
"@tauri-apps/plugin-dialog": "=2.0.0-rc.0",
"@tauri-apps/plugin-http": "2.0.0-rc.1",
"@tauri-apps/plugin-os": "=2.0.0-rc.0",
"@tauri-apps/plugin-shell": "=2.0.0-rc.0",
"consistent-hash": "^1.2.2",

View File

@@ -41,6 +41,7 @@ tauri-plugin-os = "=2.0.0-rc.0"
tauri-plugin-shell = "=2.0.0-rc.0"
tauri-plugin-updater = "=2.0.0-rc.0"
tauri-plugin-deep-link = "=2.0.0-rc.0"
tauri-plugin-http = "2.0.0-rc.0"
[dependencies.tauri]
features = ["linux-libxdo", "macos-private-api", "native-tls-vendored", "unstable"]

View File

@@ -2,7 +2,9 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"windows": [
"main"
],
"permissions": [
"core:app:default",
"core:event:default",
@@ -25,6 +27,20 @@
"core:window:allow-minimize",
"core:window:allow-toggle-maximize",
"core:window:allow-start-dragging",
"core:webview:allow-internal-toggle-devtools"
"core:webview:allow-internal-toggle-devtools",
{
"identifier": "http:default",
"allow": [
{
"url": "https://**"
},
{
"url": "http://**"
},
{
"url": "http://localhost:9420/"
}
]
}
]
}

View File

@@ -363,6 +363,7 @@ async fn main() -> tauri::Result<()> {
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_http::init())
// TODO: Bring back Tauri Plugin Window State - it was buggy so we removed it.
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(updater::plugin())

View File

@@ -18,6 +18,7 @@ import { RouteTitleContext } from '@sd/interface/hooks/useRouteTitle';
import '@sd/ui/style/style.scss';
import { fetch } from '@tauri-apps/plugin-http';
import SuperTokens from 'supertokens-web-js';
import EmailPassword from 'supertokens-web-js/recipe/emailpassword';
import Session from 'supertokens-web-js/recipe/session';
@@ -58,6 +59,9 @@ SuperTokens.init({
const startupError = (window as any).__SD_ERROR__ as string | undefined;
//Set global fetch to use tauri fetch
globalThis.fetch = fetch;
export default function App() {
useEffect(() => {
// This tells Tauri to show the current window because it's finished loading

View File

@@ -7,6 +7,7 @@ use strum_macros::{Display, EnumIter};
#[repr(i32)]
#[derive(Debug, Clone, Display, Copy, EnumIter, Type, Serialize, Deserialize, Eq, PartialEq)]
#[specta(rename = "core_HardwareModel")]
pub enum HardwareModel {
Other,
MacStudio,

View File

@@ -174,12 +174,14 @@ export default () => {
{/* <FeatureFlagSelector /> */}
<InvalidateDebugPanel />
{/* <TestNotifications /> */}
<Button size="sm" variant="gray" onClick={() => navigate('./debug/cache')}>
Cache Debug
</Button>
<Button size="sm" variant="gray" onClick={() => toggleRenderRects()}>
Toggle DND Rects
</Button>
<div className='flex gap-2'>
<Button size="sm" variant="gray" onClick={() => navigate('./debug/cache')}>
Cache Debug
</Button>
<Button size="sm" variant="gray" onClick={() => toggleRenderRects()}>
Toggle DND Rects
</Button>
</div>
{/* {platform.showDevtools && (
<SettingContainer
@@ -218,7 +220,6 @@ function InvalidateDebugPanel() {
);
}
// function TestNotifications() {
// const coreNotif = useBridgeMutation(['notifications.test']);
// const libraryNotif = useLibraryMutation(['notifications.testLibrary']);

View File

@@ -1,6 +1,6 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { useEffect } from 'react';
import { NavigateFunction, useNavigate } from 'react-router';
import { NavigateFunction, useNavigate } from 'react-router-dom';
import { signInAndUp } from 'supertokens-web-js/recipe/thirdparty';
import { toast } from '@sd/ui';
@@ -34,11 +34,12 @@ async function handleGoogleCallback(navigate: NavigateFunction) {
// this may be a custom error message sent from the API by you.
toast.error(err.message);
} else {
console.error(err);
toast.error('Oops! Something went wrong.');
}
}
console.log('Navigating to settings');
navigate('./settings/client/account');
navigate(-1);
}
export const Component = () => {

View File

@@ -79,7 +79,7 @@ export default (platform: Platform) =>
},
{
path: 'auth',
lazy: () => import('./auth'),
lazy: () => import('./Layout/auth'),
children: []
},
{ path: '*', lazy: () => import('./404') }

View File

@@ -56,7 +56,7 @@ const Tabs = () => {
// This is where Google should redirect the user back after login or error.
// This URL goes on the Google's dashboard as well.
frontendRedirectURI: 'http://localhost:9420/api/auth/callback/google'
frontendRedirectURI: 'spacedrive://-/auth'
});
/*

View File

@@ -231,7 +231,7 @@ export type CursorOrderItem<T> = { order: SortOrder; data: T }
export type DefaultLocations = { desktop: boolean; documents: boolean; downloads: boolean; pictures: boolean; music: boolean; videos: boolean }
export type Device = { pub_id: DevicePubId; name: string; os: DeviceOS; storage_size: bigint; connection_id: string; created_at: string; updated_at: string }
export type Device = { pub_id: DevicePubId; name: string; os: DeviceOS; storage_size: bigint; used_storage: bigint; connection_id: string; created_at: string; updated_at: string; hardware_model: HardwareModel }
export type DeviceDeleteRequest = { access_token: AccessToken; pub_id: DevicePubId }
@@ -505,7 +505,7 @@ export type MediaLocation = { latitude: number; longitude: number; pluscode: Plu
export type Metadata = { album: string | null; album_artist: string | null; artist: string | null; comment: string | null; composer: string | null; copyright: string | null; creation_time: string | null; date: string | null; disc: number | null; encoder: string | null; encoded_by: string | null; filename: string | null; genre: string | null; language: string | null; performer: string | null; publisher: string | null; service_name: string | null; service_provider: string | null; title: string | null; track: number | null; variant_bit_rate: number | null; custom: { [key in string]: string } }
export type MockDevice = { pub_id: DevicePubId; name: string; os: DeviceOS; used_storage: bigint; storage_size: bigint; created_at: string; updated_at: string; device_model: HardwareModel }
export type MockDevice = { pub_id: DevicePubId; name: string; os: DeviceOS; used_storage: bigint; storage_size: bigint; created_at: string; updated_at: string; device_model: core_HardwareModel }
export type NodeConfigP2P = { discovery?: P2PDiscoveryState; port: Port; disabled: boolean; disable_ipv6: boolean; disable_relay: boolean; enable_remote_access: boolean;
/**
@@ -602,7 +602,7 @@ export type P2PDiscoveryState = "Everyone" | "ContactsOnly" | "Disabled"
export type P2PEvent = { type: "PeerChange"; identity: RemoteIdentity; connection: ConnectionMethod; discovery: DiscoveryMethod; metadata: PeerMetadata; addrs: string[] } | { type: "PeerDelete"; identity: RemoteIdentity } | { type: "SpacedropRequest"; id: string; identity: RemoteIdentity; peer_name: string; files: string[] } | { type: "SpacedropProgress"; id: string; percent: number } | { type: "SpacedropTimedOut"; id: string } | { type: "SpacedropRejected"; id: string }
export type PeerMetadata = { name: string; operating_system: OperatingSystem | null; device_model: HardwareModel | null; version: string | null }
export type PeerMetadata = { name: string; operating_system: OperatingSystem | null; device_model: core_HardwareModel | null; version: string | null }
export type PlusCode = string
@@ -702,3 +702,5 @@ export type UpdateThumbnailerPreferences = Record<string, never>
export type VideoProps = { pixel_format: string | null; color_range: string | null; bits_per_channel: number | null; color_space: string | null; color_primaries: string | null; color_transfer: string | null; field_order: string | null; chroma_location: string | null; width: number; height: number; aspect_ratio_num: number | null; aspect_ratio_den: number | null; properties: string[] }
export type Volume = { name: string; mount_points: string[]; total_capacity: string; available_capacity: string; disk_type: DiskType; file_system: string | null; is_root_filesystem: boolean }
export type core_HardwareModel = "Other" | "MacStudio" | "MacBookAir" | "MacBookPro" | "MacBook" | "MacMini" | "MacPro" | "IMac" | "IMacPro" | "IPad" | "IPhone" | "Simulator" | "Android"

BIN
pnpm-lock.yaml generated
View File

Binary file not shown.