intricacy 0.8.2 → 0.8.2.1
raw patch · 4 files changed
+30/−9 lines, 4 filesdep ~containersdep ~filepath
Dependency ranges changed: containers, filepath
Files
- GameState.hs +1/−1
- Server.hs +16/−3
- Version.hs +1/−1
- intricacy.cabal +12/−4
GameState.hs view
@@ -254,7 +254,7 @@ let overarmed = length arms > 2 in Map.fromList $ (pos, PivotTile $ if overarmed then head arms else zero ) : [ (rel +^ pos, ArmTile rel main)- | (rel,main) <- zip arms $ repeat False ]+ | (rel,main) <- map (,False) arms ] plPieceMap (PlacedPiece pos (Hook arm _)) = Map.fromList $ (pos, HookTile) : [ (arm +^ pos, ArmTile arm True) ] plPieceMap (PlacedPiece pos (Wrench mom)) = Map.singleton pos $ WrenchTile mom
Server.hs view
@@ -8,6 +8,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. +{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} module Main where@@ -60,9 +61,11 @@ import Crypto.PubKey.RSA.OAEP (decrypt, defaultOAEPParams) import Crypto.PubKey.RSA.Types (private_n) +#ifdef SENDMAIL import Network.Mail.Mime (plainPart) import qualified Network.Mail.SMTP as SMTP import qualified Text.Email.Validate+#endif import System.Console.GetOpt import System.Environment@@ -143,8 +146,8 @@ -- Note: switching to cryptonite's argon2 implementation would not be -- straightforwardsly backwards-compatible, the output format is different. argon2 :: String -> ExceptT String IO String-argon2 s = either (throwE . show) return $- TSh.unpack <$> A2.hashEncoded hashOptions (CS.pack s) (CS.pack salt)+argon2 s = either (throwE . show) (return . TSh.unpack) $+ A2.hashEncoded hashOptions (CS.pack s) (CS.pack salt) where salt = "intricacy salt" -- |default argon2 hash options@@ -457,11 +460,15 @@ setEmail Nothing _ = throwE "Authentication required" setEmail auth@(Just (Auth name _)) addressStr = do checkAuth auth+#ifdef SENDMAIL serverAddr <- erroredDB $ getRecord RecServerEmail when (isNothing serverAddr) $ throwE "This server is not configured to support email notifications." let addr = CS.pack addressStr unless (CS.null addr || Text.Email.Validate.isValid addr) $ throwE "Invalid email address" erroredDB $ putRecord (RecEmail name) (RCEmail addr)+#else+ throwE "This server is not compiled to support email notifications."+#endif checkCodeName :: Codename -> ExceptT String IO Bool checkCodeName name = do unless (validCodeName name) $ throwE "Invalid codename"@@ -555,7 +562,10 @@ -- TODO: purge old entries let Right element = XML.fromXMLElement $ xmlFeed $ withFeedLastUpdate timeText $ addItem item feed document = XML.Document (XML.Prologue [] Nothing []) element []- writeFile feedPath $ TL.unpack $ XML.renderText XML.def document+ -- | force the feed, so feedPath is closed (lazy IO)+ feedString <- return $! TL.unpack $ XML.renderText XML.def document+ writeFile feedPath feedString+#ifdef SENDMAIL mailDeclaration target@(ActiveLock name _) behind@(ActiveLock solverName _) = runMaybeT $ do let makeAddr :: CS.ByteString -> SMTP.Address makeAddr bs = SMTP.Address Nothing $ TS.pack $ CS.unpack bs@@ -572,3 +582,6 @@ "\nYou can disable notifications in-game by pressing 'R' on your home" ++ "\nscreen and setting an empty address." ++ "\nAlternatively, just reply to this email with the phrase \"stop bugging me\"." ]+#else+ mailDeclaration _ _ = pure ()+#endif
Version.hs view
@@ -11,4 +11,4 @@ module Version where version :: String-version = "0.8.2"+version = "0.8.2.1"
intricacy.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: intricacy-version: 0.8.2+version: 0.8.2.1 license: GPL-3 license-file: COPYING maintainer: mbays@sdf.org@@ -61,6 +61,11 @@ default: False manual: True +flag sendmail+ description: Include support for sending mail+ default: False+ manual: True+ executable intricacy main-is: Intricacy.hs other-modules:@@ -108,11 +113,11 @@ stm >=2.1 && <2.6, directory >=1.0 && <1.4, exceptions >=0.8.3 && <0.11,- filepath >=1.0 && <1.5,+ filepath >=1.0 && <1.6, time >=1.2 && <1.14, bytestring >=0.10 && <0.13, array >=0.3 && <0.6,- containers >=0.4 && <0.7,+ containers >=0.4 && <0.8, vector >=0.9 && <0.14, binary >=0.5 && <0.11, network-simple >=0.3 && <0.5,@@ -226,7 +231,6 @@ text >=0.1 && <3, text-short ==0.1.*, mime-mail >=0.4.4 && <0.6,- smtp-mail >=0.1.4.1 && <0.4, memory >=0.11 && <0.18, cryptonite >=0.16 && <0.31, argon2 ==1.3.*@@ -234,5 +238,9 @@ if !impl(ghc >=8.0) build-depends: semigroups ==0.18.* + if flag(sendmail)+ cpp-options: -DSENDMAIL+ build-depends:+ smtp-mail >=0.1.4.1 && <0.4 else buildable: False