Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
7cc2df92
Commit
7cc2df92
authored
Aug 31, 2025
by
Johnny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix linter
parent
3d1c1977
Changes
33
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
401 additions
and
352 deletions
+401
-352
main.go
bin/memos/main.go
+28
-35
util_test.go
internal/util/util_test.go
+1
-1
parser.go
plugin/cron/parser.go
+2
-0
common_converter.go
plugin/filter/common_converter.go
+6
-2
activity_service.pb.go
proto/gen/api/v1/activity_service.pb.go
+1
-1
attachment_service.pb.go
proto/gen/api/v1/attachment_service.pb.go
+1
-1
auth_service.pb.go
proto/gen/api/v1/auth_service.pb.go
+1
-1
common.pb.go
proto/gen/api/v1/common.pb.go
+1
-1
idp_service.pb.go
proto/gen/api/v1/idp_service.pb.go
+1
-1
inbox_service.pb.go
proto/gen/api/v1/inbox_service.pb.go
+1
-1
markdown_service.pb.go
proto/gen/api/v1/markdown_service.pb.go
+1
-1
memo_service.pb.go
proto/gen/api/v1/memo_service.pb.go
+1
-1
shortcut_service.pb.go
proto/gen/api/v1/shortcut_service.pb.go
+1
-1
user_service.pb.go
proto/gen/api/v1/user_service.pb.go
+1
-1
workspace_service.pb.go
proto/gen/api/v1/workspace_service.pb.go
+1
-1
openapi.yaml
proto/gen/openapi.yaml
+85
-281
activity.pb.go
proto/gen/store/activity.pb.go
+1
-1
attachment.pb.go
proto/gen/store/attachment.pb.go
+1
-1
idp.pb.go
proto/gen/store/idp.pb.go
+1
-1
inbox.pb.go
proto/gen/store/inbox.pb.go
+1
-1
memo.pb.go
proto/gen/store/memo.pb.go
+1
-1
user_setting.pb.go
proto/gen/store/user_setting.pb.go
+1
-1
workspace_setting.pb.go
proto/gen/store/workspace_setting.pb.go
+1
-1
attachment_service.go
server/router/api/v1/attachment_service.go
+2
-1
auth_service_client_info_test.go
server/router/api/v1/auth_service_client_info_test.go
+1
-1
idp_service.go
server/router/api/v1/idp_service.go
+2
-0
user_service.go
server/router/api/v1/user_service.go
+14
-0
workspace_service.go
server/router/api/v1/workspace_service.go
+2
-0
cache_test.go
store/cache/cache_test.go
+10
-10
memo.go
store/memo.go
+2
-1
migrator.go
store/migrator.go
+2
-0
user.go
store/user.go
+2
-1
descriptor.ts
web/src/types/proto/google/protobuf/descriptor.ts
+224
-1
No files found.
bin/memos/main.go
View file @
7cc2df92
...
...
@@ -12,23 +12,17 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/usememos/memos/internal/profile"
"github.com/usem fmt.Println()
fmt.Printf("
Documentation
:
%
s
\
n
", "
https
:
//usememos.com")
fmt
.
Printf
(
"Source code: %s
\n
"
,
"https://github.com/usememos/memos"
)
fmt
.
Println
(
"
\n
Happy note-taking!"
)
/
memos
/
internal
/
profile
"
"
github
.
com
/
usememos
/
memos
/
internal
/
version
"
"
github
.
com
/
usememos
/
memos
/
server
"
"
github
.
com
/
usememos
/
memos
/
store
"
"
github
.
com
/
usememos
/
memos
/
store
/
db
"
)
const
(
greetingBanner
=
`
███╗ ███╗███████╗███╗ ███╗ ██████╗ ███████╗
████╗ ████║██╔════╝████╗ ████║██╔═══██╗██╔════╝
██╔████╔██║█████╗ ██╔████╔██║██║ ██║███████╗
██║╚██╔╝██║██╔══╝ ██║╚██╔╝██║██║ ██║╚════██║
██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║╚██████╔╝███████║
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
`
)
var (
rootCmd = &cobra.Command{
...
...
@@ -146,38 +140,37 @@ func init() {
}
func printGreetings(profile *profile.Profile) {
fmt.Printf("
Memos
%
s
started
successfully
!
\
n
", profile.Version)
if profile.IsDev() {
println
(
"Development mode is enabled"
)
println
(
"DSN: "
,
profile
.
DSN
)
}
fmt
.
Printf
(
`---
Server profile
version: %s
data: %s
addr: %s
port: %d
unix-sock: %s
mode: %s
driver: %s
---
`
,
profile
.
Version
,
profile
.
Data
,
profile
.
Addr
,
profile
.
Port
,
profile
.
UNIXSock
,
profile
.
Mode
,
profile
.
Driver
)
print
(
greetingBanner
)
fmt.Fprintf(os.Stderr, "
Development
mode
is
enabled
\
n
")
if profile.DSN != "" {
fmt.Fprintf(os.Stderr, "
Database
:
%
s
\
n
", profile.DSN)
}
}
// Server information
fmt.Printf("
Data
directory
:
%
s
\
n
", profile.Data)
fmt.Printf("
Database
driver
:
%
s
\
n
", profile.Driver)
fmt.Printf("
Mode
:
%
s
\
n
", profile.Mode)
// Connection information
if len(profile.UNIXSock) == 0 {
if len(profile.Addr) == 0 {
fmt
.
Printf
(
"Version %s has been started on port %d
\n
"
,
profile
.
Version
,
profile
.
Port
)
fmt.Printf("
Server
running
on
port
%
d
\
n
", profile.Port)
fmt.Printf("
Access
your
memos
at
:
http
:
//localhost:%d\n", profile.Port)
}
else
{
fmt
.
Printf
(
"Version %s has been started on address '%s' and port %d
\n
"
,
profile
.
Version
,
profile
.
Addr
,
profile
.
Port
)
fmt
.
Printf
(
"Server running on %s:%d
\n
"
,
profile
.
Addr
,
profile
.
Port
)
fmt
.
Printf
(
"Access your memos at: http://%s:%d
\n
"
,
profile
.
Addr
,
profile
.
Port
)
}
}
else
{
fmt
.
Printf
(
"Version %s has been started on unix socket %s
\n
"
,
profile
.
Version
,
profile
.
UNIXSock
)
}
fmt
.
Printf
(
`---
See more in:
👉Website: %s
👉GitHub: %s
---
`
,
"https://usememos.com"
,
"https://github.com/usememos/memos"
)
fmt
.
Printf
(
"Server running on unix socket: %s
\n
"
,
profile
.
UNIXSock
)
}
fmt
.
Println
()
fmt
.
Printf
(
"� Documentation: %s
\n
"
,
"https://usememos.com"
)
fmt
.
Printf
(
"💻 Source code: %s
\n
"
,
"https://github.com/usememos/memos"
)
fmt
.
Println
(
"
\n
✨ Happy note-taking!"
)
}
func
main
()
{
...
...
internal/util/util_test.go
View file @
7cc2df92
package
util
package
util
//nolint:revive // util is an appropriate package name for utility functions
import
(
"testing"
...
...
plugin/cron/parser.go
View file @
7cc2df92
...
...
@@ -420,6 +420,8 @@ func parseDescriptor(descriptor string, loc *time.Location) (Schedule, error) {
Dow
:
all
(
dow
),
Location
:
loc
,
},
nil
default
:
// Continue to check @every prefix below
}
const
every
=
"@every "
...
...
plugin/filter/common_converter.go
View file @
7cc2df92
...
...
@@ -45,6 +45,8 @@ func (c *CommonSQLConverter) ConvertExprToSQL(ctx *ConvertContext, expr *exprv1.
return
c
.
handleInOperator
(
ctx
,
v
.
CallExpr
)
case
"contains"
:
return
c
.
handleContainsOperator
(
ctx
,
v
.
CallExpr
)
default
:
return
errors
.
Errorf
(
"unsupported call expression function: %s"
,
v
.
CallExpr
.
Function
)
}
}
else
if
v
,
ok
:=
expr
.
ExprKind
.
(
*
exprv1
.
Expr_IdentExpr
);
ok
{
return
c
.
handleIdentifier
(
ctx
,
v
.
IdentExpr
)
...
...
@@ -144,9 +146,9 @@ func (c *CommonSQLConverter) handleComparisonOperator(ctx *ConvertContext, callE
return
c
.
handlePinnedComparison
(
ctx
,
operator
,
value
)
case
"has_task_list"
,
"has_link"
,
"has_code"
,
"has_incomplete_tasks"
:
return
c
.
handleBooleanComparison
(
ctx
,
identifier
,
operator
,
value
)
default
:
return
errors
.
Errorf
(
"unsupported identifier in comparison: %s"
,
identifier
)
}
return
nil
}
func
(
c
*
CommonSQLConverter
)
handleSizeComparison
(
ctx
*
ConvertContext
,
callExpr
*
exprv1
.
Expr_Call
,
sizeCall
*
exprv1
.
Expr_Call
)
error
{
...
...
@@ -567,6 +569,8 @@ func (c *CommonSQLConverter) handleBooleanComparison(ctx *ConvertContext, field,
jsonPath
=
"$.property.hasCode"
case
"has_incomplete_tasks"
:
jsonPath
=
"$.property.hasIncompleteTasks"
default
:
return
errors
.
Errorf
(
"unsupported boolean field: %s"
,
field
)
}
// Special handling for SQLite based on field
...
...
proto/gen/api/v1/activity_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/activity_service.proto
...
...
proto/gen/api/v1/attachment_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/attachment_service.proto
...
...
proto/gen/api/v1/auth_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/auth_service.proto
...
...
proto/gen/api/v1/common.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/common.proto
...
...
proto/gen/api/v1/idp_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/idp_service.proto
...
...
proto/gen/api/v1/inbox_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/inbox_service.proto
...
...
proto/gen/api/v1/markdown_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/markdown_service.proto
...
...
proto/gen/api/v1/memo_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/memo_service.proto
...
...
proto/gen/api/v1/shortcut_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/shortcut_service.proto
...
...
proto/gen/api/v1/user_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/user_service.proto
...
...
proto/gen/api/v1/workspace_service.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: api/v1/workspace_service.proto
...
...
proto/gen/openapi.yaml
View file @
7cc2df92
This diff is collapsed.
Click to expand it.
proto/gen/store/activity.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/activity.proto
...
...
proto/gen/store/attachment.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/attachment.proto
...
...
proto/gen/store/idp.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/idp.proto
...
...
proto/gen/store/inbox.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/inbox.proto
...
...
proto/gen/store/memo.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/memo.proto
...
...
proto/gen/store/user_setting.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/user_setting.proto
...
...
proto/gen/store/workspace_setting.pb.go
View file @
7cc2df92
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.
7
// protoc-gen-go v1.36.
8
// protoc (unknown)
// source: store/workspace_setting.proto
...
...
server/router/api/v1/attachment_service.go
View file @
7cc2df92
...
...
@@ -582,8 +582,9 @@ func replaceFilenameWithPathTemplate(path, filename string) string {
return
fmt
.
Sprintf
(
"%02d"
,
t
.
Second
())
case
"{uuid}"
:
return
util
.
GenUUID
()
}
default
:
return
s
}
})
return
path
}
...
...
server/router/api/v1/auth_service_client_info_test.go
View file @
7cc2df92
...
...
@@ -162,7 +162,7 @@ func TestClientInfoExamples(t *testing.T) {
t
.
Logf
(
"Device Type: %s"
,
clientInfo
.
DeviceType
)
t
.
Logf
(
"Operating System: %s"
,
clientInfo
.
Os
)
t
.
Logf
(
"Browser: %s"
,
clientInfo
.
Browser
)
t
.
Log
f
(
"---"
)
t
.
Log
(
"---"
)
// Ensure all fields are populated
if
clientInfo
.
DeviceType
==
""
{
...
...
server/router/api/v1/idp_service.go
View file @
7cc2df92
...
...
@@ -82,6 +82,8 @@ func (s *APIV1Service) UpdateIdentityProvider(ctx context.Context, request *v1pb
update
.
IdentifierFilter
=
&
request
.
IdentityProvider
.
IdentifierFilter
case
"config"
:
update
.
Config
=
convertIdentityProviderConfigToStore
(
request
.
IdentityProvider
.
Type
,
request
.
IdentityProvider
.
Config
)
default
:
// Ignore unsupported fields
}
}
...
...
server/router/api/v1/user_service.go
View file @
7cc2df92
...
...
@@ -405,6 +405,8 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda
updatedGeneral
.
Theme
=
incomingGeneral
.
Theme
case
"locale"
:
updatedGeneral
.
Locale
=
incomingGeneral
.
Locale
default
:
// Ignore unsupported fields
}
}
...
...
@@ -899,6 +901,8 @@ func (s *APIV1Service) UpdateUserWebhook(ctx context.Context, request *v1pb.Upda
}
case
"display_name"
:
updatedWebhook
.
Title
=
request
.
Webhook
.
DisplayName
default
:
// Ignore unsupported fields
}
}
}
else
{
...
...
@@ -1143,6 +1147,11 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32
Webhooks
:
[]
*
v1pb
.
UserWebhook
{},
},
}
default
:
// Default to general setting
setting
.
Value
=
&
v1pb
.
UserSetting_GeneralSetting_
{
GeneralSetting
:
getDefaultUserGeneralSetting
(),
}
}
return
setting
}
...
...
@@ -1223,6 +1232,11 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32
Webhooks
:
apiWebhooks
,
},
}
default
:
// Default to general setting if unknown key
setting
.
Value
=
&
v1pb
.
UserSetting_GeneralSetting_
{
GeneralSetting
:
getDefaultUserGeneralSetting
(),
}
}
return
setting
...
...
server/router/api/v1/workspace_service.go
View file @
7cc2df92
...
...
@@ -141,6 +141,8 @@ func convertWorkspaceSettingToStore(setting *v1pb.WorkspaceSetting) *storepb.Wor
workspaceSetting
.
Value
=
&
storepb
.
WorkspaceSetting_MemoRelatedSetting
{
MemoRelatedSetting
:
convertWorkspaceMemoRelatedSettingToStore
(
setting
.
GetMemoRelatedSetting
()),
}
default
:
// Keep the default GeneralSetting value
}
return
workspaceSetting
}
...
...
store/cache/cache_test.go
View file @
7cc2df92
...
...
@@ -31,30 +31,30 @@ func TestCacheBasicOperations(t *testing.T) {
// Test Delete
cache
.
Delete
(
ctx
,
"key1"
)
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"key1"
);
ok
{
t
.
Error
f
(
"Key 'key1' should have been deleted"
)
t
.
Error
(
"Key 'key1' should have been deleted"
)
}
// Test automatic expiration
time
.
Sleep
(
150
*
time
.
Millisecond
)
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"key1"
);
ok
{
t
.
Error
f
(
"Key 'key1' should have expired"
)
t
.
Error
(
"Key 'key1' should have expired"
)
}
// key2 should still be valid (200ms TTL)
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"key2"
);
!
ok
{
t
.
Error
f
(
"Key 'key2' should still be valid"
)
t
.
Error
(
"Key 'key2' should still be valid"
)
}
// Wait for key2 to expire
time
.
Sleep
(
100
*
time
.
Millisecond
)
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"key2"
);
ok
{
t
.
Error
f
(
"Key 'key2' should have expired"
)
t
.
Error
(
"Key 'key2' should have expired"
)
}
// Test Clear
cache
.
Set
(
ctx
,
"key3"
,
"value3"
)
cache
.
Clear
(
ctx
)
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"key3"
);
ok
{
t
.
Error
f
(
"Cache should be empty after Clear()"
)
t
.
Error
(
"Cache should be empty after Clear()"
)
}
}
...
...
@@ -98,15 +98,15 @@ func TestCacheEviction(t *testing.T) {
}
if
evictedCount
==
0
{
t
.
Error
f
(
"No keys were evicted despite exceeding max items"
)
t
.
Error
(
"No keys were evicted despite exceeding max items"
)
}
// The newer keys should still be present
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"keyA"
);
!
ok
{
t
.
Error
f
(
"Key 'keyA' should be in the cache"
)
t
.
Error
(
"Key 'keyA' should be in the cache"
)
}
if
_
,
ok
:=
cache
.
Get
(
ctx
,
"keyB"
);
!
ok
{
t
.
Error
f
(
"Key 'keyB' should be in the cache"
)
t
.
Error
(
"Key 'keyB' should be in the cache"
)
}
}
...
...
@@ -193,7 +193,7 @@ func TestEvictionCallback(t *testing.T) {
time
.
Sleep
(
10
*
time
.
Millisecond
)
// Small delay to ensure callback processed
evictedMu
.
Lock
()
if
evicted
[
"key1"
]
!=
"value1"
{
t
.
Error
f
(
"Eviction callback not triggered for manual deletion"
)
t
.
Error
(
"Eviction callback not triggered for manual deletion"
)
}
evictedMu
.
Unlock
()
...
...
@@ -203,7 +203,7 @@ func TestEvictionCallback(t *testing.T) {
// Verify TTL expiration triggered callback
evictedMu
.
Lock
()
if
evicted
[
"key2"
]
!=
"value2"
{
t
.
Error
f
(
"Eviction callback not triggered for TTL expiration"
)
t
.
Error
(
"Eviction callback not triggered for TTL expiration"
)
}
evictedMu
.
Unlock
()
}
store/memo.go
View file @
7cc2df92
...
...
@@ -29,8 +29,9 @@ func (v Visibility) String() string {
return
"PROTECTED"
case
Private
:
return
"PRIVATE"
}
default
:
return
"PRIVATE"
}
}
type
Memo
struct
{
...
...
store/migrator.go
View file @
7cc2df92
...
...
@@ -102,6 +102,8 @@ func (s *Store) Migrate(ctx context.Context) error {
if
err
:=
s
.
seed
(
ctx
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"failed to seed"
)
}
default
:
// For other modes (like dev), no special migration handling needed
}
return
nil
}
...
...
store/user.go
View file @
7cc2df92
...
...
@@ -24,8 +24,9 @@ func (e Role) String() string {
return
"ADMIN"
case
RoleUser
:
return
"USER"
}
default
:
return
"USER"
}
}
const
(
...
...
web/src/types/proto/google/protobuf/descriptor.ts
View file @
7cc2df92
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment