commit bbe315c450731a1b0b1225e02fa4b6d3d126f94c
parent b1a4251d95ae778f461e9f400acc186c7b2e2622
Author: James Eversole <james@eversole.co>
Date: Fri, 29 Jul 2022 17:40:45 -0500
Random generation of xkcd-style passwords now functioning as expected, web interface now serves randomly generated xkcd-style passwords and provides a button to create a sharing link for them when a new generation is requested. Misc stylesheet updates. Generalized the hx-vals helper function in Core.Templates to be useful for arbitrary endpoints that will need to include specific JSON. Added configuration field for dbSalt which will be used as an encryption salt in the next commit when passwods are stored encrypted in the DB instead of in plaintext.
Diffstat:
16 files changed, 1757 insertions(+), 1644 deletions(-)
diff --git a/Purr.cabal b/Purr.cabal
@@ -24,9 +24,11 @@ library
Core.SQLite
Core.Templates
Core.Types
+ Feature.Generation.HTTP
Feature.Generation.Links
Feature.Generation.Passwords
Feature.Generation.Shared
+ Feature.Generation.Templates
Feature.Sharing.HTTP
Feature.Sharing.SQLite
Feature.Sharing.Templates
diff --git a/examples/config.dhall b/examples/config.dhall
@@ -10,4 +10,6 @@
, applicationHost = "REPLACEME"
, applicationPort = +3000
, dbFile = "data/Purr.sqlite"
+, dbSalt = "REPLACEME!!!!!"
+, linkLength = +24
}
diff --git a/src/Core/HTTP.hs b/src/Core/HTTP.hs
@@ -2,8 +2,9 @@ module Core.HTTP ( app ) where
import Core.Types
-import Core.Templates (renderIndex, renderStyle)
-import Feature.Sharing.HTTP as Sharing
+import Core.Templates (renderIndex, renderStyle)
+import Feature.Sharing.HTTP as Sharing
+import Feature.Generation.HTTP as Generation
import Data.Maybe (Maybe (Nothing))
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
@@ -26,3 +27,4 @@ app = do
-- Feature Routes
Sharing.routes
+ Generation.routes
diff --git a/src/Core/Templates.hs b/src/Core/Templates.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
-module Core.Templates ( renderIndex, renderStyle ) where
+module Core.Templates ( renderIndex, renderStyle, hxVals ) where
import Text.Blaze.Html.Renderer.Text (renderHtml)
import Text.Blaze.Html
@@ -16,10 +16,10 @@ import Prelude
renderIndex :: String -> LT.Text
renderIndex link = renderHtml ( $(shamletFile "./views/index.hamlet") )
where
- hsUserLink = userLinkAttr link
+ hsUserLink = hxVals "userLink" link
renderStyle :: LT.Text
renderStyle = renderCss ( $(cassiusFile "./views/cassius/style.cassius") "/style.css" )
-userLinkAttr :: String -> (String, String)
-userLinkAttr str = ("hx-vals", "{\"userLink\": \"" <> str <> "\"}")
+hxVals :: String -> String -> (String, String)
+hxVals attr str = ("hx-vals", "{\"" <> attr <> "\": \"" <> str <> "\"}")
diff --git a/src/Core/Types.hs b/src/Core/Types.hs
@@ -20,5 +20,6 @@ data DhallConfig = DhallConfig
, applicationHost :: String
, applicationPort :: Int
, dbFile :: String
+ , dbSalt :: String
, linkLength :: Int
} deriving (Generic, Show)
diff --git a/src/Feature/Generation/HTTP.hs b/src/Feature/Generation/HTTP.hs
@@ -0,0 +1,22 @@
+module Feature.Generation.HTTP ( routes ) where
+
+import Core.Types
+import Core.Templates (renderIndex)
+
+import Feature.Generation.Passwords (suggestedScheme)
+import Feature.Generation.Templates (renderGen)
+
+import qualified Data.Text as T
+import qualified Data.Text.Lazy as LT
+
+import Control.Monad.Reader (ask, lift, liftIO)
+import Data.Maybe (listToMaybe)
+import Web.Scotty.Trans
+import Prelude
+
+routes :: PurrApp ()
+routes = do
+
+ get "/gen" $ do
+ genPw <- liftIO $ suggestedScheme 24
+ html $ renderGen genPw
diff --git a/src/Feature/Generation/Links.hs b/src/Feature/Generation/Links.hs
@@ -1,7 +1,7 @@
module Feature.Generation.Links ( genLink ) where
import Core.Types
-import Feature.Generation.Shared (rIndex)
+import Feature.Generation.Shared (rIndex, validChars)
import Control.Monad.Reader (ask, lift, liftIO)
import Data.Char (toLower, toUpper)
@@ -21,12 +21,6 @@ genLink = do
fin <- liftIO $ randCapitalization res
genLink' (d - 1) (cs <> (fin:[]))
--- Defines the valid range of characters to be used when generating links.
--- This consists of all lowercase Latin alphabet characters and the
--- numbers 1 through 9.
-validChars :: [Char]
-validChars = ['a'..'z'] <> ['1'..'9']
-
randChar :: IO Char
randChar = rIndex validChars
diff --git a/src/Feature/Generation/Passwords.hs b/src/Feature/Generation/Passwords.hs
@@ -1,25 +1,47 @@
module Feature.Generation.Passwords where
import Core.Types
-import Feature.Generation.Shared (rIndex)
+import Feature.Generation.Shared (rIndex, validChars)
import Control.Monad.Reader (ask, lift, liftIO)
import Data.Char (toLower, toUpper)
+import Data.List (singleton)
import System.IO
import System.Random
+camelCase :: [Char] -> [Char]
+camelCase [] = []
+camelCase x = toUpper (head x) : map toLower (tail x)
+
-- suggestedScheme and its helpers xkcd, oldschool, and gibberish are TODO.
-suggestedScheme :: Int -> String
+suggestedScheme :: Int -> IO String
suggestedScheme i
| i > 23 = xkcd i
| i > 12 = oldschool i
| otherwise = gibberish i
-xkcd :: Int -> String
-xkcd i = take i "correcthorsebatterystaple"
+xkcd :: Int -> IO String
+xkcd i = do
+ wOne <- randomCamel
+ wTwo <- randomCamel
+ wThree <- randomCamel
+ wFour <- randomCamel
+ return $ wOne <> wTwo <> wThree <> wFour
+
+oldschool :: Int -> IO String
+oldschool i = do
+ wOne <- randomWord
+ wTwo <- randomWord
+ return $ wOne <> wTwo
+
+gibberish :: Int -> IO String
+gibberish i = return "mf98sgs7bgg%#"
+
+wordList :: IO [String]
+wordList = fmap lines (readFile "./src/Feature/Generation/wordlist.txt")
-oldschool :: Int -> String
-oldschool i = take i "PowerProlonger2974!"
+randomWord :: IO String
+randomWord = wordList >>= rIndex
-gibberish :: Int -> String
-gibberish i = take i "TCYx#@z5zlgw1o"
+randomCamel :: IO String
+randomCamel = camelCase <$> randomWord
diff --git a/src/Feature/Generation/Shared.hs b/src/Feature/Generation/Shared.hs
@@ -6,3 +6,15 @@ rIndex :: [a] -> IO a
rIndex arr = do
i <- randomRIO (0, length arr - 1)
return $ arr !! i
+
+-- Defines the valid range of characters to be used when generating.
+-- This consists of all lowercase Latin alphabet characters and the
+-- numbers 1 through 9.
+validChars :: [Char]
+validChars = validLetters <> validNumbers
+
+validNumbers :: [Char]
+validNumbers = ['1'..'9']
+
+validLetters :: [Char]
+validLetters = ['a'..'z']
diff --git a/src/Feature/Generation/Templates.hs b/src/Feature/Generation/Templates.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE TemplateHaskell #-}
+
+module Feature.Generation.Templates ( renderGen ) where
+
+import Core.Templates (hxVals)
+
+import qualified Data.Text as T
+import qualified Data.Text.Lazy as LT
+
+import Text.Blaze.Html.Renderer.Text (renderHtml)
+import Text.Blaze.Html
+import Text.Hamlet (shamletFile)
+
+import Prelude
+
+renderGen :: String -> LT.Text
+renderGen genPw = renderHtml ( $(shamletFile "./views/gen.hamlet") )
+ where
+ hsGeneratedSharing = hxVals "newSec" genPw
diff --git a/src/Feature/Generation/wordlist.txt b/src/Feature/Generation/wordlist.txt
@@ -0,0 +1,1616 @@
+able
+about
+above
+abroad
+absent
+absorb
+accent
+accept
+access
+accuse
+acid
+across
+action
+active
+actor
+actual
+adapt
+adjust
+admire
+admit
+adopt
+adult
+advice
+advise
+affair
+affect
+afford
+afraid
+after
+again
+aged
+agency
+agent
+agree
+ahead
+alarm
+alive
+allied
+allow
+ally
+almost
+alone
+along
+aloud
+also
+alter
+always
+amaze
+amazed
+among
+amount
+amuse
+amused
+anger
+angle
+angry
+animal
+ankle
+annoy
+annual
+answer
+anyone
+anyway
+apart
+appeal
+appear
+apple
+apply
+area
+argue
+arise
+armed
+arms
+army
+around
+arrest
+arrive
+arrow
+artist
+aside
+asleep
+aspect
+assist
+assume
+assure
+atom
+attach
+attack
+attend
+aunt
+author
+autumn
+avoid
+awake
+award
+aware
+away
+awful
+baby
+back
+badly
+bake
+ball
+band
+bank
+base
+based
+basic
+basis
+bath
+battle
+beach
+beak
+bear
+beard
+beat
+beauty
+become
+beef
+beer
+before
+begin
+behalf
+behave
+behind
+belief
+bell
+belong
+below
+belt
+bend
+bent
+beside
+best
+better
+beyond
+bill
+bird
+birth
+bite
+bitter
+blame
+blank
+blind
+block
+blood
+blow
+blue
+board
+boat
+body
+boil
+bomb
+bone
+book
+boot
+border
+bore
+bored
+boring
+born
+borrow
+boss
+both
+bother
+bottle
+bottom
+bound
+bowl
+brain
+branch
+brand
+brave
+bread
+break
+breast
+breath
+breed
+brick
+bridge
+brief
+bright
+bring
+broad
+broken
+brush
+bubble
+budget
+build
+bunch
+burn
+burnt
+burst
+bury
+bush
+busy
+butter
+butterfly
+button
+buyer
+cable
+cake
+call
+called
+calm
+calmly
+camera
+camp
+cancel
+cancer
+candy
+cannot
+card
+care
+career
+carpet
+carrot
+carry
+case
+cash
+cast
+castle
+catch
+cause
+cease
+cell
+cent
+centre
+chain
+chair
+chance
+change
+charge
+chart
+chase
+chat
+cheap
+cheat
+check
+cheek
+cheese
+cheque
+chest
+chew
+chief
+child
+chin
+chip
+choice
+choose
+chop
+cinema
+circle
+city
+civil
+claim
+clap
+class
+clean
+clear
+clerk
+clever
+click
+client
+climb
+clock
+close
+closed
+closet
+cloth
+cloud
+club
+coach
+coal
+coast
+coat
+code
+coffee
+coin
+cold
+coldly
+colour
+column
+come
+comedy
+commit
+common
+cook
+cooker
+cookie
+cool
+cope
+copy
+core
+corner
+cost
+cotton
+cough
+could
+count
+county
+couple
+course
+court
+cousin
+cover
+crack
+craft
+crash
+crazy
+cream
+create
+credit
+crime
+crisis
+crisp
+crop
+cross
+crowd
+crown
+cruel
+crush
+curb
+cure
+curl
+curly
+curve
+curved
+custom
+cycle
+daily
+damage
+damp
+dance
+dancer
+danger
+dare
+dark
+data
+date
+dead
+deaf
+deal
+dear
+death
+debate
+debt
+decade
+decay
+decide
+deep
+deeply
+defeat
+defend
+define
+degree
+delay
+demand
+deny
+depend
+depth
+derive
+desert
+design
+desire
+desk
+detail
+device
+devote
+diary
+diet
+dinner
+direct
+dirt
+dirty
+disc
+dish
+disk
+divide
+doctor
+doing
+dollar
+door
+double
+doubt
+down
+dozen
+draft
+drag
+drama
+draw
+drawer
+dream
+dress
+drink
+drive
+driver
+drop
+drug
+drum
+drunk
+dull
+dump
+during
+dust
+duty
+dying
+each
+early
+earn
+earth
+ease
+easily
+east
+easy
+edge
+editor
+effect
+effort
+either
+elbow
+elect
+else
+email
+emerge
+empire
+employ
+empty
+enable
+ending
+enemy
+energy
+engage
+engine
+enjoy
+enough
+ensure
+enter
+entire
+entry
+equal
+error
+escape
+essay
+estate
+euro
+even
+event
+ever
+every
+evil
+exact
+exam
+except
+excite
+excuse
+exist
+exit
+expand
+expect
+expert
+export
+expose
+extend
+extent
+extra
+face
+fact
+factor
+fail
+faint
+fair
+fairly
+faith
+fall
+false
+fame
+family
+famous
+fancy
+farm
+farmer
+fast
+fasten
+faucet
+fault
+favour
+fear
+feed
+feel
+fellow
+fence
+fetch
+fever
+field
+fight
+figure
+file
+fill
+film
+final
+find
+fine
+finely
+finger
+finish
+fire
+firm
+firmly
+first
+fish
+fixed
+flag
+flame
+flash
+flat
+flesh
+flight
+float
+flood
+floor
+flour
+flow
+flower
+flying
+focus
+fold
+follow
+food
+foot
+force
+forest
+forget
+fork
+form
+formal
+former
+found
+frame
+free
+freely
+freeze
+fresh
+fridge
+friend
+from
+front
+frozen
+fruit
+fuel
+fully
+fund
+funny
+future
+gain
+gallon
+gamble
+game
+garage
+garden
+gate
+gather
+gear
+gentle
+gently
+giant
+gift
+girl
+give
+glad
+glass
+global
+glove
+glue
+goal
+going
+gold
+good
+goods
+govern
+grab
+grade
+grain
+gram
+grand
+grant
+grass
+grave
+gray
+great
+green
+grey
+ground
+group
+grow
+growth
+guard
+guess
+guest
+guide
+guilty
+habit
+hair
+half
+hall
+hammer
+hand
+handle
+happen
+happy
+hard
+hardly
+harm
+hate
+hatred
+have
+heal
+health
+hear
+heart
+heat
+heavy
+heel
+height
+hello
+help
+hence
+here
+hero
+hide
+high
+highly
+hill
+hire
+hobby
+hold
+hole
+hollow
+holy
+home
+honest
+honour
+hook
+hope
+horn
+horror
+horse
+host
+hotel
+hour
+house
+huge
+human
+humour
+hungry
+hunt
+hurry
+hurt
+idea
+ideal
+ignore
+image
+impact
+imply
+import
+impose
+inch
+income
+indeed
+index
+indoor
+infect
+inform
+injure
+injury
+inner
+insect
+insert
+inside
+insist
+insult
+intend
+into
+invent
+invest
+invite
+iron
+island
+issue
+item
+itself
+jacket
+jeans
+jelly
+join
+joint
+joke
+judge
+juice
+jump
+junior
+just
+keen
+keep
+kick
+kind
+kindly
+king
+kiss
+knee
+knife
+knit
+knock
+knot
+know
+known
+label
+labour
+lack
+lady
+lake
+lamp
+land
+lane
+large
+last
+late
+later
+latest
+latter
+laugh
+launch
+lawyer
+layer
+lazy
+lead
+leader
+leaf
+league
+lean
+learn
+least
+leave
+left
+legal
+lemon
+lend
+length
+less
+lesson
+letter
+level
+life
+lift
+light
+like
+likely
+limit
+line
+link
+liquid
+list
+listen
+litre
+little
+live
+lively
+living
+load
+loan
+local
+locate
+lock
+logic
+lonely
+long
+look
+loose
+lord
+lose
+loss
+lost
+lots
+loud
+loudly
+loyal
+luck
+lucky
+lunch
+lung
+magic
+mail
+main
+mainly
+major
+make
+mall
+manage
+manner
+many
+march
+mark
+marker
+market
+marry
+mass
+master
+match
+mate
+math
+maths
+matter
+maybe
+mayor
+meal
+mean
+means
+meat
+media
+medium
+meet
+melt
+member
+memory
+mental
+menu
+mere
+merely
+mess
+metal
+method
+metre
+midday
+middle
+might
+mild
+mile
+milk
+mind
+mine
+minor
+minute
+mirror
+miss
+mixed
+mobile
+modal
+model
+modern
+moment
+money
+month
+mood
+moon
+moral
+more
+most
+mostly
+motion
+motor
+mount
+mouse
+mouth
+move
+movie
+moving
+much
+murder
+muscle
+museum
+music
+must
+myself
+nail
+naked
+name
+narrow
+nation
+nature
+navy
+near
+nearby
+nearly
+neat
+neatly
+neck
+need
+needle
+nerve
+nest
+never
+newly
+news
+next
+nice
+nicely
+night
+nobody
+noise
+noisy
+none
+normal
+north
+nose
+note
+notice
+novel
+number
+nurse
+obey
+object
+obtain
+occupy
+occur
+ocean
+oddly
+offend
+offer
+office
+often
+once
+onion
+only
+onto
+open
+openly
+oppose
+option
+orange
+order
+organ
+origin
+other
+ought
+ours
+outer
+output
+oven
+over
+pace
+pack
+packet
+page
+pain
+paint
+pair
+palace
+pale
+panel
+pants
+paper
+parent
+park
+part
+partly
+party
+pass
+past
+path
+pause
+peace
+peak
+pence
+pencil
+penny
+people
+pepper
+period
+permit
+person
+petrol
+phase
+phone
+photo
+phrase
+piano
+pick
+piece
+pile
+pill
+pilot
+pink
+pint
+pipe
+pitch
+pity
+place
+plain
+plan
+plane
+planet
+plant
+plate
+play
+player
+please
+plenty
+plot
+plug
+plus
+pocket
+poem
+poetry
+point
+poison
+pole
+police
+policy
+polish
+polite
+pool
+poor
+port
+pose
+post
+potato
+pound
+pour
+powder
+power
+praise
+prayer
+prefer
+prefix
+press
+pretty
+price
+pride
+prime
+prince
+print
+prior
+prize
+profit
+prompt
+proof
+proper
+proud
+prove
+public
+pull
+punch
+punish
+pupil
+pure
+purely
+purple
+pursue
+push
+quick
+quiet
+quit
+quite
+quote
+race
+racing
+radio
+rail
+rain
+raise
+range
+rank
+rapid
+rare
+rarely
+rate
+rather
+reach
+react
+read
+reader
+ready
+real
+really
+rear
+reason
+recall
+recent
+reckon
+record
+reduce
+refer
+reform
+refuse
+regard
+region
+regret
+reject
+relate
+relax
+relief
+rely
+remain
+remark
+remind
+remote
+remove
+rent
+rented
+repair
+repeat
+reply
+report
+rescue
+resist
+resort
+rest
+result
+retain
+retire
+return
+reveal
+review
+revise
+reward
+rhythm
+rice
+rich
+ride
+rider
+riding
+right
+ring
+rise
+risk
+rival
+river
+road
+rock
+role
+roll
+roof
+room
+root
+rope
+rough
+round
+route
+royal
+rubber
+rude
+rudely
+ruin
+ruined
+rule
+ruler
+rumour
+runner
+rural
+rush
+sack
+sadly
+safe
+safely
+safety
+sail
+sailor
+salad
+salary
+sale
+salt
+salty
+same
+sample
+sand
+sauce
+save
+saving
+scale
+scare
+scared
+scene
+scheme
+school
+score
+scream
+screen
+screw
+seal
+search
+season
+seat
+second
+secret
+sector
+secure
+seed
+seek
+seem
+select
+self
+sell
+senate
+send
+senior
+sense
+series
+serve
+settle
+severe
+sewing
+shade
+shadow
+shake
+shall
+shame
+shape
+shaped
+share
+sharp
+shave
+sheep
+sheet
+shelf
+shell
+shift
+shine
+shiny
+ship
+shirt
+shock
+shoe
+shop
+short
+shot
+should
+shout
+show
+shower
+shut
+sick
+side
+sight
+sign
+signal
+silent
+silk
+silly
+silver
+simple
+simply
+since
+sing
+singer
+single
+sink
+site
+size
+skill
+skin
+skirt
+sleep
+sleeve
+slice
+slide
+slight
+slip
+slope
+slow
+slowly
+small
+smart
+smash
+smell
+smile
+smoke
+smooth
+snake
+snow
+soap
+social
+sock
+soft
+softly
+soil
+solid
+solve
+some
+song
+soon
+sore
+sorry
+sort
+soul
+sound
+soup
+sour
+source
+south
+space
+spare
+speak
+speech
+speed
+spell
+spend
+spice
+spicy
+spider
+spin
+spirit
+spite
+split
+spoil
+spoken
+spoon
+sport
+spot
+spray
+spread
+spring
+square
+stable
+staff
+stage
+stair
+stamp
+stand
+star
+stare
+start
+state
+statue
+status
+stay
+steady
+steal
+steam
+steel
+steep
+steer
+step
+stick
+sticky
+stiff
+still
+sting
+stir
+stock
+stone
+stop
+store
+storm
+story
+stove
+strain
+stream
+street
+stress
+strict
+strike
+string
+strip
+stripe
+stroke
+strong
+studio
+study
+stuff
+stupid
+style
+such
+suck
+sudden
+suffer
+suffix
+sugar
+suit
+suited
+summer
+supply
+sure
+surely
+survey
+swear
+sweat
+sweep
+sweet
+swell
+swim
+swing
+switch
+symbol
+system
+table
+tablet
+tackle
+tail
+take
+talk
+tall
+tank
+tape
+target
+task
+taste
+taxi
+teach
+team
+tear
+tell
+tend
+tent
+term
+test
+text
+than
+thank
+thanks
+that
+their
+theirs
+them
+theme
+then
+theory
+there
+they
+thick
+thief
+thin
+thing
+think
+this
+though
+thread
+threat
+throat
+throw
+thumb
+thus
+ticket
+tidy
+tight
+till
+time
+tiny
+tire
+tired
+tiring
+title
+today
+toilet
+tomato
+tone
+tongue
+tonne
+tool
+tooth
+topic
+total
+touch
+tough
+tour
+toward
+towel
+tower
+town
+trace
+track
+trade
+train
+trap
+travel
+treat
+tree
+trend
+trial
+trick
+trip
+truck
+true
+truly
+trust
+truth
+tube
+tune
+tunnel
+turn
+twice
+twin
+twist
+type
+tyre
+ugly
+unable
+uncle
+under
+undo
+unfair
+union
+unique
+unit
+unite
+united
+unkind
+unless
+unlike
+unload
+untidy
+until
+upon
+upper
+upset
+upside
+upward
+urban
+urge
+urgent
+used
+useful
+user
+usual
+valid
+valley
+value
+varied
+vary
+vast
+very
+victim
+video
+view
+virus
+vision
+visit
+vital
+voice
+volume
+vote
+wage
+waist
+wait
+waiter
+wake
+walk
+wall
+wallet
+wander
+want
+warm
+warmth
+warn
+wash
+waste
+watch
+water
+wave
+weak
+wealth
+weapon
+wear
+week
+weekly
+weigh
+weight
+well
+west
+what
+wheel
+when
+where
+which
+while
+whilst
+whole
+whom
+whose
+wide
+widely
+width
+wife
+wild
+wildly
+will
+wind
+window
+wine
+wing
+winner
+winter
+wire
+wise
+wish
+with
+within
+woman
+wonder
+wood
+wooden
+wool
+word
+work
+worker
+world
+worry
+worse
+worst
+worth
+would
+wound
+wrap
+wrist
+write
+writer
+wrong
+yard
+yawn
+yeah
+year
+young
+your
+yours
+youth
+zero
+zone
diff --git a/src/wordlist b/src/wordlist
@@ -1,1618 +0,0 @@
-able
-about
-above
-abroad
-absent
-absorb
-accent
-accept
-access
-accuse
-acid
-across
-action
-active
-actor
-actual
-adapt
-adjust
-admire
-admit
-adopt
-adult
-advice
-advise
-affair
-affect
-afford
-afraid
-after
-again
-aged
-agency
-agent
-agree
-ahead
-alarm
-alive
-allied
-allow
-ally
-almost
-alone
-along
-aloud
-also
-alter
-always
-amaze
-amazed
-among
-amount
-amuse
-amused
-anger
-angle
-angry
-animal
-ankle
-annoy
-annual
-answer
-anyone
-anyway
-apart
-appeal
-appear
-apple
-apply
-area
-argue
-arise
-armed
-arms
-army
-around
-arrest
-arrive
-arrow
-artist
-aside
-asleep
-aspect
-assist
-assume
-assure
-atom
-attach
-attack
-attend
-aunt
-author
-autumn
-avoid
-awake
-award
-aware
-away
-awful
-baby
-back
-badly
-bake
-ball
-band
-bank
-base
-based
-basic
-basis
-bath
-battle
-beach
-beak
-bear
-beard
-beat
-beauty
-become
-beef
-beer
-before
-begin
-behalf
-behave
-behind
-belief
-bell
-belong
-below
-belt
-bend
-bent
-beside
-best
-better
-beyond
-bill
-bird
-birth
-bite
-bitter
-blame
-blank
-blind
-block
-blood
-blow
-blue
-board
-boat
-body
-boil
-bomb
-bone
-book
-boot
-border
-bore
-bored
-boring
-born
-borrow
-boss
-both
-bother
-bottle
-bottom
-bound
-bowl
-brain
-branch
-brand
-brave
-bread
-break
-breast
-breath
-breed
-brick
-bridge
-brief
-bright
-bring
-broad
-broken
-brush
-bubble
-budget
-build
-bunch
-burn
-burnt
-burst
-bury
-bush
-busy
-butter
-button
-buyer
-cable
-cake
-call
-called
-calm
-calmly
-camera
-camp
-cancel
-cancer
-candy
-cannot
-card
-care
-career
-carpet
-carrot
-carry
-case
-cash
-cast
-castle
-catch
-cause
-cease
-cell
-cent
-centre
-chain
-chair
-chance
-change
-charge
-chart
-chase
-chat
-cheap
-cheat
-check
-cheek
-cheese
-cheque
-chest
-chew
-chief
-child
-chin
-chip
-choice
-choose
-chop
-cinema
-circle
-city
-civil
-claim
-clap
-class
-clean
-clear
-clerk
-clever
-click
-client
-climb
-clock
-close
-closed
-closet
-cloth
-cloud
-club
-coach
-coal
-coast
-coat
-code
-coffee
-coin
-cold
-coldly
-colour
-column
-come
-comedy
-commit
-common
-cook
-cooker
-cookie
-cool
-cope
-copy
-core
-corner
-cost
-cotton
-cough
-could
-count
-county
-couple
-course
-court
-cousin
-cover
-crack
-craft
-crash
-crazy
-cream
-create
-credit
-crime
-crisis
-crisp
-crop
-cross
-crowd
-crown
-cruel
-crush
-curb
-cure
-curl
-curly
-curve
-curved
-custom
-cycle
-daily
-damage
-damp
-dance
-dancer
-danger
-dare
-dark
-data
-date
-dead
-deaf
-deal
-dear
-death
-debate
-debt
-decade
-decay
-decide
-deep
-deeply
-defeat
-defend
-define
-degree
-delay
-demand
-deny
-depend
-depth
-derive
-desert
-design
-desire
-desk
-detail
-device
-devote
-diary
-diet
-dinner
-direct
-dirt
-dirty
-disc
-dish
-disk
-divide
-doctor
-doing
-dollar
-door
-double
-doubt
-down
-dozen
-draft
-drag
-drama
-draw
-drawer
-dream
-dress
-drink
-drive
-driver
-drop
-drug
-drum
-drunk
-dull
-dump
-during
-dust
-duty
-dying
-each
-early
-earn
-earth
-ease
-easily
-east
-easy
-edge
-editor
-effect
-effort
-either
-elbow
-elect
-else
-email
-emerge
-empire
-employ
-empty
-enable
-ending
-enemy
-energy
-engage
-engine
-enjoy
-enough
-ensure
-enter
-entire
-entry
-equal
-error
-escape
-essay
-estate
-euro
-even
-event
-ever
-every
-evil
-exact
-exam
-except
-excite
-excuse
-exist
-exit
-expand
-expect
-expert
-export
-expose
-extend
-extent
-extra
-face
-fact
-factor
-fail
-faint
-fair
-fairly
-faith
-fall
-false
-fame
-family
-famous
-fancy
-farm
-farmer
-fast
-fasten
-faucet
-fault
-favour
-fear
-feed
-feel
-fellow
-fence
-fetch
-fever
-field
-fight
-figure
-file
-fill
-film
-final
-find
-fine
-finely
-finger
-finish
-fire
-firm
-firmly
-first
-fish
-fixed
-flag
-flame
-flash
-flat
-flesh
-flight
-float
-flood
-floor
-flour
-flow
-flower
-flying
-focus
-fold
-follow
-food
-foot
-force
-forest
-forget
-fork
-form
-formal
-former
-found
-frame
-free
-freely
-freeze
-fresh
-fridge
-friend
-from
-front
-frozen
-fruit
-fuel
-fully
-fund
-funny
-future
-gain
-gallon
-gamble
-game
-garage
-garden
-gate
-gather
-gear
-gentle
-gently
-giant
-gift
-girl
-give
-glad
-glass
-global
-glove
-glue
-goal
-going
-gold
-good
-goods
-govern
-grab
-grade
-grain
-gram
-grand
-grant
-grass
-grave
-gray
-great
-green
-grey
-ground
-group
-grow
-growth
-guard
-guess
-guest
-guide
-guilty
-habit
-hair
-half
-hall
-hammer
-hand
-handle
-hang
-happen
-happy
-hard
-hardly
-harm
-hate
-hatred
-have
-head
-heal
-health
-hear
-heart
-heat
-heavy
-heel
-height
-hello
-help
-hence
-here
-hero
-hers
-hide
-high
-highly
-hill
-hire
-hobby
-hold
-hole
-hollow
-holy
-home
-honest
-honour
-hook
-hope
-horn
-horror
-horse
-host
-hotel
-hour
-house
-huge
-human
-humour
-hungry
-hunt
-hurry
-hurt
-idea
-ideal
-ignore
-image
-impact
-imply
-import
-impose
-inch
-income
-indeed
-index
-indoor
-infect
-inform
-injure
-injury
-inner
-insect
-insert
-inside
-insist
-insult
-intend
-into
-invent
-invest
-invite
-iron
-island
-issue
-item
-itself
-jacket
-jeans
-jelly
-join
-joint
-joke
-judge
-juice
-jump
-junior
-just
-keen
-keep
-kick
-kind
-kindly
-king
-kiss
-knee
-knife
-knit
-knock
-knot
-know
-known
-label
-labour
-lack
-lady
-lake
-lamp
-land
-lane
-large
-last
-late
-later
-latest
-latter
-laugh
-launch
-lawyer
-layer
-lazy
-lead
-leader
-leaf
-league
-lean
-learn
-least
-leave
-left
-legal
-lemon
-lend
-length
-less
-lesson
-letter
-level
-life
-lift
-light
-like
-likely
-limit
-line
-link
-liquid
-list
-listen
-litre
-little
-live
-lively
-living
-load
-loan
-local
-locate
-lock
-logic
-lonely
-long
-look
-loose
-lord
-lose
-loss
-lost
-lots
-loud
-loudly
-loyal
-luck
-lucky
-lunch
-lung
-magic
-mail
-main
-mainly
-major
-make
-mall
-manage
-manner
-many
-march
-mark
-marker
-market
-marry
-mass
-master
-match
-mate
-math
-maths
-matter
-maybe
-mayor
-meal
-mean
-means
-meat
-media
-medium
-meet
-melt
-member
-memory
-mental
-menu
-mere
-merely
-mess
-metal
-method
-metre
-midday
-middle
-might
-mild
-mile
-milk
-mind
-mine
-minor
-minute
-mirror
-miss
-mixed
-mobile
-modal
-model
-modern
-moment
-money
-month
-mood
-moon
-moral
-more
-most
-mostly
-motion
-motor
-mount
-mouse
-mouth
-move
-movie
-moving
-much
-murder
-muscle
-museum
-music
-must
-myself
-nail
-naked
-name
-narrow
-nation
-nature
-navy
-near
-nearby
-nearly
-neat
-neatly
-neck
-need
-needle
-nerve
-nest
-never
-newly
-news
-next
-nice
-nicely
-night
-nobody
-noise
-noisy
-none
-normal
-north
-nose
-note
-notice
-novel
-number
-nurse
-obey
-object
-obtain
-occupy
-occur
-ocean
-oddly
-offend
-offer
-office
-often
-once
-onion
-only
-onto
-open
-openly
-oppose
-option
-orange
-order
-organ
-origin
-other
-ought
-ours
-outer
-output
-oven
-over
-pace
-pack
-packet
-page
-pain
-paint
-pair
-palace
-pale
-panel
-pants
-paper
-parent
-park
-part
-partly
-party
-pass
-past
-path
-pause
-peace
-peak
-pence
-pencil
-penny
-people
-pepper
-period
-permit
-person
-petrol
-phase
-phone
-photo
-phrase
-piano
-pick
-piece
-pile
-pill
-pilot
-pink
-pint
-pipe
-pitch
-pity
-place
-plain
-plan
-plane
-planet
-plant
-plate
-play
-player
-please
-plenty
-plot
-plug
-plus
-pocket
-poem
-poetry
-point
-poison
-pole
-police
-policy
-polish
-polite
-pool
-poor
-port
-pose
-post
-potato
-pound
-pour
-powder
-power
-praise
-prayer
-prefer
-prefix
-press
-pretty
-price
-pride
-prime
-prince
-print
-prior
-prize
-profit
-prompt
-proof
-proper
-proud
-prove
-public
-pull
-punch
-punish
-pupil
-pure
-purely
-purple
-pursue
-push
-quick
-quiet
-quit
-quite
-quote
-race
-racing
-radio
-rail
-rain
-raise
-range
-rank
-rapid
-rare
-rarely
-rate
-rather
-reach
-react
-read
-reader
-ready
-real
-really
-rear
-reason
-recall
-recent
-reckon
-record
-reduce
-refer
-reform
-refuse
-regard
-region
-regret
-reject
-relate
-relax
-relief
-rely
-remain
-remark
-remind
-remote
-remove
-rent
-rented
-repair
-repeat
-reply
-report
-rescue
-resist
-resort
-rest
-result
-retain
-retire
-return
-reveal
-review
-revise
-reward
-rhythm
-rice
-rich
-ride
-rider
-riding
-right
-ring
-rise
-risk
-rival
-river
-road
-rock
-role
-roll
-roof
-room
-root
-rope
-rough
-round
-route
-royal
-rubber
-rude
-rudely
-ruin
-ruined
-rule
-ruler
-rumour
-runner
-rural
-rush
-sack
-sadly
-safe
-safely
-safety
-sail
-sailor
-salad
-salary
-sale
-salt
-salty
-same
-sample
-sand
-sauce
-save
-saving
-scale
-scare
-scared
-scene
-scheme
-school
-score
-scream
-screen
-screw
-seal
-search
-season
-seat
-second
-secret
-sector
-secure
-seed
-seek
-seem
-select
-self
-sell
-senate
-send
-senior
-sense
-series
-serve
-settle
-severe
-sewing
-shade
-shadow
-shake
-shall
-shame
-shape
-shaped
-share
-sharp
-shave
-sheep
-sheet
-shelf
-shell
-shift
-shine
-shiny
-ship
-shirt
-shock
-shoe
-shop
-short
-shot
-should
-shout
-show
-shower
-shut
-sick
-side
-sight
-sign
-signal
-silent
-silk
-silly
-silver
-simple
-simply
-since
-sing
-singer
-single
-sink
-site
-size
-skill
-skin
-skirt
-sleep
-sleeve
-slice
-slide
-slight
-slip
-slope
-slow
-slowly
-small
-smart
-smash
-smell
-smile
-smoke
-smooth
-snake
-snow
-soap
-social
-sock
-soft
-softly
-soil
-solid
-solve
-some
-song
-soon
-sore
-sorry
-sort
-soul
-sound
-soup
-sour
-source
-south
-space
-spare
-speak
-speech
-speed
-spell
-spend
-spice
-spicy
-spider
-spin
-spirit
-spite
-split
-spoil
-spoken
-spoon
-sport
-spot
-spray
-spread
-spring
-square
-stable
-staff
-stage
-stair
-stamp
-stand
-star
-stare
-start
-state
-statue
-status
-stay
-steady
-steal
-steam
-steel
-steep
-steer
-step
-stick
-sticky
-stiff
-still
-sting
-stir
-stock
-stone
-stop
-store
-storm
-story
-stove
-strain
-stream
-street
-stress
-strict
-strike
-string
-strip
-stripe
-stroke
-strong
-studio
-study
-stuff
-stupid
-style
-such
-suck
-sudden
-suffer
-suffix
-sugar
-suit
-suited
-summer
-supply
-sure
-surely
-survey
-swear
-sweat
-sweep
-sweet
-swell
-swim
-swing
-switch
-symbol
-system
-table
-tablet
-tackle
-tail
-take
-talk
-tall
-tank
-tape
-target
-task
-taste
-taxi
-teach
-team
-tear
-tell
-tend
-tent
-term
-test
-text
-than
-thank
-thanks
-that
-their
-theirs
-them
-theme
-then
-theory
-there
-they
-thick
-thief
-thin
-thing
-think
-this
-though
-thread
-threat
-throat
-throw
-thumb
-thus
-ticket
-tidy
-tight
-till
-time
-tiny
-tire
-tired
-tiring
-title
-today
-toilet
-tomato
-tone
-tongue
-tonne
-tool
-tooth
-topic
-total
-touch
-tough
-tour
-toward
-towel
-tower
-town
-trace
-track
-trade
-train
-trap
-travel
-treat
-tree
-trend
-trial
-trick
-trip
-truck
-true
-truly
-trust
-truth
-tube
-tune
-tunnel
-turn
-twice
-twin
-twist
-type
-tyre
-ugly
-unable
-uncle
-under
-undo
-unfair
-union
-unique
-unit
-unite
-united
-unkind
-unless
-unlike
-unload
-untidy
-until
-upon
-upper
-upset
-upside
-upward
-urban
-urge
-urgent
-used
-useful
-user
-usual
-valid
-valley
-value
-varied
-vary
-vast
-very
-victim
-video
-view
-virus
-vision
-visit
-vital
-voice
-volume
-vote
-wage
-waist
-wait
-waiter
-wake
-walk
-wall
-wallet
-wander
-want
-warm
-warmth
-warn
-wash
-waste
-watch
-water
-wave
-weak
-wealth
-weapon
-wear
-week
-weekly
-weigh
-weight
-well
-west
-what
-wheel
-when
-where
-which
-while
-whilst
-whole
-whom
-whose
-wide
-widely
-width
-wife
-wild
-wildly
-will
-wind
-window
-wine
-wing
-winner
-winter
-wire
-wise
-wish
-with
-within
-woman
-wonder
-wood
-wooden
-wool
-word
-work
-worker
-world
-worry
-worse
-worst
-worth
-would
-wound
-wrap
-wrist
-write
-writer
-wrong
-yard
-yawn
-yeah
-year
-young
-your
-yours
-youth
-zero
-zone
diff --git a/views/cassius/style.cassius b/views/cassius/style.cassius
@@ -4,14 +4,18 @@
@colorFour: #435F5D
html
+ font-family: Courier
background-color: #{colorTwo}
color: #{colorOne}
body
- font-family: Courier
font-size: 20px
text-align: left
+h2
+ font-family: monaco, Consolas, monospace
+ text-transform: uppercase
+
p
margin: 0.4em 0 0.4em 0
@@ -38,6 +42,7 @@ a
height: 1%
.mainButton
+ margin: 0 0 0.25em 0
padding: 0.75em 1.75em
background-color: #{colorThree}
color: #{colorTwo}
@@ -51,8 +56,8 @@ a
outline: none
color: #{colorOne}
background: #{colorTwo}
- margin: 1em 0
- border-style: none none none none
+ margin: 0.5em 0
+ border-style: none none solid none
padding: 0.4em 0
box-sizing: border-box
-webkit-box-sizing: border-box
@@ -77,6 +82,9 @@ a
.pwUtils
width: 75%
+.generators
+ margin: 5% 0 0 0
+
.shareNew
margin-bottom: 2em
diff --git a/views/gen.hamlet b/views/gen.hamlet
@@ -0,0 +1,19 @@
+<div #generators .generators>
+ <h2>Generators
+ <p>Generated password:
+ <h3>#{genPw}
+ <button .mainButton
+ hx-get="/gen"
+ hx-target="#generators"
+ hx-swap="outerHTML"
+ />
+ Generate New Password
+ <br />
+ <button .mainButton
+ hx-post="/new"
+ hx-target="#requestedPw"
+ hx-swap="outerHTML"
+ *{hsGeneratedSharing}
+ />
+ Share Generated Password
+ <img class="htmx-indicator" src="/loading.svg" />
diff --git a/views/index.hamlet b/views/index.hamlet
@@ -18,6 +18,7 @@ $doctype 5
<a #titleLink .titleLink href="/">Purr
<div #pwUtils .pwUtils>
+ <h2>Sharing Tools
$if (link == "/")
<div #requestedPw .requestedPw>
<p .emptyReq>
@@ -62,3 +63,12 @@ $doctype 5
/>
Get Secret
<img class="htmx-indicator" src="/loading.svg" />
+
+ <div #generators .generators>
+ <h2>Generators
+ <button .mainButton
+ hx-get="/gen"
+ hx-target="#generators"
+ hx-swap="outerHTML"
+ />
+ Generate Password
diff --git a/views/pw.hamlet b/views/pw.hamlet
@@ -1,6 +1,7 @@
<div #requestedPw .requestedPw>
$maybe pw <- password
<p>Here's the secret found at <a href="/pw/#{link}">/pw/#{link}</a>:
- <h2 .pwResult>#{pw}
+ <h3 .pwResult>#{pw}
+ <hr />
$nothing
- <p>No secret found at <a href="/pw/#{link}">/pw/#{link}</a>
+ <h3>No secret found at <a href="/pw/#{link}">/pw/#{link}</a>