mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-06 15:15:58 +00:00
Use old ip checks and fix dev-ui-build script
These checks could be improved to not use javas InetAddress. But for now it should have the same behaviour as before.
This commit is contained in:
parent
0bdfcd531d
commit
7dcb61ef56
@ -42,14 +42,13 @@ object Config {
|
|||||||
case class HttpHeader(enabled: Boolean, headerName: String, headerValue: String)
|
case class HttpHeader(enabled: Boolean, headerName: String, headerValue: String)
|
||||||
case class AllowedIps(enabled: Boolean, ips: Set[String]) {
|
case class AllowedIps(enabled: Boolean, ips: Set[String]) {
|
||||||
|
|
||||||
def containsAddress(inet: IpAddress): Boolean = {
|
def containsAddress(ipa: IpAddress): Boolean = {
|
||||||
val ip = inet.fold(_.toUriString, _.toUriString) //.getHostAddress
|
val inet = ipa.toInetAddress
|
||||||
|
val ip = inet.getHostAddress
|
||||||
lazy val ipParts = ip.split('.')
|
lazy val ipParts = ip.split('.')
|
||||||
|
|
||||||
def checkSingle(pattern: String): Boolean =
|
def checkSingle(pattern: String): Boolean =
|
||||||
pattern == ip || (ip.contains(
|
pattern == ip || (inet.isLoopbackAddress && pattern == "127.0.0.1") || (pattern
|
||||||
"localhost"
|
|
||||||
) && pattern == "127.0.0.1") || (pattern
|
|
||||||
.split('.')
|
.split('.')
|
||||||
.zip(ipParts)
|
.zip(ipParts)
|
||||||
.foldLeft(true) { case (r, (a, b)) =>
|
.foldLeft(true) { case (r, (a, b)) =>
|
||||||
|
@ -41,7 +41,8 @@ object ClientRequestInfo {
|
|||||||
req.headers
|
req.headers
|
||||||
.get[`X-Forwarded-For`]
|
.get[`X-Forwarded-For`]
|
||||||
.flatMap(_.values.head)
|
.flatMap(_.values.head)
|
||||||
.map(ip => ip.fold(_.toUriString, _.toUriString))
|
.map(_.toInetAddress)
|
||||||
|
.flatMap(inet => Option(inet.getHostName).orElse(Option(inet.getHostAddress)))
|
||||||
|
|
||||||
private def xForwardedHost[F[_]](req: Request[F]): Option[String] =
|
private def xForwardedHost[F[_]](req: Request[F]): Option[String] =
|
||||||
req.headers
|
req.headers
|
||||||
|
@ -48,6 +48,7 @@ watch_both() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cd "$wdir/modules/webapp"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
all)
|
all)
|
||||||
compile_js
|
compile_js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user