mirror of
https://github.com/usememos/memos.git
synced 2025-12-18 22:59:24 +08:00
Remove work-related terminology by renaming "workspace" to "instance" across the entire application. This change better reflects that Memos is a self-hosted tool suitable for personal and non-work use cases. Breaking Changes: - API endpoints: /api/v1/workspace/* → /api/v1/instance/* - gRPC service: WorkspaceService → InstanceService - Proto types: WorkspaceSetting → InstanceSetting - Frontend translation keys: workspace-section → instance-section Backend Changes: - Renamed proto definitions and regenerated code - Updated all store layer methods and database drivers - Renamed service implementations and API handlers - Updated cache from workspaceSettingCache to instanceSettingCache Frontend Changes: - Renamed service client: workspaceServiceClient → instanceServiceClient - Updated all React components and state management - Refactored stores: workspace.ts → instance.ts - Updated all 32 locale translation files All tests pass and both backend and frontend build successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
33 lines
1.6 KiB
Go
33 lines
1.6 KiB
Go
package v1
|
|
|
|
var authenticationAllowlistMethods = map[string]bool{
|
|
"/memos.api.v1.InstanceService/GetInstanceProfile": true,
|
|
"/memos.api.v1.InstanceService/GetInstanceSetting": 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.InstanceService/UpdateInstanceSetting": true,
|
|
}
|
|
|
|
// isOnlyForAdminAllowedMethod returns true if the method is allowed to be called only by admin.
|
|
func isOnlyForAdminAllowedMethod(methodName string) bool {
|
|
return allowedMethodsOnlyForAdmin[methodName]
|
|
}
|