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
94ce1e53
Commit
94ce1e53
authored
Apr 27, 2026
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(settings): show build commit in version info
parent
e2c60845
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
7 deletions
+54
-7
main.go
cmd/memos/main.go
+1
-0
profile.go
internal/profile/profile.go
+2
-0
instance_service.proto
proto/api/v1/instance_service.proto
+3
-0
instance_service.pb.go
proto/gen/api/v1/instance_service.pb.go
+13
-3
openapi.yaml
proto/gen/openapi.yaml
+3
-0
instance_service.go
server/router/api/v1/instance_service.go
+1
-0
instance_service_test.go
server/router/api/v1/test/instance_service_test.go
+3
-0
test_helper.go
server/router/api/v1/test/test_helper.go
+1
-0
Setting.tsx
web/src/pages/Setting.tsx
+19
-3
instance_service_pb.ts
web/src/types/proto/api/v1/instance_service_pb.ts
+8
-1
No files found.
cmd/memos/main.go
View file @
94ce1e53
...
...
@@ -37,6 +37,7 @@ var (
InstanceURL
:
viper
.
GetString
(
"instance-url"
),
}
instanceProfile
.
Version
=
version
.
GetCurrentVersion
()
instanceProfile
.
Commit
=
version
.
Commit
webhook
.
AllowPrivateIPs
=
viper
.
GetBool
(
"allow-private-webhooks"
)
if
err
:=
instanceProfile
.
Validate
();
err
!=
nil
{
...
...
internal/profile/profile.go
View file @
94ce1e53
...
...
@@ -30,6 +30,8 @@ type Profile struct {
Driver
string
// Version is the current version of server
Version
string
// Commit is the current build commit of server
Commit
string
// InstanceURL is the url of your memos instance.
InstanceURL
string
}
...
...
proto/api/v1/instance_service.proto
View file @
94ce1e53
...
...
@@ -48,6 +48,9 @@ message InstanceProfile {
// The first administrator who set up this instance.
// When null, instance requires initial setup (creating the first admin account).
User
admin
=
7
;
// Commit is the current build commit of instance.
string
commit
=
8
;
}
// Request for instance profile.
...
...
proto/gen/api/v1/instance_service.pb.go
View file @
94ce1e53
...
...
@@ -209,7 +209,9 @@ type InstanceProfile struct {
InstanceUrl
string
`protobuf:"bytes,6,opt,name=instance_url,json=instanceUrl,proto3" json:"instance_url,omitempty"`
// The first administrator who set up this instance.
// When null, instance requires initial setup (creating the first admin account).
Admin
*
User
`protobuf:"bytes,7,opt,name=admin,proto3" json:"admin,omitempty"`
Admin
*
User
`protobuf:"bytes,7,opt,name=admin,proto3" json:"admin,omitempty"`
// Commit is the current build commit of instance.
Commit
string
`protobuf:"bytes,8,opt,name=commit,proto3" json:"commit,omitempty"`
unknownFields
protoimpl
.
UnknownFields
sizeCache
protoimpl
.
SizeCache
}
...
...
@@ -272,6 +274,13 @@ func (x *InstanceProfile) GetAdmin() *User {
return
nil
}
func
(
x
*
InstanceProfile
)
GetCommit
()
string
{
if
x
!=
nil
{
return
x
.
Commit
}
return
""
}
// Request for instance profile.
type
GetInstanceProfileRequest
struct
{
state
protoimpl
.
MessageState
`protogen:"open.v1"`
...
...
@@ -1377,12 +1386,13 @@ var File_api_v1_instance_service_proto protoreflect.FileDescriptor
const
file_api_v1_instance_service_proto_rawDesc
=
""
+
"
\n
"
+
"
\x1d
api/v1/instance_service.proto
\x12\f
memos.api.v1
\x1a\x19
api/v1/user_service.proto
\x1a\x1c
google/api/annotations.proto
\x1a\x17
google/api/client.proto
\x1a\x1f
google/api/field_behavior.proto
\x1a\x19
google/api/resource.proto
\x1a
google/protobuf/field_mask.proto
\x1a\x17
google/type/color.proto
\"\x
8c
\x01\n
"
+
"
\x1d
api/v1/instance_service.proto
\x12\f
memos.api.v1
\x1a\x19
api/v1/user_service.proto
\x1a\x1c
google/api/annotations.proto
\x1a\x17
google/api/client.proto
\x1a\x1f
google/api/field_behavior.proto
\x1a\x19
google/api/resource.proto
\x1a
google/protobuf/field_mask.proto
\x1a\x17
google/type/color.proto
\"\x
a4
\x01\n
"
+
"
\x0f
InstanceProfile
\x12\x18\n
"
+
"
\a
version
\x18\x02
\x01
(
\t
R
\a
version
\x12\x12\n
"
+
"
\x04
demo
\x18\x03
\x01
(
\b
R
\x04
demo
\x12
!
\n
"
+
"
\f
instance_url
\x18\x06
\x01
(
\t
R
\v
instanceUrl
\x12
(
\n
"
+
"
\x05
admin
\x18\a
\x01
(
\v
2
\x12
.memos.api.v1.UserR
\x05
admin
\"\x1b\n
"
+
"
\x05
admin
\x18\a
\x01
(
\v
2
\x12
.memos.api.v1.UserR
\x05
admin
\x12\x16\n
"
+
"
\x06
commit
\x18\b
\x01
(
\t
R
\x06
commit
\"\x1b\n
"
+
"
\x19
GetInstanceProfileRequest
\"\xe6\x19\n
"
+
"
\x0f
InstanceSetting
\x12\x17\n
"
+
"
\x04
name
\x18\x01
\x01
(
\t
B
\x03\xe0
A
\b
R
\x04
name
\x12
W
\n
"
+
...
...
proto/gen/openapi.yaml
View file @
94ce1e53
...
...
@@ -2530,6 +2530,9 @@ components:
description
:
|-
The first administrator who set up this instance.
When null, instance requires initial setup (creating the first admin account).
commit
:
type
:
string
description
:
Commit is the current build commit of instance.
description
:
Instance profile message containing basic instance information.
InstanceSetting
:
type
:
object
...
...
server/router/api/v1/instance_service.go
View file @
94ce1e53
...
...
@@ -30,6 +30,7 @@ func (s *APIV1Service) GetInstanceProfile(ctx context.Context, _ *v1pb.GetInstan
Demo
:
s
.
Profile
.
Demo
,
InstanceUrl
:
s
.
Profile
.
InstanceURL
,
Admin
:
admin
,
// nil when not initialized
Commit
:
s
.
Profile
.
Commit
,
}
return
instanceProfile
,
nil
}
...
...
server/router/api/v1/test/instance_service_test.go
View file @
94ce1e53
...
...
@@ -29,6 +29,7 @@ func TestGetInstanceProfile(t *testing.T) {
// Verify the response contains expected data
require
.
Equal
(
t
,
"test-1.0.0"
,
resp
.
Version
)
require
.
Equal
(
t
,
"test-commit"
,
resp
.
Commit
)
require
.
True
(
t
,
resp
.
Demo
)
require
.
Equal
(
t
,
"http://localhost:8080"
,
resp
.
InstanceUrl
)
...
...
@@ -56,6 +57,7 @@ func TestGetInstanceProfile(t *testing.T) {
// Verify the response contains expected data with initialized flag
require
.
Equal
(
t
,
"test-1.0.0"
,
resp
.
Version
)
require
.
Equal
(
t
,
"test-commit"
,
resp
.
Commit
)
require
.
True
(
t
,
resp
.
Demo
)
require
.
Equal
(
t
,
"http://localhost:8080"
,
resp
.
InstanceUrl
)
...
...
@@ -102,6 +104,7 @@ func TestGetInstanceProfile_Concurrency(t *testing.T) {
case
resp
:=
<-
results
:
require
.
NotNil
(
t
,
resp
)
require
.
Equal
(
t
,
"test-1.0.0"
,
resp
.
Version
)
require
.
Equal
(
t
,
"test-commit"
,
resp
.
Commit
)
require
.
True
(
t
,
resp
.
Demo
)
require
.
Equal
(
t
,
"http://localhost:8080"
,
resp
.
InstanceUrl
)
require
.
NotNil
(
t
,
resp
.
Admin
)
...
...
server/router/api/v1/test/test_helper.go
View file @
94ce1e53
...
...
@@ -32,6 +32,7 @@ func NewTestService(t *testing.T) *TestService {
testProfile
:=
&
profile
.
Profile
{
Demo
:
true
,
Version
:
"test-1.0.0"
,
Commit
:
"test-commit"
,
InstanceURL
:
"http://localhost:8080"
,
Driver
:
"sqlite"
,
DSN
:
":memory:"
,
...
...
web/src/pages/Setting.tsx
View file @
94ce1e53
...
...
@@ -37,6 +37,9 @@ type SettingSection = "my-account" | "preference" | "webhook" | "member" | "syst
const
BASIC_SECTIONS
:
SettingSection
[]
=
[
"my-account"
,
"preference"
,
"webhook"
];
const
ADMIN_SECTIONS
:
SettingSection
[]
=
[
"member"
,
"system"
,
"memo"
,
"tags"
,
"storage"
,
"sso"
,
"ai"
];
const
GITHUB_COMMIT_URL_PREFIX
=
"https://github.com/usememos/memos/commit/"
;
const
isCommitSha
=
(
commit
:
string
)
=>
/^
[
0-9a-f
]{7,40}
$/i
.
test
(
commit
);
const
SECTION_ICON_MAP
:
Record
<
SettingSection
,
LucideIcon
>
=
{
"my-account"
:
UserIcon
,
...
...
@@ -72,6 +75,7 @@ const Setting = () => {
const
{
profile
,
fetchSetting
}
=
useInstance
();
const
[
selectedSection
,
setSelectedSection
]
=
useState
<
SettingSection
>
(
"my-account"
);
const
isHost
=
user
?.
role
===
User_Role
.
ADMIN
;
const
commitUrl
=
isCommitSha
(
profile
.
commit
)
?
`
${
GITHUB_COMMIT_URL_PREFIX
}${
profile
.
commit
}
`
:
""
;
const
settingsSectionList
=
useMemo
(()
=>
{
return
isHost
?
[...
BASIC_SECTIONS
,
...
ADMIN_SECTIONS
]
:
[...
BASIC_SECTIONS
];
...
...
@@ -131,9 +135,21 @@ const Setting = () => {
onClick=
{
()
=>
handleSectionSelectorItemClick
(
item
)
}
/>
))
}
<
span
className=
"px-3 mt-2 opacity-70 text-sm"
>
{
t
(
"setting.version"
)
}
: v
{
profile
.
version
}
</
span
>
<
div
className=
"px-3 mt-2 opacity-70 text-sm leading-5"
>
{
t
(
"setting.version"
)
}
:
{
profile
.
version
}
{
profile
.
commit
&&
(
<
span
className=
"block font-mono break-all"
>
Commit:
{
" "
}
{
commitUrl
?
(
<
a
className=
"underline hover:text-foreground"
href=
{
commitUrl
}
target=
"_blank"
rel=
"noreferrer"
>
{
profile
.
commit
}
</
a
>
)
:
(
profile
.
commit
)
}
</
span
>
)
}
</
div
>
</
div
>
</>
)
}
...
...
web/src/types/proto/api/v1/instance_service_pb.ts
View file @
94ce1e53
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