mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
chore: bump deps (#15059)
#### PR Dependency Tree * **PR #15059** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Configurable minimum account age before new accounts can invite members or create share links (default: 24 hours). * Sign-in now returns and caches user info for improved session handling. * **Bug Fixes** * Queue handling accepts and resolves job IDs with special characters. * Improved clipboard/rich-text caret handling and nested-list paste reliability. * Calendar tests use dynamic current-month dates. * AI search returns explicit "No matching documents" when none found. * Auth session responses are explicitly non-cacheable. * **Chores** * Dependency and toolchain bumps; admin UI config/schema exposes the new account-age setting. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -70,7 +70,7 @@ export function configureDefaultAuthProvider(framework: Framework) {
|
||||
headers['x-captcha-challenge'] = credential.challenge;
|
||||
}
|
||||
|
||||
await fetchService.fetch('/api/auth/sign-in', {
|
||||
const res = await fetchService.fetch('/api/auth/sign-in', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(credential),
|
||||
headers: {
|
||||
@@ -78,6 +78,7 @@ export function configureDefaultAuthProvider(framework: Framework) {
|
||||
...headers,
|
||||
},
|
||||
});
|
||||
return await res.json();
|
||||
},
|
||||
async signInOpenAppSignInCode(code: string) {
|
||||
await fetchService.fetch('/api/auth/open-app/sign-in', {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { createIdentifier } from '@toeverything/infra';
|
||||
|
||||
export interface SignInUserInfo {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
hasPassword: boolean | null;
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
}
|
||||
|
||||
export interface AuthProvider {
|
||||
signInMagicLink(
|
||||
email: string,
|
||||
@@ -19,7 +28,7 @@ export interface AuthProvider {
|
||||
password: string;
|
||||
verifyToken?: string;
|
||||
challenge?: string;
|
||||
}): Promise<void>;
|
||||
}): Promise<SignInUserInfo | void>;
|
||||
|
||||
signInOpenAppSignInCode(code: string): Promise<void>;
|
||||
|
||||
|
||||
@@ -235,7 +235,10 @@ export class AuthService extends Service {
|
||||
}) {
|
||||
track.$.$.auth.signIn({ method: 'password' });
|
||||
try {
|
||||
await this.store.signInPassword(credential);
|
||||
const user = await this.store.signInPassword(credential);
|
||||
if (user) {
|
||||
this.store.setCachedSignInUser(user);
|
||||
}
|
||||
this.session.revalidate();
|
||||
track.$.$.auth.signedIn({ method: 'password' });
|
||||
} catch (e) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Store } from '@toeverything/infra';
|
||||
|
||||
import type { GlobalState, NbstoreService } from '../../storage';
|
||||
import type { AuthSessionInfo } from '../entities/session';
|
||||
import type { AuthProvider } from '../provider/auth';
|
||||
import type { AuthProvider, SignInUserInfo } from '../provider/auth';
|
||||
import type { FetchService } from '../services/fetch';
|
||||
import type { GraphQLService } from '../services/graphql';
|
||||
import type { ServerService } from '../services/server';
|
||||
@@ -57,6 +57,25 @@ export class AuthStore extends Store {
|
||||
this.globalState.set(`${this.serverService.server.id}-auth`, session);
|
||||
}
|
||||
|
||||
setCachedSignInUser(user: SignInUserInfo) {
|
||||
this.setCachedAuthSession({
|
||||
account: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
label: user.name,
|
||||
avatar: user.avatarUrl,
|
||||
info: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
hasPassword: Boolean(user.hasPassword),
|
||||
avatarUrl: user.avatarUrl,
|
||||
emailVerified: user.emailVerified ? 'true' : null,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getClientNonce() {
|
||||
return this.globalState.get<string>('auth-client-nonce');
|
||||
}
|
||||
@@ -67,7 +86,7 @@ export class AuthStore extends Store {
|
||||
|
||||
async fetchSession() {
|
||||
const { user } = await this.fetchService
|
||||
.fetch('/api/auth/session')
|
||||
.fetch('/api/auth/session', { cache: 'no-store' })
|
||||
.then(res => res.json());
|
||||
const authMethods = user
|
||||
? await this.fetchService
|
||||
@@ -109,7 +128,7 @@ export class AuthStore extends Store {
|
||||
verifyToken?: string;
|
||||
challenge?: string;
|
||||
}) {
|
||||
await this.authProvider.signInPassword(credential);
|
||||
return await this.authProvider.signInPassword(credential);
|
||||
}
|
||||
|
||||
async signInOpenAppSignInCode(code: string) {
|
||||
|
||||
Reference in New Issue
Block a user