hash on upload (#123)

* hash on upload

* Update src/Cli/Cli.hs

* fix import and clean up error response

* remove content length limit

* remove import

* lift version

* slow af but works

Co-authored-by: Lucy C <12953208+elvece@users.noreply.github.com>
This commit is contained in:
Aiden McClelland
2022-09-08 10:29:01 -06:00
committed by GitHub
parent d8f667e41a
commit 3aef9dbf09
9 changed files with 113 additions and 93 deletions

View File

@@ -55,7 +55,6 @@ import Startlude (
killThread,
newEmptyMVar,
newMVar,
onException,
panic,
print,
putMVar,
@@ -180,6 +179,7 @@ import Handler.Admin (
deletePkgCategorizeR,
getPkgDeindexR,
postCategoryR,
postEosUploadR,
postPkgCategorizeR,
postPkgDeindexR,
postPkgIndexR,
@@ -187,7 +187,6 @@ import Handler.Admin (
)
import Handler.Eos (getEosR, getEosVersionR)
import Handler.Package
import Lib.PkgRepository (watchEosRepoRoot)
import Lib.Ssl (
doesSslNeedRenew,
renewSslCerts,
@@ -240,12 +239,12 @@ makeFoundation appSettings = do
-- logging function. To get out of this loop, we initially create a
-- temporary foundation without a real connection pool, get a log function
-- from there, and then create the real foundation.
let mkFoundation appConnPool appStopFsNotifyEos = RegistryCtx{..}
let mkFoundation appConnPool = RegistryCtx{..}
-- The RegistryCtx {..} syntax is an example of record wild cards. For more
-- information, see:
-- https://ocharles.org.uk/blog/posts/2014-12-04-record-wildcards.html
tempFoundation =
mkFoundation (panic "connPool forced in tempFoundation") (panic "stopFsNotify forced in tempFoundation")
mkFoundation (panic "connPool forced in tempFoundation")
logFunc = messageLoggerSource tempFoundation appLogger
createDirectoryIfMissing True (errorLogRoot appSettings)
@@ -255,8 +254,6 @@ makeFoundation appSettings = do
flip runLoggingT logFunc $
createPostgresqlPool (pgConnStr $ appDatabaseConf appSettings) (pgPoolSize . appDatabaseConf $ appSettings)
stopEosWatch <- runLoggingT (runReaderT (watchEosRepoRoot pool) appSettings) logFunc
runSqlPool
(Database.Persist.Migration.Postgres.runMigration Database.Persist.Migration.defaultSettings manualMigration)
pool
@@ -264,7 +261,7 @@ makeFoundation appSettings = do
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc
-- Return the foundation
return $ mkFoundation pool stopEosWatch
return $ mkFoundation pool
-- | Convert our foundation to a WAI Application by calling @toWaiAppPlain@ and
@@ -449,7 +446,7 @@ startWeb foundation = do
app <- makeApplication foundation
startWeb' app
where
startWeb' app = (`onException` appStopFsNotifyEos foundation) $ do
startWeb' app = do
let AppSettings{..} = appSettings foundation
runLog $ $logInfo [i|Launching Tor Web Server on port #{torPort}|]
torAction <- async $ runSettings (warpSettings torPort foundation) app