~jan0sch/smederee
Showing details for patch 4b2124d076730f1756db6df3c18c752d83f7ae9c.
diff -rN -u old-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala new-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala --- old-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/modules/darcs/src/main/scala/de/smederee/darcs/DarcsCommands.scala 2025-03-08 23:21:01.733114217 +0000 @@ -73,8 +73,8 @@ final class DarcsCommands[F[_]: Sync](val darcsBinary: Path) { private val log = LoggerFactory.getLogger(getClass) - /** Clone a darcs repository from one directory into another one. This function is intended to be used for - * server side forking or repositories. + /** Clone a darcs repository from one directory into another one. This function is intended to be used for server side + * forking or repositories. * * @param sourceRepositoryPath * The path of the source repository. @@ -119,8 +119,8 @@ } yield DarcsCommandOutput(process.exitCode, Chain(process.out.text()), Chain(process.err.text())) } - /** Initialize a darcs repository under the given base path with the provided name. This is done by running - * the external darcs binary with the appropriate parameters. + /** Initialize a darcs repository under the given base path with the provided name. This is done by running the + * external darcs binary with the appropriate parameters. * * @param basePath * The base path under which the repository is located. diff -rN -u old-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala new-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala --- old-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala 2025-03-08 23:21:01.733114217 +0000 @@ -30,9 +30,7 @@ val workingDirectory = ResourceSuiteLocalFixture( "working-directory", - Resource.make(IO(Files.createTempDirectory("darcs-cmd-test-").toAbsolutePath()))(path => - IO(deleteDirectory(path)) - ) + Resource.make(IO(Files.createTempDirectory("darcs-cmd-test-").toAbsolutePath()))(path => IO(deleteDirectory(path))) ) override def munitFixtures = List(workingDirectory) diff -rN -u old-smederee/modules/darcs/src/test/scala/de/smederee/darcs/TestHelpers.scala new-smederee/modules/darcs/src/test/scala/de/smederee/darcs/TestHelpers.scala --- old-smederee/modules/darcs/src/test/scala/de/smederee/darcs/TestHelpers.scala 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/modules/darcs/src/test/scala/de/smederee/darcs/TestHelpers.scala 2025-03-08 23:21:01.733114217 +0000 @@ -37,8 +37,7 @@ Files.walkFileTree( path, new FileVisitor[Path] { - override def visitFileFailed(file: Path, exc: IOException): FileVisitResult = - FileVisitResult.CONTINUE + override def visitFileFailed(file: Path, exc: IOException): FileVisitResult = FileVisitResult.CONTINUE override def visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult = { Files.delete(file) diff -rN -u old-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala new-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala --- old-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala 2025-03-08 23:21:01.733114217 +0000 @@ -61,8 +61,7 @@ * @return * An option to the successfully converted EmailServerPassword. */ - def from(source: String): Option[EmailServerPassword] = - Option(source).map(_.getBytes(StandardCharsets.UTF_8)) + def from(source: String): Option[EmailServerPassword] = Option(source).map(_.getBytes(StandardCharsets.UTF_8)) } extension (password: EmailServerPassword) { @@ -278,8 +277,8 @@ */ trait EmailMiddleware[F[_]] { - /** Send the given message via the email protocol. Details depend on the configuration used for the - * underlying implementation. + /** Send the given message via the email protocol. Details depend on the configuration used for the underlying + * implementation. * * @param email * An email message containing all necessary information (headers and message body) to be sent. diff -rN -u old-smederee/modules/email/src/main/scala/de/smederee/email/SimpleJavaMailMiddleware.scala new-smederee/modules/email/src/main/scala/de/smederee/email/SimpleJavaMailMiddleware.scala --- old-smederee/modules/email/src/main/scala/de/smederee/email/SimpleJavaMailMiddleware.scala 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/modules/email/src/main/scala/de/smederee/email/SimpleJavaMailMiddleware.scala 2025-03-08 23:21:01.733114217 +0000 @@ -27,14 +27,13 @@ import org.simplejavamail.mailer.MailerBuilder import org.simplejavamail.api.email.Email -/** Provides an [[EmailMiddleware]] using the [Simple Java Mail](https://www.simplejavamail.org/) library and - * the IO monad from cats effect. +/** Provides an [[EmailMiddleware]] using the [Simple Java Mail](https://www.simplejavamail.org/) library and the IO + * monad from cats effect. * * @param configuration * The configuration containing all needed information to connect to the email server and send emails. */ -final class SimpleJavaMailMiddleware(configuration: EmailMiddlewareConfiguration) - extends EmailMiddleware[IO] { +final class SimpleJavaMailMiddleware(configuration: EmailMiddlewareConfiguration) extends EmailMiddleware[IO] { import SimpleJavaMailMiddleware.helpers._ private val cachedMailer: IO[Mailer] = for { diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala --- old-smederee/modules/hub/src/it/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/AuthenticationMiddlewareTest.scala 2025-03-08 23:21:01.733114217 +0000 @@ -76,8 +76,8 @@ val session = s.copy(uid = account.uid, createdAt = createdAt) val timeouts = AuthenticationTimeouts(duration, duration, duration) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -99,8 +99,8 @@ val session = s.copy(uid = account.uid, createdAt = createdAt) val timeouts = AuthenticationTimeouts(duration, duration, duration) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -119,8 +119,8 @@ val session = s.copy(uid = account.uid) val timeouts = AuthenticationTimeouts(duration, duration, duration) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) user <- resolveUser[IO](repo)(timeouts).run(session.id) diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala --- old-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala 2025-03-08 23:21:01.737114206 +0000 @@ -35,9 +35,9 @@ /** Base class for our integration test suites. * - * It loads and provides the configuration as a resource suit fixture (loaded once for all tests within a - * suite) and does initialise the test database for each suite. The latter means a possibly existing database - * with the name configured **will be deleted**! + * It loads and provides the configuration as a resource suit fixture (loaded once for all tests within a suite) and + * does initialise the test database for each suite. The latter means a possibly existing database with the name + * configured **will be deleted**! */ abstract class BaseSpec extends CatsEffectSuite { @@ -84,8 +84,8 @@ }.unsafeRunSync() } - /** Find and return a free port on the local machine by starting a server socket and closing it. The port - * number used by the socket is marked to allow reuse, considered free and returned. + /** Find and return a free port on the local machine by starting a server socket and closing it. The port number used + * by the socket is marked to allow reuse, considered free and returned. * * @return * An optional port number if a free one can be found. @@ -294,8 +294,7 @@ Files.walkFileTree( path, new FileVisitor[Path] { - override def visitFileFailed(file: Path, exc: IOException): FileVisitResult = - FileVisitResult.CONTINUE + override def visitFileFailed(file: Path, exc: IOException): FileVisitResult = FileVisitResult.CONTINUE override def visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult = { Files.delete(file) diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala --- old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAccountManagementRepositoryTest.scala 2025-03-08 23:21:01.737114206 +0000 @@ -51,7 +51,7 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -71,9 +71,9 @@ val account = ac.copy(validatedEmail = true) val token = ValidationToken.generate val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash, validationToken = token.some) o <- repo.findByValidationToken(token) @@ -87,7 +87,7 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieAccountManagementRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -106,9 +106,9 @@ val account = ac.copy(validatedEmail = true) val token = ValidationToken.generate val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash, validationToken = token.some) _ <- repo.markAsValidated(account.uid) @@ -126,9 +126,9 @@ case Some(account) => val token = ValidationToken.generate val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAccountManagementRepository[IO](tx) - val hash = PasswordHash("Yet another weak password!") + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAccountManagementRepository[IO](tx) + val hash = PasswordHash("Yet another weak password!") val test = for { _ <- createAccount(account, hash) _ <- repo.setValidationToken(account.uid, token) diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala --- old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieAuthenticationRepositoryTest.scala 2025-03-08 23:21:01.737114206 +0000 @@ -51,8 +51,8 @@ case (Some(s), Some(account)) => val session = s.copy(uid = account.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) w <- repo.createUserSession(session) @@ -71,8 +71,8 @@ genValidSession.sample match { case Some(session) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- repo.createUserSession(session) _ <- repo.findUserSession(session.id) @@ -87,8 +87,8 @@ case (Some(s), Some(account)) => val session = s.copy(uid = account.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -111,8 +111,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) o <- repo.findAccount(account.uid) @@ -128,8 +128,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount( account, @@ -150,8 +150,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) o <- repo.findAccountByEmail(account.email) @@ -167,8 +167,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount( account, @@ -189,8 +189,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) o <- repo.findAccountByName(account.name) @@ -206,8 +206,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount( account, @@ -228,9 +228,9 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) - val token = UnlockToken.generate + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) + val token = UnlockToken.generate val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), Option(token), None) o <- repo.findLockedAccount(account.name)(token) @@ -246,7 +246,7 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieAuthenticationRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -270,7 +270,7 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieAuthenticationRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -289,8 +289,8 @@ case (Some(s), Some(account)) => val session = s.copy(uid = account.uid) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) _ <- createUserSession(session) @@ -308,7 +308,7 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieAuthenticationRepository[IO](tx) val attempts = scala.util.Random.nextInt(128) val hash = PasswordHash("Yet another weak password!") @@ -333,9 +333,9 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieAuthenticationRepository[IO](tx) - val token = UnlockToken.generate + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieAuthenticationRepository[IO](tx) + val token = UnlockToken.generate val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) before <- repo.findAccount(account.uid) diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala --- old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieSignupRepositoryTest.scala 2025-03-08 23:21:01.737114206 +0000 @@ -50,8 +50,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSignupRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieSignupRepository[IO](tx) val test = for { w <- repo.createAccount(account, PasswordHash("I am not a password hash!")) o <- loadAccount(account.uid) @@ -70,7 +70,7 @@ val existingAccount = a val newAccount = b.copy(email = a.email) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- createAccount(existingAccount, PasswordHash("I am not a password hash!"), None, None) @@ -94,7 +94,7 @@ val existingAccount = a val newAccount = b.copy(name = a.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- createAccount(existingAccount, PasswordHash("I am not a password hash!"), None, None) @@ -117,8 +117,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSignupRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- repo.createAccount(account, PasswordHash("I am not a password hash!")) e <- repo.findEmail(account.email) @@ -136,8 +136,8 @@ case None => fail("Could not generate data samples!") case Some(account) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieSignupRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieSignupRepository[IO](tx) val test = for { c <- repo.createAccount(account, PasswordHash("I am not a password hash!")) n <- repo.findUsername(account.name) diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala --- old-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/DoobieVcsMetadataRepositoryTest.scala 2025-03-08 23:21:01.737114206 +0000 @@ -84,7 +84,7 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -101,8 +101,8 @@ genValidVcsRepository.sample match { case Some(repository) => val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { written <- repo.createVcsRepository(repository) } yield written @@ -116,7 +116,7 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -133,7 +133,7 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -157,7 +157,7 @@ case (Some(account), Some(repository)) => val vcsRepository = repository.copy(owner = account.toVcsRepositoryOwner) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -181,7 +181,7 @@ case Some(accounts) => val expectedOwner = accounts(scala.util.Random.nextInt(accounts.size)).toVcsRepositoryOwner val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { written <- accounts.traverse(account => @@ -218,7 +218,7 @@ ) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -255,7 +255,7 @@ ) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -295,7 +295,7 @@ ) val expectedRepoList = vcsRepositories val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -324,7 +324,7 @@ val vcsRepositories = repositories.map(_.copy(owner = account.toVcsRepositoryOwner)) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false).sortBy(_.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -351,7 +351,7 @@ val vcsRepositories = repositories.map(_.copy(owner = account.toVcsRepositoryOwner)) val expectedRepoList = vcsRepositories.sortBy(_.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -378,7 +378,7 @@ val vcsRepositories = repositories.map(_.copy(owner = account.toVcsRepositoryOwner)) val expectedRepoList = vcsRepositories.filter(_.isPrivate === false).sortBy(_.name) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) @@ -413,8 +413,8 @@ website = Option(uri"https://updated.example.com") ) val dbConfig = configuration.database - val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) - val repo = new DoobieVcsMetadataRepository[IO](tx) + val tx = Transactor.fromDriverManager[IO](dbConfig.driver, dbConfig.url, dbConfig.user, dbConfig.pass) + val repo = new DoobieVcsMetadataRepository[IO](tx) val test = for { _ <- createAccount(account, PasswordHash("I am not a password hash!"), None, None) written <- vcsRepositories.traverse(vcsRepository => repo.createVcsRepository(vcsRepository)) diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/html/LinkTools.scala new-smederee/modules/hub/src/main/scala/de/smederee/html/LinkTools.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/html/LinkTools.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/html/LinkTools.scala 2025-03-08 23:21:01.737114206 +0000 @@ -25,15 +25,15 @@ extension (linkConfig: ExternalLinkConfig) { - /** Take the given URI path and create a full URI using the specified configuration with a possible path - * prefix and append the given path to it. + /** Take the given URI path and create a full URI using the specified configuration with a possible path prefix and + * append the given path to it. * * @param path - * An URI containing a path with possible URL fragment and query parameters which will be used to - * construct the full URI. + * An URI containing a path with possible URL fragment and query parameters which will be used to construct the + * full URI. * @return - * A full URI created from the values of the ExternalLinkConfig (scheme, host, port, possible path - * prefix) and the path data from the given URI. + * A full URI created from the values of the ExternalLinkConfig (scheme, host, port, possible path prefix) and + * the path data from the given URI. */ def createFullUri(path: Uri): Uri = { val completePath = linkConfig.path match { diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -26,8 +26,8 @@ /** Delete the account with the given user id from the database. * - * The internal database logic (foreign keys, cascading) SHALL ensure that everything related to the user - * is deleted from the database. + * The internal database logic (foreign keys, cascading) SHALL ensure that everything related to the user is deleted + * from the database. * * @param uid * The unique id of the user account. @@ -54,8 +54,7 @@ */ def findPasswordHash(uid: UserId): F[Option[PasswordHash]] - /** Mark the account with the given user id as validated. This includes the following operations in the - * database: + /** Mark the account with the given user id as validated. This includes the following operations in the database: * * {{{ * 1. set the ´validated_email` column to `true` diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala 2025-03-08 23:21:01.737114206 +0000 @@ -36,8 +36,8 @@ import org.http4s.twirl.TwirlInstances._ import org.slf4j.LoggerFactory -/** Routes for user account self management which should provide every functionality needed by users to manage - * their account. +/** Routes for user account self management which should provide every functionality needed by users to manage their + * account. * * @param accountManagementRepo * The repository providing all needed database functionality for account management. @@ -58,8 +58,8 @@ ) extends Http4sDsl[F] { private val log = LoggerFactory.getLogger(getClass) - /** Delete the given directory recursively. It is checked if the given directory is a direct sub directory - * of the `repositoriesDirectory` and only if this is the case is the directory removed. + /** Delete the given directory recursively. It is checked if the given directory is a direct sub directory of the + * `repositoriesDirectory` and only if this is the case is the directory removed. * * @param userDirectory * The path on the filesystem to the directory that shall be deleted. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/Account.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/Account.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/Account.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/Account.scala 2025-03-08 23:21:01.737114206 +0000 @@ -230,8 +230,7 @@ * @return * An option to the successfully converted ResetToken. */ - def from(source: String): Option[ResetToken] = - Option(source).filter(s => s.length === Length && Format.matches(s)) + def from(source: String): Option[ResetToken] = Option(source).filter(s => s.length === Length && Format.matches(s)) /** Generate a new reset token. * @@ -265,8 +264,7 @@ * @return * An option to the successfully converted UnlockToken. */ - def from(source: String): Option[UnlockToken] = - Option(source).filter(s => s.length === Length && Format.matches(s)) + def from(source: String): Option[UnlockToken] = Option(source).filter(s => s.length === Length && Format.matches(s)) /** Generate a new unlock token. * diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationMiddleware.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationMiddleware.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationMiddleware.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationMiddleware.scala 2025-03-08 23:21:01.737114206 +0000 @@ -33,8 +33,7 @@ */ trait AuthenticationMiddleware { - /** Helper function to find and validate the authentication token from a request and extract the session id - * from it. + /** Helper function to find and validate the authentication token from a request and extract the session id from it. * * @param request * A http4s request. @@ -53,9 +52,9 @@ id <- SessionId.from(authId).toRight(ErrorMessageKey("error.auth.token.invalid")) } yield id - /** Extract an authentication token from a request, validate it and try to load the corresponding user - * account from the database repository if the token is valid. The functionality is wrapped into a - * [[cats.data.Kleisli]] to be composable within the http4s middleware. + /** Extract an authentication token from a request, validate it and try to load the corresponding user account from + * the database repository if the token is valid. The functionality is wrapped into a [[cats.data.Kleisli]] to be + * composable within the http4s middleware. * * @param repo * A database repository providing the functionality to find a user account in the database. @@ -81,9 +80,9 @@ } /** This is an Implementation of [[authenticateUser]] which in addition to [[cats.data.Kleisli]] also uses - * [[cats.data.OptionT]] to make it useable with the fall through functionality of the http4s - * authentication middleware. The function also extracts an authentication token from a requests, validates - * it and tries to load the corresponding user account from the database repository if the token is valid. + * [[cats.data.OptionT]] to make it useable with the fall through functionality of the http4s authentication + * middleware. The function also extracts an authentication token from a requests, validates it and tries to load the + * corresponding user account from the database repository if the token is valid. * * @param repo * A database repository providing the functionality to find a user account in the database. @@ -104,9 +103,9 @@ OptionT(sessionId.traverse(resolveUser(repo)(timeouts).run).map(_.getOrElse(None))) } - /** Try to resolve a user account using the provided database repository. It is wrapped into a - * [[cats.data.Kleisli]] to be composable within the http4s middleware. The function expects a - * [[SessionId]] to be passed to it which is used to obtain a session and the related user account. + /** Try to resolve a user account using the provided database repository. It is wrapped into a [[cats.data.Kleisli]] + * to be composable within the http4s middleware. The function expects a [[SessionId]] to be passed to it which is + * used to obtain a session and the related user account. * * @param repo * A database repository providing the functionality to find a user account in the database. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -60,8 +60,7 @@ */ def findAccount(uid: UserId): F[Option[Account]] - /** Search for the unlocked account with the given email address in the database and return the first found - * result. + /** Search for the unlocked account with the given email address in the database and return the first found result. * * @param email * The email address of the user account which must be unique according to our requirements. @@ -81,8 +80,8 @@ /** Search for a locked account with the given unlock token and return the first found result. * - * An account is considered *locked* **NOT** by the presence of an unlock token **BUT** by the presence of - * the `locked_at` date! + * An account is considered *locked* **NOT** by the presence of an unlock token **BUT** by the presence of the + * `locked_at` date! * * @param name * The username which must be unique according to our requirements. @@ -120,8 +119,8 @@ */ def incrementFailedAttempts(uid: UserId): F[Int] - /** Lock the account with the given id and set the value of the `unlock_token` column to the given token - * which might be `None` (`null` in the database). + /** Lock the account with the given id and set the value of the `unlock_token` column to the given token which might + * be `None` (`null` in the database). * * @param uid * The unique id of the user account. @@ -141,8 +140,8 @@ */ def resetFailedAttempts(uid: UserId): F[Int] - /** Unlock the user account with the given id. The process of unlocking clears both columns related to - * locking: `locked_at` and `unlock_token`! + /** Unlock the user account with the given id. The process of unlocking clears both columns related to locking: + * `locked_at` and `unlock_token`! * * @param uid * The unique id of the user account. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala 2025-03-08 23:21:01.737114206 +0000 @@ -39,8 +39,7 @@ import org.slf4j.LoggerFactory import play.twirl.api._ -/** The routes for handling the authentication related tasks like login, logout, password reset, unlocking - * etc. +/** The routes for handling the authentication related tasks like login, logout, password reset, unlocking etc. * * @param clock * A clock to generate nounces for cryptograpic operations. @@ -161,16 +160,15 @@ // private val parseResetPasswordForm = ??? - private val logout: AuthedRoutes[Account, F] = AuthedRoutes.of { - case ar @ POST -> Root / "logout" as user => - for { - authToken <- Sync[F].delay(ar.req.getAuthenticationToken) - sessionId <- Sync[F].delay(authToken.flatMap(signAndValidate.validate).flatMap(SessionId.from)) - _ <- sessionId.traverse(repo.deleteUserSession) - response <- SeeOther - .apply(Location(loginPath)) - .map(_.removeCookie(Constants.authenticationCookieName.toString)) - } yield response + private val logout: AuthedRoutes[Account, F] = AuthedRoutes.of { case ar @ POST -> Root / "logout" as user => + for { + authToken <- Sync[F].delay(ar.req.getAuthenticationToken) + sessionId <- Sync[F].delay(authToken.flatMap(signAndValidate.validate).flatMap(SessionId.from)) + _ <- sessionId.traverse(repo.deleteUserSession) + response <- SeeOther + .apply(Location(loginPath)) + .map(_.removeCookie(Constants.authenticationCookieName.toString)) + } yield response } private val showLoginForm: HttpRoutes[F] = HttpRoutes.of { case req @ GET -> Root / "login" => diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/config/SmedereeHubConfig.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/config/SmedereeHubConfig.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/config/SmedereeHubConfig.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/config/SmedereeHubConfig.scala 2025-03-08 23:21:01.741114194 +0000 @@ -234,8 +234,7 @@ object SmedereeHubConfig { given Eq[SmedereeHubConfig] = Eq.fromUniversalEquals - given ConfigReader[SmedereeHubConfig] = - ConfigReader.forProduct2("database", "service")(SmedereeHubConfig.apply) + given ConfigReader[SmedereeHubConfig] = ConfigReader.forProduct2("database", "service")(SmedereeHubConfig.apply) } /** Configuration specifying the database access. @@ -257,8 +256,7 @@ given Eq[DatabaseConfig] = Eq.fromUniversalEquals - given ConfigReader[DatabaseConfig] = - ConfigReader.forProduct4("driver", "url", "user", "pass")(DatabaseConfig.apply) + given ConfigReader[DatabaseConfig] = ConfigReader.forProduct4("driver", "url", "user", "pass")(DatabaseConfig.apply) } /** The general service configuration which describes how the service will be run. @@ -268,8 +266,8 @@ * @param port * The TCP port number on which the service shall listen for requests. * @param downloadDirectory - * A directory into which files are written that are supposed to be downloaded by users (e.g. distribution - * files of repositories). + * A directory into which files are written that are supposed to be downloaded by users (e.g. distribution files of + * repositories). * @param authentication * The configuration of the authentication feature. * @param billing @@ -279,8 +277,8 @@ * @param email * The email middleware configuration for sending email messages. * @param external - * Settings affecting how the service will communicate several information to the "outside world" e.g. if - * it runs behind a reverse proxy. + * Settings affecting how the service will communicate several information to the "outside world" e.g. if it runs + * behind a reverse proxy. * @param signup * The configuration for the signup / registration feature. * @param ssh @@ -309,10 +307,8 @@ given ConfigReader[Port] = ConfigReader.fromStringOpt[Port](Port.fromString) given ConfigReader[DirectoryPath] = ConfigReader.fromStringOpt(DirectoryPath.fromString) - given ConfigReader[EmailServerUsername] = - ConfigReader.fromStringOpt[EmailServerUsername](EmailServerUsername.from) - given ConfigReader[EmailServerPassword] = - ConfigReader.fromStringOpt[EmailServerPassword](EmailServerPassword.from) + given ConfigReader[EmailServerUsername] = ConfigReader.fromStringOpt[EmailServerUsername](EmailServerUsername.from) + given ConfigReader[EmailServerPassword] = ConfigReader.fromStringOpt[EmailServerPassword](EmailServerPassword.from) given ConfigReader[SmtpTransport] = ConfigReader.fromStringOpt[SmtpTransport](string => Try(SmtpTransport.valueOf(string)).toOption) @@ -339,8 +335,8 @@ /** Timeouts related to the authentication and session management. * * @param absoluteTimeout - * The maximum allowed age an authentication session. This setting will affect the invalidation of a - * session on the server side. This timeout MUST be triggered regardless of session activity. + * The maximum allowed age an authentication session. This setting will affect the invalidation of a session on the + * server side. This timeout MUST be triggered regardless of session activity. * @param idleTimeout * This timeout defines how long after the last activity a session will remain valid. * @param renewalTimeout @@ -397,8 +393,7 @@ None } - given ConfigReader[PrivateKey] = - ConfigReader.fromStringOpt(s => PrivateKey.from(s.getBytes(StandardCharsets.UTF_8))) + given ConfigReader[PrivateKey] = ConfigReader.fromStringOpt(s => PrivateKey.from(s.getBytes(StandardCharsets.UTF_8))) given ConfigReader[Uri] = ConfigReader.fromStringOpt(s => Uri.fromString(s).toOption) @@ -427,8 +422,8 @@ /** Configuration for the darcs module for vcs related operations via darcs. * * @param executable - * The path to the darcs binary executable. If not a full path (i.e. just `darcs`) it must be present on - * the `$PATH` of the environment under which the server is running. + * The path to the darcs binary executable. If not a full path (i.e. just `darcs`) it must be present on the `$PATH` + * of the environment under which the server is running. * @param repositoriesDirectory * The directory used to store the actual repositories structured after owner. * {{{ @@ -455,17 +450,16 @@ } /** @param host - * The official hostname of the service which will be used for the CSRF protection, generation of links in - * e-mails etc. + * The official hostname of the service which will be used for the CSRF protection, generation of links in e-mails + * etc. * @param path * A possible path prefix that will be prepended to any paths used in link generation. * @param port - * The port number which defaults to the port the service is listening on. Please note that this is also - * relevant for CSRF protection! It should not be defined if the service is running behind a reverse proxy - * listening on the standard port for the given URL scheme (http/https). + * The port number which defaults to the port the service is listening on. Please note that this is also relevant for + * CSRF protection! It should not be defined if the service is running behind a reverse proxy listening on the + * standard port for the given URL scheme (http/https). * @param scheme - * The URL scheme which is used for links and will also determine if cookies will have the secure flag - * enabled. + * The URL scheme which is used for links and will also determine if cookies will have the secure flag enabled. */ final case class ExternalLinkConfig(host: Host, path: Option[Uri], port: Option[Port], scheme: Uri.Scheme) diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/DatabaseMigrator.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/DatabaseMigrator.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/DatabaseMigrator.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/DatabaseMigrator.scala 2025-03-08 23:21:01.737114206 +0000 @@ -36,8 +36,8 @@ * @param pass * The password needed to authenticate against the database. * @return - * A migrate result object holding information about executed migrations and the schema. See the Java-Doc - * of Flyway for details. + * A migrate result object holding information about executed migrations and the schema. See the Java-Doc of Flyway + * for details. */ def migrate(url: String, user: String, pass: String): F[MigrateResult] = for { diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAccountManagementRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAccountManagementRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAccountManagementRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAccountManagementRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -29,8 +29,7 @@ import fs2.Stream import org.http4s.Uri -final class DoobieAccountManagementRepository[F[_]: Sync](tx: Transactor[F]) - extends AccountManagementRepository[F] { +final class DoobieAccountManagementRepository[F[_]: Sync](tx: Transactor[F]) extends AccountManagementRepository[F] { given Meta[Email] = Meta[String].timap(Email.apply)(_.toString) given Meta[PasswordHash] = Meta[String].timap(PasswordHash.apply)(_.toString) given Meta[UserId] = Meta[UUID].timap(UserId.apply)(_.toUUID) diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAuthenticationRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAuthenticationRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAuthenticationRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieAuthenticationRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -25,8 +25,7 @@ import doobie.implicits._ import doobie.postgres.implicits._ -final class DoobieAuthenticationRepository[F[_]: Sync](tx: Transactor[F]) - extends AuthenticationRepository[F] { +final class DoobieAuthenticationRepository[F[_]: Sync](tx: Transactor[F]) extends AuthenticationRepository[F] { given Meta[Email] = Meta[String].timap(Email.apply)(_.toString) given Meta[PasswordHash] = Meta[String].timap(PasswordHash.apply)(_.toString) given Meta[SessionId] = Meta[String].timap(SessionId.apply)(_.toString) @@ -66,7 +65,7 @@ override def findLockedAccount(name: Username)(token: UnlockToken): F[Option[Account]] = { val nameFilter = fr"""name = $name""" val tokenFilter = fr"""unlock_token = $token""" - val query = selectAccountColumns ++ whereAnd(lockedFilter, nameFilter, tokenFilter) ++ fr"""LIMIT 1""" + val query = selectAccountColumns ++ whereAnd(lockedFilter, nameFilter, tokenFilter) ++ fr"""LIMIT 1""" query.query[Account].option.transact(tx) } diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -62,7 +62,7 @@ override def findVcsRepositoryId(owner: VcsRepositoryOwner, name: VcsRepositoryName): F[Option[Long]] = { val nameFilter = fr"""name = $name""" val ownerFilter = fr"""owner = ${owner.uid}""" - val query = fr"""SELECT id FROM "repositories"""" ++ whereAnd(ownerFilter, nameFilter) ++ fr"""LIMIT 1""" + val query = fr"""SELECT id FROM "repositories"""" ++ whereAnd(ownerFilter, nameFilter) ++ fr"""LIMIT 1""" query.query[Long].option.transact(tx) } diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/EditVcsRepositoryForm.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/EditVcsRepositoryForm.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/EditVcsRepositoryForm.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/EditVcsRepositoryForm.scala 2025-03-08 23:21:01.737114206 +0000 @@ -27,11 +27,10 @@ * * @param name * The name of the repository. A repository name must start with a letter or number and must contain only - * alphanumeric ASCII characters as well as minus or underscore signs. It must be between 2 and 64 - * characters long. + * alphanumeric ASCII characters as well as minus or underscore signs. It must be between 2 and 64 characters long. * @param isPrivate - * A flag indicating if this repository is private i.e. only visible / accessible for accounts with - * appropriate permissions. + * A flag indicating if this repository is private i.e. only visible / accessible for accounts with appropriate + * permissions. * @param description * An optional short text description of the repository. * @param website @@ -77,9 +76,7 @@ else VcsRepositoryDescription .from(s) - .fold(FormFieldError("Invalid repository description!").invalidNec)(descr => - Option(descr).validNec - ) + .fold(FormFieldError("Invalid repository description!").invalidNec)(descr => Option(descr).validNec) } .leftMap(es => NonEmptyChain.of(Map(fieldDescription -> es.toList))) val website = data @@ -94,14 +91,13 @@ .fold(FormFieldError("Invalid website URI!").invalidNec) { uri => uri.scheme match { case Some(Uri.Scheme.http) | Some(Uri.Scheme.https) => Option(uri).validNec - case _ => FormFieldError("Invalid website URI!").invalidNec + case _ => FormFieldError("Invalid website URI!").invalidNec } } } .leftMap(es => NonEmptyChain.of(Map(fieldWebsite -> es.toList))) - (name, privateFlag, description, website).mapN { - case (validName, isPrivate, validDescription, validWebsite) => - EditVcsRepositoryForm(validName, isPrivate, validDescription, validWebsite) + (name, privateFlag, description, website).mapN { case (validName, isPrivate, validDescription, validWebsite) => + EditVcsRepositoryForm(validName, isPrivate, validDescription, validWebsite) } } @@ -109,8 +105,8 @@ extension (form: EditVcsRepositoryForm) { - /** Convert the form class into a stringified map which is used as underlying data type for form handling in - * the twirl templating library. + /** Convert the form class into a stringified map which is used as underlying data type for form handling in the twirl + * templating library. * * @return * A stringified map containing the data of the form. @@ -128,9 +124,8 @@ val description = form.description.fold(Map.empty)(description => Map(EditVcsRepositoryForm.fieldDescription.toString -> description.toString) ) - val website = form.website.fold(Map.empty)(website => - Map(EditVcsRepositoryForm.fieldWebsite.toString -> website.toString) - ) + val website = + form.website.fold(Map.empty)(website => Map(EditVcsRepositoryForm.fieldWebsite.toString -> website.toString)) formData ++ description ++ website } } diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/FormValidator.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/FormValidator.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/FormValidator.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/FormValidator.scala 2025-03-08 23:21:01.741114194 +0000 @@ -22,11 +22,11 @@ /** A base class for form validators. * - * <p>It is intended to extend this class if you want to provide a more sophisticated validation for a form - * which gets submitted as raw stringified map.</p> + * <p>It is intended to extend this class if you want to provide a more sophisticated validation for a form which gets + * submitted as raw stringified map.</p> * - * <p>Please note that you can achieve auto validation if you use proper models (with refined types) in your - * tapir endpoints.</p> + * <p>Please note that you can achieve auto validation if you use proper models (with refined types) in your tapir + * endpoints.</p> * * <p>However, sometimes you want to have more fine grained control...</p> * @@ -36,8 +36,8 @@ abstract class FormValidator[T] { final val fieldGlobal: FormField = FormValidator.fieldGlobal - /** Validate the submitted form data which is received as stringified map and return either a validated `T` - * or a list of [[de.smederee.hub.forms.types.FormErrors]]. + /** Validate the submitted form data which is received as stringified map and return either a validated `T` or a list + * of [[de.smederee.hub.forms.types.FormErrors]]. * * @param data * The stringified map which was submitted. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/types.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/types.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/types.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/forms/types.scala 2025-03-08 23:21:01.741114194 +0000 @@ -26,27 +26,25 @@ object FormErrors { val empty: FormErrors = Map.empty[FormField, List[FormFieldError]] - /** Create a single FormErrors instance from a given non empty chain of FormErrors which is usually - * returned from validators. + /** Create a single FormErrors instance from a given non empty chain of FormErrors which is usually returned from + * validators. * * @param errors * A non empty chain of FormErrors. * @return * A single FormErrors instance containing all the errors. */ - def fromNec(errors: NonEmptyChain[FormErrors]): FormErrors = - errors.toList.fold(FormErrors.empty)(_ combine _) + def fromNec(errors: NonEmptyChain[FormErrors]): FormErrors = errors.toList.fold(FormErrors.empty)(_ combine _) - /** Create a single FormErrors instance from a given non empty list of FormErrors which is usually - * returned from validators. + /** Create a single FormErrors instance from a given non empty list of FormErrors which is usually returned from + * validators. * * @param errors * A non empty list of FormErrors. * @return * A single FormErrors instance containing all the errors. */ - def fromNel(errors: NonEmptyList[FormErrors]): FormErrors = - errors.toList.fold(FormErrors.empty)(_ combine _) + def fromNel(errors: NonEmptyList[FormErrors]): FormErrors = errors.toList.fold(FormErrors.empty)(_ combine _) } opaque type FormField = String diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/HubServer.scala 2025-03-08 23:21:01.737114206 +0000 @@ -42,8 +42,7 @@ /** This is the main entry point for the hub service. * - * It initialises the application (configuration parsing, database migrations) and starts the HTTP service - * eventually. + * It initialises the application (configuration parsing, database migrations) and starts the HTTP service eventually. */ object HubServer extends IOApp with AuthenticationMiddleware { private val log = LoggerFactory.getLogger(getClass) diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/LandingPageRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/LandingPageRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/LandingPageRoutes.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/LandingPageRoutes.scala 2025-03-08 23:21:01.737114206 +0000 @@ -29,8 +29,8 @@ /** This bundles all routing related to possible landing pages for users entering the site. * - * Please note that due to the routing logic of http4s catch-all pages (`-> Root`) should be put last in the - * list of routes! + * Please note that due to the routing logic of http4s catch-all pages (`-> Root`) should be put last in the list of + * routes! * * @param linkConfig * The configuration needed to build correct links which are working from the outside. @@ -57,12 +57,11 @@ } yield resp } - private val mainSiteForLoggedInUsers: AuthedRoutes[Account, F] = AuthedRoutes.of { - case ar @ GET -> Root as user => - for { - csrf <- Sync[F].delay(ar.req.getCsrfToken) - resp <- Ok(views.html.index(baseUri)()(signupUri, csrf, "Welcome to the Smederee!".some, user.some)) - } yield resp + private val mainSiteForLoggedInUsers: AuthedRoutes[Account, F] = AuthedRoutes.of { case ar @ GET -> Root as user => + for { + csrf <- Sync[F].delay(ar.req.getCsrfToken) + resp <- Ok(views.html.index(baseUri)()(signupUri, csrf, "Welcome to the Smederee!".some, user.some)) + } yield resp } private val mainSite: HttpRoutes[F] = HttpRoutes.of { case req @ GET -> Root => diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/NewVcsRepositoryForm.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/NewVcsRepositoryForm.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/NewVcsRepositoryForm.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/NewVcsRepositoryForm.scala 2025-03-08 23:21:01.737114206 +0000 @@ -27,11 +27,10 @@ * * @param name * The name of the repository. A repository name must start with a letter or number and must contain only - * alphanumeric ASCII characters as well as minus or underscore signs. It must be between 2 and 64 - * characters long. + * alphanumeric ASCII characters as well as minus or underscore signs. It must be between 2 and 64 characters long. * @param isPrivate - * A flag indicating if this repository is private i.e. only visible / accessible for accounts with - * appropriate permissions. + * A flag indicating if this repository is private i.e. only visible / accessible for accounts with appropriate + * permissions. * @param description * An optional short text description of the repository. * @param website @@ -67,9 +66,7 @@ else VcsRepositoryDescription .from(s) - .fold(FormFieldError("Invalid repository description!").invalidNec)(descr => - Option(descr).validNec - ) + .fold(FormFieldError("Invalid repository description!").invalidNec)(descr => Option(descr).validNec) } .leftMap(es => NonEmptyChain.of(Map(fieldDescription -> es.toList))) val website = data @@ -84,14 +81,13 @@ .fold(FormFieldError("Invalid website URI!").invalidNec) { uri => uri.scheme match { case Some(Uri.Scheme.http) | Some(Uri.Scheme.https) => Option(uri).validNec - case _ => FormFieldError("Invalid website URI!").invalidNec + case _ => FormFieldError("Invalid website URI!").invalidNec } } } .leftMap(es => NonEmptyChain.of(Map(fieldWebsite -> es.toList))) - (name, privateFlag, description, website).mapN { - case (validName, isPrivate, validDescription, validWebsite) => - NewVcsRepositoryForm(validName, isPrivate, validDescription, validWebsite) + (name, privateFlag, description, website).mapN { case (validName, isPrivate, validDescription, validWebsite) => + NewVcsRepositoryForm(validName, isPrivate, validDescription, validWebsite) } } } diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/SessionHelpers.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/SessionHelpers.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/SessionHelpers.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SessionHelpers.scala 2025-03-08 23:21:01.737114206 +0000 @@ -31,16 +31,15 @@ object instances { extension (session: Session) { - /** Check if the session has reached the absolute timeout defined by the given timeouts configuration in - * regard to the given point in time passed as `currentTime`. + /** Check if the session has reached the absolute timeout defined by the given timeouts configuration in regard to + * the given point in time passed as `currentTime`. * * @param timeouts * Timeouts related to the authentication and session management. * @param currentTime * The current time to compare the `createdAt` field of the session to. * @return - * Return `true` if the session was created at a point in time that is out of the allowed timeout - * range. + * Return `true` if the session was created at a point in time that is out of the allowed timeout range. */ def hasReachedAbsoluteTimeout(timeouts: AuthenticationTimeouts)(currentTime: OffsetDateTime): Boolean = session.createdAt.compareTo(currentTime.minusSeconds(timeouts.absoluteTimeout.toSeconds)) < 0 @@ -48,17 +47,17 @@ extension (signedToken: SignedToken) { - /** Create an authentication cookie from the signed token. The mentioned cookie will be named after the - * related constant from [[de.smederee.hub.config.Constants]] and contain the signed token as value. - * Furthermore the cookie will be using a strict same-site policy, be http-only and respect the given - * values for expiration and the secure flag. + /** Create an authentication cookie from the signed token. The mentioned cookie will be named after the related + * constant from [[de.smederee.hub.config.Constants]] and contain the signed token as value. Furthermore the + * cookie will be using a strict same-site policy, be http-only and respect the given values for expiration and + * the secure flag. * * @param expires - * A duration in which the cookie shall expire. It is optional resulting in the cookie being a - * non-persistent "session cookie" if not set. + * A duration in which the cookie shall expire. It is optional resulting in the cookie being a non-persistent + * "session cookie" if not set. * @param secure - * A flag indication if the secure flag on the cookie shall be set to allow it only to be transmitted - * via encrypted channels (i.e. HTTPS). + * A flag indication if the secure flag on the cookie shall be set to allow it only to be transmitted via + * encrypted channels (i.e. HTTPS). * @return * A response cookie ready to be used as an authentication cookie. */ diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/Session.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/Session.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/Session.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/Session.scala 2025-03-08 23:21:01.737114206 +0000 @@ -31,8 +31,8 @@ * @param createdAt * The timestamp when the session was created. * @param updatedAt - * The session ID should be re-generated in regular intervals resulting in a copy of the old session entry - * with a new ID and the corresponding timestamp in this field. + * The session ID should be re-generated in regular intervals resulting in a copy of the old session entry with a new + * ID and the corresponding timestamp in this field. */ final case class Session(id: SessionId, uid: UserId, createdAt: OffsetDateTime, updatedAt: OffsetDateTime) @@ -51,8 +51,8 @@ * @param createdAt * The creation timestamp to be used for the session. * @param updatedAt - * The session ID should be re-generated in regular intervals resulting in a copy of the old session - * entry with a new ID and the corresponding timestamp in this field. + * The session ID should be re-generated in regular intervals resulting in a copy of the old session entry with a + * new ID and the corresponding timestamp in this field. * @return * A new session with a generated id for the given user and timestamp. */ diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupForm.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupForm.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupForm.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupForm.scala 2025-03-08 23:21:01.737114206 +0000 @@ -24,8 +24,7 @@ /** A data container for our signup form. * - * Please note that both `name` and `email` have to be checked against possibly existing entries in the - * database! + * Please note that both `name` and `email` have to be checked against possibly existing entries in the database! * * @param name * The username which is desired to be taken by the user. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -35,8 +35,8 @@ */ def createAccount(account: Account, hash: PasswordHash): F[Int] - /** Find the given email address in the database accounts table. This function can be used to check if an - * email address has already been taken. + /** Find the given email address in the database accounts table. This function can be used to check if an email + * address has already been taken. * * @param address * An email address which shall be searched for. @@ -45,8 +45,8 @@ */ def findEmail(address: Email): F[Option[Email]] - /** Find the given username in the database accounts table. This function can be used to check if a username - * has already been taken. + /** Find the given username in the database accounts table. This function can be used to check if a username has + * already been taken. * * @param name * The username which shall be searched for. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala 2025-03-08 23:21:01.737114206 +0000 @@ -152,12 +152,11 @@ SeeOther.apply(Location(Uri(path = Uri.Path.Root))) // Redirect already logged in users. } - private val showWelcomePage: HttpRoutes[F] = HttpRoutes.of { - case req @ GET -> Root / "signup" / "welcome" => - for { - csrf <- Sync[F].delay(req.getCsrfToken) - resp <- Ok(views.html.welcome(baseUri)(csrf, "Thank you and welcome!".some)) - } yield resp + private val showWelcomePage: HttpRoutes[F] = HttpRoutes.of { case req @ GET -> Root / "signup" / "welcome" => + for { + csrf <- Sync[F].delay(req.getCsrfToken) + resp <- Ok(views.html.welcome(baseUri)(csrf, "Thank you and welcome!".some)) + } yield resp } val protectedRoutes = diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsMetadataRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsMetadataRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsMetadataRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsMetadataRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -19,8 +19,8 @@ import fs2.Stream -/** A base class for a database repository that should handle all functionality regarding vcs repositories and - * their metadata in the database. +/** A base class for a database repository that should handle all functionality regarding vcs repositories and their + * metadata in the database. * * @tparam F * A higher kinded type which wraps the actual return values. @@ -56,8 +56,8 @@ */ def findVcsRepository(owner: VcsRepositoryOwner, name: VcsRepositoryName): F[Option[VcsRepository]] - /** Search for the internal database specific (auto generated) ID of the given owner / repository - * combination which serves as a primary key for the database table. + /** Search for the internal database specific (auto generated) ID of the given owner / repository combination which + * serves as a primary key for the database table. * * @param owner * Data about the owner of the repository containing information needed to query the database. @@ -80,8 +80,8 @@ /** Return a list of all repositories from all users. * * @param requester - * An optional account (None if guest i.e. not logged in user) for whom the list shall be created. This - * will affect which repositories will be returned in regard to access rights. + * An optional account (None if guest i.e. not logged in user) for whom the list shall be created. This will affect + * which repositories will be returned in regard to access rights. * @param ordering * The desired ordering of the list. * @return @@ -94,8 +94,8 @@ /** Return a list of all repositories of the given owner. * * @param requester - * An optional account (None if guest i.e. not logged in user) for whom the list shall be created. This - * will affect which repositories will be returned in regard to access rights. + * An optional account (None if guest i.e. not logged in user) for whom the list shall be created. This will affect + * which repositories will be returned in regard to access rights. * @param owner * Data about the owner of the repositories containing information needed to query the database. * @return diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-03-08 23:21:01.737114206 +0000 @@ -70,9 +70,8 @@ // The base URI for our site which that be passed into some templates which create links themselfes. private val baseUri = linkConfig.createFullUri(Uri()) - /** Delete the given directory recursively. It is checked if the given directory is a direct sub directory - * of the owner's directory under `repositoriesDirectory` and only if this is the case is the directory - * removed. + /** Delete the given directory recursively. It is checked if the given directory is a direct sub directory of the + * owner's directory under `repositoriesDirectory` and only if this is the case is the directory removed. * * @param ownerName * The name of the repository owner which is used for the directory check. @@ -218,8 +217,8 @@ ) } yield resp - /** Logic for rendering a list of repositories of the given owner for a specific user account. This function - * takes visibility into account. + /** Logic for rendering a list of repositories of the given owner for a specific user account. This function takes + * visibility into account. * * @param csrf * An optional CSRF-Token that shall be used. @@ -313,9 +312,9 @@ ) ) ) - log <- darcs.log(directory.toNIO)(repositoryName.toString)(Chain(s"--max-count=2", "--xml-output")) - xmlLog <- Sync[F].delay(scala.xml.XML.loadString(log.stdout.toList.mkString)) - patches <- Sync[F].delay((xmlLog \ "patch").flatMap(VcsRepositoryPatchMetadata.fromDarcsXmlLog).toList) + log <- darcs.log(directory.toNIO)(repositoryName.toString)(Chain(s"--max-count=2", "--xml-output")) + xmlLog <- Sync[F].delay(scala.xml.XML.loadString(log.stdout.toList.mkString)) + patches <- Sync[F].delay((xmlLog \ "patch").flatMap(VcsRepositoryPatchMetadata.fromDarcsXmlLog).toList) readmeData <- repo.traverse(repo => doLoadReadme(repo)) readme <- readmeData match { case Some((lines, Some(filename))) => @@ -365,8 +364,8 @@ * @param repositoryName * The actual name of the repository. * @param filePath - * An URI path which describes the path the the requested part of the repository (empty or `/` for the - * root directory of the repo). + * An URI path which describes the path the the requested part of the repository (empty or `/` for the root + * directory of the repo). * @return * An HTTP response containing the rendered HTML. */ @@ -567,9 +566,9 @@ } } yield resp - /** List walk the given directory at the first level and return all found files and directories and their - * stats sorted by directory first and by name second. If the given path is _not_ a directory then no - * traversal is done and an empty list is returned. + /** List walk the given directory at the first level and return all found files and directories and their stats sorted + * by directory first and by name second. If the given path is _not_ a directory then no traversal is done and an + * empty list is returned. * * @param directory * The path to the directory that shall be traversed. @@ -600,8 +599,8 @@ Sync[F].delay(IndexedSeq.empty) } yield listing - /** Load the content of the first file matching our "readme file" heuristic which does not exceed the - * maximum file size and return it. + /** Load the content of the first file matching our "readme file" heuristic which does not exceed the maximum file + * size and return it. * * @param repo * A repository in which we should search. @@ -831,9 +830,7 @@ case 0 => SeeOther.apply( Location( - Uri(path = - Uri.Path.Root |+| Uri.Path(Vector(Uri.Path.Segment(s"~${user.name.toString}"))) - ) + Uri(path = Uri.Path.Root |+| Uri.Path(Vector(Uri.Path.Segment(s"~${user.name.toString}")))) ) ) case _ => @@ -979,12 +976,11 @@ } yield resp } - private val showAllRepositoriesForGuests: HttpRoutes[F] = HttpRoutes.of { - case req @ GET -> Root / "projects" => - for { - csrf <- Sync[F].delay(req.getCsrfToken) - resp <- doShowAllRepositories(csrf)(None) - } yield resp + private val showAllRepositoriesForGuests: HttpRoutes[F] = HttpRoutes.of { case req @ GET -> Root / "projects" => + for { + csrf <- Sync[F].delay(req.getCsrfToken) + resp <- doShowAllRepositories(csrf)(None) + } yield resp } private val showCreateRepositoryForm: AuthedRoutes[Account, F] = AuthedRoutes.of { diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala 2025-03-08 23:21:01.729114229 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala 2025-03-08 23:21:01.737114206 +0000 @@ -304,8 +304,8 @@ extension (timestamp: VcsPatchTimestamp) { - /** Converts this date-time to an Instant. This returns an Instant representing the same point on the - * time-line as this date-time. + /** Converts this date-time to an Instant. This returns an Instant representing the same point on the time-line as + * this date-time. * * @return * an Instant representing the same instant, not null @@ -342,8 +342,8 @@ object VcsPatchSummary { private val log = LoggerFactory.getLogger(classOf[VcsPatchSummary]) - /** Parse the given xml element which SHALL originate from the xml output of a darcs log command. Any - * exceptional errors which occur during conversion are logged. + /** Parse the given xml element which SHALL originate from the xml output of a darcs log command. Any exceptional + * errors which occur during conversion are logged. * * @param darcsLogEntry * A log entry from a darcs log using the xml output (i.e. the `<patch>` element). @@ -411,8 +411,8 @@ val DarcsCommentFilter: Regex = "^Ignore-this: [0-9a-f]+".r val DarcsDateFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss") - /** Parse the given xml element which SHALL originate from the xml output of a darcs log command. Any - * exceptional errors which occur during conversion are logged. + /** Parse the given xml element which SHALL originate from the xml output of a darcs log command. Any exceptional + * errors which occur during conversion are logged. * * @param darcsLogEntry * A log entry from a darcs log using the xml output (i.e. the `<patch>` element). @@ -450,13 +450,12 @@ * * @param name * The name of the repository. A repository name must start with a letter or number and must contain only - * alphanumeric ASCII characters as well as minus or underscore signs. It must be between 2 and 64 - * characters long. + * alphanumeric ASCII characters as well as minus or underscore signs. It must be between 2 and 64 characters long. * @param owner * The owner of the repository. * @param isPrivate - * A flag indicating if this repository is private i.e. only visible / accessible for accounts with - * appropriate permissions. + * A flag indicating if this repository is private i.e. only visible / accessible for accounts with appropriate + * permissions. * @param description * An optional short text description of the repository. * @param vcsType diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala new-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala 2025-03-08 23:21:01.741114194 +0000 @@ -125,8 +125,8 @@ } } -/** The command factory is appended to the apache ssh server and responsible for parsing requested commands - * and delegating to the appropriate specific command implementation. +/** The command factory is appended to the apache ssh server and responsible for parsing requested commands and + * delegating to the appropriate specific command implementation. * * @param darcsConfiguration * The configuration needed to properly execute underlying darcs commands and access repository data on the diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/ssh/NoLogin.scala new-smederee/modules/hub/src/main/scala/de/smederee/ssh/NoLogin.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/ssh/NoLogin.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/ssh/NoLogin.scala 2025-03-08 23:21:01.741114194 +0000 @@ -27,8 +27,8 @@ import org.apache.sshd.server.command.Command import org.apache.sshd.server.shell.ShellFactory -/** A shell factory for our SSH server which prevents interactive logins and shell sessions. This is stripped - * down to the bare minimum of needed functionality. +/** A shell factory for our SSH server which prevents interactive logins and shell sessions. This is stripped down to + * the bare minimum of needed functionality. * * @param genericUser * A username for generic access to services for darcs clone, pull and push (e.g. `darcs pull diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala new-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/ssh/SshServer.scala 2025-03-08 23:21:01.741114194 +0000 @@ -63,8 +63,8 @@ extension (sshUsername: SshUsername) { - /** Convert to a [[Username]] instance. The format of both is identical so we just return the wrapped ssh - * username string. + /** Convert to a [[Username]] instance. The format of both is identical so we just return the wrapped ssh username + * string. * * @return * A proper username derived from the given ssh username. @@ -110,8 +110,8 @@ ) } -/** A ssh server using the [Apache MINA SSHD](https://mina.apache.org/sshd-project/) library and the IO monad - * from cats effect. +/** A ssh server using the [Apache MINA SSHD](https://mina.apache.org/sshd-project/) library and the IO monad from cats + * effect. * * @param darcsConfiguration * The configuration needed to properly execute underlying darcs commands and access repository data on the diff -rN -u old-smederee/modules/i18n/src/main/scala/de/smederee/i18n/Messages.scala new-smederee/modules/i18n/src/main/scala/de/smederee/i18n/Messages.scala --- old-smederee/modules/i18n/src/main/scala/de/smederee/i18n/Messages.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/i18n/src/main/scala/de/smederee/i18n/Messages.scala 2025-03-08 23:21:01.741114194 +0000 @@ -31,9 +31,9 @@ val DefaultLocale: Locale = Locale.ENGLISH val Filename: String = "messages" - /** Provide a way to simply write `Messages("my.key", foo, bar)` to translate stuff. This function will - * catch possible exceptions underneath and in case of an error will log an error message and the - * underlying exception and will return the given message string instead a translation! + /** Provide a way to simply write `Messages("my.key", foo, bar)` to translate stuff. This function will catch possible + * exceptions underneath and in case of an error will log an error message and the underlying exception and will + * return the given message string instead a translation! * * @param message * The message to be translated, which should be a valid property key. @@ -78,8 +78,7 @@ /** Return the string stored in the properties bundle for the given locale and key. * - * If the resource bundle for the desired locale cannot be found then the function falls back to the - * default one. + * If the resource bundle for the desired locale cannot be found then the function falls back to the default one. * * @param locale * The locale for which the string shall be returned. diff -rN -u old-smederee/modules/security/src/main/scala/de/smederee/security/SignAndValidate.scala new-smederee/modules/security/src/main/scala/de/smederee/security/SignAndValidate.scala --- old-smederee/modules/security/src/main/scala/de/smederee/security/SignAndValidate.scala 2025-03-08 23:21:01.733114217 +0000 +++ new-smederee/modules/security/src/main/scala/de/smederee/security/SignAndValidate.scala 2025-03-08 23:21:01.741114194 +0000 @@ -37,8 +37,8 @@ extension (string: String) { - /** Convert the string into an array of bytes, assuming that it follows the notation generated by the - * corresponding `toHexString` function. + /** Convert the string into an array of bytes, assuming that it follows the notation generated by the corresponding + * `toHexString` function. * * @return * An array containing the bytes represented by the given hexadecimal codes. @@ -59,8 +59,8 @@ */ def apply(source: String): SignedToken = source - /** Try to create an instance of SignedToken from the given String. Please note that this function will only - * do a syntactic check! + /** Try to create an instance of SignedToken from the given String. Please note that this function will only do a + * syntactic check! * * @param source * A String that should fulfil the requirements to be converted into a SignedToken. @@ -104,21 +104,21 @@ * @param nonce * A nonce string used to prepend it before the token. * @return - * A string containing the HMAC-SHA256 signature followed by a hash sign and the raw string used for - * signing which contains the nonce a hash sign and the token. + * A string containing the HMAC-SHA256 signature followed by a hash sign and the raw string used for signing which + * contains the nonce a hash sign and the token. */ def signToken(token: String)(nonce: String): SignedToken = { val combined = s"$nonce${SignedToken.Separator}$token" SignedToken(s"${sign(combined)}${SignedToken.Separator}$combined") } - /** Validate the given string which should contain a signature generated by the corresponding [[signToken]] - * function. This function uses the [[java.security.MessageDigest#isEqual]] function which should ensure - * constant time comparison. + /** Validate the given string which should contain a signature generated by the corresponding [[signToken]] function. + * This function uses the [[java.security.MessageDigest#isEqual]] function which should ensure constant time + * comparison. * * @param signedToken - * A string containing the HMAC-SHA256 signature followed by a hash sign and the raw string used for - * signing which contains the nonce a hash sign and the token. + * A string containing the HMAC-SHA256 signature followed by a hash sign and the raw string used for signing which + * contains the nonce a hash sign and the token. * @return * Option containing the pure token if the validation was successful. */ diff -rN -u old-smederee/.scalafmt.conf new-smederee/.scalafmt.conf --- old-smederee/.scalafmt.conf 2025-03-08 23:21:01.725114240 +0000 +++ new-smederee/.scalafmt.conf 2025-03-08 23:21:01.733114217 +0000 @@ -1,9 +1,9 @@ -version = "3.4.3" +version = "3.5.9" runner.dialect = scala3 style = "defaultWithAlign" # Other options... danglingParentheses.preset = true -maxColumn = 110 +maxColumn = 120 newlines.forceBeforeMultilineAssign = def project.excludeFilters = [".*\\.sbt"] rewrite.rules = [Imports, RedundantBraces, RedundantParens]