mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 00:38:33 +02:00
refactor(rules): simplify nested block detection by removing @ prefix requirement
Changes the nested block syntax detection from requiring `@`
as the first non-space character on a line to using a line-ending brace heuristic.
The parser now recognizes nested blocks when a line ends with an unquoted `{`,
simplifying the syntax and removing the mandatory `@` prefix while maintaining the same functionality.
This commit is contained in:
@@ -11,22 +11,22 @@ default {
|
||||
|
||||
header X-Test-Header {
|
||||
set header X-Remote-Type public
|
||||
@remote 127.0.0.1 | remote 192.168.0.0/16 {
|
||||
remote 127.0.0.1 | remote 192.168.0.0/16 {
|
||||
set header X-Remote-Type private
|
||||
}
|
||||
}
|
||||
|
||||
path glob(/api/admin/*) {
|
||||
@cookie session-id {
|
||||
cookie session-id {
|
||||
set header X-Session-ID $cookie(session-id)
|
||||
}
|
||||
}
|
||||
|
||||
!remote 192.168.0.0/16 {
|
||||
@!header X-User-Role admin & !header X-User-Role user {
|
||||
!header X-User-Role admin & !header X-User-Role user {
|
||||
error 403 "Access denied"
|
||||
} elif remote 127.0.0.1 {
|
||||
@header X-User-Role staff {
|
||||
header X-User-Role staff {
|
||||
set header X-User-Role staff
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user