Use EFF wordlist. Embed wordlist into executable. Move views/public to assets/public. Move wordlist into assets.

This commit is contained in:
James Eversole 2023-01-11 15:23:01 -06:00
parent cb45c4ce1d
commit 2889c7e9e7
12 changed files with 7786 additions and 1619 deletions

View File

@ -53,6 +53,7 @@ library
, containers >=0.6.4.1
, crypto-simple >=0.1.0.0
, dhall >=1.40 && <1.41.2
, file-embed ==0.0.15.0
, http-types >=0.12.3
, iso8601-time >=0.1.5
, mtl >=2.2.2
@ -63,6 +64,7 @@ library
, sqlite-simple >=0.4.18.0
, text >=1.2.5.0
, time >=1.9
, utf8-string ==1.0.2
, wai-extra >=3.1.12.1
, wai-middleware-static >=0.5
default-language: Haskell2010
@ -91,6 +93,7 @@ executable Purr-musl
, containers >=0.6.4.1
, crypto-simple >=0.1.0.0
, dhall >=1.40 && <1.41.2
, file-embed ==0.0.15.0
, http-types >=0.12.3
, iso8601-time >=0.1.5
, mtl >=2.2.2
@ -101,6 +104,7 @@ executable Purr-musl
, sqlite-simple >=0.4.18.0
, text >=1.2.5.0
, time >=1.9
, utf8-string ==1.0.2
, wai-extra >=3.1.12.1
, wai-middleware-static >=0.5
default-language: Haskell2010

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

7765
assets/wordlist.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,6 @@ RUN upx /app/Purr-musl -o /app/Purr-musl-upx
FROM scratch
WORKDIR /app
ADD ./views /app/views
ADD ./src /app/src
COPY --from=builder /app/Purr-musl-upx /app/Purr

View File

@ -35,6 +35,7 @@ dependencies:
- containers >= 0.6.4.1
- crypto-simple >= 0.1.0.0
- dhall >= 1.40 && < 1.41.2
- file-embed == 0.0.15.0
- http-types >= 0.12.3
- iso8601-time >= 0.1.5
- mtl >= 2.2.2
@ -45,6 +46,7 @@ dependencies:
- split >= 0.2.3.4
- time >= 1.9
- text >= 1.2.5.0
- utf8-string == 1.0.2
- wai-extra >= 3.1.12.1
- wai-middleware-static >= 0.5

View File

@ -16,7 +16,7 @@ app :: PurrApp ()
app = do
-- Middleware definition
middleware logStdoutDev
middleware $ staticPolicy (noDots >-> addBase "views/public")
middleware $ staticPolicy (noDots >-> addBase "assets/public")
-- Core Routes
get "/" $ do

View File

@ -1,3 +1,5 @@
{-# LANGUAGE TemplateHaskell #-}
module Feature.Generation.Passwords
( Password
, Random
@ -12,6 +14,7 @@ import Feature.Generation.Shared (camelCase, rCharSym, rIndex,
validChars, validNumbers,
validSymbols)
import Data.FileEmbed
import Data.List (singleton)
suggestedScheme :: Int -> Random Password
@ -53,7 +56,7 @@ rNum :: Random Int
rNum = rIndex validNumbers
rWord :: Random String
rWord = wordList >>= rIndex
rWord = rIndex wordList
rSym :: Random Char
rSym = rIndex validSymbols
@ -61,5 +64,5 @@ rSym = rIndex validSymbols
rCamel :: Random String
rCamel = camelCase <$> rWord
wordList :: Random [String]
wordList = fmap lines (readFile "./src/Feature/Generation/wordlist.txt")
wordList :: [String]
wordList = lines $(embedStringFile "./assets/wordlist.txt")

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,18 @@
<div #generators .generators>
<form id="genForm">
<div .generatorRadio">
<label .radioLabel for="gibberish" .genResult>
<input .radioInput type="radio" id="gibberish" name="newSec" value="#{show genGibberish}">
<div .radioDesign>
<div .radioText>#{show genGibberish}
<label .radioLabel for="oldschool" .genResult>
<input .radioInput type="radio" id="oldschool" name="newSec" value="#{show genOldschool}">
<div .radioDesign>
<div .radioText>#{show genOldschool}
<label .radioLabel for="xkcd" .genResult>
<input .radioInput type="radio" id="xkcd" name="newSec" value="#{show genXkcd}">
<div .radioDesign>
<div .radioText>#{show genXkcd}
<label .radioLabel for="oldschool" .genResult>
<input .radioInput type="radio" id="oldschool" name="newSec" value="#{show genOldschool}">
<div .radioDesign>
<div .radioText>#{show genOldschool}
<label .radioLabel for="gibberish" .genResult>
<input .radioInput type="radio" id="gibberish" name="newSec" value="#{show genGibberish}">
<div .radioDesign>
<div .radioText>#{show genGibberish}
<div .validForm>
<input .numberInput