mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +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:
@@ -79,6 +79,10 @@
|
||||
"type": "Boolean",
|
||||
"desc": "Whether require email verification before accessing restricted resources(not implemented)."
|
||||
},
|
||||
"newAccountShareActionDelay": {
|
||||
"type": "Number",
|
||||
"desc": "Minimum account age in seconds before new accounts can invite members or create share links."
|
||||
},
|
||||
"passwordRequirements": {
|
||||
"type": "Object",
|
||||
"desc": "The password strength requirements when set new password."
|
||||
|
||||
@@ -62,6 +62,11 @@ export const KNOWN_CONFIG_GROUPS = [
|
||||
fields: [
|
||||
'allowSignup',
|
||||
'allowSignupForOauth',
|
||||
{
|
||||
key: 'newAccountShareActionDelay',
|
||||
type: 'Number',
|
||||
desc: 'Minimum account age in seconds before new accounts can invite members or create share links.',
|
||||
},
|
||||
// nested json object
|
||||
{
|
||||
key: 'passwordRequirements',
|
||||
|
||||
@@ -8,7 +8,13 @@ import {
|
||||
setNativeAuthToken,
|
||||
} from './native-token';
|
||||
|
||||
interface SignInResponse {
|
||||
export interface SignInResponse {
|
||||
id?: string;
|
||||
email?: string;
|
||||
name?: string;
|
||||
hasPassword?: boolean | null;
|
||||
avatarUrl?: string | null;
|
||||
emailVerified?: boolean;
|
||||
exchangeCode?: string;
|
||||
redirectUri?: string;
|
||||
}
|
||||
@@ -97,7 +103,8 @@ export const authHandlers = {
|
||||
token,
|
||||
client_nonce: clientNonce,
|
||||
});
|
||||
await exchangeSession(endpoint, await readJson(response));
|
||||
const body = await readJson<SignInResponse>(response);
|
||||
await exchangeSession(endpoint, body);
|
||||
},
|
||||
|
||||
signInOauth: async (
|
||||
@@ -145,7 +152,9 @@ export const authHandlers = {
|
||||
password: credential.password,
|
||||
}),
|
||||
});
|
||||
await exchangeSession(endpoint, await readJson(response));
|
||||
const body = await readJson<SignInResponse>(response);
|
||||
await exchangeSession(endpoint, body);
|
||||
return body;
|
||||
},
|
||||
|
||||
signInOpenAppSignInCode: async (_e, endpoint: string, code: string) => {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
"lit": "^3.2.1",
|
||||
"lodash-es": "^4.17.23",
|
||||
"lottie-react": "^2.4.0",
|
||||
"mermaid": "^11.13.0",
|
||||
"mermaid": "^11.15.0",
|
||||
"mp4-muxer": "^5.2.2",
|
||||
"nanoid": "^5.1.6",
|
||||
"next-themes": "^0.4.4",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -112,7 +112,7 @@ impl SqliteDocStorage {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
updates.sort_by(|a, b| a.timestamp.cmp(&b.timestamp));
|
||||
updates.sort_by_key(|a| a.timestamp);
|
||||
|
||||
let mut segments = Vec::with_capacity(snapshot.as_ref().map(|_| 1).unwrap_or(0) + updates.len());
|
||||
if let Some(record) = snapshot {
|
||||
|
||||
Reference in New Issue
Block a user