Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed May 30, 2024
1 parent 28c2c7c commit 3695213
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
2 changes: 0 additions & 2 deletions project/src/middleware/noCache.middleware.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import org.http4s.Header
import org.http4s.HttpRoutes
import org.http4s.Request

import org.typelevel.ci.CIStringSyntax

import cats.data.Kleisli

import cats.effect.*
import cats.effect.IO

Expand Down
7 changes: 4 additions & 3 deletions project/src/middleware/static.file.middleware.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import java.time.Instant
import java.time.ZoneId
import java.time.ZonedDateTime

import org.http4s.Header
import org.http4s.HttpRoutes
import org.http4s.Request
Expand All @@ -16,9 +20,6 @@ import cats.data.OptionT
import cats.effect.*
import cats.effect.IO
import cats.syntax.all.*
import java.time.Instant
import java.time.ZonedDateTime
import java.time.ZoneId

def parseFromHeader(epochInstant: Instant, header: String): Long =
java.time.Duration.between(epochInstant, ZonedDateTime.parse(header, formatter)).toSeconds()
Expand Down
7 changes: 4 additions & 3 deletions project/src/middleware/static.path.middleware.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import java.time.Instant
import java.time.ZoneId
import java.time.ZonedDateTime

import org.http4s.Header
import org.http4s.HttpRoutes
import org.http4s.Request
Expand All @@ -16,9 +20,6 @@ import cats.data.OptionT
import cats.effect.*
import cats.effect.IO
import cats.syntax.all.*
import java.time.Instant
import java.time.ZonedDateTime
import java.time.ZoneId

inline def respondWithCacheLastModified(resp: Response[IO], lastModZdt: ZonedDateTime) =
resp.putHeaders(
Expand Down
21 changes: 10 additions & 11 deletions project/src/routes.scala
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
import java.time.Instant
import java.time.ZoneId
import java.time.ZonedDateTime

import scala.concurrent.duration.DurationInt

import org.http4s.Header
import org.http4s.HttpApp
import org.http4s.HttpRoutes
import org.http4s.Request
import org.http4s.Response
import org.http4s.ServerSentEvent
import org.http4s.StaticFile
import org.http4s.Status
import org.http4s.dsl.io.*
import org.http4s.implicits.*
import org.http4s.scalatags.*
import org.http4s.server.Router
import org.http4s.server.middleware.Logger
import org.http4s.server.staticcontent.*
import org.http4s.server.staticcontent.FileService
import org.typelevel.ci.CIStringSyntax

import fs2.*
import fs2.concurrent.Topic
import fs2.io.file.Files

import scribe.Scribe

import cats.MonadThrow
import cats.data.Kleisli
import cats.data.OptionT
import cats.effect.*
import cats.effect.IO
import cats.effect.kernel.Ref
import cats.effect.kernel.Resource
import cats.syntax.all.*
import org.typelevel.ci.CIStringSyntax

import _root_.io.circe.syntax.EncoderOps
import java.time.ZonedDateTime
import java.time.Instant
import java.time.ZoneId
import org.http4s.Status
import org.http4s.StaticFile
import cats.MonadThrow
import org.http4s.server.middleware.Logger

def routes[F[_]: Files: MonadThrow](
stringPath: String,
Expand Down Expand Up @@ -149,7 +148,7 @@ def routes[F[_]: Files: MonadThrow](
case Some(spaRoute) =>
indexOpts match
case None =>
val aPath = Root / spaRoute
Root / spaRoute
StaticHtmlMiddleware(
HttpRoutes.of[IO] {
case GET -> aPath /: path =>
Expand Down
4 changes: 2 additions & 2 deletions project/src/static.watcher.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter

import scala.concurrent.duration.*
Expand All @@ -11,6 +12,7 @@ import fs2.io.Watcher.Event.Deleted
import fs2.io.Watcher.Event.Modified
import fs2.io.Watcher.Event.NonStandard
import fs2.io.Watcher.Event.Overflow
import fs2.io.file.Files
import fs2.io.file.Path

import scribe.Scribe
Expand All @@ -20,8 +22,6 @@ import cats.effect.IO
import cats.effect.OutcomeIO
import cats.effect.ResourceIO
import cats.syntax.all.*
import fs2.io.file.Files
import java.time.ZonedDateTime

def staticWatcher(
refreshTopic: Topic[IO, Unit],
Expand Down

0 comments on commit 3695213

Please sign in to comment.