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
87055904
Unverified
Commit
87055904
authored
Feb 12, 2023
by
boojack
Committed by
GitHub
Feb 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update skipper name (#1080)
parent
a997e1d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
10 deletions
+11
-10
acl.go
server/acl.go
+1
-1
common.go
server/common.go
+3
-3
embed_frontend.go
server/embed_frontend.go
+2
-1
profile.go
server/profile/profile.go
+3
-3
server.go
server/server.go
+2
-2
No files found.
server/acl.go
View file @
87055904
...
@@ -58,7 +58,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
...
@@ -58,7 +58,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
ctx
:=
c
.
Request
()
.
Context
()
ctx
:=
c
.
Request
()
.
Context
()
path
:=
c
.
Path
()
path
:=
c
.
Path
()
if
s
.
D
efaultAuthSkipper
(
c
)
{
if
s
.
d
efaultAuthSkipper
(
c
)
{
return
next
(
c
)
return
next
(
c
)
}
}
...
...
server/common.go
View file @
87055904
...
@@ -18,16 +18,16 @@ func composeResponse(data interface{}) response {
...
@@ -18,16 +18,16 @@ func composeResponse(data interface{}) response {
}
}
}
}
func
D
efaultGetRequestSkipper
(
c
echo
.
Context
)
bool
{
func
d
efaultGetRequestSkipper
(
c
echo
.
Context
)
bool
{
return
c
.
Request
()
.
Method
==
http
.
MethodGet
return
c
.
Request
()
.
Method
==
http
.
MethodGet
}
}
func
D
efaultAPIRequestSkipper
(
c
echo
.
Context
)
bool
{
func
d
efaultAPIRequestSkipper
(
c
echo
.
Context
)
bool
{
path
:=
c
.
Path
()
path
:=
c
.
Path
()
return
common
.
HasPrefixes
(
path
,
"/api"
)
return
common
.
HasPrefixes
(
path
,
"/api"
)
}
}
func
(
server
*
Server
)
D
efaultAuthSkipper
(
c
echo
.
Context
)
bool
{
func
(
server
*
Server
)
d
efaultAuthSkipper
(
c
echo
.
Context
)
bool
{
ctx
:=
c
.
Request
()
.
Context
()
ctx
:=
c
.
Request
()
.
Context
()
path
:=
c
.
Path
()
path
:=
c
.
Path
()
...
...
server/embed_frontend.go
View file @
87055904
...
@@ -25,7 +25,7 @@ func embedFrontend(e *echo.Echo) {
...
@@ -25,7 +25,7 @@ func embedFrontend(e *echo.Echo) {
// Use echo static middleware to serve the built dist folder
// Use echo static middleware to serve the built dist folder
// refer: https://github.com/labstack/echo/blob/master/middleware/static.go
// refer: https://github.com/labstack/echo/blob/master/middleware/static.go
e
.
Use
(
middleware
.
StaticWithConfig
(
middleware
.
StaticConfig
{
e
.
Use
(
middleware
.
StaticWithConfig
(
middleware
.
StaticConfig
{
Skipper
:
D
efaultAPIRequestSkipper
,
Skipper
:
d
efaultAPIRequestSkipper
,
HTML5
:
true
,
HTML5
:
true
,
Filesystem
:
getFileSystem
(
"dist"
),
Filesystem
:
getFileSystem
(
"dist"
),
}))
}))
...
@@ -38,6 +38,7 @@ func embedFrontend(e *echo.Echo) {
...
@@ -38,6 +38,7 @@ func embedFrontend(e *echo.Echo) {
}
}
})
})
assetsGroup
.
Use
(
middleware
.
StaticWithConfig
(
middleware
.
StaticConfig
{
assetsGroup
.
Use
(
middleware
.
StaticWithConfig
(
middleware
.
StaticConfig
{
Skipper
:
defaultAPIRequestSkipper
,
HTML5
:
true
,
HTML5
:
true
,
Filesystem
:
getFileSystem
(
"dist/assets"
),
Filesystem
:
getFileSystem
(
"dist/assets"
),
}))
}))
...
...
server/profile/profile.go
View file @
87055904
...
@@ -15,11 +15,11 @@ type Profile struct {
...
@@ -15,11 +15,11 @@ type Profile struct {
// Mode can be "prod" or "dev"
// Mode can be "prod" or "dev"
Mode
string
`json:"mode"`
Mode
string
`json:"mode"`
// Port is the binding port for server
// Port is the binding port for server
Port
int
`json:"
port
"`
Port
int
`json:"
-
"`
// Data is the data directory
// Data is the data directory
Data
string
`json:"
data
"`
Data
string
`json:"
-
"`
// DSN points to where Memos stores its own data
// DSN points to where Memos stores its own data
DSN
string
`json:"
dsn
"`
DSN
string
`json:"
-
"`
// Version is the current version of server
// Version is the current version of server
Version
string
`json:"version"`
Version
string
`json:"version"`
}
}
...
...
server/server.go
View file @
87055904
...
@@ -58,14 +58,14 @@ func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
...
@@ -58,14 +58,14 @@ func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
e
.
Use
(
middleware
.
Gzip
())
e
.
Use
(
middleware
.
Gzip
())
e
.
Use
(
middleware
.
CSRFWithConfig
(
middleware
.
CSRFConfig
{
e
.
Use
(
middleware
.
CSRFWithConfig
(
middleware
.
CSRFConfig
{
Skipper
:
s
.
D
efaultAuthSkipper
,
Skipper
:
s
.
d
efaultAuthSkipper
,
TokenLookup
:
"cookie:_csrf"
,
TokenLookup
:
"cookie:_csrf"
,
}))
}))
e
.
Use
(
middleware
.
CORS
())
e
.
Use
(
middleware
.
CORS
())
e
.
Use
(
middleware
.
SecureWithConfig
(
middleware
.
SecureConfig
{
e
.
Use
(
middleware
.
SecureWithConfig
(
middleware
.
SecureConfig
{
Skipper
:
D
efaultGetRequestSkipper
,
Skipper
:
d
efaultGetRequestSkipper
,
XSSProtection
:
"1; mode=block"
,
XSSProtection
:
"1; mode=block"
,
ContentTypeNosniff
:
"nosniff"
,
ContentTypeNosniff
:
"nosniff"
,
XFrameOptions
:
"SAMEORIGIN"
,
XFrameOptions
:
"SAMEORIGIN"
,
...
...
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