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
b8a7df21
Commit
b8a7df21
authored
Sep 09, 2022
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: release `v0.4.3`
parent
d1a43480
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
9 deletions
+16
-9
version.go
common/version.go
+8
-2
acl.go
server/acl.go
+2
-2
auth.go
server/auth.go
+2
-2
system.go
server/system.go
+2
-1
db.go
store/db/db.go
+1
-1
package.json
web/package.json
+1
-1
No files found.
common/version.go
View file @
b8a7df21
...
@@ -7,10 +7,10 @@ import (
...
@@ -7,10 +7,10 @@ import (
// Version is the service current released version.
// Version is the service current released version.
// Semantic versioning: https://semver.org/
// Semantic versioning: https://semver.org/
var
Version
=
"0.4.
2
"
var
Version
=
"0.4.
3
"
// DevVersion is the service current development version.
// DevVersion is the service current development version.
var
DevVersion
=
"0.4.
2
"
var
DevVersion
=
"0.4.
3
"
func
GetCurrentVersion
(
mode
string
)
string
{
func
GetCurrentVersion
(
mode
string
)
string
{
if
mode
==
"dev"
{
if
mode
==
"dev"
{
...
@@ -27,6 +27,12 @@ func GetMinorVersion(version string) string {
...
@@ -27,6 +27,12 @@ func GetMinorVersion(version string) string {
return
versionList
[
0
]
+
"."
+
versionList
[
1
]
return
versionList
[
0
]
+
"."
+
versionList
[
1
]
}
}
func
GetSchemaVersion
(
version
string
)
string
{
minorVersion
:=
GetMinorVersion
(
version
)
return
minorVersion
+
".0"
}
// convSemanticVersionToInt converts version string to int.
// convSemanticVersionToInt converts version string to int.
func
convSemanticVersionToInt
(
version
string
)
int
{
func
convSemanticVersionToInt
(
version
string
)
int
{
versionList
:=
strings
.
Split
(
version
,
"."
)
versionList
:=
strings
.
Split
(
version
,
"."
)
...
...
server/acl.go
View file @
b8a7df21
...
@@ -71,7 +71,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
...
@@ -71,7 +71,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
OpenID
:
&
openID
,
OpenID
:
&
openID
,
}
}
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
userFind
)
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
userFind
)
if
err
!=
nil
{
if
err
!=
nil
&&
common
.
ErrorCode
(
err
)
!=
common
.
NotFound
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find user by open_id"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find user by open_id"
)
.
SetInternal
(
err
)
}
}
if
user
!=
nil
{
if
user
!=
nil
{
...
@@ -90,7 +90,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
...
@@ -90,7 +90,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
ID
:
&
userID
,
ID
:
&
userID
,
}
}
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
userFind
)
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
userFind
)
if
err
!=
nil
{
if
err
!=
nil
&&
common
.
ErrorCode
(
err
)
!=
common
.
NotFound
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
fmt
.
Sprintf
(
"Failed to find user by ID: %d"
,
userID
))
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
fmt
.
Sprintf
(
"Failed to find user by ID: %d"
,
userID
))
.
SetInternal
(
err
)
}
}
if
user
!=
nil
{
if
user
!=
nil
{
...
...
server/auth.go
View file @
b8a7df21
...
@@ -24,7 +24,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
...
@@ -24,7 +24,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
Email
:
&
signin
.
Email
,
Email
:
&
signin
.
Email
,
}
}
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
userFind
)
user
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
userFind
)
if
err
!=
nil
{
if
err
!=
nil
&&
common
.
ErrorCode
(
err
)
!=
common
.
NotFound
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
fmt
.
Sprintf
(
"Failed to find user by email %s"
,
signin
.
Email
))
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
fmt
.
Sprintf
(
"Failed to find user by email %s"
,
signin
.
Email
))
.
SetInternal
(
err
)
}
}
if
user
==
nil
{
if
user
==
nil
{
...
@@ -68,7 +68,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
...
@@ -68,7 +68,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
Role
:
&
hostUserType
,
Role
:
&
hostUserType
,
}
}
hostUser
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
&
hostUserFind
)
hostUser
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
&
hostUserFind
)
if
err
!=
nil
{
if
err
!=
nil
&&
common
.
ErrorCode
(
err
)
!=
common
.
NotFound
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find host user"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find host user"
)
.
SetInternal
(
err
)
}
}
if
hostUser
!=
nil
{
if
hostUser
!=
nil
{
...
...
server/system.go
View file @
b8a7df21
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"net/http"
"net/http"
"github.com/usememos/memos/api"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4"
)
)
...
@@ -27,7 +28,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
...
@@ -27,7 +28,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
Role
:
&
hostUserType
,
Role
:
&
hostUserType
,
}
}
hostUser
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
&
hostUserFind
)
hostUser
,
err
:=
s
.
Store
.
FindUser
(
ctx
,
&
hostUserFind
)
if
err
!=
nil
{
if
err
!=
nil
&&
common
.
ErrorCode
(
err
)
!=
common
.
NotFound
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find host user"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to find host user"
)
.
SetInternal
(
err
)
}
}
...
...
store/db/db.go
View file @
b8a7df21
...
@@ -84,7 +84,7 @@ func (db *DB) Open(ctx context.Context) (err error) {
...
@@ -84,7 +84,7 @@ func (db *DB) Open(ctx context.Context) (err error) {
}
}
}
}
if
common
.
IsVersionGreaterThan
(
c
urrentVersion
,
migrationHistory
.
Version
)
{
if
common
.
IsVersionGreaterThan
(
c
ommon
.
GetSchemaVersion
(
currentVersion
)
,
migrationHistory
.
Version
)
{
minorVersionList
:=
getMinorVersionList
()
minorVersionList
:=
getMinorVersionList
()
// backup the raw database file before migration
// backup the raw database file before migration
...
...
web/package.json
View file @
b8a7df21
{
{
"name"
:
"memos"
,
"name"
:
"memos"
,
"version"
:
"0.4.
2
"
,
"version"
:
"0.4.
3
"
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"vite"
,
"dev"
:
"vite"
,
"build"
:
"tsc && vite build"
,
"build"
:
"tsc && vite build"
,
...
...
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