mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-07-08 11:25:52 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0ab9162cb5 | |||
d3018998cd | |||
d4553b2e50 | |||
8496d105c0 |
@ -124,7 +124,7 @@
|
||||
password: passwordInput.val(),
|
||||
permission: "admin",
|
||||
}),
|
||||
type: "PUT",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
|
@ -50,6 +50,7 @@ me.arcanis.ffxivbis {
|
||||
#hostname = "127.0.0.1:8000"
|
||||
# enable head requests for GET requests
|
||||
enable-head-requests = yes
|
||||
schemes = ["http"]
|
||||
|
||||
authorization-cache {
|
||||
# maximum amount of cached logins
|
||||
|
@ -14,6 +14,7 @@ import com.typesafe.config.Config
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme
|
||||
|
||||
import scala.io.Source
|
||||
import scala.jdk.CollectionConverters._
|
||||
|
||||
class Swagger(config: Config) extends SwaggerHttpService {
|
||||
|
||||
@ -38,13 +39,15 @@ class Swagger(config: Config) extends SwaggerHttpService {
|
||||
if (config.hasPath("me.arcanis.ffxivbis.web.hostname")) config.getString("me.arcanis.ffxivbis.web.hostname")
|
||||
else s"${config.getString("me.arcanis.ffxivbis.web.host")}:${config.getInt("me.arcanis.ffxivbis.web.port")}"
|
||||
|
||||
override val schemes: List[String] = config.getStringList("me.arcanis.ffxivbis.web.schemes").asScala.toList
|
||||
|
||||
private val basicAuth = new SecurityScheme()
|
||||
.description("basic http auth")
|
||||
.`type`(SecurityScheme.Type.HTTP)
|
||||
.in(SecurityScheme.In.HEADER)
|
||||
.scheme("basic")
|
||||
override val securitySchemes: Map[String, SecurityScheme] = Map("auth" -> basicAuth)
|
||||
override val securitySchemes: Map[String, SecurityScheme] = Map("basic" -> basicAuth)
|
||||
|
||||
override val unwantedDefinitions: Seq[String] =
|
||||
Seq("Function1", "Function1RequestContextFutureRouteResult")
|
||||
Seq("Function1", "Function1RequestContextFutureRouteResult", "SeqLootModel", "SeqPieceModel")
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class BiSEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
|
||||
tags = Array("best in slot"),
|
||||
)
|
||||
def createBiS: Route =
|
||||
@ -140,7 +140,7 @@ class BiSEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("best in slot"),
|
||||
)
|
||||
def getBiS: Route =
|
||||
@ -197,7 +197,7 @@ class BiSEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
|
||||
tags = Array("best in slot"),
|
||||
)
|
||||
def modifyBiS: Route =
|
||||
|
@ -81,7 +81,7 @@ class LootEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("loot"),
|
||||
)
|
||||
def getLoot: Route =
|
||||
@ -137,7 +137,7 @@ class LootEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
|
||||
tags = Array("loot"),
|
||||
)
|
||||
def modifyLoot: Route =
|
||||
@ -202,7 +202,7 @@ class LootEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("loot"),
|
||||
)
|
||||
def suggestLoot: Route =
|
||||
|
@ -73,7 +73,7 @@ class PartyEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("party"),
|
||||
)
|
||||
def getPartyDescription: Route =
|
||||
@ -126,7 +126,7 @@ class PartyEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
|
||||
tags = Array("party"),
|
||||
)
|
||||
def modifyPartyDescription: Route =
|
||||
|
@ -85,7 +85,7 @@ class PlayerEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("party"),
|
||||
)
|
||||
def getParty: Route =
|
||||
@ -146,7 +146,7 @@ class PlayerEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("party"),
|
||||
)
|
||||
def getPartyStats: Route =
|
||||
@ -202,7 +202,7 @@ class PlayerEndpoint(
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("post"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("post"))),
|
||||
tags = Array("party"),
|
||||
)
|
||||
def modifyParty: Route =
|
||||
|
@ -38,7 +38,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
|
||||
def routes: Route = createParty ~ createUser ~ deleteUser ~ getUsers ~ getUsersCurrent
|
||||
|
||||
@PUT
|
||||
@POST
|
||||
@Path("party")
|
||||
@Consumes(value = Array("application/json"))
|
||||
@Operation(
|
||||
@ -76,7 +76,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
def createParty: Route =
|
||||
path("party") {
|
||||
extractExecutionContext { implicit executionContext =>
|
||||
put {
|
||||
post {
|
||||
entity(as[UserModel]) { user =>
|
||||
onSuccess(newPartyId) { partyId =>
|
||||
val admin = user.toUser.copy(partyId = partyId, permission = Permission.admin)
|
||||
@ -126,7 +126,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("admin"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("admin"))),
|
||||
tags = Array("users"),
|
||||
)
|
||||
def createUser: Route =
|
||||
@ -172,7 +172,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("admin"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("admin"))),
|
||||
tags = Array("users"),
|
||||
)
|
||||
def deleteUser: Route =
|
||||
@ -223,7 +223,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("get"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("get"))),
|
||||
tags = Array("users"),
|
||||
)
|
||||
def getUsers: Route =
|
||||
@ -270,7 +270,7 @@ class UserEndpoint(override val storage: ActorRef[Message], override val auth: A
|
||||
content = Array(new Content(schema = new Schema(implementation = classOf[ErrorModel])))
|
||||
),
|
||||
),
|
||||
security = Array(new SecurityRequirement(name = "basic auth", scopes = Array("admin"))),
|
||||
security = Array(new SecurityRequirement(name = "basic", scopes = Array("admin"))),
|
||||
tags = Array("users"),
|
||||
)
|
||||
def getUsersCurrent: Route =
|
||||
|
@ -50,7 +50,7 @@ class UserEndpointTest extends AnyWordSpecLike with Matchers with ScalatestRoute
|
||||
val uri = Uri(s"/party")
|
||||
val entity = UserModel.fromUser(Fixtures.userAdmin).copy(password = Fixtures.userPassword)
|
||||
|
||||
Put(uri, entity) ~> route ~> check {
|
||||
Post(uri, entity) ~> route ~> check {
|
||||
status shouldEqual StatusCodes.OK
|
||||
partyId = responseAs[PartyIdModel].partyId
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
version := "0.13.0"
|
||||
version := "0.13.2"
|
||||
|
Reference in New Issue
Block a user