mirror of
https://github.com/usememos/memos.git
synced 2025-12-17 22:28:52 +08:00
- Removed the `nodes` field from the `Memo` interface in `memo_service.ts`. - Updated the `createBaseMemo` function and the `Memo` message functions to reflect the removal of `nodes`. - Cleaned up the serialization and deserialization logic accordingly. chore: remove code-inspector-plugin from Vite configuration - Deleted the `codeInspectorPlugin` from the Vite configuration in `vite.config.mts`. - Simplified the plugins array to include only `react` and `tailwindcss`.
33 lines
1.6 KiB
Go
33 lines
1.6 KiB
Go
package v1
|
|
|
|
var authenticationAllowlistMethods = map[string]bool{
|
|
"/memos.api.v1.WorkspaceService/GetWorkspaceProfile": true,
|
|
"/memos.api.v1.WorkspaceService/GetWorkspaceSetting": true,
|
|
"/memos.api.v1.IdentityProviderService/ListIdentityProviders": true,
|
|
"/memos.api.v1.AuthService/CreateSession": true,
|
|
"/memos.api.v1.AuthService/GetCurrentSession": true,
|
|
"/memos.api.v1.UserService/CreateUser": true,
|
|
"/memos.api.v1.UserService/GetUser": true,
|
|
"/memos.api.v1.UserService/GetUserAvatar": true,
|
|
"/memos.api.v1.UserService/GetUserStats": true,
|
|
"/memos.api.v1.UserService/ListAllUserStats": true,
|
|
"/memos.api.v1.UserService/SearchUsers": true,
|
|
"/memos.api.v1.MemoService/GetMemo": true,
|
|
"/memos.api.v1.MemoService/ListMemos": true,
|
|
"/memos.api.v1.AttachmentService/GetAttachmentBinary": true,
|
|
}
|
|
|
|
// isUnauthorizeAllowedMethod returns whether the method is exempted from authentication.
|
|
func isUnauthorizeAllowedMethod(fullMethodName string) bool {
|
|
return authenticationAllowlistMethods[fullMethodName]
|
|
}
|
|
|
|
var allowedMethodsOnlyForAdmin = map[string]bool{
|
|
"/memos.api.v1.UserService/CreateUser": true,
|
|
"/memos.api.v1.WorkspaceService/UpdateWorkspaceSetting": true,
|
|
}
|
|
|
|
// isOnlyForAdminAllowedMethod returns true if the method is allowed to be called only by admin.
|
|
func isOnlyForAdminAllowedMethod(methodName string) bool {
|
|
return allowedMethodsOnlyForAdmin[methodName]
|
|
}
|