mirror of
https://github.com/unmojang/drasl.git
synced 2025-09-10 07:40:00 -04:00
Add disabling frontend (#137)
* Add disabling frontend * fixes requested in review * Document EnableWebFrontEnd in configuration.md
This commit is contained in:
parent
cda9c270f9
commit
c16361c6bc
@ -75,6 +75,7 @@ type Config struct {
|
|||||||
Domain string
|
Domain string
|
||||||
EnableBackgroundEffect bool
|
EnableBackgroundEffect bool
|
||||||
EnableFooter bool
|
EnableFooter bool
|
||||||
|
EnableWebFrontEnd bool
|
||||||
FallbackAPIServers []FallbackAPIServer
|
FallbackAPIServers []FallbackAPIServer
|
||||||
ForwardSkins bool
|
ForwardSkins bool
|
||||||
InstanceName string
|
InstanceName string
|
||||||
@ -123,6 +124,7 @@ func DefaultConfig() Config {
|
|||||||
Domain: "",
|
Domain: "",
|
||||||
EnableBackgroundEffect: true,
|
EnableBackgroundEffect: true,
|
||||||
EnableFooter: true,
|
EnableFooter: true,
|
||||||
|
EnableWebFrontEnd: true,
|
||||||
ForwardSkins: true,
|
ForwardSkins: true,
|
||||||
InstanceName: "Drasl",
|
InstanceName: "Drasl",
|
||||||
ListenAddress: "0.0.0.0:25585",
|
ListenAddress: "0.0.0.0:25585",
|
||||||
|
@ -23,6 +23,7 @@ Other available options:
|
|||||||
- `PreMigrationBackups`: Back up the database to `/path/to/StateDirectory/drasl.X.YYYY-mm-ddTHH-MM-SSZ.db` (where `X` is the old database version) before migrating to a new database version. Boolean. Default value: `true`.
|
- `PreMigrationBackups`: Back up the database to `/path/to/StateDirectory/drasl.X.YYYY-mm-ddTHH-MM-SSZ.db` (where `X` is the old database version) before migrating to a new database version. Boolean. Default value: `true`.
|
||||||
- `EnableBackgroundEffect`: Whether to enable the 3D background animation in the web UI. Boolean. Default value: `true`.
|
- `EnableBackgroundEffect`: Whether to enable the 3D background animation in the web UI. Boolean. Default value: `true`.
|
||||||
- `EnableFooter`: Whether to enable the page footer in the web UI. Boolean. Default value: `true`.
|
- `EnableFooter`: Whether to enable the page footer in the web UI. Boolean. Default value: `true`.
|
||||||
|
- `EnableWebFrontEnd`: Whether to enable the web UI. Boolean. Default value: `true`.
|
||||||
- `[RateLimit]`: Rate-limit requests per IP address to limit abuse. Only applies to certain web UI routes, not any Yggdrasil routes. Requests for skins, capes, and web pages are also unaffected. Uses [Echo](https://echo.labstack.com)'s [rate limiter middleware](https://echo.labstack.com/middleware/rate-limiter/).
|
- `[RateLimit]`: Rate-limit requests per IP address to limit abuse. Only applies to certain web UI routes, not any Yggdrasil routes. Requests for skins, capes, and web pages are also unaffected. Uses [Echo](https://echo.labstack.com)'s [rate limiter middleware](https://echo.labstack.com/middleware/rate-limiter/).
|
||||||
- `Enable`: Boolean. Default value: `true`.
|
- `Enable`: Boolean. Default value: `true`.
|
||||||
- `RequestsPerSecond`: Number of requests per second allowed per IP address. Integer. Default value: `5`.
|
- `RequestsPerSecond`: Number of requests per second allowed per IP address. Integer. Default value: `5`.
|
||||||
|
56
main.go
56
main.go
@ -144,30 +144,32 @@ func (app *App) MakeServer() *echo.Echo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Front
|
// Front
|
||||||
t := NewTemplate(app)
|
if app.Config.EnableWebFrontEnd {
|
||||||
e.Renderer = t
|
t := NewTemplate(app)
|
||||||
e.GET("/", FrontRoot(app))
|
e.Renderer = t
|
||||||
e.GET("/web/admin", FrontAdmin(app))
|
e.GET("/", FrontRoot(app))
|
||||||
e.GET("/web/create-player-challenge", FrontCreatePlayerChallenge(app))
|
e.GET("/web/admin", FrontAdmin(app))
|
||||||
e.GET("/web/manifest.webmanifest", FrontWebManifest(app))
|
e.GET("/web/create-player-challenge", FrontCreatePlayerChallenge(app))
|
||||||
e.GET("/web/player/:uuid", FrontPlayer(app))
|
e.GET("/web/manifest.webmanifest", FrontWebManifest(app))
|
||||||
e.GET("/web/register-challenge", FrontRegisterChallenge(app))
|
e.GET("/web/player/:uuid", FrontPlayer(app))
|
||||||
e.GET("/web/registration", FrontRegistration(app))
|
e.GET("/web/register-challenge", FrontRegisterChallenge(app))
|
||||||
frontUser := FrontUser(app)
|
e.GET("/web/registration", FrontRegistration(app))
|
||||||
e.GET("/web/user", frontUser)
|
frontUser := FrontUser(app)
|
||||||
e.GET("/web/user/:uuid", frontUser)
|
e.GET("/web/user", frontUser)
|
||||||
e.POST("/web/admin/delete-invite", FrontDeleteInvite(app))
|
e.GET("/web/user/:uuid", frontUser)
|
||||||
e.POST("/web/admin/new-invite", FrontNewInvite(app))
|
e.POST("/web/admin/delete-invite", FrontDeleteInvite(app))
|
||||||
e.POST("/web/admin/update-users", FrontUpdateUsers(app))
|
e.POST("/web/admin/new-invite", FrontNewInvite(app))
|
||||||
e.POST("/web/create-player", FrontCreatePlayer(app))
|
e.POST("/web/admin/update-users", FrontUpdateUsers(app))
|
||||||
e.POST("/web/delete-player", FrontDeletePlayer(app))
|
e.POST("/web/create-player", FrontCreatePlayer(app))
|
||||||
e.POST("/web/delete-user", FrontDeleteUser(app))
|
e.POST("/web/delete-player", FrontDeletePlayer(app))
|
||||||
e.POST("/web/login", FrontLogin(app))
|
e.POST("/web/delete-user", FrontDeleteUser(app))
|
||||||
e.POST("/web/logout", FrontLogout(app))
|
e.POST("/web/login", FrontLogin(app))
|
||||||
e.POST("/web/register", FrontRegister(app))
|
e.POST("/web/logout", FrontLogout(app))
|
||||||
e.POST("/web/update-player", FrontUpdatePlayer(app))
|
e.POST("/web/register", FrontRegister(app))
|
||||||
e.POST("/web/update-user", FrontUpdateUser(app))
|
e.POST("/web/update-player", FrontUpdatePlayer(app))
|
||||||
e.Static("/web/public", path.Join(app.Config.DataDirectory, "public"))
|
e.POST("/web/update-user", FrontUpdateUser(app))
|
||||||
|
e.Static("/web/public", path.Join(app.Config.DataDirectory, "public"))
|
||||||
|
}
|
||||||
e.Static("/web/texture/cape", path.Join(app.Config.StateDirectory, "cape"))
|
e.Static("/web/texture/cape", path.Join(app.Config.StateDirectory, "cape"))
|
||||||
e.Static("/web/texture/default-cape", path.Join(app.Config.StateDirectory, "default-cape"))
|
e.Static("/web/texture/default-cape", path.Join(app.Config.StateDirectory, "default-cape"))
|
||||||
e.Static("/web/texture/default-skin", path.Join(app.Config.StateDirectory, "default-skin"))
|
e.Static("/web/texture/default-skin", path.Join(app.Config.StateDirectory, "default-skin"))
|
||||||
@ -435,7 +437,11 @@ func setup(config *Config) *App {
|
|||||||
log.Fatal(result.Error)
|
log.Fatal(result.Error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("No users found! Here's an invite URL:", Unwrap(app.InviteURL(&invite)))
|
if app.Config.EnableWebFrontEnd {
|
||||||
|
log.Println("No users found! Here's an invite URL:", Unwrap(app.InviteURL(&invite)))
|
||||||
|
} else {
|
||||||
|
log.Println("No users found! Here's an invite code:", invite.Code)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user