mirror of https://github.com/usememos/memos.git
fix: correct typos in comments, error messages, and identifiers (#5704)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bdd3554b89
commit
8f43e8075b
|
|
@ -12,7 +12,7 @@ import (
|
|||
// Configuration options for creating a parser. Most options specify which
|
||||
// fields should be included, while others enable features. If a field is not
|
||||
// included the parser will assume a default value. These options do not change
|
||||
// the order fields are parse in.
|
||||
// the order fields are parsed in.
|
||||
type ParseOption int
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ func (p *IdentityProvider) UserInfo(token string) (*idp.IdentityProviderUserInfo
|
|||
client := &http.Client{}
|
||||
req, err := http.NewRequest(http.MethodGet, p.config.UserInfoUrl, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to new http request")
|
||||
return nil, errors.Wrap(err, "failed to create http request")
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ func (c *Client) PresignGetObject(ctx context.Context, key string) (string, erro
|
|||
opts.Expires = time.Duration(5 * 24 * time.Hour)
|
||||
})
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "failed to presign put object")
|
||||
return "", errors.Wrap(err, "failed to presign get object")
|
||||
}
|
||||
return presignResult.URL, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ service AttachmentService {
|
|||
rpc ListAttachments(ListAttachmentsRequest) returns (ListAttachmentsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/attachments"};
|
||||
}
|
||||
// GetAttachment returns a attachment by name.
|
||||
// GetAttachment returns an attachment by name.
|
||||
rpc GetAttachment(GetAttachmentRequest) returns (Attachment) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=attachments/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// UpdateAttachment updates a attachment.
|
||||
// UpdateAttachment updates an attachment.
|
||||
rpc UpdateAttachment(UpdateAttachmentRequest) returns (Attachment) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{attachment.name=attachments/*}"
|
||||
|
|
@ -38,7 +38,7 @@ service AttachmentService {
|
|||
};
|
||||
option (google.api.method_signature) = "attachment,update_mask";
|
||||
}
|
||||
// DeleteAttachment deletes a attachment by name.
|
||||
// DeleteAttachment deletes an attachment by name.
|
||||
rpc DeleteAttachment(DeleteAttachmentRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=attachments/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ type AttachmentServiceClient interface {
|
|||
CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error)
|
||||
// ListAttachments lists all attachments.
|
||||
ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error)
|
||||
// GetAttachment returns a attachment by name.
|
||||
// GetAttachment returns an attachment by name.
|
||||
GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error)
|
||||
// UpdateAttachment updates a attachment.
|
||||
// UpdateAttachment updates an attachment.
|
||||
UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error)
|
||||
// DeleteAttachment deletes a attachment by name.
|
||||
// DeleteAttachment deletes an attachment by name.
|
||||
DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error)
|
||||
}
|
||||
|
||||
|
|
@ -149,11 +149,11 @@ type AttachmentServiceHandler interface {
|
|||
CreateAttachment(context.Context, *connect.Request[v1.CreateAttachmentRequest]) (*connect.Response[v1.Attachment], error)
|
||||
// ListAttachments lists all attachments.
|
||||
ListAttachments(context.Context, *connect.Request[v1.ListAttachmentsRequest]) (*connect.Response[v1.ListAttachmentsResponse], error)
|
||||
// GetAttachment returns a attachment by name.
|
||||
// GetAttachment returns an attachment by name.
|
||||
GetAttachment(context.Context, *connect.Request[v1.GetAttachmentRequest]) (*connect.Response[v1.Attachment], error)
|
||||
// UpdateAttachment updates a attachment.
|
||||
// UpdateAttachment updates an attachment.
|
||||
UpdateAttachment(context.Context, *connect.Request[v1.UpdateAttachmentRequest]) (*connect.Response[v1.Attachment], error)
|
||||
// DeleteAttachment deletes a attachment by name.
|
||||
// DeleteAttachment deletes an attachment by name.
|
||||
DeleteAttachment(context.Context, *connect.Request[v1.DeleteAttachmentRequest]) (*connect.Response[emptypb.Empty], error)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ type AttachmentServiceClient interface {
|
|||
CreateAttachment(ctx context.Context, in *CreateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error)
|
||||
// ListAttachments lists all attachments.
|
||||
ListAttachments(ctx context.Context, in *ListAttachmentsRequest, opts ...grpc.CallOption) (*ListAttachmentsResponse, error)
|
||||
// GetAttachment returns a attachment by name.
|
||||
// GetAttachment returns an attachment by name.
|
||||
GetAttachment(ctx context.Context, in *GetAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error)
|
||||
// UpdateAttachment updates a attachment.
|
||||
// UpdateAttachment updates an attachment.
|
||||
UpdateAttachment(ctx context.Context, in *UpdateAttachmentRequest, opts ...grpc.CallOption) (*Attachment, error)
|
||||
// DeleteAttachment deletes a attachment by name.
|
||||
// DeleteAttachment deletes an attachment by name.
|
||||
DeleteAttachment(ctx context.Context, in *DeleteAttachmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
|
|
@ -109,11 +109,11 @@ type AttachmentServiceServer interface {
|
|||
CreateAttachment(context.Context, *CreateAttachmentRequest) (*Attachment, error)
|
||||
// ListAttachments lists all attachments.
|
||||
ListAttachments(context.Context, *ListAttachmentsRequest) (*ListAttachmentsResponse, error)
|
||||
// GetAttachment returns a attachment by name.
|
||||
// GetAttachment returns an attachment by name.
|
||||
GetAttachment(context.Context, *GetAttachmentRequest) (*Attachment, error)
|
||||
// UpdateAttachment updates a attachment.
|
||||
// UpdateAttachment updates an attachment.
|
||||
UpdateAttachment(context.Context, *UpdateAttachmentRequest) (*Attachment, error)
|
||||
// DeleteAttachment deletes a attachment by name.
|
||||
// DeleteAttachment deletes an attachment by name.
|
||||
DeleteAttachment(context.Context, *DeleteAttachmentRequest) (*emptypb.Empty, error)
|
||||
mustEmbedUnimplementedAttachmentServiceServer()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ paths:
|
|||
get:
|
||||
tags:
|
||||
- AttachmentService
|
||||
description: GetAttachment returns a attachment by name.
|
||||
description: GetAttachment returns an attachment by name.
|
||||
operationId: AttachmentService_GetAttachment
|
||||
parameters:
|
||||
- name: attachment
|
||||
|
|
@ -183,7 +183,7 @@ paths:
|
|||
delete:
|
||||
tags:
|
||||
- AttachmentService
|
||||
description: DeleteAttachment deletes a attachment by name.
|
||||
description: DeleteAttachment deletes an attachment by name.
|
||||
operationId: AttachmentService_DeleteAttachment
|
||||
parameters:
|
||||
- name: attachment
|
||||
|
|
@ -205,7 +205,7 @@ paths:
|
|||
patch:
|
||||
tags:
|
||||
- AttachmentService
|
||||
description: UpdateAttachment updates a attachment.
|
||||
description: UpdateAttachment updates an attachment.
|
||||
operationId: AttachmentService_UpdateAttachment
|
||||
parameters:
|
||||
- name: attachment
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ func convertAttachmentFromStore(attachment *store.Attachment) *v1pb.Attachment {
|
|||
return attachmentMessage
|
||||
}
|
||||
|
||||
// SaveAttachmentBlob save the blob of attachment based on the storage config.
|
||||
// SaveAttachmentBlob saves the blob of attachment based on the storage config.
|
||||
func SaveAttachmentBlob(ctx context.Context, profile *profile.Profile, stores *store.Store, create *store.Attachment) error {
|
||||
instanceStorageSetting, err := stores.GetInstanceStorageSetting(ctx)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func NewDB(profile *profile.Profile) (store.Driver, error) {
|
|||
driver := DB{profile: profile}
|
||||
driver.config, err = mysql.ParseDSN(dsn)
|
||||
if err != nil {
|
||||
return nil, errors.New("Parse DSN eroor")
|
||||
return nil, errors.New("Parse DSN error")
|
||||
}
|
||||
|
||||
driver.db, err = sql.Open("mysql", dsn)
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ export const AttachmentService: GenService<{
|
|||
output: typeof ListAttachmentsResponseSchema;
|
||||
},
|
||||
/**
|
||||
* GetAttachment returns a attachment by name.
|
||||
* GetAttachment returns an attachment by name.
|
||||
*
|
||||
* @generated from rpc memos.api.v1.AttachmentService.GetAttachment
|
||||
*/
|
||||
|
|
@ -298,7 +298,7 @@ export const AttachmentService: GenService<{
|
|||
output: typeof AttachmentSchema;
|
||||
},
|
||||
/**
|
||||
* UpdateAttachment updates a attachment.
|
||||
* UpdateAttachment updates an attachment.
|
||||
*
|
||||
* @generated from rpc memos.api.v1.AttachmentService.UpdateAttachment
|
||||
*/
|
||||
|
|
@ -308,7 +308,7 @@ export const AttachmentService: GenService<{
|
|||
output: typeof AttachmentSchema;
|
||||
},
|
||||
/**
|
||||
* DeleteAttachment deletes a attachment by name.
|
||||
* DeleteAttachment deletes an attachment by name.
|
||||
*
|
||||
* @generated from rpc memos.api.v1.AttachmentService.DeleteAttachment
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export const useTranslate = (): TypedT => {
|
|||
return t;
|
||||
};
|
||||
|
||||
export const isValidateLocale = (locale: string | undefined | null): boolean => {
|
||||
export const isValidLocale = (locale: string | undefined | null): boolean => {
|
||||
if (!locale) return false;
|
||||
return locales.includes(locale);
|
||||
};
|
||||
|
|
@ -77,7 +77,7 @@ export const isValidateLocale = (locale: string | undefined | null): boolean =>
|
|||
// 3. Browser language preference
|
||||
export const getLocaleWithFallback = (userLocale?: string): Locale => {
|
||||
// Priority 1: User setting (if logged in and valid)
|
||||
if (userLocale && isValidateLocale(userLocale)) {
|
||||
if (userLocale && isValidLocale(userLocale)) {
|
||||
return userLocale as Locale;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ export const getLocaleWithFallback = (userLocale?: string): Locale => {
|
|||
|
||||
// Applies and persists a locale setting
|
||||
export const loadLocale = (locale: string): Locale => {
|
||||
const validLocale = isValidateLocale(locale) ? (locale as Locale) : findNearestMatchedLanguage(navigator.language);
|
||||
const validLocale = isValidLocale(locale) ? (locale as Locale) : findNearestMatchedLanguage(navigator.language);
|
||||
setStoredLocale(validLocale);
|
||||
i18n.changeLanguage(validLocale);
|
||||
return validLocale;
|
||||
|
|
|
|||
Loading…
Reference in New Issue