~jan0sch/smederee
Showing details for patch 7e3a1b158547496fd335f2251ed87c751a13ab79.
diff -rN -u old-smederee/modules/hub/src/main/resources/reference.conf new-smederee/modules/hub/src/main/resources/reference.conf --- old-smederee/modules/hub/src/main/resources/reference.conf 2025-01-31 05:08:48.236803853 +0000 +++ new-smederee/modules/hub/src/main/resources/reference.conf 2025-01-31 05:08:48.236803853 +0000 @@ -35,6 +35,8 @@ # If it does not exist then it should be created with sensible permissions. csrf-key-file = /var/tmp/smederee/csrf-key.bin csrf-key-file = ${?SMEDEREE_CSRF_KEY_FILE} + # The maximum allowed size of a file in bytes to be displayed / rendered via the web interface. + render-maximum-file-size = 131072 # Settings affecting how the service will communicate several information to # the "outside world" e.g. if it runs behind a reverse proxy. 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-01-31 05:08:48.236803853 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/config/SmedereeHubConfig.scala 2025-01-31 05:08:48.236803853 +0000 @@ -180,6 +180,8 @@ * @param downloadDirectory * A directory into which files are written that are supposed to be downloaded by users (e.g. distribution files of * repositories). + * @param renderMaximumFileSize + * The maximum allowed size of a file in bytes to be displayed / rendered via the web interface. * @param authentication * The configuration of the authentication feature. * @param billing @@ -201,6 +203,7 @@ port: Port, csrfKeyFile: Path, downloadDirectory: DirectoryPath, + renderMaximumFileSize: Long, authentication: AuthenticationConfiguration, billing: BillingConfiguration, darcs: DarcsConfiguration, @@ -234,11 +237,12 @@ ConfigReader.forProduct4("host", "path", "port", "scheme")(ExternalUrlConfiguration.apply) given ConfigReader[ServiceConfig] = - ConfigReader.forProduct11( + ConfigReader.forProduct12( "host", "port", "csrf-key-file", "download-directory", + "render-maximum-file-size", "authentication", "billing", "darcs", 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-01-31 05:08:48.236803853 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-01-31 05:08:48.236803853 +0000 @@ -64,12 +64,11 @@ ) extends Http4sDsl[F] { private val log = LoggerFactory.getLogger(getClass) + private val MaximumFileSize = configuration.renderMaximumFileSize private val createRepoPath = uri"/repo/create" - private val MaximumFileSize = 131072L // TODO: Move to configuration directive. - - val darcsConfig = configuration.darcs - val linkConfig = configuration.external - val sshConfig = configuration.ssh + private val darcsConfig = configuration.darcs + private val linkConfig = configuration.external + private val sshConfig = configuration.ssh // The base URI for our site which that be passed into some templates which create links themselfes. private val baseUri = linkConfig.createFullUri(Uri())